领料流程修改

This commit is contained in:
xiaofajia 2024-11-23 17:11:09 +08:00
parent 0bb87c2f67
commit 2f6a07a856

View File

@ -156,7 +156,8 @@
</el-table-column>
<el-table-column label="分类" align="center" width="180" prop="wares.type">
<div class="item" slot-scope="scope">
<el-select class="item__input" clearable ref="selectTree" v-model="scope.row.wares.type" @change="save(scope.row)">
<el-select class="item__input" clearable ref="selectTree" v-model="scope.row.wares.type"
@change="save(scope.row)">
<el-option v-for="server in optionData(serverList)"
:key="server.value"
:label="server.label"
@ -167,7 +168,7 @@
highlight-current
@node-click="handleNodeClick($event, scope.row)"
:expand-on-click-node="expandOnClickNode"
default-expand-all />
default-expand-all/>
</el-select>
<span class="item__txt">{{ getTypeById(scope.row.wares.type) }}</span>
</div>
@ -244,8 +245,17 @@
</div>
</el-dialog>
<el-dialog title="图片上传" :visible.sync="inPhoto" width="40%" v-dialogDrag append-to-body>
<ImageUpload v-model="images" />
<el-dialog title="通知领料" :visible.sync="inPhoto" width="40%" v-dialogDrag append-to-body>
<el-form :inline="true" label-width="15rem">
<el-form-item label="领料人">
<el-select v-model="chooseStaff" multiple clearable filterable>
<el-option v-for="staff in staffs" :key="staff.id" :value="staff.userId" :label="staff.userName" />
</el-select>
</el-form-item>
<el-form-item label="图片上传">
<ImageUpload v-model="images"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handlePass">确定</el-button>
<el-button type="primary" @click="inPhoto = false">取消</el-button>
@ -270,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",
@ -310,7 +321,7 @@ export default {
ticketId: null,
expandOnClickNode: true,
serverList: [],
treeProps:{
treeProps: {
label: "name",
children: "children"
},
@ -318,20 +329,22 @@ export default {
allSelectRows: [],
isRefresh: false,
inPhoto: false,
images: null
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)
}
@ -344,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)
}
})
@ -387,17 +400,29 @@ export default {
return this.getDictDatas(type)
},
handlePassBefore(){
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)
},
// truefalse
async handlePass() {
if (this.images){
if (this.images) {
this.formData.images = this.images.split(",").map(item => {
return item.replace(process.env.VUE_APP_FILE_API, "")
}).join(",")
}
if (this.type && (!this.chooseStaff || this.chooseStaff.length === 0)){
this.$modal.msgError("请选择领料人!")
return
}
// 退
this.formData.repairSo = {
soType: this.type ? "02" : "04",
@ -406,6 +431,7 @@ export default {
userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
soStatus: this.type ? "04" : "07",
userIds: this.type ? this.chooseStaff.join(",") : ''
// purchaseType: "01"
}
this.formData.repairSois = [...this.allSelectRows.map(item => {
@ -515,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))
@ -531,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
}
}, [])
@ -615,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)
}
@ -688,7 +714,7 @@ 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