Compare commits

...

3 Commits

Author SHA1 Message Date
xiaofajia
47c9d3b46b Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-repair-app 2024-11-23 15:17:11 +08:00
xiaofajia
69a5d4fa54 config改回去 2024-11-23 15:17:02 +08:00
xiaofajia
e67a8e5438 领料配件上传图片由员工上传改仓库上传 2024-11-23 15:16:37 +08:00
2 changed files with 66 additions and 28 deletions

View File

@ -59,7 +59,7 @@
<view class="no" @click="confirmOpe('no')"> <view class="no" @click="confirmOpe('no')">
{{ backText }} {{ backText }}
</view> </view>
<view class="yes" @click="openFile"> <view class="yes" @click="confirmOpe('yes')">
{{ yesText }} {{ yesText }}
</view> </view>
</view> </view>

View File

@ -50,8 +50,18 @@
<text class="label"></text> <text class="label"></text>
<text class="repairNum"></text> <text class="repairNum"></text>
<view class="submit" @click="toPart">采购</view> <view class="submit" @click="toPart">采购</view>
<view class="submit" @click="submit">{{ isReceive ? '通知领料' : '通知退料' }}</view> <view class="submit" @click="submitBefore">{{ isReceive ? '通知领料' : '通知退料' }}</view>
</view> </view>
<uni-popup ref="popup" background-color="#fff">
<view class="popup-content" style="padding: 15px;">
<view class="dl-avatar-box">
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
limit="9" title="请上传配件申请单照片最多选择9张图片"></uni-file-picker>
</view>
<button type="primary" @click="submit">保存</button>
</view>
</uni-popup>
</view> </view>
</template> </template>
@ -62,6 +72,8 @@ import {
getJSONData, setJSONData getJSONData, setJSONData
} from '@/utils/auth' } from '@/utils/auth'
import {getDictTextByCodeAndValue, createUniqueCodeByHead} from "@/utils/utils"; import {getDictTextByCodeAndValue, createUniqueCodeByHead} from "@/utils/utils";
import upload from "@/utils/upload";
import config from "@/config";
export default { export default {
components: {VNavigationBar}, components: {VNavigationBar},
@ -78,7 +90,9 @@ export default {
active: '', active: '',
isToBeReviewed: true, isToBeReviewed: true,
query: null, query: null,
selectRows: [] selectRows: [],
fileList: [],
sizeType: ['compressed'],
}; };
}, },
onLoad(data) { onLoad(data) {
@ -95,6 +109,36 @@ export default {
computed: {}, computed: {},
methods: { methods: {
submitBefore(){
if (this.isReceive){
if (!this.selectRows || this.selectRows.length === 0){
uni.showToast({
title: '请选择配件!',
icon: 'none'
})
return
}
this.$refs.popup.open()
}else {
this.submit()
}
},
afterRead(file) {
for (let i = 0; i < file.tempFilePaths.length; i++) {
upload({
url: '/admin-api/infra/file/upload',
filePath: file.tempFilePaths[i]
}).then((res) => {
this.fileList.push({
url: config.baseImageUrl + res.data
})
console.log(this.fileList)
})
}
},
deleteFile(file, index) {
this.fileList.splice(index, 1);
},
chooseItem(item) { chooseItem(item) {
const index = this.selectRows.findIndex(i => i.id === item.id) const index = this.selectRows.findIndex(i => i.id === item.id)
const parentIndex = this.wares.findIndex(i => i.id === item.id) const parentIndex = this.wares.findIndex(i => i.id === item.id)
@ -152,27 +196,6 @@ export default {
item.isSelected = this.selectRows.findIndex(i => i.id === item.id) !== -1 item.isSelected = this.selectRows.findIndex(i => i.id === item.id) !== -1
} }
}) })
// res.data.map((item)=>{
// if(!item.waresAlreadyCount){
// item.waresAlreadyCount = 0
// }
// if(!item.wares.stock){
// item.wares.stock=0
// }
// if(this.isReceive){
// //-
// item.maxNum = parseInt(item.waresCount) - parseInt(item.waresAlreadyCount)
// if(item.maxNum >item.wares.stock){
// item.maxNum = item.wares.stock
// }
// item.thisNum = item.maxNum
// }else{
// //退0,0
// item.maxNum = item.waresAlreadyCount
// item.thisNum = 0
// }
// })
// this.wares = res.data;
}) })
}, },
/** /**
@ -229,8 +252,15 @@ export default {
userName: this.formData.repairName, userName: this.formData.repairName,
soStatus: this.isReceive ? '04' : '07' soStatus: this.isReceive ? '04' : '07'
} }
if (!this.selectRows || this.selectRows.length === 0){
uni.showToast({
title: '请选择配件!',
icon: 'none'
})
return
}
// thisNum0 // thisNum0
const flag = this.wares.filter(item => item.thisNum > 0) const flag = this.selectRows.filter(item => item.thisNum > 0)
if (!flag || flag.length === 0) { if (!flag || flag.length === 0) {
uni.showToast({ uni.showToast({
title: '请设置配件数量!', title: '请设置配件数量!',
@ -238,8 +268,8 @@ export default {
}) })
return return
} }
this.wares = flag // this.wares = flag
this.formData.repairSois = [...this.wares.map(item => { this.formData.repairSois = [...flag.map(item => {
return { return {
soiType: this.isReceive ? '02' : "04", soiType: this.isReceive ? '02' : "04",
goodsId: item.waresId, goodsId: item.waresId,
@ -247,17 +277,25 @@ export default {
} }
})] })]
if (this.isReceive) { if (this.isReceive) {
this.formData.items = [...this.wares.map(item => { this.formData.items = [...flag.map(item => {
return { return {
id: item.id, id: item.id,
} }
})] })]
} }
if (this.isReceive && this.fileList && this.fileList.length > 0){
this.formData.images = this.fileList.map(item => {
return item.path.replace(config.baseImageUrl, "")
}).join(",")
}
request({ request({
url: '/admin-api/repair/tw/pass', url: '/admin-api/repair/tw/pass',
method: 'post', method: 'post',
data: this.formData data: this.formData
}).then((res) => { }).then((res) => {
if (this.isReceive){
this.$refs.popup.close()
}
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '通知成功!', title: '通知成功!',