Merge branch 'repair'
This commit is contained in:
commit
8d3f5c5cef
@ -504,7 +504,7 @@ export default {
|
|||||||
const res = await getMapBySoIdAndQuery(this.soId, this.inItemsQuery)
|
const res = await getMapBySoIdAndQuery(this.soId, this.inItemsQuery)
|
||||||
this.inItems = Object.entries(res.data)
|
this.inItems = Object.entries(res.data)
|
||||||
this.inItems = this.inItems.map(([key, value]) => {
|
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 = this.inItems.filter(([key, value]) => value.length > 0)
|
||||||
this.inItems.forEach(([key, value]) => {
|
this.inItems.forEach(([key, value]) => {
|
||||||
|
@ -94,11 +94,11 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" v-if="type" @click="handlePass"
|
<el-button type="primary" v-if="type" @click="handlePassBefore"
|
||||||
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
|
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
|
||||||
通知领料
|
通知领料
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" v-else @click="handlePass"
|
<el-button type="primary" v-else @click="handlePassBefore"
|
||||||
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
|
:disabled="allSelectRows.length === 0 || allSelectRows.filter(item => !item.isStock).length !== 0">
|
||||||
通知退料
|
通知退料
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -156,7 +156,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="分类" align="center" width="180" prop="wares.type">
|
<el-table-column label="分类" align="center" width="180" prop="wares.type">
|
||||||
<div class="item" slot-scope="scope">
|
<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)"
|
<el-option v-for="server in optionData(serverList)"
|
||||||
:key="server.value"
|
:key="server.value"
|
||||||
:label="server.label"
|
:label="server.label"
|
||||||
@ -167,7 +168,7 @@
|
|||||||
highlight-current
|
highlight-current
|
||||||
@node-click="handleNodeClick($event, scope.row)"
|
@node-click="handleNodeClick($event, scope.row)"
|
||||||
:expand-on-click-node="expandOnClickNode"
|
:expand-on-click-node="expandOnClickNode"
|
||||||
default-expand-all />
|
default-expand-all/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span class="item__txt">{{ getTypeById(scope.row.wares.type) }}</span>
|
<span class="item__txt">{{ getTypeById(scope.row.wares.type) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -244,6 +245,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :title="type ? '通知领料' : '通知退料'" :visible.sync="inPhoto" width="40%" v-dialogDrag append-to-body>
|
||||||
|
<el-form :inline="true" label-width="15rem">
|
||||||
|
<el-form-item :label="type ? '领料人' : '退料人'">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<TicketWaresShow ref="ticketWaresShow" :user-role="'repair_warehouse'" @success="getList" :type="false"/>
|
<TicketWaresShow ref="ticketWaresShow" :user-role="'repair_warehouse'" @success="getList" :type="false"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -262,6 +280,7 @@ import {getCusAndCarById} from "@/api/repair/tickets/Tickets";
|
|||||||
import {getCarBrand} from "@/api/base/carbrand";
|
import {getCarBrand} from "@/api/base/carbrand";
|
||||||
import {listGoods} from "@/views/partner/api/workOrder";
|
import {listGoods} from "@/views/partner/api/workOrder";
|
||||||
import {getBaseTypeList} from "@/api/base/type";
|
import {getBaseTypeList} from "@/api/base/type";
|
||||||
|
import {listByTicketId} from "@/api/repair/repairworker";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "WaresItem",
|
name: "WaresItem",
|
||||||
@ -302,26 +321,30 @@ export default {
|
|||||||
ticketId: null,
|
ticketId: null,
|
||||||
expandOnClickNode: true,
|
expandOnClickNode: true,
|
||||||
serverList: [],
|
serverList: [],
|
||||||
treeProps:{
|
treeProps: {
|
||||||
label: "name",
|
label: "name",
|
||||||
children: "children"
|
children: "children"
|
||||||
},
|
},
|
||||||
typeMap: null,
|
typeMap: null,
|
||||||
allSelectRows: [],
|
allSelectRows: [],
|
||||||
isRefresh: false
|
isRefresh: false,
|
||||||
|
inPhoto: false,
|
||||||
|
images: null,
|
||||||
|
chooseStaff: [],
|
||||||
|
staffs: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTypeById(id){
|
getTypeById(id) {
|
||||||
return this.typeMap.get(id)
|
return this.typeMap.get(id)
|
||||||
},
|
},
|
||||||
async listServer(){
|
async listServer() {
|
||||||
if (!this.serverList || this.serverList.length === 0){
|
if (!this.serverList || this.serverList.length === 0) {
|
||||||
const res = await getBaseTypeList({type: "02"})
|
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.typeMap = new Map()
|
||||||
this.extractNodesToMap(this.serverList, this.typeMap)
|
this.extractNodesToMap(this.serverList, this.typeMap)
|
||||||
}
|
}
|
||||||
@ -334,14 +357,14 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleNodeClick(data, scopeRow){
|
handleNodeClick(data, scopeRow) {
|
||||||
scopeRow.wares.type = data.id;
|
scopeRow.wares.type = data.id;
|
||||||
this.save(scopeRow)
|
this.save(scopeRow)
|
||||||
},
|
},
|
||||||
optionData(array, result=[]){
|
optionData(array, result = []) {
|
||||||
array.forEach(item => {
|
array.forEach(item => {
|
||||||
result.push({label: item.name, value: item.id})
|
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)
|
this.optionData(item.children, result)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -376,8 +399,30 @@ export default {
|
|||||||
getDictDatasToType(type) {
|
getDictDatasToType(type) {
|
||||||
return this.getDictDatas(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是选择
|
// 通过 true是全部、false是选择
|
||||||
async handlePass() {
|
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 = {
|
this.formData.repairSo = {
|
||||||
soType: this.type ? "02" : "04",
|
soType: this.type ? "02" : "04",
|
||||||
@ -386,6 +431,7 @@ export default {
|
|||||||
userName: this.formData.repairName,
|
userName: this.formData.repairName,
|
||||||
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
|
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
|
||||||
soStatus: this.type ? "04" : "07",
|
soStatus: this.type ? "04" : "07",
|
||||||
|
userIds: this.chooseStaff.join(",")
|
||||||
// purchaseType: "01"
|
// purchaseType: "01"
|
||||||
}
|
}
|
||||||
this.formData.repairSois = [...this.allSelectRows.map(item => {
|
this.formData.repairSois = [...this.allSelectRows.map(item => {
|
||||||
@ -408,6 +454,7 @@ export default {
|
|||||||
await this.getList()
|
await this.getList()
|
||||||
} finally {
|
} finally {
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
|
this.inPhoto = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 生成采购 true是全部、false是选择
|
// 生成采购 true是全部、false是选择
|
||||||
@ -494,12 +541,12 @@ export default {
|
|||||||
this.allSelectRows = [...this.allSelectRows, ...row]
|
this.allSelectRows = [...this.allSelectRows, ...row]
|
||||||
// 更新自身的数据
|
// 更新自身的数据
|
||||||
// 点搜索不走下面逻辑
|
// 点搜索不走下面逻辑
|
||||||
if (!this.isRefresh){
|
if (!this.isRefresh) {
|
||||||
// 如果本页没有选中数据,那就把属于本页的数据全部删掉
|
// 如果本页没有选中数据,那就把属于本页的数据全部删掉
|
||||||
const ids = this.$refs.tableRef.data.map(item => item.id);
|
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))
|
this.allSelectRows = this.allSelectRows.filter(item => !ids.includes(item.id))
|
||||||
}else {
|
} else {
|
||||||
// 把属于本页但是之前选中了本次没有选中的删掉
|
// 把属于本页但是之前选中了本次没有选中的删掉
|
||||||
const rowIds = row.map(item => item.id)
|
const rowIds = row.map(item => item.id)
|
||||||
const exIds = ids.filter(id => !rowIds.includes(id))
|
const exIds = ids.filter(id => !rowIds.includes(id))
|
||||||
@ -510,9 +557,9 @@ export default {
|
|||||||
// 可能重复,去重
|
// 可能重复,去重
|
||||||
this.allSelectRows = this.allSelectRows.reduce((acc, item) => {
|
this.allSelectRows = this.allSelectRows.reduce((acc, item) => {
|
||||||
const flag = acc.find(i => i.id === item.id)
|
const flag = acc.find(i => i.id === item.id)
|
||||||
if (!flag){
|
if (!flag) {
|
||||||
return acc.concat([item])
|
return acc.concat([item])
|
||||||
}else {
|
} else {
|
||||||
return acc
|
return acc
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
@ -594,7 +641,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.partList.forEach(([key, value]) => {
|
this.partList.forEach(([key, value]) => {
|
||||||
const flag = value.findIndex(f => f.id === row.id)
|
const flag = value.findIndex(f => f.id === row.id)
|
||||||
if (flag !== -1){
|
if (flag !== -1) {
|
||||||
row.totalPrice = row.waresCount * row.wares.price
|
row.totalPrice = row.waresCount * row.wares.price
|
||||||
this.$set(value, flag, row)
|
this.$set(value, flag, row)
|
||||||
}
|
}
|
||||||
@ -667,11 +714,13 @@ export default {
|
|||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
this.formData.waresList = [...values.map(item => {
|
this.formData.waresList = [...values.map(item => {
|
||||||
if (item.wares.ware){
|
if (item.wares.ware) {
|
||||||
item.wares.warehouse = item.wares.ware.id
|
item.wares.warehouse = item.wares.ware.id
|
||||||
}
|
}
|
||||||
return item.wares
|
return item.wares
|
||||||
})]
|
})]
|
||||||
|
|
||||||
|
this.formData.twId = this.twId
|
||||||
},
|
},
|
||||||
validateNull() {
|
validateNull() {
|
||||||
const flag = this.partList.map(item => {
|
const flag = this.partList.map(item => {
|
||||||
|
Loading…
Reference in New Issue
Block a user