Browse Source

设备档案优化

wyh 1 year ago
parent
commit
46fac32bf7

+ 18 - 6
src/views/module_tpm/equipment/EquipmentList.vue

@@ -9,9 +9,8 @@
               <a-input placeholder="请输入设备名称" v-model="queryParam.equipmentname"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+          <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <a-form-item label="设备分类">
-              <!-- <j-category-select placeholder="请选择设备分类" v-model="queryParam.equipmenttreeid" pcode="id"/> -->
               <j-tree-select
                 ref="treeSelect"
                 placeholder="请选择设备分类"
@@ -23,13 +22,13 @@
                 >
               </j-tree-select>
             </a-form-item>
-          </a-col>
+          </a-col> -->
           <template v-if="toggleSearchStatus">
-            <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
               <a-form-item label="设备编号">
                 <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentcode"></a-input>
               </a-form-item>
-            </a-col>
+            </a-col> -->
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
               <a-form-item label="规格型号">
                 <a-input placeholder="请输入规格型号" v-model="queryParam.spec"></a-input>
@@ -166,6 +165,14 @@
         EquipmentModal,
         EquipmentDetail
     },
+    props: {
+      selectData: {
+        type: Object,
+        default: function(){
+            return {} // 使用工厂函数返回默认值
+        }
+      },
+    },
     data () {
       return {
         description: '设备档案管理页面',
@@ -289,13 +296,18 @@
       },
     },
     methods: {
+      getDataList(){
+        console.log(111,this.selectData)
+        this.queryParam.equipmenttreeid = this.selectData.equipmenttreeid
+        this.loadData()
+      },
       customCellDetail(record){
         return {
           style: {
             'color': "#1890ff",
             'cursor': "pointer",
           },
-          on: { 
+          on: {
             // 点击事件
             click: (event) => {
               this.$refs.equipmentDetail.detail(record);

+ 54 - 0
src/views/module_tpm/equipment/index.vue

@@ -0,0 +1,54 @@
+<template>
+    <div class="all">
+        <div class="left">
+            <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
+        </div>
+        <div class="right">
+            <equipment-list ref="realForm" :selectData="selectData"></equipment-list>
+        </div>
+    </div>
+</template>
+
+<script>
+import EquipmentList from '@/views/module_tpm/equipment/EquipmentList'
+
+    export default({
+        components: {
+            EquipmentList
+        },
+        data () {
+            return {
+                selectData: {},
+            }
+        },
+        methods: {
+            selectEquipment(selectedKeys,e){
+                console.log(222,selectedKeys,e.selectedNodes[0].data.props)
+                this.selectData.equipmenttreeid = e.selectedNodes[0].data.props.id
+                this.$nextTick(()=>{
+                    this.$refs.realForm.getDataList();
+                })
+            }
+        },
+    })
+</script>
+
+<style scoped>
+.all{
+    height: calc(100vh - 90px);
+    width: 100%;
+    display: flex;
+}
+.left{
+    height: 100%;
+    width: 20%;
+    /* border: 2px solid red; */
+    margin-right: 10px;
+    margin-left: 5px;
+}
+.right{
+    height: 100%;
+    width: 80%;
+    /* border: 2px solid red; */
+}
+</style>

+ 2 - 0
src/views/module_tpm/equipment/modules/EquipmentForm.vue

@@ -19,8 +19,10 @@
                 pidField="parentid"
                 pidValue="0"
                 hasChildField="has_child"
+                style="width:85%;"
                 >
               </j-tree-select>
+              <a-button type="primary">1</a-button>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">