From 0590bdfc0fa9f803d74207d9835b65191b20e576 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期六, 22 二月 2025 16:29:45 +0800
Subject: [PATCH] 完成记录的控制搬迁

---
 src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue |  315 +++++++++++++++++++++++++++++----------------------
 1 files changed, 179 insertions(+), 136 deletions(-)

diff --git a/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue b/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
index 7eb6040..fb8d415 100644
--- a/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
+++ b/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
@@ -1,28 +1,16 @@
 <template>
   <!-- 浣滃簾鏂囦欢閿�姣佽褰� -->
   <div class="ObsoleteDocumentDestructionRecords">
-    <el-row class="title">
-      <el-col :span="12" style="padding-left: 20px;text-align: left;">浣滃簾鏂囦欢閿�姣佽褰�</el-col>
-      <el-col :span="12" style="text-align: right;">
-        <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板</el-button>
-        <el-upload :action="action" :multiple="false" :show-file-list="false" accept='.doc,.docx' :headers="headers"
-          :on-change="beforeUpload" :on-error="onError" ref='upload' v-if="upPower" :on-success="handleSuccessUp"
-          style="display:inline-block;margin-left: 20px;">
-          <el-button type="primary" size="medium">瀵煎叆</el-button></el-upload>
-        <el-button size="medium" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower"
-          style="display:inline-block;margin-left: 20px;">瀵煎嚭</el-button>
-      </el-col>
-    </el-row>
     <div class="search">
       <div class="search_thing">
         <div class="search_label">鏂囦欢鍚嶇О锛�</div>
-        <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-            v-model="componentData.entity.documentName" @keyup.enter.native="refreshTable()"></el-input></div>
+        <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.documentName"
+            @keyup.enter.native="refreshTable()"></el-input></div>
       </div>
       <div class="search_thing">
         <div class="search_label">鏂囦欢缂栧彿锛�</div>
         <div class="search_input">
-          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.documentCode"
+          <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.documentCode"
             @keyup.enter.native="refreshTable()"></el-input>
         </div>
       </div>
@@ -30,11 +18,19 @@
         <el-button size="small" @click="refresh()">閲� 缃�</el-button>
         <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
       </div>
+      <div class="btn">
+        <el-button size="small" type="primary" @click="openAdd">鏂板</el-button>
+        <el-upload :action="action" :multiple="false" :show-file-list="false" accept='.doc,.docx' :headers="headers"
+          :on-change="beforeUpload" :on-error="onError" ref='upload' :on-success="handleSuccessUp"
+          style="display:inline-block;margin-left: 20px;">
+          <el-button type="primary" size="small">瀵煎叆</el-button></el-upload>
+        <el-button size="small" type="primary" @click="handleDown" :loading="outLoading"
+          style="display:inline-block;margin-left: 20px;">瀵煎嚭</el-button>
+      </div>
     </div>
     <div class="table">
-      <ValueTable ref="ValueTable" :url="$api.manageRecordCancel.pageManageRecordCancel"
-        :delUrl="$api.manageRecordCancel.delManageRecordCancel" :componentData="componentData"
-        :upUrl="$api.manageRecordIssueRecycle.doManageRecordIssueRecycle" :key="upIndex" />
+      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
+        :height="'calc(100vh - 260px)'" @pagination="pagination"></lims-table>
     </div>
     <el-dialog :title="title" :visible.sync="addDialogVisible" width="400px" top="6vh">
       <el-row>
@@ -89,11 +85,25 @@
 </template>
 
 <script>
-import ValueTable from '@/components/Table//value-table.vue'
+import limsTable from "@/components/Table/lims-table.vue";
 import { getToken } from "@/utils/auth";
+import {
+  selectUserCondition,
+} from "@/api/business/inspectionTask.js";
+import {
+  exportOutManageRecordCancel,
+  addManageRecordCancel,
+  doManageRecordCancel,
+  ratifyManageRecordCancel,
+  delManageRecordCancel,
+  pageManageRecordCancel
+} from '@/api/cnas/systemManagement/documentRecords.js'
+import {
+  pageManageDocumentList,
+} from '@/api/cnas/systemManagement/documentControl.js'
 export default {
   components: {
-    ValueTable
+    limsTable
   },
   data() {
     return {
@@ -102,78 +112,71 @@
       upPower: true,
       outLoading: false,
       addLoading: false,
-      componentData: {
-        entity: {
-          documentName: null,
-          documentCode: null,
-          orderBy: {
-            field: 'createTime',
-            order: 'desc'
-          }
-        },
-        isIndex: true,
-        showSelect: false,
-        select: false,
-        // selectMethod: 'handleChangeTask',
-        do: [{
-          id: 'handleEdit0',
-          font: '淇敼',
-          type: 'text',
-          method: 'handleEdit0',
-          field: [],
-          disabFun: (row, index) => {
-            return row.ratifyState == '閫氳繃'
-          }
-        }, {
-          id: 'handleRatify',
-          font: '鎵瑰噯',
-          type: 'text',
-          method: 'handleRatify',
-          field: [],
-          disabFun: (row, index) => {
-            return row.ratifyState == '閫氳繃'
-          }
-        }, {
-          id: 'delete',
-          font: '鍒犻櫎',
-          type: 'text',
-          method: 'doDiy',
-          disabFun: (row, index) => {
-            return row.ratifyState == '閫氳繃'
-          }
-        },],
-        tagField: {
-          // documentType:{
-          //   select: []
-          // },
-          // receiveUserName:{
-          //   select: []
-          // },
-        },
-        selectField: {
-          // documentType:{
-          //   select: []
-          // },
-          // receiveUserName:{
-          //   select: []
-          // },
-        },
-        addUpload: ['signatoryUrl'],
-        requiredAdd: [],
-        requiredUp: [],
-        datePicker: ['receiveDate'],
-        noHead: ['signedUserName', 'signedDate', 'departLims'],//涓嶅弬涓庢柊澧炵紪杈戠殑瀛楁
-        needSort: [],
-        inputType: ''
-      },
-      entityCopy: {},
-      upIndex: 0,
       addInfo: {},
       title: '鏂板',
       addInfo: {},
       addDialogVisible: false,
       fileList: [],
       personList: [],
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "鏂囦欢缂栧彿", prop: "documentCode" },
+        { label: "鏂囦欢鍚嶇О", prop: "documentName", width: "120px" },
+        {
+          label: "鏁伴噺",
+          prop: "qty",
+        },
+        { label: "閿�姣佸師鍥�", prop: "reason" },
+        { label: "鐢宠浜�", prop: "createUserName" },
+        { label: "鐢宠鏃ユ湡", prop: "createTime" },
+        { label: "鎵瑰噯浜�", prop: "ratifyUserName" },
+        { label: "鎵瑰噯鏃ユ湡", prop: "ratifyTime" },
+        { label: "澶囨敞", prop: "remark" },
+        {
+          dataType: "action",
+          fixed: "right",
+          label: "鎿嶄綔",
+          operation: [
+            {
+              name: "缂栬緫",
+              type: "text",
+              clickFun: (row) => {
+                this.handleEdit0(row);
+              },
+              disabled: (row) => {
+                return row.ratifyState == '閫氳繃'
+              },
+            },
+            {
+              name: "鎵瑰噯",
+              type: "text",
+              clickFun: (row) => {
+                this.handleRatify(row);
+              },
+              disabled: (row) => {
+                return row.ratifyState == '閫氳繃'
+              },
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabled: (row) => {
+                return row.ratifyState == '閫氳繃'
+              },
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading: false,
     }
   },
   // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
@@ -184,12 +187,12 @@
       }
     },
     action() {
-      return this.javaApi + this.$api.manageRecordCancel.exportInManageRecordCancel
+      return this.javaApi + '/manageRecordCancel/exportInManageRecordCancel'
     }
   },
   mounted() {
-    this.entityCopy = this.HaveJson(this.componentData.entity);
-    this.getPower()
+    // this.entityCopy = this.HaveJson(this.componentData.entity);
+    this.getList()
     this.getAuthorizedPerson()
     this.getFileList()
   },
@@ -232,7 +235,6 @@
       this.upPower = up
     },
     openAdd() {
-      // this.$refs.ValueTable.openAddDia(this.$api.manageRecordIssueRecycle.addManageRecordIssueRecycle);
       this.addInfo = {}
       this.title = '鏂板'
       this.addDialogVisible = true;
@@ -245,24 +247,43 @@
     // 瀵煎嚭
     handleDown() {
       this.outLoading = true
-      this.$axios.post(this.$api.manageRecordCancel.exportOutManageRecordCancel, { entity: this.componentData.entity }, { headers: { 'Content-Type': 'application/json' } }).then(res => {
+      exportOutManageRecordCancel(this.queryParams).then(res => {
         this.outLoading = false
         if (res.code == 201) return this.$message.error('瀵煎嚭澶辫触')
         this.$message.success('瀵煎嚭鎴愬姛')
-        let url = this.javaApi + 'word/' + res.message
-        const link = document.createElement('a');
-        link.href = url;
-        link.download = '浣滃簾鏂囦欢閿�姣佽褰�';
-        link.click();
+        let url = this.javaApi + '/word/' + res.data
+        this.$download.saveAs(url, "浣滃簾鏂囦欢閿�姣佽褰�");
       })
     },
-    refreshTable() {
-      this.refreshTable()()
+    getList() {
+      this.tableLoading = true;
+      let param = { ...this.queryParams, ...this.page };
+      delete param.total;
+      pageManageRecordCancel({ ...param })
+        .then((res) => {
+          this.tableLoading = false;
+          if (res.code === 200) {
+            this.tableData = res.data.records;
+            this.page.total = res.data.total;
+          }
+        })
+        .catch((err) => {
+          this.tableLoading = false;
+        });
+    },
+    pagination({ page, limit }) {
+      this.page.current = page;
+      this.page.size = limit;
+      this.getList();
     },
     refresh() {
-      this.componentData.entity = this.HaveJson(this.entityCopy)
-      this.upIndex++
-      this.refreshTable()
+      this.queryParams = {};
+      this.page.current = 1;
+      this.getList();
+    },
+    refreshTable() {
+      this.page.current = 1;
+      this.getList();
     },
     beforeUpload(file) {
       if (file.size > 1024 * 1024 * 10) {
@@ -289,23 +310,11 @@
     },
     // 鑾峰彇鏂囦欢鍒楄〃--鏂囦欢娓呭崟
     getFileList() {
-      this.$axios.post(this.$api.manageDocumentList.pageManageDocumentList, {
-        entity: {
-          orderBy: {
-            field: 'createTime',
-            order: 'desc'
-          }
-        },
-        page: {
-          current: -1,
-          size: -1
-        }
-      }, {
-        headers: {
-          'Content-Type': 'application/json'
-        }
+      pageManageDocumentList({
+        current: -1,
+        size: -1
       }).then(res => {
-        this.fileList = res.data.body.records.map(m => {
+        this.fileList = res.data.records.map(m => {
           m.title = m.documentCode
           return m
         })
@@ -321,18 +330,33 @@
         let { id, documentCode, documentName, qty, reason, remark } = this.addInfo
         obj = { id, documentCode, documentName, qty, reason, remark }
       }
-      this.$axios.post(this.$api.manageRecordCancel[this.title == '鏂板' ? 'addManageRecordCancel' : 'doManageRecordCancel'], obj, { headers: { 'Content-Type': 'application/json' }, noQs: true }).then(res => {
-        this.addLoading = false
-        if (res.code == 201) {
-          return
-        }
-        this.addDialogVisible = false
-        this.$message({
-          type: 'success',
-          message: '鎿嶄綔鎴愬姛!'
-        });
-        this.refreshTable()
-      }).catch(err => { })
+      if (this.title == '鏂板') {
+        addManageRecordCancel(obj).then(res => {
+          this.addLoading = false
+          if (res.code == 201) {
+            return
+          }
+          this.addDialogVisible = false
+          this.$message({
+            type: 'success',
+            message: '鎿嶄綔鎴愬姛!'
+          });
+          this.refreshTable()
+        }).catch(err => { })
+      } else {
+        doManageRecordCancel(obj).then(res => {
+          this.addLoading = false
+          if (res.code == 201) {
+            return
+          }
+          this.addDialogVisible = false
+          this.$message({
+            type: 'success',
+            message: '鎿嶄綔鎴愬姛!'
+          });
+          this.refreshTable()
+        }).catch(err => { })
+      }
     },
     getCurrentFile(e) {
       let obj = this.fileList.find(m => m.documentCode == e)
@@ -341,7 +365,7 @@
       }
     },
     getAuthorizedPerson() {
-      this.$axios.get(this.$api.user.getUserMenu).then(res => {
+      selectUserCondition().then(res => {
         let data = []
         res.data.forEach(a => {
           data.push({
@@ -349,8 +373,6 @@
             value: a.id
           })
         })
-        // this.componentData.tagField.receiveUserName.select = data
-        // this.componentData.selectField.receiveUserName.select = data
         this.personList = data
       })
     },
@@ -364,7 +386,7 @@
         beforeClose: (action, instance, done) => {
           if (action === 'confirm') {
             // 鐐瑰嚮鈥滅‘瀹氣�濇寜閽紝鍏佽鍏抽棴
-            this.$axios.post(this.$api.manageRecordCancel.ratifyManageRecordCancel, { id: row.id, ratifyState: '閫氳繃' }).then(res => {
+            ratifyManageRecordCancel({ id: row.id, ratifyState: '閫氳繃' }).then(res => {
               if (res.code === 201) return
               this.refreshTable()
               done();
@@ -378,7 +400,7 @@
               })
           } else if (action === 'cancel') {
             // 鐐瑰嚮鈥滃彇娑堚�濇寜閽紝涓嶅厑璁稿叧闂�
-            this.$axios.post(this.$api.manageRecordCancel.ratifyManageRecordCancel, { id: row.id, ratifyState: '涓嶉�氳繃' }).then(res => {
+            ratifyManageRecordCancel({ id: row.id, ratifyState: '涓嶉�氳繃' }).then(res => {
               if (res.code === 201) return
               this.refreshTable()
               done();
@@ -398,7 +420,22 @@
           }
         }
       })
-    }
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delManageRecordCancel({ id: row.id }).then((res) => {
+            if (res.code == 201) return;
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.refresh();
+          });
+        })
+        .catch(() => { });
+    },
   }
 }
 </script>
@@ -435,8 +472,14 @@
 .table {
   margin-top: 10px;
   background-color: #fff;
-  width: calc(100% - 40px);
   height: calc(100% - 60px - 80px - 10px - 40px);
   padding: 20px;
+  padding-top: 0;
+}
+
+.btn {
+  position: absolute;
+  right: 20px;
+  top: 16px;
 }
 </style>

--
Gitblit v1.9.3