|
@@ -61,13 +61,14 @@
|
|
|
<el-button size="small" @click="changeShow(item)">{{ item.show ? '收起' : '修改' }}</el-button>
|
|
|
</div>
|
|
|
<div v-show="item.show">
|
|
|
- <el-tree :data="item.option" node-key="id" default-expand-all :props="defaultProps">
|
|
|
- <span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
- <el-checkbox-group :value="item.selectedValue" >
|
|
|
- <el-checkbox :label="data.id" @change="(val) => onChange(data, item, val)">{{ data.name }}</el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </span>
|
|
|
- </el-tree>
|
|
|
+ <el-tree :data="item.option" node-key="id" default-expand-all :props="defaultProps">
|
|
|
+ <span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
+ <el-checkbox-group :value="item.selectedValue">
|
|
|
+ <el-checkbox :label="data.id" @change="(val) => onChange(data, item, val)">{{ data.name
|
|
|
+ }}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
@@ -109,61 +110,27 @@ export default {
|
|
|
this.getCustomField()
|
|
|
},
|
|
|
methods: {
|
|
|
- // getShow(item) {
|
|
|
- // this.
|
|
|
- // this.getCustomOption(item)
|
|
|
- // },
|
|
|
//上移下移
|
|
|
handleOption(type, index) {
|
|
|
- if(index == 0){
|
|
|
+ if (index == 0) {
|
|
|
this.$message.warning('已是最顶层')
|
|
|
return false
|
|
|
}
|
|
|
- if(index == this.customField.length - 1){
|
|
|
+ if (index == this.customField.length - 1) {
|
|
|
this.$message.warning('已是最后一层')
|
|
|
return false
|
|
|
}
|
|
|
- if(type == 0){
|
|
|
+ if (type == 0) {
|
|
|
var current = index - 1
|
|
|
- var next = index
|
|
|
- }else{
|
|
|
+ var next = index
|
|
|
+ } else {
|
|
|
var current = index
|
|
|
var next = index + 1
|
|
|
}
|
|
|
var order = this.customField[current].sysOrder
|
|
|
this.customField[current].sysOrder = this.customField[next].sysOrder
|
|
|
this.customField[next].sysOrder = order
|
|
|
- this.customField.splice(this.customField[current],0,this.customField[next])
|
|
|
-
|
|
|
- // if (row.sysOrder == 0) {
|
|
|
- // this.$message.warning('已是最顶层')
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // if (row.sysOrder == this.customField.length - 1) {
|
|
|
- // this.$message.warning('已是最后一层')
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // if (type == 0) {//上移
|
|
|
-
|
|
|
- // this.customField.forEach(item => {
|
|
|
- // if (item.sysOrder == row.sysOrder - 1) {
|
|
|
- // item.sysOrder += 1
|
|
|
- // }
|
|
|
- // if (item.id == row.id) {
|
|
|
- // item.sysOrder -= 1
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // this.customField.forEach(item => {
|
|
|
- // if (item.sysOrder == row.sysOrder + 1) {
|
|
|
- // item.sysOrder -= 1
|
|
|
- // }
|
|
|
- // if (item.id == row.id) {
|
|
|
- // item.sysOrder += 1
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
-
|
|
|
+ this.customField.splice(this.customField[current], 0, this.customField[next])
|
|
|
let params = {
|
|
|
taskId: this.taskId,
|
|
|
projectId: this.projectId,
|
|
@@ -364,29 +331,32 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//切换是否修改
|
|
|
- changeShow(item){
|
|
|
+ changeShow(item) {
|
|
|
this.$set(item, 'show', !item.show)
|
|
|
- if(item.option && item.option.length>0){
|
|
|
- return ;
|
|
|
+ if (item.option && item.option.length > 0) {
|
|
|
+ return;
|
|
|
}
|
|
|
this.getOption(item)
|
|
|
},
|
|
|
- getOption(item){
|
|
|
+ getOption(item) {
|
|
|
switch (item.type) {
|
|
|
- case 4:
|
|
|
- case 5:
|
|
|
- case 6:
|
|
|
- this.getCustomOption(item)
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- this.queryProductCategory(item, 7)
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- this.queryProductCategory(item, 8)
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- break;
|
|
|
- }
|
|
|
+ case 4:
|
|
|
+ case 5:
|
|
|
+ this.getCustomOption(item)
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ this.queryProductCategory(item, 4)
|
|
|
+ break;
|
|
|
+ case 7://接口传值类型:1产品类别,2产品,3技术分类,4自定义树
|
|
|
+ this.queryProductCategory(item, 2)
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ this.queryProductCategory(item, 1)
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ this.queryProductCategory(item, 3)
|
|
|
+ break;
|
|
|
+ }
|
|
|
},
|
|
|
//获取已选中选项值、已添加的值
|
|
|
getSelected(item) {
|
|
@@ -414,7 +384,7 @@ export default {
|
|
|
var a = []
|
|
|
// item.selectedValue = []
|
|
|
a = (item.selected && item.selected.length > 0) ? item.selected.map(item => item.valueId) : []
|
|
|
- this.$set(item,'selectedValue',a)
|
|
|
+ this.$set(item, 'selectedValue', a)
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -442,15 +412,17 @@ export default {
|
|
|
//获取产品或产品类别架构以及技术分类
|
|
|
queryProductCategory(item, type) {
|
|
|
let params = {
|
|
|
+ projectId: this.projectId,
|
|
|
+ taskId: this.taskId,
|
|
|
type: type,//类型:1产品类别,2产品,3技术分类,4自定义树
|
|
|
typeId: item.id,//产品或类别id
|
|
|
}
|
|
|
this.$api.queryTreeNodeTree(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
-
|
|
|
+ this.$set(item, 'option', response.data.data)
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
-
|
|
|
+ this.$set(item, 'option', [])
|
|
|
})
|
|
|
},
|
|
|
}
|