diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue index 66ce0f5..4c16e4f 100644 --- a/src/views/repair/stockOperate/Components/SoIndex.vue +++ b/src/views/repair/stockOperate/Components/SoIndex.vue @@ -504,7 +504,7 @@ export default { const res = await getMapBySoIdAndQuery(this.soId, this.inItemsQuery) this.inItems = Object.entries(res.data) this.inItems = this.inItems.map(([key, value]) => { - return [key, value.filter(item => (!item.inCount && item.inCount !== item.goodsCount))] + return [key, value.filter(item => item.inCount < item.goodsCount)] }) this.inItems = this.inItems.filter(([key, value]) => value.length > 0) this.inItems.forEach(([key, value]) => { diff --git a/src/views/repair/stockOperate/Components/WaresItem.vue b/src/views/repair/stockOperate/Components/WaresItem.vue index d74f988..453aa77 100644 --- a/src/views/repair/stockOperate/Components/WaresItem.vue +++ b/src/views/repair/stockOperate/Components/WaresItem.vue @@ -94,11 +94,11 @@ + + + + + + + + + + + + + + @@ -262,6 +280,7 @@ import {getCusAndCarById} from "@/api/repair/tickets/Tickets"; import {getCarBrand} from "@/api/base/carbrand"; import {listGoods} from "@/views/partner/api/workOrder"; import {getBaseTypeList} from "@/api/base/type"; +import {listByTicketId} from "@/api/repair/repairworker"; export default { name: "WaresItem", @@ -302,26 +321,30 @@ export default { ticketId: null, expandOnClickNode: true, serverList: [], - treeProps:{ + treeProps: { label: "name", children: "children" }, typeMap: null, allSelectRows: [], - isRefresh: false + isRefresh: false, + inPhoto: false, + images: null, + chooseStaff: [], + staffs: [], } }, mounted() { this.getList() }, methods: { - getTypeById(id){ + getTypeById(id) { return this.typeMap.get(id) }, - async listServer(){ - if (!this.serverList || this.serverList.length === 0){ + async listServer() { + if (!this.serverList || this.serverList.length === 0) { const res = await getBaseTypeList({type: "02"}) - this.serverList = this.handleTree(res.data, 'id', 'parentId',"children","0") + this.serverList = this.handleTree(res.data, 'id', 'parentId', "children", "0") this.typeMap = new Map() this.extractNodesToMap(this.serverList, this.typeMap) } @@ -334,14 +357,14 @@ export default { } }); }, - handleNodeClick(data, scopeRow){ + handleNodeClick(data, scopeRow) { scopeRow.wares.type = data.id; this.save(scopeRow) }, - optionData(array, result=[]){ + optionData(array, result = []) { array.forEach(item => { result.push({label: item.name, value: item.id}) - if (item.children && item.children.length !== 0){ + if (item.children && item.children.length !== 0) { this.optionData(item.children, result) } }) @@ -376,8 +399,30 @@ export default { getDictDatasToType(type) { return this.getDictDatas(type) }, + + handlePassBefore() { + this.chooseStaff = [] + this.staffs = [] + this.getTicketStaff() + this.images = null + this.inPhoto = true + }, + async getTicketStaff(){ + const res = await listByTicketId(this.ticketId) + this.staffs = res.data + this.chooseStaff.push(this.formData.repairId) + }, // 通过 true是全部、false是选择 async handlePass() { + if (this.images) { + this.formData.images = this.images.split(",").map(item => { + return item.replace(process.env.VUE_APP_FILE_API, "") + }).join(",") + } + if ((!this.chooseStaff || this.chooseStaff.length === 0)){ + this.$modal.msgError(`请选择${this.type ? '领' : '退'}料人!`) + return + } // 生成领料单、退料单 this.formData.repairSo = { soType: this.type ? "02" : "04", @@ -386,6 +431,7 @@ export default { userName: this.formData.repairName, soTime: parseTime(Date.now(), '{y}-{m}-{d}'), soStatus: this.type ? "04" : "07", + userIds: this.chooseStaff.join(",") // purchaseType: "01" } this.formData.repairSois = [...this.allSelectRows.map(item => { @@ -408,6 +454,7 @@ export default { await this.getList() } finally { this.dialogVisible = false + this.inPhoto = false } }, // 生成采购 true是全部、false是选择 @@ -494,12 +541,12 @@ export default { this.allSelectRows = [...this.allSelectRows, ...row] // 更新自身的数据 // 点搜索不走下面逻辑 - if (!this.isRefresh){ + if (!this.isRefresh) { // 如果本页没有选中数据,那就把属于本页的数据全部删掉 const ids = this.$refs.tableRef.data.map(item => item.id); - if (!row || row.length === 0){ + if (!row || row.length === 0) { this.allSelectRows = this.allSelectRows.filter(item => !ids.includes(item.id)) - }else { + } else { // 把属于本页但是之前选中了本次没有选中的删掉 const rowIds = row.map(item => item.id) const exIds = ids.filter(id => !rowIds.includes(id)) @@ -510,9 +557,9 @@ export default { // 可能重复,去重 this.allSelectRows = this.allSelectRows.reduce((acc, item) => { const flag = acc.find(i => i.id === item.id) - if (!flag){ + if (!flag) { return acc.concat([item]) - }else { + } else { return acc } }, []) @@ -594,7 +641,7 @@ export default { } this.partList.forEach(([key, value]) => { const flag = value.findIndex(f => f.id === row.id) - if (flag !== -1){ + if (flag !== -1) { row.totalPrice = row.waresCount * row.wares.price this.$set(value, flag, row) } @@ -667,11 +714,13 @@ export default { } })] this.formData.waresList = [...values.map(item => { - if (item.wares.ware){ + if (item.wares.ware) { item.wares.warehouse = item.wares.ware.id } return item.wares })] + + this.formData.twId = this.twId }, validateNull() { const flag = this.partList.map(item => {