From 83be7ca0c138b64b3447cc207b63c7933690f6ec Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 25 二月 2025 09:08:58 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-before into dev

---
 src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue |  335 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 185 insertions(+), 150 deletions(-)

diff --git a/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue b/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
index 9be00a1..f4fcca0 100644
--- a/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
+++ b/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
@@ -1,28 +1,16 @@
 <template>
   <!-- 鎵�鏈夋枃浠讹紙鍐呫�佸閮ㄦ枃浠讹級鐨勫彂鏀句笌鍥炴敹璁板綍 -->
   <div class="DistributionRetrievalRecordsAllDocuments">
-    <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="uploadHeader" :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.manageRecordIssueRecycle.pageManageRecordIssueRecycle"
-        :delUrl="$api.manageRecordIssueRecycle.delManageRecordIssueRecycle" :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>
@@ -133,14 +129,28 @@
 </template>
 
 <script>
-import ValueTable from '@/components/Table/value-table.vue'
+import limsTable from "@/components/Table/lims-table.vue";
 import {
   getYearAndMonthAndDays
 } from '@/utils/date'
-import { getToken } from "@/utils/auth";
+import {
+  selectUserCondition,
+} from "@/api/business/inspectionTask.js";
+import {
+  exportOutManageRecordIssueRecycle,
+  doManageRecordIssueRecycle,
+  addManageRecordIssueRecycle,
+  selectCNSAPersonTree,
+  pageManageRecordIssueRecycle,
+  delManageRecordIssueRecycle,
+} from '@/api/cnas/systemManagement/documentRecords.js'
+import {
+  pageManageDocumentList,
+} from '@/api/cnas/systemManagement/documentControl.js'
+import { mapGetters } from "vuex";
 export default {
   components: {
-    ValueTable
+    limsTable
   },
   data() {
     return {
@@ -149,98 +159,91 @@
       upPower: true,
       outLoading: false,
       addLoading: false,
-      componentData: {
-        entity: {
-          documentName: null,
-          documentCode: null,
-          orderBy: {
-            field: 'id',
-            order: 'desc'
-          }
-        },
-        isIndex: true,
-        showSelect: false,
-        select: false,
-        // selectMethod: 'handleChangeTask',
-        do: [{
-          id: 'delete',
-          font: '鍒犻櫎',
-          type: 'text',
-          method: 'doDiy',
-          disabFun: (row, index) => {
-            return !!row.signedUser
-          }
-        }, {
-          id: 'handleEdit',
-          font: '淇敼',
-          type: 'text',
-          method: 'handleEdit',
-          field: [],
-          disabFun: (row, index) => {
-            return !!row.signedUser
-          }
-        }, {
-          id: 'handleBack',
-          font: '鍥炴敹',
-          type: 'text',
-          method: 'handleBack',
-          disabFun: (row, index) => {
-            return !!row.signedUser
-          }
-        }],
-        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,
       title: '鏂板',
       addDialogVisible: false,
       addInfo: {},
       personList: [],
       fileType: [],
       fileList: [],
-      list: []
+      list: [],
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "鏂囦欢缂栧彿", prop: "documentCode" },
+        { label: "鏂囦欢鍚嶇О", prop: "documentName", width: "120px" },
+        {
+          label: "鐗堝彿",
+          prop: "documentVersion",
+        },
+        { label: "浠芥暟", prop: "pages" },
+        { label: "鏂囦欢绫诲埆", prop: "documentType" },
+        { label: "鍒嗗彂鍙�", prop: "number" },
+        { label: "鎺ュ彈浜�", prop: "receiveUserName" },
+        { label: "鎺ユ敹閮ㄩ棬", prop: "departLims" },
+        { label: "鎺ュ彈鏃ユ湡", prop: "receiveDate" },
+        { label: "绛炬敹浜�", prop: "signedUserName" },
+        { label: "绛炬敹鏃ユ湡", prop: "signedDate" },
+        {
+          dataType: "action",
+          fixed: "right",
+          label: "鎿嶄綔",
+          operation: [
+            {
+              name: "缂栬緫",
+              type: "text",
+              clickFun: (row) => {
+                this.handleEdit(row);
+              },
+              disabled: (row) => {
+                return !!row.signedUser
+              },
+            },
+            {
+              name: "鍥炴敹",
+              type: "text",
+              clickFun: (row) => {
+                this.handleBack(row);
+              },
+              disabled: (row) => {
+                return !!row.signedUser
+              },
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabled: (row) => {
+                return !!row.signedUser
+              },
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading: false,
     }
   },
   // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
   computed: {
-    headers() {
-      return {
-        'Authorization': "Bearer " + getToken()
-      }
-    },
     action() {
-      return this.javaApi + this.$api.manageRecordIssueRecycle.exportInManageRecordIssueRecycle
-    }
+      return this.javaApi + '/manageRecordIssueRecycle/exportInManageRecordIssueRecycle'
+    },
+    ...mapGetters(["userId"]),
   },
   mounted() {
-    this.entityCopy = this.HaveJson(this.componentData.entity);
-    this.getPower()
+    // this.entityCopy = this.HaveJson(this.componentData.entity);
+    this.getList()
     this.getAuthorizedPerson()
     this.selectEnumByCategory()
     this.getFileList()
-    this.selectTreeList()
+    // TODO 閮ㄩ棬鎺ュ彛闇�瑕侀噸鍐�
+    // this.selectTreeList()
   },
   methods: {
     getPower() {
@@ -295,27 +298,46 @@
     // 瀵煎嚭
     handleDown() {
       this.outLoading = true
-      this.$axios.post(this.$api.manageRecordIssueRecycle.exportOutManageRecordIssueRecycle, { entity: this.componentData.entity }, { headers: { 'Content-Type': 'application/json' } }).then(res => {
+      exportOutManageRecordIssueRecycle(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;
+      pageManageRecordIssueRecycle({ ...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();
     },
     getAuthorizedPerson() {
-      this.$axios.get(this.$api.user.getUserMenu).then(res => {
+      selectUserCondition().then(res => {
         let data = []
         res.data.forEach(a => {
           data.push({
@@ -323,8 +345,6 @@
             value: a.id
           })
         })
-        // this.componentData.tagField.receiveUserName.select = data
-        // this.componentData.selectField.receiveUserName.select = data
         this.personList = data
       })
     },
@@ -352,33 +372,18 @@
       }
     },
     selectEnumByCategory() {
-      this.$axios.post(this.$api.enums.selectEnumByCategory, {
-        category: "鏂囦欢绫诲埆"
-      }).then(res => {
-        // this.componentData.tagField.documentType.select = res.data
-        // this.componentData.selectField.documentType.select = res.data
-        this.fileType = res.data
-      })
+      // 鏂囦欢绫诲埆
+      this.getDicts("document_type").then((response) => {
+        this.fileType = this.dictToValue(response.data);
+      });
     },
     // 鑾峰彇鏂囦欢鍒楄〃--鏂囦欢娓呭崟
     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
         })
@@ -402,18 +407,33 @@
         let { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims } = this.addInfo
         obj = { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims }
       }
-      this.$axios.post(this.$api.manageRecordIssueRecycle[this.title == '鏂板' ? 'addManageRecordIssueRecycle' : 'doManageRecordIssueRecycle'], 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 == '鏂板') {
+        addManageRecordIssueRecycle(obj).then(res => {
+          this.addLoading = false
+          if (res.code == 201) {
+            return
+          }
+          this.addDialogVisible = false
+          this.$message({
+            type: 'success',
+            message: '鎿嶄綔鎴愬姛!'
+          });
+          this.refreshTable()
+        }).catch(err => { })
+      } else {
+        doManageRecordIssueRecycle(obj).then(res => {
+          this.addLoading = false
+          if (res.code == 201) {
+            return
+          }
+          this.addDialogVisible = false
+          this.$message({
+            type: 'success',
+            message: '鎿嶄綔鎴愬姛!'
+          });
+          this.refreshTable()
+        }).catch(err => { })
+      }
     },
     // 鍥炴敹
     handleBack(row) {
@@ -424,8 +444,8 @@
       }).then(() => {
         let obj = {}
         let { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims } = row
-        obj = { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims, signedDate: getYearAndMonthAndDays(), signedUser: JSON.parse(localStorage.getItem("user")).userId }
-        this.$axios.post(this.$api.manageRecordIssueRecycle.doManageRecordIssueRecycle, obj, { headers: { 'Content-Type': 'application/json' }, noQs: true }).then(res => {
+        obj = { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims, signedDate: getYearAndMonthAndDays(), signedUser: this.userId }
+        doManageRecordIssueRecycle(obj).then(res => {
           this.addLoading = false
           if (res.code == 201) {
             return
@@ -441,9 +461,24 @@
     },
     // 鏌ヨ鏍戝舰鍒楄〃
     selectTreeList() {
-      this.$axios.get(this.$api.personnel.selectCNSAPersonTree).then((res) => {
+      selectCNSAPersonTree().then((res) => {
         this.list = res.data[0].children;
       });
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delManageRecordIssueRecycle({ id: row.id }).then((res) => {
+            if (res.code == 201) return;
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.refresh();
+          });
+        })
+        .catch(() => { });
     },
   }
 }
@@ -481,8 +516,8 @@
 .table {
   margin-top: 10px;
   background-color: #fff;
-  width: calc(100% - 40px);
   height: calc(100% - 60px - 80px - 10px - 40px);
   padding: 20px;
+  padding-top: 0;
 }
 </style>

--
Gitblit v1.9.3