|
@@ -11,7 +11,7 @@
|
|
|
<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" /> -->
|
|
|
- <j-tree-select
|
|
|
+ <!-- <j-tree-select
|
|
|
ref="treeSelect"
|
|
|
placeholder="请选择设备分类"
|
|
|
v-model="model.equipmenttreeid"
|
|
@@ -21,8 +21,15 @@
|
|
|
hasChildField="has_child"
|
|
|
style="width:89%;"
|
|
|
>
|
|
|
- </j-tree-select>
|
|
|
- <a-button type="primary" icon="plus"></a-button>
|
|
|
+ </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>
|
|
|
<a-col :span="12">
|
|
@@ -115,6 +122,7 @@
|
|
|
</a-row>
|
|
|
</a-form-model>
|
|
|
</j-form-container>
|
|
|
+ <equipment-tree-modal ref="modalForm" @fMethod="modalFormOk2"></equipment-tree-modal>
|
|
|
</a-spin>
|
|
|
</template>
|
|
|
|
|
@@ -122,10 +130,12 @@
|
|
|
|
|
|
import { httpAction, getAction } from '@/api/manage'
|
|
|
import { validateDuplicateValue } from '@/utils/util'
|
|
|
+ import EquipmentTreeModal from '@/views/module_tpm/equipmentTree/modules/EquipmentTreeModal'
|
|
|
|
|
|
export default {
|
|
|
name: 'EquipmentForm',
|
|
|
components: {
|
|
|
+ EquipmentTreeModal
|
|
|
},
|
|
|
props: {
|
|
|
//表单禁用
|
|
@@ -142,7 +152,8 @@
|
|
|
// spaceid: "1780065347359883265",
|
|
|
// responseDepartment: "67fc001af12a4f9b8458005d3f19934a",
|
|
|
spec: "无",
|
|
|
- },
|
|
|
+ },
|
|
|
+ treeData:[],
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
|
sm: { span: 5 },
|
|
@@ -187,8 +198,39 @@
|
|
|
created () {
|
|
|
//备份model原始值
|
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
|
|
+ this.getTpmTreeData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getTpmTreeData(){
|
|
|
+ getAction(`/tpmEquipmentTree/tpmEquipmentTree/listtypetree`).then(res=>{
|
|
|
+ console.log(111,res)
|
|
|
+ if (res.success) {
|
|
|
+ // 防止res.result对tpmListData造成地址赋值的问题
|
|
|
+ let treeDataZanCun = JSON.parse(JSON.stringify(res.result))
|
|
|
+ let treeDatashuju = treeDataZanCun.map((res) => {
|
|
|
+ return {
|
|
|
+ id: res.id,
|
|
|
+ parentid: res.parentid,
|
|
|
+ value: res.id,
|
|
|
+ title: res.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.treeData = this.handleTree(treeDatashuju, "id", "parentid")
|
|
|
+ console.log(treeDatashuju)
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleAdd: function () {
|
|
|
+ this.$refs.modalForm.add();
|
|
|
+ this.$refs.modalForm.title = "新增设备分类";
|
|
|
+ this.$refs.modalForm.disableSubmit = false;
|
|
|
+ },
|
|
|
+ modalFormOk2(){
|
|
|
+ console.log(7777)
|
|
|
+ this.getTpmTreeData()
|
|
|
+ },
|
|
|
add () {
|
|
|
this.edit(this.modelDefault);
|
|
|
},
|