打印机部分修改优化
This commit is contained in:
@@ -50,9 +50,12 @@
|
|||||||
<!-- <el-radio label="2">部分商品</el-radio> -->
|
<!-- <el-radio label="2">部分商品</el-radio> -->
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<div v-if="forms.classifyPrint == 1" style="margin-left:70px">
|
<div v-if="forms.classifyPrint == 1" style="margin-left:70px">
|
||||||
<el-tree :data="partList" show-checkbox node-key="id" ref="tree" :default-checked-keys="this.forms.categoryIds"
|
<!-- <el-tree :data="partList" show-checkbox node-key="id" ref="tree" :default-checked-keys="this.forms.categoryIds"
|
||||||
:props="{ children: 'childrenList', label: 'name' }">
|
:props="{ children: 'childrenList', label: 'name' }">
|
||||||
</el-tree>
|
</el-tree> -->
|
||||||
|
<el-checkbox-group v-model="forms.selectcheckbox">
|
||||||
|
<el-checkbox v-for="item in partList" :key="item.id" :label="item.name"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@@ -113,7 +116,8 @@ export default {
|
|||||||
forms: {
|
forms: {
|
||||||
sort: "0",
|
sort: "0",
|
||||||
status: "0",
|
status: "0",
|
||||||
connectionType: "network", printType: []
|
connectionType: "network", printType: [],
|
||||||
|
selectcheckbox: []
|
||||||
},
|
},
|
||||||
partList: []
|
partList: []
|
||||||
}
|
}
|
||||||
@@ -121,13 +125,11 @@ export default {
|
|||||||
filters: {
|
filters: {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.$route.query.id) {
|
|
||||||
this.getList(this.$route.query.id)
|
|
||||||
}
|
|
||||||
this.getpartList()
|
this.getpartList()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleNodeClick(d) { console.log(d) },
|
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
|
|
||||||
// 删除时间字段
|
// 删除时间字段
|
||||||
@@ -137,17 +139,17 @@ export default {
|
|||||||
}
|
}
|
||||||
// 处理打印部分分类
|
// 处理打印部分分类
|
||||||
if (this.forms.classifyPrint == 1) {
|
if (this.forms.classifyPrint == 1) {
|
||||||
let data = this.$refs.tree.getCheckedNodes()
|
|
||||||
let idstr = ''
|
let idstr = ''
|
||||||
let arr = []
|
let arr = []
|
||||||
data.forEach(element => {
|
this.forms.selectcheckbox.forEach(element => {
|
||||||
idstr += element.id + ','
|
let prts = this.partList.filter(ele => ele.name == element)[0]
|
||||||
arr.push({ id: element.id, name: element.name })
|
idstr = idstr + prts.id + ','
|
||||||
});
|
arr.push(prts)
|
||||||
this.forms.categoryList = JSON.stringify(arr)
|
})
|
||||||
this.forms.categoryIds = idstr.substring(0, idstr.length - 1)
|
this.forms.categoryIds = idstr.substring(0, idstr.length - 1)
|
||||||
}
|
this.forms.categoryList = JSON.stringify(arr)
|
||||||
|
|
||||||
|
}
|
||||||
const res = await configprinter({
|
const res = await configprinter({
|
||||||
shopId: localStorage.getItem('shopId'),
|
shopId: localStorage.getItem('shopId'),
|
||||||
...this.forms,
|
...this.forms,
|
||||||
@@ -163,18 +165,44 @@ export default {
|
|||||||
page: 0,
|
page: 0,
|
||||||
size: 500
|
size: 500
|
||||||
})
|
})
|
||||||
this.partList = res.content
|
let arr = []
|
||||||
|
res.content.forEach(ele => {
|
||||||
|
arr.push({
|
||||||
|
id: ele.id,
|
||||||
|
name: ele.name
|
||||||
|
})
|
||||||
|
if (ele.childrenList.length > 0) {
|
||||||
|
ele.childrenList.forEach(element => {
|
||||||
|
arr.push({
|
||||||
|
id: element.id,
|
||||||
|
name: element.name
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.partList = arr
|
||||||
|
if (this.$route.query.id) {
|
||||||
|
this.getList(this.$route.query.id)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getList(id) {
|
async getList(id) {
|
||||||
const res = await printerd(id)
|
const res = await printerd(id)
|
||||||
this.forms = res
|
this.forms = res
|
||||||
this.forms.categoryIds=this.forms.categoryIds.split(',')
|
if (res.categoryIds) {
|
||||||
console.log(this.forms.categoryIds,'调试11111')
|
let ids = res.categoryIds.split(',')
|
||||||
|
let arr = []
|
||||||
|
ids.forEach(element => {
|
||||||
|
let prts = this.partList.filter(ele => ele.id == element)[0]
|
||||||
|
arr.push(prts.name)
|
||||||
|
})
|
||||||
|
this.$set(this.forms, 'selectcheckbox', arr)
|
||||||
|
} else {
|
||||||
|
this.$set(this.forms, 'selectcheckbox', [])
|
||||||
|
}
|
||||||
if (res.printType) {
|
if (res.printType) {
|
||||||
this.forms.printType = JSON.parse(res.printType)
|
this.forms.printType = JSON.parse(res.printType)
|
||||||
} else {
|
} else {
|
||||||
this.forms.printType = []
|
this.forms.printType = []
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user