From accebdce93486d3b4f26e55ffdea047549cce20c Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期一, 28 七月 2025 21:12:38 +0800
Subject: [PATCH] Merge branch 'master' of http://125.76.225.53:18448/r/xhj/vue_mdc_xhj

---
 src/views/mdc/base/modules/EquipmentList/UserRecycleBinModal.vue |  194 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 194 insertions(+), 0 deletions(-)

diff --git a/src/views/mdc/base/modules/EquipmentList/UserRecycleBinModal.vue b/src/views/mdc/base/modules/EquipmentList/UserRecycleBinModal.vue
new file mode 100644
index 0000000..921a3ed
--- /dev/null
+++ b/src/views/mdc/base/modules/EquipmentList/UserRecycleBinModal.vue
@@ -0,0 +1,194 @@
+<template>
+  <a-modal
+    :width="1000"
+    :title="title"
+    :visible="innerVisible"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴"
+    :okButtonProps="{style:{display:'none'}}"
+  >
+    <a-alert type="info" showIcon style="margin-bottom: 16px;">
+      <template slot="message">
+        <span>宸查�夋嫨</span>
+        <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
+        <span>椤�</span>
+        <template v-if="selectedRowKeys.length>0">
+          <a-divider type="vertical"/>
+          <a @click="handleClearSelection">娓呯┖閫夋嫨</a>
+          <a-divider type="vertical"/>
+          <a @click="handleRevertBatch">鎵归噺杩樺師</a>
+          <a-divider type="vertical"/>
+          <a @click="handleDeleteBatch">鎵归噺鍒犻櫎</a>
+        </template>
+      </template>
+    </a-alert>
+
+    <a-table
+      ref="table"
+      rowKey="id"
+      size="middle"
+      bordered
+      :columns="columns"
+      :loading="loading"
+      :dataSource="dataSource"
+      :pagination="false"
+      :rowSelection="{selectedRowKeys, onChange: handleTableSelectChange}"
+    >
+
+      <!-- 鏄剧ず澶村儚 -->
+      <template slot="avatarslot" slot-scope="text, record, index">
+        <div class="anty-img-wrap">
+          <a-avatar shape="square" :src="url.getAvatar(record.avatar)" icon="user"/>
+        </div>
+      </template>
+
+      <span slot="action" slot-scope="text, record">
+        <a @click="handleRevert([record.id])"><a-icon type="redo"/> 杩樺師鐢ㄦ埛</a>
+        <a-divider type="vertical"/>
+        <a @click="handleDelete([record.id])"><a-icon type="delete"/> 褰诲簳鍒犻櫎</a>
+      </span>
+    </a-table>
+
+  </a-modal>
+</template>
+
+<script>
+  import { putAction,deleteAction,getFileAccessHttpUrl } from "@/api/manage"
+
+  // 楂樺害灏佽鐨勮姹傦紝璇峰姟蹇呬娇鐢� superRequest.call(this,{}) 鐨勬柟寮忚皟鐢�
+  function superRequest(options) {
+    this.loading = !!options.loading
+    options.promise.then(res => {
+      if (res.success && typeof options.success === 'function') {
+        options.success(res)
+      } else {
+        throw new Error(res.message)
+      }
+    }).catch(e => {
+      console.error('鏌ヨ宸插垹闄ょ殑鐢ㄦ埛澶辫触锛�', e)
+      this.$message.warning('鏌ヨ宸插垹闄ょ殑鐢ㄦ埛澶辫触锛�' + (e.message || e))
+    }).finally(() => {
+      this.loading = false
+    })
+  }
+
+  export default {
+    name: 'UserRecycleBinModal',
+    props: {
+      visible: {
+        type: Boolean,
+        default: false
+      },
+    },
+    data() {
+      return {
+        title: '鐢ㄦ埛鍥炴敹绔�',
+        loading: false,
+        innerVisible: false,
+        selectedRowKeys: [],
+        dataSource: [],
+        columns: [
+          { title: '#', align: 'center', key: 'rowIndex', width: 80, customRender: (t, r, i) => i + 1 },
+          { title: '璐﹀彿', align: 'center', dataIndex: 'username' },
+          { title: '濮撳悕', align: 'center', dataIndex: 'realname', },
+          { title: '澶村儚', align: 'center', dataIndex: 'avatar', scopedSlots: { customRender: 'avatarslot' } },
+          { title: '閮ㄩ棬', align: 'center', dataIndex: 'orgCode' },
+          { title: '杞﹂棿', align: 'center', dataIndex: 'productionName' },
+          { title: '鎿嶄綔', align: 'center', dataIndex: 'action', width: 200, scopedSlots: { customRender: 'action' } }
+        ],
+        url: {
+          getAvatar: (path) => getFileAccessHttpUrl(`${path}`),
+          // 鍥炴敹绔欐搷浣滐紝get = 鑾峰彇鍒楄〃锛沺ut = 鍙栧洖锛沝elete = 褰诲簳鍒犻櫎
+          recycleBin: '/sys/user/recycleBin',
+          putRecycleBin: '/sys/user/putRecycleBin',
+          deleteRecycleBin: '/sys/user/deleteRecycleBin',
+        },
+      }
+    },
+    watch: {
+      visible: {
+        immediate: true,
+        handler(val) {
+          if (val) {
+            this.loadData()
+          }
+          this.innerVisible = val
+        }
+      },
+      innerVisible(val) {
+        this.$emit('update:visible', val)
+      },
+    },
+    methods: {
+      loadData() {
+        superRequest.call(this, {
+          loading: true,
+          promise: this.$http.get(this.url.recycleBin),
+          success: res => this.dataSource = res.result
+        })
+      },
+      handleOk() {
+        this.loadData()
+        this.$emit('ok')
+      },
+      handleCancel() {
+        this.innerVisible = false
+      },
+      // 杩樺師鐢ㄦ埛
+      handleRevert(userIds) {
+        this.$confirm({
+          title: '鎭㈠鐢ㄦ埛',
+          content: `鎮ㄧ‘瀹氳鎭㈠杩� ${userIds.length} 涓敤鎴峰悧锛焋,
+          centered: true,
+          onOk: () => {
+            putAction(this.url.putRecycleBin,{userIds:userIds.join(',')}).then((res)=>{
+              if(res.success){
+                this.handleOk()
+                this.handleClearSelection()
+                this.$message.success(`杩樺師 ${userIds.length} 涓敤鎴锋垚鍔燂紒`)
+              }
+            })
+          }
+        })
+      },
+      // 褰诲簳鍒犻櫎鐢ㄦ埛
+      handleDelete(userIds) {
+        this.$confirm({
+          title: '褰诲簳鍒犻櫎鐢ㄦ埛',
+          content: (<div>
+            <p>鎮ㄧ‘瀹氳褰诲簳鍒犻櫎杩� {userIds.length} 涓敤鎴峰悧锛�</p>
+            <p style="color:red;">娉ㄦ剰锛氬交搴曞垹闄ゅ悗灏嗘棤娉曟仮澶嶏紝璇疯皑鎱庢搷浣滐紒</p>
+          </div>),
+          centered: true,
+          onOk: () => {
+            var that = this;
+            deleteAction(that.url.deleteRecycleBin, {userIds: userIds.join(',')}).then((res) => {
+              if (res.success) {
+                this.loadData()
+                this.handleClearSelection()
+                this.$message.success(`褰诲簳鍒犻櫎 ${userIds.length} 涓敤鎴锋垚鍔燂紒`)
+              } else {
+                that.$message.warning(res.message);
+              }
+            });
+          },
+        })
+      },
+      handleRevertBatch() {
+        this.handleRevert(this.selectedRowKeys)
+      },
+      handleDeleteBatch() {
+        this.handleDelete(this.selectedRowKeys)
+      },
+      handleClearSelection() {
+        this.handleTableSelectChange([], [])
+      },
+      handleTableSelectChange(selectedRowKeys, selectionRows) {
+        this.selectedRowKeys = selectedRowKeys
+        this.selectionRows = selectionRows
+      },
+    }
+  }
+</script>
+
+<style lang="less" scoped></style>
\ No newline at end of file

--
Gitblit v1.9.3