From 972f713230a71a7f162b47f1ca3ebdf09b5858c5 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期一, 29 十二月 2025 22:33:10 +0800
Subject: [PATCH] 增加代码

---
 src/views/archiveManager/index.vue |  137 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 134 insertions(+), 3 deletions(-)

diff --git a/src/views/archiveManager/index.vue b/src/views/archiveManager/index.vue
index 7ee8e76..c995fb3 100644
--- a/src/views/archiveManager/index.vue
+++ b/src/views/archiveManager/index.vue
@@ -306,7 +306,16 @@
           v-hasPermi="['system:records:export']"
         >鎵归噺鎻愪氦</el-button>
       </el-col>
-
+   <el-col v-if="userId==1" :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleGivePermission"
+          v-hasPermi="['system:materials:edit']"
+        >鎵归噺鎺堟潈</el-button>
+      </el-col>
         <el-col v-if="userId==1" :span="1.5">
         <el-button
           type="warning"
@@ -898,6 +907,45 @@
         <el-button @click="cancel">鍙� 娑�</el-button>
       </div>
     </el-dialog>
+
+
+
+
+    <!-- 鎺堟潈鐢ㄦ埛 -->
+     <el-dialog title="閫夋嫨鐢ㄦ埛" :visible.sync="visibleUser" width="800px" top="5vh" append-to-body>
+
+       <el-row>
+         <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSingleSelection"
+    height="260px">
+           <el-table-column type="selection" width="55"></el-table-column>
+           <el-table-column label="鐢ㄦ埛鍚嶇О" prop="userName" :show-overflow-tooltip="true" />
+           <el-table-column label="鐢ㄦ埛鏄电О" prop="nickName" :show-overflow-tooltip="true" />
+           <el-table-column label="閭" prop="email" :show-overflow-tooltip="true" />
+           <el-table-column label="鎵嬫満" prop="phonenumber" :show-overflow-tooltip="true" />
+      <!--     <el-table-column label="鐘舵��" align="center" prop="status">
+             <template slot-scope="scope">
+               <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+             </template>
+           </el-table-column> -->
+           <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
+             <template slot-scope="scope">
+               <span>{{ parseTime(scope.row.createTime) }}</span>
+             </template>
+           </el-table-column>
+         </el-table>
+         <pagination
+           v-show="totalUser>0"
+           :total="totalUser"
+           :page.sync="queryParamsUser.pageNum"
+           :limit.sync="queryParamsUser.pageSize"
+           @pagination="getUserList"
+         />
+       </el-row>
+       <div slot="footer" class="dialog-footer">
+         <el-button type="primary" @click="handleSelectUser">纭� 瀹�</el-button>
+         <el-button @click="visibleUser = false">鍙� 娑�</el-button>
+       </div>
+     </el-dialog>
   </div>
 </template>
 
@@ -912,6 +960,9 @@
 import { listAllProjectName } from "@/api/system/projectName"
 import { listPlaceName, listAllPlaceName } from "@/api/system/placeName"
 import { judge } from "@/api/system/materials"
+import { UserRoleIdList,unallocatedUserList, authUserSelectAll } from "@/api/system/role"
+import {authManyRecordsToUsers}  from "@/api/system/archiverecordstouser"
+
 export default {
      components: {
         VueOfficeExcel
@@ -919,6 +970,18 @@
   name: "Records",
   data() {
     return {
+      totalUser: 0,
+      visibleUser:false,
+      userList:[],
+      // 閫変腑鏁扮粍鍊�
+      userIds: [],
+      queryParamsUser: {
+        pageNum: 1,
+        pageSize: 10,
+        roleId: undefined,
+        archiveRecordsId: undefined,
+
+      },
       showExcelPreview: false,
                   excel: 'http://localhost:8080/profile/upload/12.xls', //璁剧疆鏂囨。缃戠粶鍦板潃锛屽彲浠ユ槸鐩稿鍦板潃
 
@@ -1063,6 +1126,7 @@
     this.fetchProjectOptions()
     this.fetchProjectCompanyOptions()
 this.getList()
+
   },
   watch: {
     'form.constructionUnit': {
@@ -1095,6 +1159,62 @@
     }
   },
   methods: {
+    /** 閫夋嫨鎺堟潈鐢ㄦ埛鎿嶄綔 */
+    handleSelectUser() {
+    //  const archiveRecordsId = this.queryParams.archiveRecordsId
+      const userIds = this.userIds.join(",")
+     // const aids = this.ids.join(",")
+    //  alert(aids)
+      if (userIds == "") {
+        this.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛")
+        return
+      }
+
+      // 鍒涘缓杞崲鍚庣殑鍙傛暟锛岀‘淇漴ecordId鏄暟瀛楃被鍨�
+     // const convertedRecordId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
+    const convertedRecordId = this.ids.join(",")
+    if (convertedRecordId == "") {
+      this.$modal.msgError("璇烽�夋嫨鐩稿簲鐨勬鍗�")
+      return
+    }
+      authManyRecordsToUsers({ recordIds: convertedRecordId, userIds: userIds }).then(res => {
+        if(res.code === 200) {
+          this.$modal.msgSuccess(res.msg)
+          this.visibleUser = false
+        //  this.$emit("ok")
+        } else {
+          this.$modal.msgError(res.msg || "鎺堟潈澶辫触锛屽凡缁忔巿鏉冭繃浜�")
+        }
+      })
+    },
+    clickRow(row) {
+      this.$refs.table.clearSelection();
+    this.$refs.table.toggleRowSelection(row);
+    },
+    // 鏇挎崲鍘熸湁鐨刪andleSelectionChange鏂规硶
+    handleSingleSelection(selection) {
+      if (selection.length > 1) {
+        this.$refs.table.clearSelection();
+        this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
+      }
+      else
+      this.userIds = selection.map(item => item.userId);
+    },
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.userIds = selection.map(item => item.userId)
+    },
+    // 鏌ヨ琛ㄦ暟鎹�
+    getUserList() {
+      this.queryParamsUser.roleId = 2
+      UserRoleIdList(this.queryParamsUser).then(res => {
+        console.log("=------00000000009")
+        console.log(res)
+
+        this.userList = res.rows
+        this.totalUser = res.total
+      })
+    },
       /** Excel娓叉煋瀹屾垚澶勭悊 */
         renderedHandler() {
             console.log("Excel娓叉煋瀹屾垚");
@@ -1443,7 +1563,7 @@
   if(this.recordTypeOptions.length > 0) {
       const recordParts = response.data.recordId.split('-')
       this.$set(this.form, 'recordType', recordParts[0])
-      if(this.recordTypeOptions.length==4)
+      if(recordParts.length==4)
       {
         this.$set(this.form, 'recordZone', recordParts[1])
 
@@ -1459,6 +1579,16 @@
         this.open = true
         this.title = "淇敼妗f璁板綍"
       })
+    },
+    /*鎵归噺鎺堟潈*/
+    handleGivePermission()
+    {
+      if (this.ids.length === 0) {
+        this.$modal.msgWarning('璇烽�夋嫨瑕佹巿鏉冪殑妗f璁板綍')
+        return
+      }
+      this.visibleUser = true
+      this.getUserList()
     },
     /** 鎵归噺鎻愪氦 */
     handleBatchSubmit() {
@@ -1499,8 +1629,9 @@
   this.form = response.data
   if(this.recordTypeOptions.length > 0) {
       const recordParts = response.data.recordId.split('-')
+
       this.$set(this.form, 'recordType', recordParts[0])
-      if(this.recordTypeOptions.length==4)
+      if(recordParts.length==4)
       {
             this.$set(this.form, 'recordZone', recordParts[1])
 

--
Gitblit v1.9.1