Procházet zdrojové kódy

Merge branch 'master' of http://152.136.206.27:3000/dongjh/ems_client

dongjh před 1 rokem
rodič
revize
c93f15bfd2

+ 141 - 0
src/components/module_ems/UEquipmentTree/UEquipmentTree.vue

@@ -0,0 +1,141 @@
+<template>
+  <div class="equipment-tree-container">
+    <a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
+    <div class="tree-container">
+      <a-tree
+        :expanded-keys="expandedKeys"
+        auto-expand-parent
+        :tree-data="tpmTreeData"
+        @expand="onExpand"
+        :replace-fields="replaceFields"
+        @select="selectNode"
+        >
+        <!-- :filter-tree-node="filterTreeNode" -->
+      </a-tree>
+    </div>
+  </div>
+</template>
+
+<script>
+  import { getAction } from '@api/manage'
+  export default({
+    name: 'UEquipmentTree',
+    components: {
+    },
+    data () {
+      return {
+        expandedKeys: [],
+        searchValue: '',
+        autoExpandParent: true,
+        tpmListData: [], // 原始数据
+        tpmTreeData: [], // 树形列表使用数据
+        replaceFields: {
+          children: 'children',
+          title: 'name',
+        },
+      }
+    },
+    created() {
+      this.getTpmTreeData()
+    },
+    methods: {
+      getTpmTreeData(){
+        getAction(`/tpmEquipmentTree/tpmEquipmentTree/listtreeandequip`).then(res=>{
+          if (res.success) {
+            // 防止res.result对tpmListData造成地址赋值的问题
+            this.tpmListData = JSON.parse(JSON.stringify(res.result))
+            this.tpmTreeData = this.handleTree(res.result, "id", "parentid")
+            console.log(this.tpmTreeData)
+          } else {
+            
+          }
+        })
+      },
+      filterTreeNode(node) {
+        // console.log(node)
+        // if (!inputValue) return true;
+        return node.title.indexOf('设备') !== -1;
+      },
+      onExpand(expandedKeys) {
+        this.expandedKeys = expandedKeys;
+        this.autoExpandParent = false;
+      },
+      onChange(e) {
+        const value = e.target.value;
+        // 筛选后数据
+        var filterData = []
+        // 筛选符合条件的数据:包含当前搜索的项
+        console.log(this.tpmListData)
+        filterData = this.tpmListData.filter(item => (item.name.indexOf(value) !== -1))
+        // var data = []
+        // filterData.forEach(item => {
+        //   var arr = this.tpmListData.filter(data => item.parentid === data.id)
+        //   console.log('父级', arr)
+        //   // filterData = [...filterData, ...arr]
+        // })
+        // 循环寻找父级
+        // console.log(this.findParents(this.tpmTreeData, '287813167808513'))
+
+        
+
+        
+        this.tpmTreeData = this.handleTree(filterData, "id", "parentid")
+        // const expandedKeys = dataList.map(item => {
+        //   if (item.name.indexOf(value) > -1) {
+        //       // return getParentKey(item.key, gData);
+        //       return this.filterNode(item.key, gData);
+        //   }
+        //   return null;
+        // }).filter((item, i, self) => item && self.indexOf(item) === i);
+        // Object.assign(this, {
+        //   expandedKeys,
+        //   searchValue: value,
+        //   autoExpandParent: true,
+        // });
+      },
+      // findParents(treeData,id){
+      //   let allparents = []
+      //   if(treeData.length==0){
+      //     return 
+      //   }
+
+      //   let findele = (data,id) => {
+      //     if(!id) return
+      //     data.forEach((item,index) => {
+      //       if(item.id == id){
+      //         allparents.unshift(item.id)
+      //         findele(treeData,item.parentid)
+
+      //       }else{
+      //         if(!!item.children){
+      //             findele(item.children,id)
+      //         }
+              
+      //       }
+      //     })
+      //   }
+
+      //   findele(treeData,id)
+      //   return allparents
+
+      // },
+      selectNode(selectedKeys, e){
+        this.$emit('select', selectedKeys, e)
+      },
+    },
+  })
+</script>
+
+<style lang="less" scoped>
+.equipment-tree-container{
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  padding: 15px;
+  .tree-container{
+    width: 100%;
+    height: calc(100% - 40px);
+    overflow: auto;
+  }
+}
+</style>

+ 1 - 1
src/components/module_ems/UModal/UModal.vue

@@ -68,7 +68,7 @@ export default {
       // 内容填满显示
       contentFull: {
         type: Boolean,
-        default: true
+        default: false
       },
       title: {
         type: String,

+ 2 - 0
src/components/module_ems/index.js

@@ -1,8 +1,10 @@
 import UModal from './UModal'
+import UEquipmentTree from './UEquipmentTree/UEquipmentTree'
 
 export default {
   install(Vue) {
     Vue.use(UModal)
+    Vue.component('UEquipmentTree', UEquipmentTree)
 
     //注册全局js函数和变量
     Vue.prototype.$UModal = UModal

+ 1 - 1
src/views/module_cmms/inspectContent/InspectContentList.vue

@@ -139,7 +139,7 @@
         // 表头
         columns: [
           {
-            title: '#',
+            title: '序号',
             dataIndex: '',
             key:'rowIndex',
             width:60,

+ 50 - 0
src/views/module_cmms/inspectContent/index.vue

@@ -0,0 +1,50 @@
+<template>
+  <div class="all u-flex">
+    <div class="left">
+      <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
+    </div>
+    <div class="right">
+      <inspect-content-list></inspect-content-list>
+    </div>
+  </div>
+</template>
+
+<script>
+  import InspectContentList from "./InspectContentList.vue";
+  export default({
+    components: {
+      InspectContentList
+    },
+    data () {
+      return {
+      }
+    },
+    created() {
+      
+    },
+    methods: {
+      selectEquipment(selectedKeys, e){
+        console.log(selectedKeys, e)
+      },
+    },
+  })
+</script>
+
+<style scoped>
+  .all{
+    height: calc(100vh - 135px);
+    width: 100%;
+    display: flex;
+  }
+  .left{
+    min-width: 200px;
+    max-width: 240px;
+    height: 100%;
+    margin-right: 10px;
+    margin-left: 5px;
+  }
+  .right{
+    flex: 1;
+    height: 100%;
+  }
+</style>

+ 0 - 1
src/views/module_cmms/inspectContent/modules/InspectContentModal.vue

@@ -2,7 +2,6 @@
   <u-modal
     :title="title"
     :visible.sync="visible"
-    contentFull
     @ok="handleOk"
     @cancel="handleCancel">
     <inspect-content-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inspect-content-form>

+ 7 - 7
src/views/module_cmms/spotcheck/SpotcheckList.vue

@@ -20,10 +20,10 @@
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
               <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
               <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
-              <a @click="handleToggleSearch" style="margin-left: 8px">
+              <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
                 {{ toggleSearchStatus ? '收起' : '展开' }}
                 <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
-              </a>
+              </a> -->
             </span>
           </a-col>
         </a-row>
@@ -34,12 +34,12 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
-      <a-button type="primary" icon="download" @click="handleExportXls('设备点检')">导出</a-button>
+      <!-- <a-button type="primary" icon="download" @click="handleExportXls('设备点检')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
-      </a-upload>
+      </a-upload> -->
       <!-- 高级查询区域 -->
-      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
           <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
@@ -216,8 +216,8 @@
         let fieldList=[];
         fieldList.push({type:'string',value:'contentcode',text:'所属点检内容编号',dictCode:''})
         fieldList.push({type:'string',value:'contentname',text:'所属点检内容名称',dictCode:''})
-        fieldList.push({type:'sel_search',value:'equipmentid',text:'设备ID',dictTable:"ems_tpm_equipment", dictText:'equipmentname', dictCode:'id'})
-        fieldList.push({type:'sel_search',value:'spotcheckcontid',text:'所属点检内容ID',dictTable:"ems_cmms_spotcheck_content", dictText:'contentname', dictCode:'id'})
+        fieldList.push({type:'sel_search',value:'equipmentid',text:'设备ID',dictTable:"tpm_equipment", dictText:'equipmentname', dictCode:'id'})
+        fieldList.push({type:'sel_search',value:'spotcheckcontid',text:'所属点检内容ID',dictTable:"cmms_spotcheck_content", dictText:'contentname', dictCode:'id'})
         fieldList.push({type:'datetime',value:'spotcheckdate',text:'点检时间'})
         fieldList.push({type:'string',value:'result',text:'点检结果',dictCode:'spotcheck_result'})
         fieldList.push({type:'string',value:'description',text:'点检描述',dictCode:''})

+ 53 - 0
src/views/module_cmms/spotcheck/index.vue

@@ -0,0 +1,53 @@
+<template>
+    <div class="all">
+        <div class="left">
+            <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
+        </div>
+        <div class="right">
+            <spotcheck-list></spotcheck-list>
+        </div>
+    </div>
+</template>
+
+<script>
+import SpotcheckList from './SpotcheckList.vue';
+
+    export default({
+        components: {
+            SpotcheckList
+        },
+        data () {
+            return {
+            }
+        },
+        methods: {
+            selectEquipment(selectedKeys,e){
+                console.log(selectedKeys,e)
+            }
+        },
+    })
+</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; */
+}
+/* .ant-card{
+    height: 100%;
+    overflow: auto;
+} */
+</style>

+ 11 - 9
src/views/module_cmms/spotcheck/modules/SpotcheckForm.vue

@@ -2,43 +2,45 @@
   <a-spin :spinning="confirmLoading">
     <j-form-container :disabled="formDisabled">
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+        <div class="cmms-dialog-item-title">基本信息</div>
         <a-row>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="所属点检内容编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentcode">
               <a-input v-model="model.contentcode" placeholder="请输入所属点检内容编号"  ></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="所属点检内容名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contentname">
               <a-input v-model="model.contentname" placeholder="请输入所属点检内容名称"  ></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="设备ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid">
-              <j-search-select-tag v-model="model.equipmentid" dict="ems_tpm_equipment,equipmentname,id"  />
+              <j-search-select-tag v-model="model.equipmentid" dict="tpm_equipment,equipmentname,id"  />
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="所属点检内容ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spotcheckcontid">
-              <j-search-select-tag v-model="model.spotcheckcontid" dict="ems_cmms_spotcheck_content,contentname,id"  />
+              <j-search-select-tag v-model="model.spotcheckcontid" dict="cmms_spotcheck_content,contentname,id"  />
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="点检时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spotcheckdate">
               <j-date placeholder="请选择点检时间"  v-model="model.spotcheckdate" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="点检结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="result">
               <j-dict-select-tag type="list" v-model="model.result" dictCode="spotcheck_result" placeholder="请选择点检结果" />
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="点检描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description">
               <a-input v-model="model.description" placeholder="请输入点检描述"  ></a-input>
             </a-form-model-item>
           </a-col>
         </a-row>
+        <div class="cmms-dialog-item-title">点检列表</div>
       </a-form-model>
     </j-form-container>
   </a-spin>

+ 3 - 4
src/views/module_cmms/spotcheck/modules/SpotcheckModal.vue

@@ -1,16 +1,15 @@
 <template>
-  <j-modal
+  <u-modal
     :title="title"
     :width="width"
     :visible="visible"
-    switchFullscreen
+    contentFull
     @ok="handleOk"
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
-    <!-- <cmms-spotcheck-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cmms-spotcheck-form> -->
     <spotcheck-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></spotcheck-form>
-  </j-modal>
+  </u-modal>
 </template>
 
 <script>

+ 8 - 3
src/views/module_cmms/spotcheckContent/index.vue

@@ -1,9 +1,9 @@
 <template>
     <div class="all">
         <div class="left">
+            <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
         </div>
         <div class="right">
-            <!-- <cmms-spotcheck-content-list></cmms-spotcheck-content-list> -->
             <spotcheck-content-list></spotcheck-content-list>
         </div>
     </div>
@@ -19,13 +19,18 @@ import SpotcheckContentList from './SpotcheckContentList.vue';
         data () {
             return {
             }
-        }
+        },
+        methods: {
+            selectEquipment(selectedKeys,e){
+                console.log(selectedKeys,e)
+            }
+        },
     })
 </script>
 
 <style scoped>
 .all{
-    height: calc(100vh - 135px);
+    height: calc(100vh - 65px);
     width: 100%;
     display: flex;
 }

+ 30 - 11
src/views/module_cmms/spotcheckContent/modules/SpotcheckContentForm.vue

@@ -175,6 +175,15 @@
         getAction(this.url.queryById, record).then((res) => {
             console.log(88,res)
             this.model = res.result
+            this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+              return {
+                id: res.spotcheckitemid,
+                itemcode: res.itemcode,
+                itemname: res.itemname,
+                conditions: res.conditions,
+                remark: res.remark
+              }
+            })
         })
         // this.model = Object.assign({}, record);
         this.visible = true;
@@ -191,21 +200,31 @@
               httpurl+=this.url.add;
               method = 'post';
               this.model.status = 1
+              this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+                return {
+                  spotcheckitemid: res.id
+                }
+              })
             }else{
               httpurl+=this.url.edit;
               method = 'put';
+              this.model.spotcheckContentItemList = this.model.spotcheckContentItemList.map((res) => {
+                return {
+                  spotcheckitemid: res.id
+                }
+              })
             }
             console.log(99,this.model)
-            // httpAction(httpurl,this.model,method).then((res)=>{
-            //   if(res.success){
-            //     that.$message.success(res.message);
-            //     that.$emit('ok');
-            //   }else{
-            //     that.$message.warning(res.message);
-            //   }
-            // }).finally(() => {
-            //   that.confirmLoading = false;
-            // })
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
           }
 
         })
@@ -223,7 +242,7 @@
       // 处理子组件传过来的数据
       handleCustomEvent(data) {
         // 处理从子组件传递过来的数据
-        console.log("Received Data:", data);
+        console.log("子组件传过来的数据:", data);
         this.model.spotcheckContentItemList = data;
       }
     }

+ 0 - 2
src/views/module_cmms/spotcheckContent/modules/SpotcheckContentModal.vue

@@ -13,12 +13,10 @@
 </template>
 
 <script>
-  import UModal from '../../../../components/module_ems/UModal/UModal.vue'
   import SpotcheckContentForm from './SpotcheckContentForm.vue'
   export default {
     name: 'SpotcheckContentModal',
     components: {
-        UModal,
         SpotcheckContentForm
     },
     data () {

+ 2 - 0
src/views/module_cmms/spotcheckContent/modules/SpotcheckContentModalAdd.vue

@@ -105,9 +105,11 @@ import { httpAction, getAction } from '@/api/manage'
         getAction(`/cmmsSpotcheckItem/cmmsSpotcheckItem/listbyequipmentid/${this.modelForm.equipmentid}`).then((res) => {
             this.dataSource = res.result
         })
+        this.selectList()
       },
       // 将以选中的值重新在列表中选中
       selectList() {
+        console.log(111,this.dataList)
         this.selectionRows = this.dataList
         this.selectedRowKeys = this.dataList.map((res) => {
             return res.id

+ 9 - 4
src/views/module_tpm/tag/index.vue

@@ -1,8 +1,8 @@
 <template>
     <div class="all">
         <div class="left">
-            <!-- <tpm-device-list></tpm-device-list> -->
-            <device-list></device-list>
+            <u-equipment-tree @select="selectEquipment"></u-equipment-tree>
+            <!-- <device-list></device-list> -->
         </div>
         <div class="right">
             <!-- <tpm-tag-list></tpm-tag-list> -->
@@ -24,13 +24,18 @@ import DeviceList from './DeviceList.vue';
             return {
                 
             }
-        }
+        },
+        methods: {
+            selectEquipment(selectedKeys,e){
+                console.log(selectedKeys,e)
+            }
+        },
     })
 </script>
 
 <style scoped>
 .all{
-    height: calc(100vh - 135px);
+    height: calc(100vh - 90px);
     width: 100%;
     display: flex;
 }

+ 0 - 2
src/views/module_tpm/tag/modulesPL/TagModalPL.vue

@@ -13,12 +13,10 @@
 </template>
 
 <script>
-import UModal from '../../../../components/module_ems/UModal/UModal.vue';
 import TagFormPL1 from './TagFormPL1.vue';
   export default {
     name: 'TagModalPL',
     components: {
-        UModal,
         TagFormPL1
     },
     data () {

+ 14 - 13
src/views/user/LoginAccount.vue

@@ -12,19 +12,20 @@
           </a-input>
         </a-form-model-item>
 
-<!--        <a-row :gutter="0">-->
-<!--          <a-col :span="16">-->
-<!--            <a-form-model-item required prop="inputCode">-->
-<!--              <a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">-->
-<!--                <a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>-->
-<!--              </a-input>-->
-<!--            </a-form-model-item>-->
-<!--          </a-col>-->
-<!--          <a-col :span="8" style="text-align: right">-->
-<!--            <img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>-->
-<!--            <img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>-->
-<!--          </a-col>-->
-<!--        </a-row>-->
+        <!-- 修改框架 -->
+        <!-- <a-row :gutter="0">
+          <a-col :span="16">
+            <a-form-model-item required prop="inputCode">
+              <a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">
+                <a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
+              </a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="8" style="text-align: right">
+            <img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
+            <img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
+          </a-col>
+        </a-row> -->
       </a-form-model>
     </div>
 </template>