This commit is contained in:
2022-11-15 20:00:46 +08:00
parent c37ad08bcc
commit 6dfe3621a0
9 changed files with 696 additions and 72 deletions

View File

@@ -48,4 +48,12 @@ export function disupload(data) {
})
}
export default { add, edit, del, upload, upload2, disupload }
export function getType(data) {
return request({
url: '/api/inandoutreturn/getType',
method: 'post',
data
})
}
export default { add, edit, del, upload, upload2, disupload, getType }

View File

@@ -32,7 +32,6 @@
<el-select
v-model="query.io_type"
size="mini"
disabled
placeholder="出入类型"
class="filter-item"
@change="ioTypeChange"
@@ -58,9 +57,9 @@
>
<el-option
v-for="item in billtypelist"
:key="item.code"
:label="item.name"
:value="item.code"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
@@ -190,8 +189,6 @@
size="mini"
:data="crud.data"
style="width: 100%;"
show-summary
:summary-method="getSum"
:highlight-current-row="true"
@selection-change="crud.selectionChangeHandler"
>
@@ -240,7 +237,6 @@ import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
import ViewDialog from '@/views/wms/st/inbill/ViewDialog'
import crudRawAssist from '@/views/wms/st/inbill/rawassist'
export default {
name: 'Return',
@@ -254,12 +250,13 @@ export default {
del: false,
reset: true,
download: false
}
},
query: { io_type: '0' }
})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['io_bill_status', 'ST_CREATE_MODE', 'io_type', 'is_upload'],
dicts: ['io_bill_status', 'ST_CREATE_MODE', 'io_type', 'is_upload', 'ST_INV_IN_TYPE', 'ST_INV_OUT_TYPE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
@@ -278,12 +275,11 @@ export default {
}
},
created() {
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
crudStorattr.getStor({ 'is_productstore': '1' }).then(res => {
this.storlist = res.content
})
crudRawAssist.getType({ 'io_code': '' }).then(res => {
this.billtypelist = res
})
debugger
this.billtypelist = this.dict.ST_INV_IN_TYPE
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
@@ -298,11 +294,20 @@ export default {
this.viewShow = true
},
bill_typeFormat(row) {
for (const item of this.billtypelist) {
if (item.code === row.bill_type) {
return item.name
}
if (this.query.io_type === '0') {
return this.dict.label.ST_INV_IN_TYPE[row.bill_type]
}
if (this.query.io_type === '1') {
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type]
}
},
ioTypeChange(value) {
if (value === '1') {
this.billtypelist = this.dict.ST_INV_OUT_TYPE
} else {
this.billtypelist = this.dict.ST_INV_IN_TYPE
}
this.crud.toQuery()
},
create_modeFormat(row) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
@@ -366,7 +371,7 @@ export default {
this.fullscreenLoading = false
})
},
disuploadSAP() {
uploadSAP() {
const res = this.$refs.table.selection
if (!res || res.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
@@ -383,7 +388,7 @@ export default {
this.fullscreenLoading = false
})
},
disuploadMES() {
uploadMES() {
const res = this.$refs.table.selection
if (!res || res.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
@@ -400,61 +405,12 @@ export default {
this.fullscreenLoading = false
})
},
ioTypeChange(value) {
if (value === '1') {
crudRawAssist.getType({ 'io_code': '', 'io_flag': '01' }).then(res => {
this.billtypelist = res
})
} else {
crudRawAssist.getType({ 'io_code': '', 'io_flag': '00' }).then(res => {
this.billtypelist = res
})
}
this.crud.toQuery()
},
formatIsUpload(row) {
if (row.is_upload === '0') {
return '否'
} else if (row.is_upload === '1') {
return '是'
}
},
getSum(param) {
// 将所有number的字段合计
const { columns, data } = param
const sums = []
let values = []
columns.forEach((column, index) => {
if (index === 1) {
sums[index] = '合计'
return
}
values = data.map(item => Number(item[column.property]))
if (column.property === 'total_qty') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
} else if (column.property === 'detail_count') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index].toFixed(0) // 保留三位小数
} else {
sums[index] = '--'
}
})
return sums
}
}
}