Kaynağa Gözat

点检内容优化

wyh 1 yıl önce
ebeveyn
işleme
f737f927e5

+ 45 - 0
src/views/module_cmms/spotcheckContent/SpotcheckContentList.vue

@@ -129,9 +129,19 @@
     components: {
       SpotcheckContentModal
     },
+    props: {
+      selectData: {
+        type: Object,
+        default: function(){
+            return {} // 使用工厂函数返回默认值
+        }
+      },
+    },
     data () {
       return {
         description: '点检内容管理页面',
+        // 查询参数
+        queryParam: {},
         // 表头
         columns: [
           {
@@ -204,6 +214,41 @@
     methods: {
       initDictConfig(){
       },
+      loadData(arg) {
+        if(!this.url.list){
+          this.$message.error("请设置url.list属性!")
+          return
+        }
+        //加载数据 若传入参数1则加载第一页的内容
+        if (arg === 1) {
+          this.ipagination.current = 1;
+        }
+        var params = this.getQueryParams();//查询条件
+        this.loading = true;
+        getAction(this.url.list, params).then((res) => {
+          if (res.success) {
+            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+            this.dataSource = res.result.records||res.result;
+            if(res.result.total)
+            {
+              this.ipagination.total = res.result.total;
+            }else{
+              this.ipagination.total = 0;
+            }
+            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          }else{
+            this.$message.warning(res.message)
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      },
+      // 处理父组件传过来的数据
+      getDataList(){
+        // console.log(111,this.selectData)
+        this.queryParam.equipmentid = this.selectData.id
+        this.loadData()
+      },
       modalFormOk() {
         // 新增/修改 成功时,重载列表
         this.loadData();

+ 6 - 1
src/views/module_cmms/spotcheckContent/index.vue

@@ -4,7 +4,7 @@
             <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
         </div>
         <div class="right">
-            <spotcheck-content-list></spotcheck-content-list>
+            <spotcheck-content-list ref="realForm" :selectData="selectData"></spotcheck-content-list>
         </div>
     </div>
 </template>
@@ -18,11 +18,16 @@ import SpotcheckContentList from './SpotcheckContentList.vue';
         },
         data () {
             return {
+                selectData: {}
             }
         },
         methods: {
             selectEquipment(selectedKeys,e){
                 console.log(selectedKeys,e)
+                this.selectData.id = e.selectedNodes[0].data.props.id
+                this.$nextTick(()=>{
+                    this.$refs.realForm.getDataList();
+                })
             }
         },
     })