|
@@ -10,25 +10,29 @@
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-model-item label="设备分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmenttreeid">
|
|
|
- <!-- <j-category-select v-model="model.equipmenttreeid" pcode="id" placeholder="请选择设备分类" back="name" @change="handleCategoryChange" /> -->
|
|
|
+ <a-tree-select
|
|
|
+ v-model="model.equipmenttreeid"
|
|
|
+ show-search
|
|
|
+ allow-clear
|
|
|
+ tree-default-expand-all
|
|
|
+ style="width: 89%"
|
|
|
+ :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
+ :tree-data="treeData"
|
|
|
+ placeholder="请选择设备分类"
|
|
|
+ tree-node-filter-prop="title"
|
|
|
+ :replaceFields="fieldnames"
|
|
|
+ ></a-tree-select>
|
|
|
<!-- <j-tree-select
|
|
|
ref="treeSelect"
|
|
|
placeholder="请选择设备分类"
|
|
|
v-model="model.equipmenttreeid"
|
|
|
+ style="width: 89%"
|
|
|
dict="tpm_equipment_tree,name,id"
|
|
|
pidField="parentid"
|
|
|
pidValue="0"
|
|
|
hasChildField="has_child"
|
|
|
- style="width:89%;"
|
|
|
>
|
|
|
</j-tree-select> -->
|
|
|
- <a-tree-select
|
|
|
- v-model="model.equipmenttreeid"
|
|
|
- style="width: 89%"
|
|
|
- :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
- :tree-data="treeData"
|
|
|
- placeholder="请选择设备分类"
|
|
|
- ></a-tree-select>
|
|
|
<a-button type="primary" icon="plus" @click="handleAdd"></a-button>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -154,6 +158,11 @@
|
|
|
// responseDepartment: "67fc001af12a4f9b8458005d3f19934a",
|
|
|
spec: "无",
|
|
|
},
|
|
|
+ fieldnames: {
|
|
|
+ children: 'children',
|
|
|
+ title: 'name',
|
|
|
+ value: 'id',
|
|
|
+ },
|
|
|
treeData:[],
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
@@ -202,9 +211,28 @@
|
|
|
created () {
|
|
|
//备份model原始值
|
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
|
|
- this.getTpmTreeData()
|
|
|
+ this.getTpmTreeData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ getTpmTreeData(){
|
|
|
+ getAction(`/tpmEquipmentTree/tpmEquipmentTree/listtypetree`).then(res=>{
|
|
|
+ if (res.success) {
|
|
|
+ // 防止res.result对tpmListData造成地址赋值的问题
|
|
|
+ this.tpmListData = JSON.parse(JSON.stringify(res.result))
|
|
|
+ this.treeData = this.handleTree(res.result, "id", "parentid")
|
|
|
+ console.log("this.treeData", this.treeData)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ let obj = {}
|
|
|
+ // obj[this.pidField] = record['id']
|
|
|
+ this.$refs.modalForm.add(obj);
|
|
|
+ },
|
|
|
+ modalFormOk2() {
|
|
|
+ // 新增/修改 成功时,重载列表
|
|
|
+ this.getTpmTreeData();
|
|
|
+ },
|
|
|
add () {
|
|
|
this.edit(this.modelDefault);
|
|
|
},
|