-
+
@@ -234,13 +245,26 @@ export default {
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount', 'model', 'unit'],
remark: null,
tableKey: 0,
+ query: null,
+ twId: null,
}
},
mounted() {
this.getList()
},
methods: {
- getDictDatasToType(type){
+ searchByQuery(){
+ const data = {
+ twId: this.twId,
+ query: this.query
+ }
+ this.getTwitemList(data)
+ },
+ resetByQuery() {
+ this.query = null
+ this.searchByQuery()
+ },
+ getDictDatasToType(type) {
return this.getDictDatas(type)
},
// 通过 true是全部、false是选择
@@ -310,15 +334,27 @@ export default {
this.resetForm('queryForm')
this.handleQuery()
},
- async handleDispose(row) {
+ handleDispose(row) {
this.formData = {}
this.formData = {
...row
}
this.dialogVisible = true
+ const data = {twId: row.id}
+ this.twId = row.id
+ this.getTwitemList(data)
+ // const res = await listTwItem(data)
+ // this.items = res.data
+ // this.items = this.items.filter(item => item.waresStatus === '1')
+ // this.items.forEach(item => {
+ // const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
+ // item.waresCount = this.type ? count : item.waresAlreadyCount
+ // item.isStock = this.type ? count <= item.wares.stock : true
+ // })
+ // this.items = this.items.filter(item => this.type ? item.waresCount > 0 : item.waresAlreadyCount > 0)
+ },
+ async getTwitemList(data) {
try {
- this.dialogLoading = true
- const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data
this.items = this.items.filter(item => item.waresStatus === '1')
@@ -328,8 +364,7 @@ export default {
item.isStock = this.type ? count <= item.wares.stock : true
})
this.items = this.items.filter(item => this.type ? item.waresCount > 0 : item.waresAlreadyCount > 0)
- } finally {
- this.dialogLoading = false
+ } catch {
}
},
getRowClass(row) {
@@ -443,7 +478,7 @@ export default {
const isNull = this.validateNull();
if (!isNull) return;
const names = this.validateZero()
- if (names){
+ if (names) {
await this.$modal.confirm("确认配件:" + names + "的采购价格为0吗?")
}
await this.createInit()
@@ -484,36 +519,36 @@ export default {
}
})]
},
- validateNull(){
+ validateNull() {
const flag = this.partList.map(item => {
const price = item.newPrice
- if (price === null || price === ""){
+ if (price === null || price === "") {
this.$modal.msgError("配件:" + item.name + "采购价格为空")
return false
- }else {
+ } else {
return true
}
})
let count = 0
flag.forEach(item => {
- if (!item){
+ if (!item) {
count++
}
})
return count === 0
},
- validateZero(){
+ validateZero() {
const flag = this.partList.map(item => {
const price = parseFloat(item.newPrice)
- if (price === 0){
+ if (price === 0) {
return item.name
- }else {
+ } else {
return ""
}
})
return flag.filter(item => item !== "").join(",")
},
- handleView(row){
+ handleView(row) {
this.$refs.ticketWaresShow.open(row)
}
}
diff --git a/src/views/repair/tickets/Components/TicketWaresShow.vue b/src/views/repair/tickets/Components/TicketWaresShow.vue
index df3bba1..ab13622 100644
--- a/src/views/repair/tickets/Components/TicketWaresShow.vue
+++ b/src/views/repair/tickets/Components/TicketWaresShow.vue
@@ -95,6 +95,9 @@
添加配件
+
+ 设置可见
+
@@ -166,12 +169,56 @@