You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
4.9 KiB

1 year ago
<template>
<div>
<!-- 选择物资编号 -->
1 year ago
<Modal v-model="isShowWuzi" :z-index="10000" width="70" title="库存选择" :loading="showLoading">
1 year ago
<div class="searchCompanys">
1 year ago
<el-input
v-model="wuzibianmakeyword"
style="margin-right:10px"
clearable
type="text"
placeholder="请输入物资编码查找库存"
@keyup.enter.native="getWuzi"
/>
<el-input
v-model="wuzimingchengkeyword"
style="margin-right:10px"
clearable
type="text"
placeholder="请输入物资名称查找"
@keyup.enter.native="getWuzi"
/>
1 year ago
<el-button type="primary" @click="getWuzi"></el-button>
</div>
1 year ago
<Table
ref="currentRowTable"
highlight-row
:columns="wuziColumns"
:data="wzList"
@on-current-change="wuziSelect"
/>
<Page
:current="wuziPageIndex"
:total="wuziTotal"
simple
style="padding-top: 14px;display: flex;justify-content: center;"
@on-change="wuziPageChange"
/>
1 year ago
<div slot="footer" align="right">
<Button class="btn" size="default" type="default" @click="mingxiCancel"></Button>
<Button class="btn" size="default" type="primary" @click="mingxiConfirm"></Button>
</div>
</Modal>
</div>
</template>
<script>
1 year ago
// import {
// index,
// } from "@/api/system/baseForm.js"
import {
index
} from '@/api/inventory.js'
export default {
data() {
return {
// 物资
showLoading: false,
isShowWuzi: false,
wuziPageIndex: 1,
wuzibianmakeyword: '',
wuzimingchengkeyword: '',
wuziTotal: 0,
wzList: [],
selectItem: {},
wuziColumns: [{
width: 60,
_isChecked: false,
key: 'isSelect',
resizable: true,
render: (h, params) => {
return h('div', [
h('Radio', {
props: {
value: params.row.isSelect
},
on: {
'on-change': (e) => {
this.wzList.forEach((items) => {
this.$set(items, 'isSelect', false)
})
this.wzList[params.index].isSelect = e
1 year ago
}
1 year ago
}
})
])
1 year ago
}
1 year ago
}, {
title: '物资编码',
key: 'wuzibianma'
}, {
title: '物资名称',
key: 'zichanmingcheng'
}, {
title: '在库数量',
key: 'zaikushuliang'
}, {
title: '入库批次',
key: 'rukupici'
}, {
title: '物资类型',
key: 'wuzileixing'
}, {
title: '所属种类',
key: 'fenlei_detail.value',
render: (h, params) => {
return h('div', [
h('strong', params.row.fenlei_detail ? params.row.fenlei_detail.value : '')
])
}
}, {
title: '物资型号',
key: 'guigexinghao'
}, {
title: '物资规格',
key: 'wuziguige'
}, {
title: '单位',
key: 'jiliangdanwei'
}]
}
},
watch: {
isShowWuzi(newVal) {
if (newVal) {
this.getWuzi()
1 year ago
}
1 year ago
}
},
methods: {
async getWuzi() {
this.showLoading = true
const res = await index({
page_size: 10,
page: this.wuziPageIndex,
sort_type: 'DESC',
sort_name: 'wuzibianma',
// table_name: 'inventorys',
filter: [{
'key': 'zichanmingcheng',
'op': 'like',
'value': this.wuzimingchengkeyword
}, {
'key': 'wuzibianma',
'op': 'like',
'value': this.wuzibianmakeyword
}]
})
1 year ago
1 year ago
for (var m of res.list.data) {
m.isSelect = false
}
this.wzList = res.list.data
this.wuziTotal = res.list.total
this.showLoading = false
console.log('res', this.wzList)
},
wuziSelect(e) {
console.log(e)
this.wzList.forEach((items) => {
this.$set(items, 'isSelect', false)
if (items.id == e.id) {
this.$set(items, 'isSelect', true)
1 year ago
}
1 year ago
})
this.selectItem = e
},
wuziPageChange(e) {
console.log('e', e)
this.wuziPageIndex = e
this.selectItem = {}
this.getWuzi()
},
mingxiConfirm() {
if (Object.keys(this.selectItem).length === 0) {
1 year ago
this.isShowWuzi = false
1 year ago
return
}
this.$emit('refresh', this.selectItem)
this.isShowWuzi = false
},
mingxiCancel() {
this.selectItem = {}
this.wuziPageIndex = 1
this.isShowWuzi = false
1 year ago
}
}
1 year ago
}
1 year ago
</script>
<style scoped>
.searchCompanys {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
}
</style>