Procházet zdrojové kódy

维修管理详情+详情通用方法添加

yuhan před 1 rokem
rodič
revize
9554b26c9d

+ 18 - 0
src/mixins/JeecgListMixin.js

@@ -262,6 +262,24 @@ export const JeecgListMixin = {
       this.$refs.modalForm.title="详情";
       this.$refs.modalForm.disableSubmit = true;
     },
+    handleDrawerDetail:function(record){
+      this.$refs.drawerDetail.detail(record);
+    },
+    // 单元格事件
+    customCellDetail(record){
+      return {
+        style: {
+          'color': "#1890ff",
+          'cursor': "pointer",
+        },
+        on: { 
+          // 点击事件
+          click: (event) => {
+            this.$refs.drawerDetail.detail(record);
+          },
+        },
+      };
+    },
     /* 导出 */
     handleExportXls2(){
       let paramsStr = encodeURI(JSON.stringify(this.getQueryParams()));

+ 17 - 15
src/views/module_ems/cmmsRepairManage/CmmsRepairManageList.vue

@@ -126,7 +126,7 @@
             <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
             <a-menu slot="overlay">
               <a-menu-item>
-                <a @click="handleDetail(record)">详情</a>
+                <a @click="handleDrawerDetail(record)">详情</a>
               </a-menu-item>
               <a-menu-item>
                 <a @click="handleFreeze(record)">冻结</a>
@@ -143,9 +143,10 @@
       </a-table>
     </div>
 
+    <!-- 增改+派单 -->
     <cmms-repair-manage-modal ref="modalForm" @ok="modalFormOk"></cmms-repair-manage-modal>
-    <!-- 派单 -->
-    <cmms-repair-dispatch ref="dispatchForm"></cmms-repair-dispatch>
+    <!-- 详情 -->
+    <cmms-repair-manage-detail ref="drawerDetail"></cmms-repair-manage-detail>
   </a-card>
 </template>
 
@@ -155,14 +156,14 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import CmmsRepairManageModal from './modules/CmmsRepairManageModal'
-import CmmsRepairDispatch from './modules/CmmsRepairDispatch.vue'
+  import CmmsRepairManageDetail from './modules/CmmsRepairManageDetail.vue'
 
   export default {
     name: 'CmmsRepairManageList',
     mixins:[JeecgListMixin, mixinDevice],
     components: {
       CmmsRepairManageModal,
-      CmmsRepairDispatch
+      CmmsRepairManageDetail,
     },
     data () {
       return {
@@ -188,7 +189,8 @@ import CmmsRepairDispatch from './modules/CmmsRepairDispatch.vue'
           {
             title:'维修工单编号',
             align:"center",
-            dataIndex: 'repaircode'
+            dataIndex: 'repaircode',
+            customCell: this.customCellDetail
           },
           {
             title:'工单名称',
@@ -263,11 +265,11 @@ import CmmsRepairDispatch from './modules/CmmsRepairDispatch.vue'
             // },
             {
               title:'创建时间',
-            align:"center",
-            dataIndex: 'createTime',
-            customRender:function (text) {
-              return !text?"":(text.length>10?text.substr(0,10):text)
-            }
+              align:"center",
+              dataIndex: 'createTime',
+              customRender:function (text) {
+                return !text?"":(text.length>10?text.substr(0,10):text)
+              }
           },
           // {
           //   title:'备注',
@@ -318,10 +320,10 @@ import CmmsRepairDispatch from './modules/CmmsRepairDispatch.vue'
     },
     methods: {
       // 派单
-      handleEdit: function (record) {
-        this.$refs.dispatchForm.dispatch(record);
-        this.$refs.dispatchForm.title = "派单";
-        this.$refs.dispatchForm.disableSubmit = false;
+      handleDisptch (record) {
+        this.$refs.modalForm.title = "派单";
+        this.$refs.modalForm.modalType = "disptch";
+        this.$refs.modalForm.dispatch(record);
       },
       // 冻结
       handleFreeze(record){

+ 162 - 0
src/views/module_ems/cmmsRepairManage/modules/CmmsRepairManageDetail.vue

@@ -0,0 +1,162 @@
+<template>
+  <a-drawer
+    :title="title"
+    :width="width"
+    placement="right"
+    @close="close"
+    destroyOnClose
+    :visible="visible"
+    >
+    <a-spin :spinning="confirmLoading">
+      <!-- 基础信息详情 -->
+      <a-descriptions title="" bordered size="middle">
+        <a-descriptions-item label="维修工单编号">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="工单名称">
+          {{detailData.repairname}}
+        </a-descriptions-item>
+        <a-descriptions-item label="设备编号">
+          {{detailData.equipmentcode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="优先级">
+          {{detailData.priority}}
+        </a-descriptions-item>
+        <a-descriptions-item label="设备名称">
+          {{detailData.equipmentname}}
+        </a-descriptions-item>
+        <a-descriptions-item label="故障日期">
+          {{detailData.faultdate}}
+        </a-descriptions-item>
+        <a-descriptions-item label="故障描述" :span="2">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="上一次维修时间">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="维修反馈">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="处理结果">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+        <a-descriptions-item label="当前状态">
+          {{detailData.repaircode}}
+        </a-descriptions-item>
+      </a-descriptions>
+      <!-- 分割线 -->
+      <a-divider orientation="left" style="font-size: 14px;"> 操作日志 </a-divider>
+      <!-- 操作日志详情 -->
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{x:true}"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="logData"
+        class="j-table-force-nowrap cmms-table">
+
+        <span slot="status" slot-scope="text, record">
+          <a-tag v-if="record.status === '0'" color="orange">{{ text }}</a-tag>
+          <a-tag v-if="record.status === '1' || record.priority === '2'" color="blue">{{ text }}</a-tag>
+          <a-tag v-if="record.status === '3'">{{ text }}</a-tag>
+        </span>
+
+      </a-table>
+    </a-spin>
+
+  </a-drawer>
+</template>
+
+<script>
+  import { httpAction, getAction } from '@/api/manage'
+  export default {
+    name: 'CmmsRepairManageDetail',
+    data () {
+      return {
+        title:"详情",
+        width:'60%',
+        visible: false,
+        confirmLoading: false, // 加载中
+        detailData: {}, // 详情
+        logData: [], // 操作日志表格数据
+        // 表头
+        columns: [
+          // {
+          //   title: '序号',
+          //   dataIndex: '',
+          //   key:'rowIndex',
+          //   width:60,
+          //   align:"center",
+          //   customRender:function (t,r,index) {
+          //     return parseInt(index)+1;
+          //   }
+          // },
+          {
+            title:'节点名称',
+            align:"center",
+            dataIndex: 'nodename'
+          },
+          {
+            title:'日期',
+            align:"center",
+            dataIndex: 'handledate'
+          },
+          {
+            title:'处理意见',
+            align:"center",
+            dataIndex: 'opinion'
+          },
+          {
+            title:'备注',
+            align:"center",
+            dataIndex: 'remark'
+          },
+        ],
+      }
+    },
+    methods: {
+      detail (record) {
+        this.visible = true
+        this.title = record.repairname
+        // this.title = record.repairname + ' 详情'
+        // this.detailData = record
+        this.confirmLoading = true
+        getAction('/cmmsRepair/cmmsRepair/queryById',{id:record.id}).then((res)=>{
+          if(res.success){
+            this.detailData = res.result
+            this.logData = res.result.nodeList
+          }else{
+            this.$message.warning(res.message);
+          }
+        }).finally(() => {
+          this.confirmLoading = false;
+        })
+      },
+      close () {
+        this.visible = false;
+      },
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+  .drawer-footer{
+    position: absolute;
+    bottom: -8px;
+    width: 100%;
+    border-top: 1px solid #e8e8e8;
+    padding: 10px 16px;
+    text-align: right;
+    left: 0;
+    background: #fff;
+    border-radius: 0 0 2px 2px;
+  }
+</style>

+ 9 - 5
src/views/module_ems/cmmsRepairManage/modules/CmmsRepairDispatch.vue

@@ -55,7 +55,7 @@
   import { validateDuplicateValue } from '@/utils/util'
 
   export default {
-    name: 'CmmsRepairManageForm',
+    name: 'CmmsRepairDispatch',
     components: {
     },
     props: {
@@ -101,10 +101,14 @@
       this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
-      add () {
-        this.edit(this.modelDefault);
-      },
-      edit (record) {
+      // add () {
+      //   this.edit(this.modelDefault);
+      // },
+      // edit (record) {
+      //   this.model = Object.assign({}, record);
+      //   this.visible = true;
+      // },
+      dispatch (record) {
         this.model = Object.assign({}, record);
         this.visible = true;
       },

+ 0 - 84
src/views/module_ems/cmmsRepairManage/modules/CmmsRepairManageModal.Style#Drawer.vue

@@ -1,84 +0,0 @@
-<template>
-  <a-drawer
-    :title="title"
-    :width="width"
-    placement="right"
-    :closable="false"
-    @close="close"
-    destroyOnClose
-    :visible="visible">
-    <cmms-repair-manage-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></cmms-repair-manage-form>
-    <div class="drawer-footer">
-      <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
-      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
-    </div>
-  </a-drawer>
-</template>
-
-<script>
-
-  import CmmsRepairManageForm from './CmmsRepairManageForm'
-
-  export default {
-    name: 'CmmsRepairManageModal',
-    components: {
-      CmmsRepairManageForm
-    },
-    data () {
-      return {
-        title:"操作",
-        width:800,
-        visible: false,
-        disableSubmit: false
-      }
-    },
-    methods: {
-      add () {
-        this.visible=true
-        this.$nextTick(()=>{
-          this.$refs.realForm.add();
-        })
-      },
-      edit (record) {
-        this.visible=true
-        this.$nextTick(()=>{
-          this.$refs.realForm.edit(record);
-        });
-      },
-      close () {
-        this.$emit('close');
-        this.visible = false;
-      },
-      submitCallback(){
-        this.$emit('ok');
-        this.visible = false;
-      },
-      handleOk () {
-        this.$refs.realForm.submitForm();
-      },
-      handleCancel () {
-        this.close()
-      }
-    }
-  }
-</script>
-
-<style lang="less" scoped>
-/** Button按钮间距 */
-  .ant-btn {
-    margin-left: 30px;
-    margin-bottom: 30px;
-    float: right;
-  }
-  .drawer-footer{
-    position: absolute;
-    bottom: -8px;
-    width: 100%;
-    border-top: 1px solid #e8e8e8;
-    padding: 10px 16px;
-    text-align: right;
-    left: 0;
-    background: #fff;
-    border-radius: 0 0 2px 2px;
-  }
-</style>

+ 17 - 4
src/views/module_ems/cmmsRepairManage/modules/CmmsRepairManageModal.vue

@@ -8,24 +8,27 @@
     :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
     @cancel="handleCancel"
     cancelText="关闭">
-    <cmms-repair-manage-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cmms-repair-manage-form>
+    <cmms-repair-manage-form v-if="modalType==='form'" ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cmms-repair-manage-form>
+    <cmms-repair-manage-dispatch v-if="modalType==='dispatch'" ref="dispatchForm"></cmms-repair-manage-dispatch>
   </j-modal>
 </template>
 
 <script>
-
   import CmmsRepairManageForm from './CmmsRepairManageForm'
+  import CmmsRepairManageDispatch from './CmmsRepairManageDispatch.vue'
   export default {
     name: 'CmmsRepairManageModal',
     components: {
-      CmmsRepairManageForm
+      CmmsRepairManageForm,
+      CmmsRepairManageDispatch
     },
     data () {
       return {
         title:'',
         width:800,
         visible: false,
-        disableSubmit: false
+        disableSubmit: false,
+        modalType: 'form',
       }
     },
     methods: {
@@ -41,9 +44,18 @@
           this.$refs.realForm.edit(record);
         })
       },
+      dispatch (record) {
+        console.log(this.modalType)
+        this.modalType = 'dispatch'
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.dispatchForm.dispatch(record);
+        })
+      },
       close () {
         this.$emit('close');
         this.visible = false;
+        this.modalType = 'form';
       },
       handleOk () {
         this.$refs.realForm.submitForm();
@@ -51,6 +63,7 @@
       submitCallback(){
         this.$emit('ok');
         this.visible = false;
+        this.modalType = 'form';
       },
       handleCancel () {
         this.close()