diff --git a/src/views/repair/stockOperate/Components/WaresItem.vue b/src/views/repair/stockOperate/Components/WaresItem.vue
index ec4bf77..c50fda8 100644
--- a/src/views/repair/stockOperate/Components/WaresItem.vue
+++ b/src/views/repair/stockOperate/Components/WaresItem.vue
@@ -114,105 +114,134 @@
车牌号
- {{carInfo.licenseNumber}}
+ {{ carInfo.licenseNumber }}
品牌
- {{carInfo.carBrand}}
+ {{ carInfo.carBrand }}
型号
- {{carInfo.carModel}}
+ {{ carInfo.carModel }}
-
-
- {{ scope.$index + 1 }}
-
-
-
-
-
-
- {{ scope.row.wares.model }}
-
-
-
-
-
- {{ scope.row.wares.code }}
-
-
-
-
-
- {{ scope.row.wares.warehouseName }}
-
-
-
-
-
-
-
-
-
+ :data="value"
+ :stripe="true"
+ :show-overflow-tooltip="true"
+ show-summary
+ :summary-method="getSummaries"
+ @cell-mouse-enter="handleCellEnter"
+ @cell-mouse-leave="handleCellLeave"
+ @cell-click="handleCellClick"
+ >
+
+
+ {{ scope.$index + 1 }}
+
+
+
+
+
+
+ {{ scope.row.wares.model }}
+
+
+
+
+
+
+
+
+ {{ getTypeById(scope.row.wares.type) }}
+
+
+
+
+
+ {{ scope.row.wares.code }}
+
+
+
+
+
+ {{ scope.row.wares?.ware?.name }}
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- {{ scope.row.waresCount }}
-
-
-
-
-
-
- {{ scope.row.wares.newPrice }}
-
-
-
-
-
-
- {{ scope.row.remark }}
-
-
-
-
- 删除
-
-
-
-
+
+
+
+
+
+ {{ scope.row.waresCount }}
+
+
+
+
+
+ {{ scope.row.wares.purPrice }}
+
+
+
+
+
+ {{ scope.row.wares.price }}
+
+
+
+
+
+
+ {{ scope.row.remark }}
+
+
+
+
+ 删除
+
+
+
+
+
@@ -231,6 +260,8 @@ import {getUserProfile} from "@/api/system/user";
import TicketWaresShow from "@/views/repair/tickets/Components/TicketWaresShow.vue";
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";
export default {
name: "WaresItem",
@@ -258,24 +289,64 @@ export default {
formData: {},
inStockDialog: false,
partList: [],
- includeColumn: ['count', 'totalPrice'],
+ includeColumn: ['waresCount', 'totalPrice'],
// 保存进入编辑的cell
clickCellMap: {},
// 需要编辑的属性
- editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount', 'wares.model', 'unit'],
+ editProp: ['wares.warehouse', 'wares.type', 'waresCount', 'wares.purPrice', 'wares.price', 'remark', 'wares.code', 'waresCount', 'wares.model', 'wares.unit'],
remark: null,
tableKey: 0,
query: null,
twId: null,
carInfo: {},
ticketId: null,
+ serverSelected: undefined,
+ expandOnClickNode: true,
+ serverList: [],
+ treeProps:{
+ label: "name",
+ children: "children"
+ },
+ typeMap: null,
}
},
mounted() {
this.getList()
},
methods: {
- searchByQuery(){
+ getTypeById(id){
+ return this.typeMap.get(id)
+ },
+ 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.typeMap = new Map()
+ this.extractNodesToMap(this.serverList, this.typeMap)
+ }
+ },
+ extractNodesToMap(nodes, map) {
+ nodes.forEach(node => {
+ map.set(node.id, node.name);
+ if (node.children && node.children.length > 0) {
+ this.extractNodesToMap(node.children, map);
+ }
+ });
+ },
+ handleNodeClick(data, scopeRow){
+ scopeRow.wares.type = data.id;
+ this.save(scopeRow)
+ },
+ optionData(array, result=[]){
+ array.forEach(item => {
+ result.push({label: item.name, value: item.id})
+ if (item.children && item.children.length !== 0){
+ this.optionData(item.children, result)
+ }
+ })
+ return JSON.parse(JSON.stringify(result))
+ },
+ searchByQuery() {
const data = {
twId: this.twId,
query: this.query
@@ -340,16 +411,23 @@ export default {
try {
const carRes = await getCusAndCarById(this.ticketId)
this.carInfo = carRes.data.carInfo
- if (this.carInfo.carBrand){
+ if (this.carInfo.carBrand) {
const brandRes = await getCarBrand(this.carInfo.carBrand)
this.carInfo.carBrand = brandRes.data.brandName
}
const ids = this.selections.map(item => item.id)
const res = await getByIds(ids)
this.partList = Object.entries(res.data)
+ const values = this.partList.map(([key, value]) => value)
+ values.forEach(item => {
+ item.forEach(i => {
+ i.totalPrice = i.waresCount * i.wares.price
+ })
+ })
this.inStockDialog = true
this.dialogVisible = false
- }catch{}
+ } catch {
+ }
},
async getList() {
try {
@@ -372,6 +450,7 @@ export default {
this.handleQuery()
},
handleDispose(row) {
+ this.listServer()
this.formData = {}
this.formData = {
...row
@@ -404,7 +483,7 @@ export default {
},
handleSelect(row) {
this.selections = row
- if (row && row.length > 0){
+ if (row && row.length > 0) {
this.selectionIds = row.map(item => item.id);
}
},
@@ -483,7 +562,13 @@ export default {
this.$modal.msgWarning("退料数量不能超过领取数量")
row.waresCount = row.waresAlreadyCount
}
- row.totalPrice = row.count * row.newPrice
+ this.partList.forEach(([key, value]) => {
+ const flag = value.findIndex(f => f.id === row.id)
+ if (flag !== -1){
+ row.totalPrice = row.waresCount * row.wares.price
+ this.$set(value, flag, row)
+ }
+ })
const id = row.id
// 取消本行所有cell的编辑状态
this.clickCellMap[id].forEach(cell => {
@@ -494,11 +579,11 @@ export default {
this.tableKey++
},
changeWare(row) {
- if (row.ware) {
- row['wareId'] = row.ware.id
- row['warehouse'] = row.ware.id
- row['warehouseName'] = row.ware.name
- }
+ // if (row.wares.ware) {
+ // row['wareId'] = row.ware.id
+ // row['warehouse'] = row.ware.id
+ // row['warehouseName'] = row.ware.name
+ // }
},
// 通知父组件,删除数据
deleteItem(index) {
@@ -523,6 +608,7 @@ export default {
},
// 提交前的构建
async createInit() {
+ const values = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value))
const res = await getUserProfile()
this.formData = {}
this.formData = {
@@ -532,24 +618,30 @@ export default {
userId: res.data.id,
userName: res.data.nickname,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
- itemCount: this.partList.length,
- totalPrice: this.partList.reduce((x, y) => {
+ itemCount: values.length,
+ totalPrice: values.reduce((x, y) => {
return x + y.totalPrice
}, 0),
soStatus: "02",
remark: this.remark,
}
- this.formData.goodsList = [...this.partList.map(item => {
+ this.formData.goodsList = [...values.map(item => {
return {
soiType: '01',
- goodsId: item.id,
+ goodsId: item.wares.id,
goodsType: '0',
- wareId: item?.wareId,
- goodsCount: item.count,
- goodsPrice: item.newPrice,
+ wareId: item.wares?.ware?.id,
+ goodsCount: item.waresCount,
+ goodsPrice: item.wares.price,
remark: item.remark
}
})]
+ this.formData.waresList = [...values.map(item => {
+ if (item.wares.ware){
+ item.wares.warehouse = item.wares.ware.id
+ }
+ return item.wares
+ })]
},
validateNull() {
const flag = this.partList.map(item => {