Browse Source

新增盘点选项

master
x_ying 3 years ago
parent
commit
5870df64ee
  1. 140
      src/views/archivesManage/archivesCheck/module/addCheck.vue

140
src/views/archivesManage/archivesCheck/module/addCheck.vue

@ -16,15 +16,15 @@
:options="selectArea" :options="selectArea"
multiple multiple
placeholder="请选择" placeholder="请选择"
style="width:245px;height:30px"
:limit="2"
style="width:280px;height:30px"
:limit="1"
:limit-text="count => `+${count}`" :limit-text="count => `+${count}`"
/> />
</el-form-item> </el-form-item>
<el-form-item label="选择门类" prop="category" class="down-select"> <el-form-item label="选择门类" prop="category" class="down-select">
<el-select <el-select
v-model="categoryValue" v-model="categoryValue"
style="width: 245px;"
style="width: 280px;"
multiple multiple
filterable filterable
clearable clearable
@ -46,10 +46,11 @@
<el-table-column type="index" align="center" label="序号" width="80" /> <el-table-column type="index" align="center" label="序号" width="80" />
<el-table-column prop="checkState" align="center" label="状态" width="120"> <el-table-column prop="checkState" align="center" label="状态" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 已执行 / 待执行/执行中 -->
<!-- 未盘点 -->
<span class="clear">{{ scope.row.checkState }}</span> <span class="clear">{{ scope.row.checkState }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="" align="center" label="子条数目" width="100" />
<el-table-column prop="" align="center" label="门类级别" width="100" /> <el-table-column prop="" align="center" label="门类级别" width="100" />
<el-table-column prop="" align="center" label="门类名称" width="120" /> <el-table-column prop="" align="center" label="门类名称" width="120" />
<el-table-column prop="" align="center" label="全宗号" width="100" /> <el-table-column prop="" align="center" label="全宗号" width="100" />
@ -75,59 +76,10 @@
<script> <script>
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
var menus = [
{
id: 1,
label: '父区域',
children: [
// {
// id: 100,
// label: '1',
// children: [
{
id: 1000,
label: '设备1.1'
},
{
id: 1001,
label: '设备1.2'
},
{
id: 1002,
label: '设备1.3'
},
{
id: 1003,
label: '设备1.4'
}
]
},
{
id: 101,
label: '子区域2',
children: [
{
id: 1006,
label: '设备2.1'
},
{
id: 1007,
label: '设备2.2'
},
{
id: 1008,
label: '设备2.3'
},
{
id: 1011,
label: '设备2.4'
}
]
}
// ]
// }
]
import { menu } from '@/api/storeManage/levelManage/level'
import { getCategoryTree } from '@/api/category/category'
export default { export default {
name: 'AddCheck',
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
@ -136,26 +88,74 @@ export default {
checkForm: {}, checkForm: {},
addFormVisible: false, addFormVisible: false,
selectAreaValue: [], selectAreaValue: [],
selectArea: menus,
selectArea: [],
// deviceTree:[],
defaultProps: { children: 'children', label: 'label' }, defaultProps: { children: 'children', label: 'label' },
nodeKey: 'id', nodeKey: 'id',
defaultCheckedKeys: [], defaultCheckedKeys: [],
categoryValue: [0, 1, 2, 3],
oldCategory: [0, 1, 2, 3],
category: [
{ value: 0, label: '全部' },
{ value: 1, label: '档号' },
{ value: 2, label: '题名' },
{ value: 3, label: '位置' }
],
categoryValue: [],
oldCategory: [],
allCategory: [],
category: [],
showTags: true showTags: true
} }
}, },
created() {
this.getTreeMenu()
this.getCateMenu()
},
methods: { methods: {
getTreeMenu() {
menu().then(data => {
const deviceTree = []
let storeroom = {}
let devices = []
// deviceTree.splice(0, deviceTree.length)
data.forEach((item, i) => {
if (!storeroom.id) {
item.storeroomId.label = item.storeroomId.name
storeroom = item.storeroomId
item.label = item.deviceName
devices.push(item)
} else if (storeroom.id !== item.storeroomId.id) {
item.storeroomId.label = item.storeroomId.name
storeroom.children = devices
deviceTree.push(storeroom)
devices = []
item.label = item.deviceName
devices.push(item)
storeroom = item.storeroomId
} else {
item.storeroomId.label = item.storeroomId.name
item.label = item.deviceName
devices.push(item)
}
if (i === data.length - 1) {
item.storeroomId.label = item.storeroomId.name
storeroom.children = devices
deviceTree.push(storeroom)
}
this.selectArea = deviceTree
})
})
},
getCateMenu() {
getCategoryTree().then(res => {
this.category = res[0].children
this.category.forEach(item => {
item.value = item.id
item.label = item.cnName
})
this.category.unshift({ value: 0, label: '全选' })
this.allCategory = this.category.map(item => { return item.value })
this.categoryValue = JSON.parse(JSON.stringify(this.allCategory))
this.oldCategory = JSON.parse(JSON.stringify(this.allCategory))
})
},
handleBuild() { handleBuild() {
console.log(this.$refs.dialogTable.$refs)
console.log(this.selectArea, this.category)
console.log(this.selectAreaValue, this.categoryValue)
}, },
handleSave() { handleSave() {
this.addFormVisible = false this.addFormVisible = false
@ -163,9 +163,9 @@ export default {
// //
selectChange(val) { selectChange(val) {
// console.log(val) // console.log(val)
const allCategory = JSON.parse(JSON.stringify(this.allCategory))
if (val[val.length - 1] === 0) { // if (val[val.length - 1] === 0) { //
this.categoryValue = [0, 1, 2, 3]
this.showTags = true
this.categoryValue = allCategory
} else { } else {
const arr1 = this.oldCategory.filter(item => item !== 0) const arr1 = this.oldCategory.filter(item => item !== 0)
const arr2 = val.filter(item => item !== 0) const arr2 = val.filter(item => item !== 0)
@ -173,10 +173,8 @@ export default {
this.categoryValue = [] this.categoryValue = []
} else if (arr1.length < arr2.length && arr2.length === this.category.length - 1) { } else if (arr1.length < arr2.length && arr2.length === this.category.length - 1) {
this.categoryValue.unshift(0) // this.categoryValue.unshift(0) //
this.showTags = true
} else { } else {
this.categoryValue = this.categoryValue.filter(item => item !== 0) // this.categoryValue = this.categoryValue.filter(item => item !== 0) //
this.showTags = false
} }
} }
this.oldCategory = this.categoryValue this.oldCategory = this.categoryValue

Loading…
Cancel
Save