From 9d783b455d6d704281ca2743ae45113e23422aad Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 31 七月 2025 09:23:17 +0800
Subject: [PATCH] 升版导入

---
 src/views/eam/equipment/modules/EamEquipmentModal.vue           |    2 
 src/views/base/modules/file/MaintenanceStandardImportModule.vue |  155 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/views/eam/base/EamMaintenanceStandardList.vue               |   22 +++++++
 3 files changed, 178 insertions(+), 1 deletions(-)

diff --git a/src/views/base/modules/file/MaintenanceStandardImportModule.vue b/src/views/base/modules/file/MaintenanceStandardImportModule.vue
new file mode 100644
index 0000000..c5402a5
--- /dev/null
+++ b/src/views/base/modules/file/MaintenanceStandardImportModule.vue
@@ -0,0 +1,155 @@
+<template>
+  <a-modal :title="title" :visible="visible" @cancel="handleModalClose" :maskClosable="false">
+    <a-upload :multiple="true" :file-list="fileList" :remove="handleRemove" :before-upload="beforeUpload" >
+      <a-button type="primary" :disabled="uploading">
+        <a-icon type="import"/>
+        閫夊彇鏂囦欢
+      </a-button>
+    </a-upload>
+
+    <template slot="footer">
+      <a-button @click="handleModalClose">鍙栨秷</a-button>
+      <a-button
+        id="custom-upload-button"
+        type="primary"
+        :disabled="fileList.length === 0"
+        :loading="uploading"
+        @click="handleUpload"
+      >
+        纭
+      </a-button>
+    </template>
+
+  </a-modal>
+</template>
+
+<script>
+import JUpload from '@/components/jeecg/JUpload'
+import { getAction, postAction, uploadAction } from '@/api/manage'
+
+export default {
+  name: 'MaintenanceStandardImportModule',
+  components: {
+    JUpload,
+  },
+  data() {
+    return {
+      visible: false,
+      title: '',
+      id:'',
+      fileList: [],
+      uploadParams: {},
+      uploading: false,
+      isUploadMultiple: true,
+      currentDeviceDocClassCode: 'SEND',
+      currentTitleAfterClass: '',
+
+      url: {
+        add: "/eam/maintenanceStandard/importUpgrade",
+      },
+    }
+  },
+
+  created() {
+  },
+  methods: {
+
+    /**
+     * 閫夋嫨濂芥枃浠剁偣鍑荤‘瀹氬悗
+     * @param file 鏂囦欢瀵硅薄
+     */
+    beforeUpload(file) {
+      if (this.isUploadMultiple) {
+        if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
+      } else this.fileList.splice(0, 1, file)
+      return false
+    },
+
+    /**
+     * 鍒犻櫎鏂囦欢鍒楄〃椤规椂瑙﹀彂
+     * @param file 鏂囦欢瀵硅薄
+     */
+    handleRemove(file) {
+      const index = this.fileList.indexOf(file)
+      const newFileList = this.fileList.slice()
+      newFileList.splice(index, 1)
+      this.fileList = newFileList
+    },
+
+    // 鎺у埗鏂囦欢涓婁紶绐楀彛鍏抽棴骞舵竻绌烘枃浠跺垪琛�
+    handleModalClose() {
+      this.visible = false
+      this.fileList = []
+    },
+
+    upload(id){
+      console.log("id",id)
+      this.id = id
+      this.isUploadMultiple = true
+      this.visible = true
+    },
+    handleUpload() {
+      const { fileList, $notification, handleModalClose} = this
+      this.uploading = true
+      let uploadedFileCount = 0
+      let uploadSuccessFileCount = 0
+      if (this.fileList.length === 0) {
+        this.$message.info("璇蜂笂浼犳枃浠�")
+        this.uploading = false;
+      }
+      fileList.forEach((file, index) => {
+        const formData = new FormData()
+        formData.append('file', file)
+        formData.append('id',this.id)
+        uploadAction(this.url.add, formData).then(res => {
+          if (res.success) {
+            file.status = 'done'
+            uploadSuccessFileCount++
+            $notification.success({
+              message: '娑堟伅',
+              description: res.message
+            })
+          } else {
+            file.status = 'error'
+            $notification.error({
+              message: '娑堟伅',
+              description: res.message
+            })
+          }
+        })
+          .catch(err => {
+            file.status = 'error'
+          })
+          .finally(() => {
+            uploadedFileCount++
+            fileList.splice(index, 1, file)
+            if (uploadedFileCount === fileList.length) {
+              if (uploadSuccessFileCount > 0) {
+                this.$emit('ok')
+              }
+              // 褰撴枃浠跺叏閮ㄤ笂浼犲畬鎴愬悗
+              if (uploadSuccessFileCount === fileList.length) {
+                handleModalClose();
+              }
+              this.uploading = false
+            }
+          })
+      })
+    }
+  }
+}
+</script>
+
+<style scoped lang="less">
+/deep/ .ant-btn-primary#custom-upload-button {
+  color: #fff;
+  background-color: #67C23A;
+  border-color: #67C23A;
+
+  &[disabled] {
+    color: rgba(0, 0, 0, 0.25);
+    background-color: #f5f5f5;
+    border-color: #d9d9d9;
+  }
+}
+</style>
\ No newline at end of file
diff --git a/src/views/eam/base/EamMaintenanceStandardList.vue b/src/views/eam/base/EamMaintenanceStandardList.vue
index a3af2bd..13fac28 100644
--- a/src/views/eam/base/EamMaintenanceStandardList.vue
+++ b/src/views/eam/base/EamMaintenanceStandardList.vue
@@ -100,6 +100,10 @@
           <a v-has="'standard:upgrade'" v-if="record.standardStatus === 'START'"
              @click.stop="handleUpgrade(record)">鍗囩増</a>
 
+          <a-divider v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" type="vertical"/>
+
+          <a v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" @click="handleAddUpgrade(record.id)" >鍗囩増瀵煎叆</a>
+
           <template v-if="record.standardStatus === 'WAIT_SUBMIT'">
               <a v-has="'standard:edit'" @click.stop="handleEdit(record)">缂栬緫</a>
 
@@ -170,6 +174,9 @@
 
     <!--瀹℃壒绐楀彛-->
     <maintenance-standard-approval-modal ref="maintenanceStandardApprovalModal" :selectShenpiData="selectedRowData"/>
+
+    <!--瀵煎叆鏂囦欢-->
+    <MaintenanceStandardImportModule ref="fileImportModule" @ok="getTreeDataByApi" />
   </a-card>
 </template>
 
@@ -182,6 +189,7 @@
   import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue'
   import MaintenanceStandardApprovalModal
     from '../../flowable/workflow/MaintenanceStandard/MaintenanceStandardApprovalModal'
+  import MaintenanceStandardImportModule from "@views/base/modules/file/MaintenanceStandardImportModule.vue";
 
 
   export default {
@@ -194,6 +202,7 @@
       }
     },
     components: {
+      MaintenanceStandardImportModule,
       MaintenanceStandardApprovalModal,
       LxSearchEquipmentSelect,
       EamMaintenanceStandardModal,
@@ -389,6 +398,19 @@
         this.$refs.maintenanceStandardApprovalModal.handleDetail(record)
       },
 
+      /**
+       * 鐐瑰嚮鍗囩増瀵煎叆鏃惰Е鍙戞椂瑙﹀彂
+       * @param record
+       */
+      handleAddUpgrade(id){
+        this.$refs.fileImportModule.upload(id);
+        this.$refs.fileImportModule.title="瀵煎叆"
+      },
+
+      getTreeDataByApi(){
+        this.loadData();
+      },
+
       batchDel() {
         var ids = ''
         for (var a = 0; a < this.selectedRowKeys.length; a++) {
diff --git a/src/views/eam/equipment/modules/EamEquipmentModal.vue b/src/views/eam/equipment/modules/EamEquipmentModal.vue
index 553843b..c1a1db1 100644
--- a/src/views/eam/equipment/modules/EamEquipmentModal.vue
+++ b/src/views/eam/equipment/modules/EamEquipmentModal.vue
@@ -36,7 +36,7 @@
                 <a-col :span="customSpan">
                   <a-form-model-item prop="factoryOrgCode" label="浣跨敤閮ㄩ棬">
                     <a-tree-select v-model="model.factoryOrgCode" style="width: 100%" show-search
-                                   :tree-data="productionTreeData" :disabled="!editable"
+                                   :tree-data="productionTreeData"
                                    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                                    placeholder="璇烽�夋嫨浣跨敤閮ㄩ棬" allow-clear treeNodeFilterProp="title"
                                    :replaceFields="{key:'orgCode',value:'orgCode'}"

--
Gitblit v1.9.3