From 1c5776c08419256f936a8cf115459f4847d51b5a Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期二, 17 十月 2023 13:46:49 +0800
Subject: [PATCH] 保养计划

---
 src/views/eam/modules/maintenancePlan/DailyMaintenanceStandardDetail.vue |  286 +++++++++++++++++++++++++++++++++++
 src/views/eam/EquipmentMaintenancePlanList.vue                           |   60 +++++-
 src/views/eam/modules/maintenancePlan/StandardDetailModel.vue            |   56 +++++++
 src/views/eam/EquipmentMaintenancePlanDetailList.vue                     |   23 ++
 4 files changed, 406 insertions(+), 19 deletions(-)

diff --git a/src/views/eam/EquipmentMaintenancePlanDetailList.vue b/src/views/eam/EquipmentMaintenancePlanDetailList.vue
index 69df8aa..c500bf0 100644
--- a/src/views/eam/EquipmentMaintenancePlanDetailList.vue
+++ b/src/views/eam/EquipmentMaintenancePlanDetailList.vue
@@ -67,19 +67,29 @@
             <a>鍒犻櫎</a>
           </a-popconfirm>
         </span>
-
+        <span
+          slot="num"
+          slot-scope="text, record"
+        >
+          <a
+            class="lot"
+            @click="handleShowDetail(record)"
+          >{{record.standardNum}}</a>
+        </span>
       </a-table>
     </div>
+    <standard-detail-model :mainId="standardId" ref="standardDetail"></standard-detail-model>
   </a-card>
 </template>
 
 <script>
 
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import StandardDetailModel from './modules/maintenancePlan/StandardDetailModel.vue'
   export default {
     name: "EquipmentMaintenancePlanDetailList",
     mixins:[JeecgListMixin],
-    components: {},
+    components: {StandardDetailModel},
     props:{
       mainId:{
         type:String,
@@ -121,6 +131,7 @@
             align:"center",
             dataIndex: 'standardNum',
             width:300,
+            scopedSlots: { customRender: 'num' }
           },
           {
             title:'璁惧缁熶竴缂栫爜',
@@ -161,7 +172,8 @@
           importUrl: "/eam/equipmentMaintenancePlan/importEquipmentMaintenancePlanDetail",
         },
         dictOptions:{
-        }
+        },
+        standardId:''
       }
     },
     created() {
@@ -176,8 +188,11 @@
         this.dataSource=[]
         this.selectedRowKeys=[]
         this.ipagination.current = 1
+      },
+      handleShowDetail(record){
+        this.standardId = record.standardId
+        this.$refs.standardDetail.visible = true;
       }
-
     }
   }
 </script>
diff --git a/src/views/eam/EquipmentMaintenancePlanList.vue b/src/views/eam/EquipmentMaintenancePlanList.vue
index 2b35154..edbe67b 100644
--- a/src/views/eam/EquipmentMaintenancePlanList.vue
+++ b/src/views/eam/EquipmentMaintenancePlanList.vue
@@ -4,6 +4,22 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="鍗曟嵁鍙�">
+              <j-input placeholder="璇疯緭鍏ュ崟鎹彿" v-model="queryParam.num"></j-input>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="淇濆吇绫诲瀷">
+              <j-dict-select-tag placeholder="璇烽�夋嫨淇濆吇绫诲瀷" v-model="queryParam.type" dictCode="maintenance_type" />
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <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>
+            </span>
+          </a-col>
         </a-row>
       </a-form>
     </div>
@@ -11,7 +27,7 @@
 
     <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
     <div class="table-operator">
-      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>
+      <a-button @click="handleAdd" type="primary" icon="plus" v-has="'MaintenancePlan:add&edit&submit'">鏂板</a-button>
     </div>
 
     <!-- table鍖哄煙-begin -->
@@ -57,27 +73,28 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)" v-if="record.status==='created'||record.status==='rejected'">缂栬緫</a>
+          <a @click="handleEdit(record)" v-if="record.status==='created'||record.status==='rejected'" v-has="'MaintenancePlan:add&edit&submit'">缂栬緫</a>
           <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
-          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)" v-if="record.status==='created'||record.status==='rejected'">
+          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)" v-if="record.status==='created'||record.status==='rejected'" v-has="'MaintenancePlan:add&edit&submit'">
               <a>鍒犻櫎</a>
           </a-popconfirm>
-          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
-          <a-popconfirm title="鎻愪氦鍚庝笉鍙挙鍥烇紝纭畾鎻愪氦鍚�?" @confirm="() => handleSubmit(record)" v-if="record.status==='created'||record.status==='rejected'">
+          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'" v-has="'MaintenancePlan:add&edit&submit'"/>
+          <a-popconfirm title="鎻愪氦鍚庝笉鍙挙鍥烇紝纭畾鎻愪氦鍚�?" @confirm="() => handleSubmit(record)" v-if="record.status==='created'||record.status==='rejected'" v-has="'MaintenancePlan:add&edit&submit'">
               <a>鎻愪氦</a>
           </a-popconfirm>
-          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
-          <a-popconfirm title="閫氳繃鍚庝笉鍙挙閿�锛岀‘瀹氶�氳繃鍚�?" @confirm="() => handleAudit(record)" v-if="record.status==='submitted'">
+          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'" v-has="'MaintenancePlan:add&edit&submit'"/>
+          <a-popconfirm title="閫氳繃鍚庝笉鍙挙閿�锛岀‘瀹氶�氳繃鍚�?" @confirm="() => handleAudit(record)" v-if="record.status==='submitted'" v-has="'MaintenancePlan:audit&reject'">
               <a>閫氳繃</a>
           </a-popconfirm>
-          <a-divider type="vertical" v-if="record.status==='submitted'"/>
-          <a-popconfirm title="纭畾椹冲洖鍚�?" @confirm="() => handleReject(record)" v-if="record.status==='submitted'">
+          <a-divider type="vertical" v-if="record.status==='submitted'" v-has="'MaintenancePlan:audit&reject'"/>
+          <a-popconfirm title="纭畾椹冲洖鍚�?" @confirm="() => handleReject(record)" v-if="record.status==='submitted'" v-has="'MaintenancePlan:audit&reject'">
               <a>椹冲洖</a>
           </a-popconfirm>
-          <a-divider type="vertical" v-if="record.status==='submitted'"/>
-          <a-popconfirm title="涓嬪彂鍚庝笉鍙挙閿�锛岀‘瀹氫笅鍙戝悧?" @confirm="() => handleDistrbute(record)" v-if="record.status==='passed'">
+          <a-divider type="vertical" v-if="record.status==='submitted'" v-has="'MaintenancePlan:audit&reject'"/>
+          <a-popconfirm title="涓嬪彂鍚庝笉鍙挙閿�锛岀‘瀹氫笅鍙戝悧?" @confirm="() => handleDistrbute(record)" v-if="record.status==='passed'" v-has="'MaintenancePlan:distribute'">
               <a>涓嬪彂</a>
           </a-popconfirm>
+          <span v-if="record.status==='distributed'" style="font-size: 12px;font-style: italic;">宸茬敓鎴愬伐鍗�</span>
         </span>
 
       </a-table>
@@ -273,40 +290,53 @@
         this.superFieldList = fieldList
       },
       handleSubmit(record){
+         this.loading = true;
          putAction(this.url.submit,record).then(res=>{
              if(res.success){
                 this.$message.success("鎿嶄綔鎴愬姛");
              }else{
                 this.$message.success("鎿嶄綔澶辫触");
+                
              }
-         })
+         }).finally(res=>{
+             this.loadData();
+          })
       },
       handleAudit(record){
+         this.loading = true;
          putAction(this.url.audit,record).then(res=>{
           if(res.success){
                 this.$message.success("鎿嶄綔鎴愬姛");
              }else{
                 this.$message.success("鎿嶄綔澶辫触");
              }
-         })
+          }).finally(res=>{
+             this.loadData();
+          })
       },
       handleDistrbute(record){
+        this.loading = true;
         putAction(this.url.distrbute,record).then(res=>{
           if(res.success){
                 this.$message.success("鎿嶄綔鎴愬姛");
              }else{
                 this.$message.success("鎿嶄綔澶辫触");
              }
-        })
+        }).finally(res=>{
+             this.loadData();
+          })
       },
       handleReject(record){
+        this.loading = true;
         putAction(this.url.reject,record).then(res=>{
           if(res.success){
                 this.$message.success("鎿嶄綔鎴愬姛");
              }else{
                 this.$message.success("鎿嶄綔澶辫触");
              }
-        })
+        }).finally(res=>{
+             this.loadData();
+          })
       }
     }
   }
diff --git a/src/views/eam/modules/maintenancePlan/DailyMaintenanceStandardDetail.vue b/src/views/eam/modules/maintenancePlan/DailyMaintenanceStandardDetail.vue
new file mode 100644
index 0000000..04431af
--- /dev/null
+++ b/src/views/eam/modules/maintenancePlan/DailyMaintenanceStandardDetail.vue
@@ -0,0 +1,286 @@
+<template>
+  <a-card
+    :bordered="false"
+    :class="'cust-erp-sub-tab'"
+  >
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form
+        layout="inline"
+        @keyup.enter.native="searchQuery"
+      >
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :scroll="{x:true}"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        @change="handleTableChange"
+      >
+        <!-- <span
+          slot="photo"
+          slot-scope="text,record"
+        >
+          <Tooltip
+            placement="top"
+            title="棰勮鍥剧墖"
+          >
+            <img
+              v-if=" record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif')"
+              width="30"
+              height="14"
+              border="1"
+              draggable="false"
+              preview="1"
+              :preview-text="''"
+              :src="record.upload.src"
+            />
+          </Tooltip>
+          <a
+            v-if="record.upload.path && record.upload.format.toLowerCase()=='pdf'"
+            href="javascript:;"
+            @click="view(record.upload)"
+          >
+            棰勮
+          </a>
+        </span> -->
+
+        <template
+          slot="photo"
+          slot-scope="text,record"
+        >
+          <span
+            v-if="!text"
+            style="font-size: 12px;font-style: italic;"
+          >鏃犲浘鐗�</span>
+          <img
+            v-else
+            :src="getImgView(text)"
+            :preview="record.id"
+            height="25px"
+            alt=""
+            style="max-width:80px;font-size: 12px;font-style: italic;"
+          />
+        </template>
+      </a-table>
+    </div>
+    <pdf-view ref="pdfview"></pdf-view>
+  </a-card>
+</template>
+
+<script>
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { getAction } from '@/api/manage'
+import Tooltip from 'ant-design-vue/es/tooltip'
+import { preview } from 'vue-photo-preview'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import Vue from 'vue'
+import PdfView from '@views/common/PdfView'
+import { getFileAccessHttpUrl } from '@/api/manage';
+
+export default {
+  name: "MaintenanceStandardModal",
+  components: {
+    Tooltip,
+    PdfView,
+    preview,
+  },
+  mixins: [JeecgListMixin],
+  props: {
+    maintenanceStandardId: {
+      type: String,
+      default: '-1',
+      required: false
+    }
+  },
+  watch: {
+    maintenanceStandardId: {
+      immediate: true,
+      handler(val) {
+        if (!this.maintenanceStandardId) {
+          this.clearList()
+        } else {
+          this.queryParam['maintenanceStandardId'] = val;
+          this.queryParam['delFlag'] = 0;
+          this.loadData(1);
+        }
+      }
+    }
+  },
+  data() {
+    return {
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          width: 50,
+          align: "center",
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1;
+          }
+        },
+        {
+          title: '閮ㄤ綅',
+          align: "center",
+          dataIndex: 'location',
+          width: 150,
+        },
+        {
+          title: '绀烘剰鍥�',
+          align: "center",
+          dataIndex: 'photo',
+          scopedSlots: { customRender: 'photo' },
+          width: 150,
+        },
+        {
+          title: '淇濆吇椤圭洰',
+          align: "center",
+          dataIndex: 'name',
+          width: 150,
+
+        },
+        {
+          title: '淇濆吇鏍囧噯',
+          align: "center",
+          dataIndex: 'standard',
+          width: 150,
+        },
+        {
+          title: '鏂规硶',
+          align: "center",
+          dataIndex: 'maintenanceMethodName',
+          width: 150,
+
+        },
+        {
+          title: '宸ュ叿',
+          align: "center",
+          dataIndex: 'maintenanceTool',
+          width: 150,
+        },
+        {
+          title: '瀹夊叏瑕佹眰',
+          align: "center",
+          dataIndex: 'maintenanceRequire',
+          width: 150,
+        },
+        {
+          title: '宸ユ椂瀹氶',
+          align: "center",
+          dataIndex: 'workingHourQuota',
+          width: 150,
+        },
+        {
+          title: '淇濆吇鍛ㄦ湡',
+          align: "center",
+          dataIndex: 'maintenanceCycleName',
+          width: 150,
+        },
+
+      ],
+      url: {
+        list: "/eam/maintenanceStandardDetail/getMaintenanceStandardList",//鏁版嵁鏉ユ簮mom_eam_daily_inspection_standard_detail
+      },
+    }
+  },
+  created() {
+  },
+  computed: {
+  },
+  methods: {
+    clearList() {
+      this.dataSource = []
+      this.selectedRowKeys = []
+      this.ipagination.current = 1
+    },
+    loadData(arg) {
+      if (!this.url.list) {
+        this.$message.error("璇疯缃畊rl.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) {
+          this.dataSource = res.result.records || res.result;
+          for (let i = 0; i < this.dataSource.length; i++) {
+            let r = this.dataSource[i].upload;
+            r.src = this.getSrc(this.dataSource[i].upload);
+          }
+          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
+      })
+    },
+
+    getSrc(record) {
+
+      if (!record.path) {
+        return '';
+      }
+      //鏈湴锛歭ocal\Minio锛歮inio\闃块噷浜戯細alioss
+      if (record.uploadType == 'local') {
+
+        let ssoLoginFlag = Vue.ls.get("ssoLoginFlag");
+        let deployMode = Vue.ls.get("deployMode");
+
+        if (ssoLoginFlag && deployMode == "container") {
+          var baseProject = Vue.ls.get("baseProject");
+          console.log("baseProject==>" + baseProject)
+
+          var hostname = window.location.protocol + "//" + window.location.host;
+          var url = hostname + '/' + baseProject + '/sys/common/static';
+          return getFileAccessHttpUrl(record.path + record.encodeName, url, window._CONFIG['hyperTextTransfer'])
+        } else {
+          //鏍规嵁鍙戝竷鐘舵�佷慨鏀筯ttps 鎴� http
+          return getFileAccessHttpUrl(record.path + record.encodeName, this.url.urlDownload, window._CONFIG['hyperTextTransfer'])
+        }
+
+      } else if (record.uploadType == 'alioss') {
+
+        const OSS = require('ali-oss')
+        const client = new OSS({
+          // region浠ユ澀宸炰负渚嬶紙oss-cn-hangzhou锛夛紝鍏朵粬region鎸夊疄闄呮儏鍐靛~鍐欍��
+          region: window._CONFIG['region'],
+          // 闃块噷浜戜富璐﹀彿AccessKey鎷ユ湁鎵�鏈堿PI鐨勮闂潈闄愶紝椋庨櫓寰堥珮銆傚己鐑堝缓璁偍鍒涘缓骞朵娇鐢≧AM璐﹀彿杩涜API璁块棶鎴栨棩甯歌繍缁达紝璇风櫥褰昍AM鎺у埗鍙板垱寤篟AM璐﹀彿銆�
+          accessKeyId: window._CONFIG['accessKeyId'],
+          accessKeySecret: window._CONFIG['accessKeySecret'],
+          bucket: window._CONFIG['bucket'],
+        })
+        // object-key琛ㄧず浠嶰SS涓嬭浇鏂囦欢鏃堕渶瑕佹寚瀹氬寘鍚枃浠跺悗缂�鍦ㄥ唴鐨勫畬鏁磋矾寰勶紝渚嬪abc/efg/123.jpg銆�
+        return client.signatureUrl(record.path)
+      }
+    },
+
+    view(record) {
+      this.$refs.pdfview.showPdf(record.src);
+    },
+
+  }
+}
+</script>
+<style scoped>
+@import '~@assets/less/common.less';
+</style>
diff --git a/src/views/eam/modules/maintenancePlan/StandardDetailModel.vue b/src/views/eam/modules/maintenancePlan/StandardDetailModel.vue
new file mode 100644
index 0000000..5b75a5a
--- /dev/null
+++ b/src/views/eam/modules/maintenancePlan/StandardDetailModel.vue
@@ -0,0 +1,56 @@
+<template>
+  <j-modal
+    :title="'淇濆吇鏍囧噯鏄庣粏'"
+    :width="1600"
+    :visible="visible"
+    :maskClosable="false"
+    switchFullscreen
+    @cancel="handleCancel"
+    >
+    <daily-maintenance-standard-detail :maintenanceStandardId="mainId"></daily-maintenance-standard-detail>
+    <template slot="footer">
+      <a-button
+        :style="{marginRight: '8px'}"
+        @click="handleCancel"
+      >
+        鍏抽棴
+      </a-button>
+    </template>
+  </j-modal>
+</template>
+<script>
+import DailyMaintenanceStandardDetail from './DailyMaintenanceStandardDetail'
+  export default {
+    name: 'EquipmentMaintenancePlanModal',
+    components: {
+      DailyMaintenanceStandardDetail
+    },
+    props:{
+        mainId: {
+        type: String,
+        default: '-1',
+        required: false
+      }
+    },
+    data() {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods:{
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>
+
+<style scoped>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3