|
|
@@ -144,7 +144,7 @@
|
|
|
<Button type="primary" ghost style="border-radius:10px"
|
|
|
>无</Button
|
|
|
>
|
|
|
- <Button type="primary" ghost style="border-radius:10px;margin-left:20px" @click="add"
|
|
|
+ <Button type="primary" ghost style="border-radius:10px;margin-left:10px" @click="add" v-if="add_show"
|
|
|
><Icon type="md-add" :size='20'/></Button
|
|
|
>
|
|
|
</div>
|
|
|
@@ -167,7 +167,7 @@
|
|
|
<svg t="1638267935515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5634" width="200" height="200" style="position: relative;left: -8px;top: -10px;" @click="del(part)"><path d="M585.412525 512.594747L973.601616 124.418586c19.600808-19.600808 19.600808-51.898182 0-71.49899l-2.120404-2.120404c-19.600808-19.600808-51.898182-19.600808-71.49899 0L511.793131 439.518384 123.61697 50.799192c-19.600808-19.600808-51.898182-19.600808-71.49899 0l-2.120404 2.120404c-20.11798 19.600808-20.11798 51.898182 0 71.49899l388.189091 388.189091L49.997576 900.783838c-19.587879 19.600808-19.587879 51.898182 0 71.49899l2.120404 2.120404c19.600808 19.600808 51.898182 19.600808 71.49899 0L511.793131 586.214141l388.189091 388.176162c19.600808 19.600808 51.898182 19.600808 71.49899 0l2.120404-2.120404c19.600808-19.600808 19.600808-51.898182 0-71.49899L585.412525 512.594747z m0 0" p-id="5635" fill="#707070"></path></svg>
|
|
|
<!-- <Icon type="md-close" style="position: relative;left: -10px;top: -8px;" color='black' :size='20'/> -->
|
|
|
</div>
|
|
|
- <Button type="primary" ghost style="border-radius:10px;margin-left:10px" @click="add"
|
|
|
+ <Button type="primary" ghost style="border-radius:10px;margin-left:10px" @click="add"
|
|
|
><Icon type="md-add" :size='20'/></Button
|
|
|
>
|
|
|
</div>
|
|
|
@@ -246,7 +246,7 @@
|
|
|
<Form>
|
|
|
<FormItem >
|
|
|
<span>默认部件:</span>
|
|
|
- <Select v-model="formData.part_id" style="width:140px">
|
|
|
+ <Select v-model="formData.part_id" style="width:140px" filterable clearable>
|
|
|
<Option v-for="item in partsList" :key="item.id" :value="item.id">
|
|
|
{{item.title}}
|
|
|
</Option>
|
|
|
@@ -282,7 +282,7 @@
|
|
|
<Form :model='addData' >
|
|
|
<FormItem >
|
|
|
<span>默认部件:</span>
|
|
|
- <Select v-model="addData.part_id" style="width:140px">
|
|
|
+ <Select v-model="addData.part_id" style="width:140px" filterable clearable>
|
|
|
<Option v-for="item in partsList" :key="item.id" :value="item.id">
|
|
|
{{item.title}}
|
|
|
</Option>
|
|
|
@@ -309,24 +309,26 @@ export default {
|
|
|
components: { KeyBoard },
|
|
|
data() {
|
|
|
return {
|
|
|
+ select_id:[],
|
|
|
+ add_show:false,
|
|
|
title:'',
|
|
|
part_id:null,
|
|
|
add_showModel:false,
|
|
|
edit_showModel:false,
|
|
|
del_showModel:false,
|
|
|
formData:{
|
|
|
- part_id:null,
|
|
|
- formula_l:null,
|
|
|
- formula_w:null,
|
|
|
- formula_h:null,
|
|
|
- is_null:null,
|
|
|
+ part_id:'',
|
|
|
+ formula_l:'',
|
|
|
+ formula_w:'',
|
|
|
+ formula_h:'',
|
|
|
+ is_null:'',
|
|
|
},
|
|
|
addData:{
|
|
|
- part_id:null,
|
|
|
- formula_l:null,
|
|
|
- formula_w:null,
|
|
|
- formula_h:null,
|
|
|
- is_null:null,
|
|
|
+ part_id:'',
|
|
|
+ formula_l:'',
|
|
|
+ formula_w:'',
|
|
|
+ formula_h:'',
|
|
|
+ is_null:'',
|
|
|
},
|
|
|
list: [
|
|
|
{
|
|
|
@@ -618,7 +620,10 @@ export default {
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
next((vm) => {
|
|
|
vm.getData(vm.proxyObj);
|
|
|
- });
|
|
|
+ vm.productPartList =[];
|
|
|
+ vm.defaultPart = [];
|
|
|
+ vm.changeableTableData = []
|
|
|
+ })
|
|
|
},
|
|
|
created() {
|
|
|
// 获取部件列表
|
|
|
@@ -660,21 +665,48 @@ export default {
|
|
|
add_part(){
|
|
|
const temp_product = this.tableData.filter((item) => item.isSelect);
|
|
|
const product_id = temp_product.map((item) => item.id);
|
|
|
+ let part_list_id = [];
|
|
|
+ this.productPartList.forEach(m=>{
|
|
|
+ part_list_id.push(m.id)
|
|
|
+ })
|
|
|
this.addData.is_null = this.addData.is_null?1:0;
|
|
|
- this.axios.post('/api/support_product_parts_add',{product_id:product_id,...this.addData}).then(res=>{
|
|
|
+ this.axios.post('/api/support_product_parts_add',{product_id:product_id,...this.addData,part_list:part_list_id}).then(res=>{
|
|
|
if(res.code == 200){
|
|
|
this.$Message.success(res.msg);
|
|
|
- this.axios
|
|
|
- .post("/api/support_product_get_part", {
|
|
|
+ this.axios.post("/api/support_product_get_part", {
|
|
|
type:2,
|
|
|
basic_product_id: [this.$route.query.id],
|
|
|
product_id,
|
|
|
- part_id: [],
|
|
|
+ part_id: []
|
|
|
})
|
|
|
.then((res) => {
|
|
|
console.log(res);
|
|
|
this.productPartList = res.data;
|
|
|
- this.productPartList.map((item) => (item.isSelect = false));
|
|
|
+ this.productPartList.map((item) => {
|
|
|
+ (item.isSelect = false)
|
|
|
+ if(item.id == this.addData.part_id){
|
|
|
+ item.isSelect = true;
|
|
|
+ this.axios.post("/api/support_product_get_part", {
|
|
|
+ type:3,
|
|
|
+ basic_product_id: [this.$route.query.id],
|
|
|
+ product_id,
|
|
|
+ part_id:[this.addData.part_id],
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.changeableTableData = res.data.list;
|
|
|
+ this.defaultPart = res.data.head;
|
|
|
+ this.defaultPart.is_null = (res.data.head.is_null == 0||!res.data.head.is_null)?false:true
|
|
|
+ this.partsList.forEach(m=>{
|
|
|
+ if(m.id == this.addData.part_id){
|
|
|
+ this.defaultPart.title = m.title
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ });
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
@@ -688,13 +720,19 @@ export default {
|
|
|
const temp_product = this.tableData.filter((item) => item.isSelect);
|
|
|
const product_id = temp_product.map((item) => item.id);
|
|
|
const temp_part = this.productPartList.filter((item) => item.isSelect);
|
|
|
+ const part_list = this.productPartList.filter((item) => !item.isSelect);
|
|
|
+ let part_list_id = [];
|
|
|
+ part_list.forEach(m=>{
|
|
|
+ part_list_id.push(m.id)
|
|
|
+ })
|
|
|
const part_id = temp_part.map((item) => item.id);
|
|
|
this.formData.is_null = this.formData.is_null?1:0;
|
|
|
let parts_id = Number(part_id.toString()) ;
|
|
|
this.axios.post('/api/support_product_parts_edit',{
|
|
|
product_id:product_id,
|
|
|
part_id:parts_id,
|
|
|
- children:{...this.formData}
|
|
|
+ children:{...this.formData},
|
|
|
+ part_list:part_list_id
|
|
|
}).then(res=>{
|
|
|
if(res.code == 200){
|
|
|
this.$Message.success(res.msg);
|
|
|
@@ -741,11 +779,11 @@ export default {
|
|
|
},
|
|
|
add(){
|
|
|
this.addData = {
|
|
|
- part_id:null,
|
|
|
- formula_l:null,
|
|
|
- formula_w:null,
|
|
|
- formula_h:null,
|
|
|
- is_null:null,
|
|
|
+ part_id:'',
|
|
|
+ formula_l:'',
|
|
|
+ formula_w:'',
|
|
|
+ formula_h:'',
|
|
|
+ is_null:'',
|
|
|
}
|
|
|
this.add_showModel = true;
|
|
|
},
|
|
|
@@ -761,6 +799,8 @@ export default {
|
|
|
this.axios.post('/api/support_product_parts_del',{product_id:product_id,part_id:this.part_id}).then(res=>{
|
|
|
if(res.code == 200){
|
|
|
this.$Message.success(res.msg);
|
|
|
+ this.changeableTableData = [];
|
|
|
+ this.defaultPart = [];
|
|
|
this.axios
|
|
|
.post("/api/support_product_get_part", {
|
|
|
type:2,
|
|
|
@@ -819,6 +859,7 @@ export default {
|
|
|
product.map((item) => {
|
|
|
item.isSelect = this.isSelectAll;
|
|
|
});
|
|
|
+ this.add_show = false;
|
|
|
let ids = product.map((item) => item.id);
|
|
|
this.isSelectAll &&
|
|
|
this.axios
|
|
|
@@ -832,6 +873,7 @@ export default {
|
|
|
console.log(res);
|
|
|
this.productPartList = res.data;
|
|
|
this.productPartList.map((item) => (item.isSelect = false));
|
|
|
+ this.add_show = true
|
|
|
});
|
|
|
},
|
|
|
handleProductClick(product, type) {
|
|
|
@@ -839,6 +881,7 @@ export default {
|
|
|
this.currentProductList = product;
|
|
|
const temp_product = this.tableData.filter((item) => item.isSelect);
|
|
|
const product_id = temp_product.map((item) => item.id);
|
|
|
+ this.select_id = product_id;
|
|
|
// 判断是否全选,全选标题选中
|
|
|
let flag = true;
|
|
|
this.tableData.map((item) => {
|
|
|
@@ -906,6 +949,9 @@ export default {
|
|
|
const temp_part = this.productPartList.filter((item) => item.isSelect);
|
|
|
const part_id = temp_part.map((item) => item.id);
|
|
|
console.log(product_id)
|
|
|
+ if(part_id.length == 0){
|
|
|
+ return this.$Message.warning('请选择部件')
|
|
|
+ }
|
|
|
this.axios
|
|
|
.post("/api/support_product_batch", {
|
|
|
type: 3,
|
|
|
@@ -921,6 +967,13 @@ export default {
|
|
|
this.tableData.map((item) => (item.isSelect = false));
|
|
|
this.productPartList = [];
|
|
|
this.changeableTableData = [];
|
|
|
+ this.defaultPart = {
|
|
|
+ title: "",
|
|
|
+ formula_l: "",
|
|
|
+ formula_w: "",
|
|
|
+ formula_h: "",
|
|
|
+ is_null: "",
|
|
|
+ },
|
|
|
this.showModal = false;
|
|
|
}
|
|
|
});
|
|
|
@@ -976,10 +1029,14 @@ export default {
|
|
|
this.defaultPart.title = val.title;
|
|
|
if(res.data.head instanceof Array){
|
|
|
this.formData.is_null = false;
|
|
|
+ this.formData.formula_l = '';
|
|
|
+ this.formData.formula_w = '';
|
|
|
+ this.formData.formula_h = '';
|
|
|
+ this.defaultPart.is_null = false;
|
|
|
}else{
|
|
|
this.formData.is_null=res.data.head.is_null == 0?false:true;
|
|
|
+ this.defaultPart.is_null = this.defaultPart.is_null == 0?false:true;
|
|
|
}
|
|
|
- this.formData.part_id = val.id;
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
|