From 3f386968d4b5cbb002ad93483f86a5443159e18a Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期六, 08 二月 2025 09:54:32 +0800
Subject: [PATCH] 1.递交

---
 src/views/sopManager/sopDevice.vue |  211 ++++++++++++++++++++++------------------------------
 1 files changed, 91 insertions(+), 120 deletions(-)

diff --git a/src/views/sopManager/sopDevice.vue b/src/views/sopManager/sopDevice.vue
index 33b13f2..24bf012 100644
--- a/src/views/sopManager/sopDevice.vue
+++ b/src/views/sopManager/sopDevice.vue
@@ -2,7 +2,7 @@
   <div>
     <div class="body" :style="{height:mainHeight+'px'}">
       <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center">
-        <el-button icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button>
+        <el-button v-waves icon="el-icon-circle-plus-outline" type="primary" @click="add">鏂囦欢涓婁紶</el-button>
         <div style="display: flex;align-items: center">
           <el-form
             ref="form"
@@ -19,8 +19,8 @@
               </el-form-item>
             </div>
           </el-form>
-          <el-button type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ</el-button>
-          <el-button type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+          <el-button v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ</el-button>
+          <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
         </div>
       </div>
 
@@ -39,81 +39,59 @@
           @sort-change="sortChange"
         >
           <el-table-column
-            prop="RowNum"
+            prop="rowNum"
             width="50"
             fixed
             label="搴忓彿"
           />
           <el-table-column
-            prop="define_name"
+            prop="filename"
             label="鏂囦欢鍚嶇О"
             min-width="160"
             show-tooltip-when-overflow
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.define_name">{{ row.define_name }}</div>
+              <div v-if="row.filename">{{ row.filename }}</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
-            prop="filetype_name"
+            prop="filetypename"
             label="鏂囦欢绫诲瀷"
             min-width="110"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.filetype_name">{{ row.filetype_name }}</div>
+              <div v-if="row.filetypename">{{ row.filetypename }}</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
-            prop="file_version"
+            prop="version"
             label="鐗堟湰鍙�"
             min-width="110"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.file_version">{{ row.file_version }}</div>
+              <div v-if="row.version">{{ row.version }}</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
-            prop="partcode"
-            label="鐗╂枡缂栫爜"
-            min-width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.partcode">{{ row.partcode }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="partname"
-            label="鐗╂枡鍚嶇О"
-            min-width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.partname">{{ row.partname }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="eqptype_name"
+            prop="eqptypename"
             label="璁惧绫诲瀷"
             min-width="110"
             show-tooltip-when-overflow
             sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.eqptype_name">{{ row.eqptype_name }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
+          />
+          <el-table-column
+            prop="eqpname"
+            label="璁惧淇℃伅"
+            min-width="110"
+            show-tooltip-when-overflow
+            sortable="custom"
+          />
           <el-table-column
             prop="username"
             min-width="110"
@@ -151,7 +129,7 @@
                   />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
-                  <i class="el-icon-delete" @click="del(row)" />
+                  <i class="el-icon-delete" style="cursor: pointer;color:#42b983;" @click="del(row)" />
                 </el-tooltip>
               </div>
             </template>
@@ -166,11 +144,12 @@
         align="right"
         layout="total,prev, pager, next,sizes"
         popper-class="select_bottom"
-        @pagination="getSystemSopSearch"
+        @pagination="getDeviceSopSearch"
       />
     </div>
 
     <el-dialog
+      v-el-drag-dialog
       title="鏂囦欢涓婁紶"
       :visible.sync="dialogVisible"
       width="800px"
@@ -180,37 +159,38 @@
       @close="handleClose"
     >
       <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
-        <el-form-item label="璁惧绫诲瀷" prop="devicetvpecode">
+        <el-form-item label="璁惧绫诲瀷" prop="devicetypecode">
           <el-select
-            v-model="dialogForm.devicetvpecode"
+            v-model="dialogForm.devicetypecode"
             style="width: 200px"
             placeholder="璇烽�夋嫨"
             filterable
             :popper-append-to-body="false"
-            @change="val=>fileversionChange(val,'devicetvpecode')"
+            @change="devicetypecodeChange"
           >
             <el-option
-              v-for="item in devicetvpeArr"
+              v-for="item in devicetypeArr"
               :key="item.code"
               :label="item.name"
               :value="item.code"
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="鐗╂枡鍚嶇О" prop="partcode">
+        <el-form-item label="璁惧淇℃伅" prop="device">
           <el-select
-            v-model="dialogForm.partcode"
+            v-model="dialogForm.device"
             style="width: 200px"
             placeholder="璇烽�夋嫨"
             filterable
+            multiple
+            collapse-tags
             :popper-append-to-body="false"
-            @change="val=>fileversionChange(val,'partcode')"
           >
             <el-option
-              v-for="item in partArr"
-              :key="item.partcode"
-              :label="item.partname"
-              :value="item.partcode"
+              v-for="item in deviceArr"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
             />
           </el-select>
         </el-form-item>
@@ -225,7 +205,6 @@
             placeholder="璇烽�夋嫨"
             filterable
             :popper-append-to-body="false"
-            @change="val=>fileversionChange(val,'filetypecode')"
           >
             <el-option
               v-for="item in filetypeArr"
@@ -235,9 +214,9 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="鐗堟湰鍙�">
-          <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />
-        </el-form-item>
+        <!--        <el-form-item label="鐗堟湰鍙�">-->
+        <!--          <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />-->
+        <!--        </el-form-item>-->
         <el-form-item label="鏂囦欢涓婁紶" prop="Files">
           <div style="width: 200px;">
             <el-upload
@@ -249,9 +228,10 @@
               :on-exceed="handleExceed"
               :auto-upload="false"
               :multiple="false"
-              accept=".mp4,.pdf"
+              accept=".mp4,.pdf,.png,.jpeg,.jpg,.svg,.txt,.xlsx,.xls"
             >
               <el-button
+                v-waves
                 type="primary"
                 style="width: 200px;display: flex;justify-content: center"
                 icon="el-icon-upload2"
@@ -263,8 +243,9 @@
       </el-form>
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
-          <el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>
+          <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
           <el-button
+            v-waves
             type="primary"
             :loading="$store.state.app.buttonIsDisabled"
             :disabled="$store.state.app.buttonIsDisabled"
@@ -279,21 +260,18 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-// import {
-//   SystemSopDelete,
-//   SystemSopDeviceSearch,
-//   SystemSopMaxVersion,
-//   SystemSopSava,
-//   SystemSopSearch,
-//   SystemSopView
-// } from '@/api/xtsz'
-// import { PartSelect } from '@/api/zzmx'
+import { DeviceSopAddSeave, DeviceSopDeleteSeave, DeviceSopSearch } from '@/api/SopManager'
+import { DeviceTypeSearch } from '@/api/DeviceManager'
+import { EqpTypecodeSeachEqpPermissions } from '@/api/GeneralBasicData'
+import waves from '@/directive/waves'
+import elDragDialog from '@/directive/el-drag-dialog'
 
 export default {
   name: 'Zzjg',
   components: {
     Pagination
   },
+  directives: { waves, elDragDialog },
   data() {
     return {
       mouseHoverType: 'mouseout',
@@ -314,19 +292,19 @@
       tableData: [],
       dialogVisible: false,
       dialogForm: {
-        devicetvpecode: '', // 璁惧绫诲瀷缂栫爜
-        partcode: '', // 鐗╂枡缂栫爜
+        devicetypecode: '', // 璁惧绫诲瀷缂栫爜
+        device: '', // 鐗╂枡缂栫爜
         defilename: '',
         filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜
         Files: '', // 鏂囦欢
         fileversion: ''// 鏂囦欢鐗堟湰鍙�
       },
       dialogFormRules: {
-        devicetvpecode: [
+        devicetypecode: [
           { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] }
         ],
-        partcode: [
-          { required: true, message: '璇烽�夋嫨鐗╂枡鍚嶇О', trigger: ['blur', 'change'] }
+        device: [
+          { required: true, message: '璇烽�夋嫨璁惧淇℃伅', trigger: ['blur', 'change'] }
         ],
         defilename: [
           { required: true, message: '璇疯緭鍏ュ悕鏂囦欢绉�', trigger: ['blur', 'change'] }
@@ -335,8 +313,8 @@
           { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] }
         ]
       },
-      devicetvpeArr: [], // 璁惧绫诲瀷涓嬫媺鍒楄〃
-      partArr: [], // 鐗╂枡涓嬫媺鍒楄〃
+      devicetypeArr: [], // 璁惧绫诲瀷涓嬫媺鍒楄〃
+      deviceArr: [], // 鐗╂枡涓嬫媺鍒楄〃
       filetypeArr: [// 鏂囦欢绫诲瀷涓嬫媺鏁扮粍
         { code: 'P001', name: '浣滀笟鎸囧涔�' },
         { code: 'P002', name: '妫�楠屾寚瀵间功' },
@@ -347,17 +325,22 @@
   },
 
   created() {
-    // this.getSystemSopSearch()
+    this.getDeviceSopSearch()
+    this.getDeviceTypeSearch()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
   },
   methods: {
-    async getSystemSopSearch() {
-      const res = await SystemSopSearch(this.form)
+    async getDeviceSopSearch() {
+      const res = await DeviceSopSearch(this.form)
       this.tableData = res.data
       this.total = res.count
+    },
+    async getDeviceTypeSearch() {
+      const { data: res } = await DeviceTypeSearch()
+      this.devicetypeArr = res
     },
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
@@ -370,58 +353,40 @@
       }
       this.form.order = order
       this.form.prop = prop
-      this.getSystemSopSearch()
+      this.getDeviceSopSearch()
     },
     // 鏌ヨ
     search() {
-      this.getSystemSopSearch()
+      this.getDeviceSopSearch()
     },
     // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂
     checkedChange(val) {
       this.form.check = val ? 'Y' : 'N'
-      this.getSystemSopSearch()
+      this.getDeviceSopSearch()
     },
     // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂
     handleExceed() {
       this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒')
     },
 
+    async devicetypecodeChange(eqptypecode) {
+      const { data: res } = await EqpTypecodeSeachEqpPermissions({ eqptypecode })
+      this.deviceArr = res
+      this.dialogForm.device = res.length > 0 ? res.map(i => i.code) : []
+    },
     // 閲嶇疆
     reset() {
       this.form.search = ''
-      this.getSystemSopSearch()
+      this.getDeviceSopSearch()
     },
     // 鏂板鎸夐挳
     add() {
       this.dialogVisible = true
-      this.getSystemSopDeviceSearch()
-      this.getPartSelect()
     },
-    // 鑾峰彇璁惧绫诲瀷
-    async getSystemSopDeviceSearch() {
-      const { data: res } = await SystemSopDeviceSearch()
-      this.devicetvpeArr = res
-    },
-    // 鑾峰彇鐗╂枡鍚嶇О
-    async getPartSelect() {
-      const { data: res } = await PartSelect()
-      this.partArr = res
-    },
-    // 鏂囦欢绫诲瀷鍊兼敼鍙樻椂
-    async fileversionChange(val, type) {
-      const data = {
-        devicetypecode: type === 'devicetvpecode' ? val : this.dialogForm.devicetvpecode,
-        filetypecode: type === 'filetypecode' ? val : this.dialogForm.filetypecode,
-        partcode: type === 'partcode' ? val : this.dialogForm.partcode
-      }
-      const { data: res } = await SystemSopMaxVersion(data)
 
-      this.dialogForm.fileversion = res
-    },
     // 棰勮
     async check(row) {
-      const { data: res } = await SystemSopView({ id: row.id, filepath: row.file_path })
-      window.open(res)
+      window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath)
     },
 
     // 鍒犻櫎鎸夐挳
@@ -433,15 +398,16 @@
       }).then(() => {
         const data = {
           id: row.id,
-          filepath: row.file_path
+          eqpcode: row.eqpcode,
+          filepath: row.filepath
         }
-        SystemSopDelete(data).then(res => {
+        DeviceSopDeleteSeave(data).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             if (this.form.page > 1 && this.tableData.length === 1) {
               this.form.page--
             }
-            this.getSystemSopSearch()
+            this.getDeviceSopSearch()
           }
         })
       }).catch(() => {
@@ -450,8 +416,8 @@
     },
     // 瀵硅瘽妗嗗叧闂簨浠�
     handleClose() {
-      this.dialogForm.devicetvpecode = ''
-      this.dialogForm.partcode = ''
+      this.dialogForm.devicetypecode = ''
+      this.dialogForm.device = ''
       this.dialogForm.defilename = ''
       this.dialogForm.filetypecode = ''
       this.dialogForm.fileversion = ''
@@ -467,29 +433,34 @@
     // 瀵硅瘽妗嗙‘璁�
     dialogVisibleConfirm() {
       console.log(this.$refs.uploadFileRef.uploadFiles[0])
+
       if (!this.$refs.uploadFileRef.uploadFiles[0]) {
-        this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�')
+        return this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�')
+      }
+
+      const isLt100M = this.$refs.uploadFileRef.uploadFiles[0].size / 1024 / 1024 <= 1024
+      if (!isLt100M) {
+        return this.$message.info('璇锋鏌ワ紝涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃1024MB!')
       }
 
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const formData = new FormData()
-          formData.append('devicetypecode', this.dialogForm.devicetvpecode)
-          formData.append('partcode', this.dialogForm.partcode)
-          formData.append('defilename', this.$refs.uploadFileRef.uploadFiles[0].name)
+          formData.append('eqptypecode', this.dialogForm.devicetypecode)
+          formData.append('device', this.dialogForm.device.join(','))
+          formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name)
           formData.append('filetypecode', this.dialogForm.filetypecode)
-          formData.append('fileversion', this.dialogForm.fileversion)
-          formData.append('Files', this.$refs.uploadFileRef.uploadFiles[0].raw)
+          formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw)
           // for (var [key, value] of formData) {
           //   console.log(key, value)
           // }
           this.$store.state.app.buttonIsDisabled = true
-          SystemSopSava(formData).then(res => {
+          DeviceSopAddSeave(formData).then(res => {
             if (res.code === '200') {
               this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�')
               this.dialogVisible = false
               this.$store.state.app.buttonIsDisabled = false
-              this.getSystemSopSearch()
+              this.getDeviceSopSearch()
             } else {
               this.$message.error('鏂囦欢涓婁紶澶辫触锛�')
               this.$store.state.app.buttonIsDisabled = false

--
Gitblit v1.9.3