From d9377fa99b4d8fff9359d27459214d12d2784d4f Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期一, 28 七月 2025 23:59:42 +0800 Subject: [PATCH] update --- src/views/base/modules/factoryManager/SelectUserModal.vue | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 288 insertions(+), 0 deletions(-) diff --git a/src/views/base/modules/factoryManager/SelectUserModal.vue b/src/views/base/modules/factoryManager/SelectUserModal.vue new file mode 100644 index 0000000..ee1d373 --- /dev/null +++ b/src/views/base/modules/factoryManager/SelectUserModal.vue @@ -0,0 +1,288 @@ +<template> + <div> + <a-modal + centered + :title="title" + :width="1000" + :visible="visible" + :maskClosable="false" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + + <a-col :span="10"> + <a-form-item label="鐢ㄦ埛璐﹀彿"> + <a-input placeholder="璇疯緭鍏ョ敤鎴疯处鍙�" v-model="queryParam.username"></a-input> + </a-form-item> + </a-col> + <a-col :span="8"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </span> + </a-col> + + </a-row> + </a-form> + </div> + <!-- table鍖哄煙-begin --> + <div> + <a-table + size="small" + bordered + rowKey="id" + :columns="columns1" + :dataSource="dataSource1" + :pagination="ipagination" + :loading="loading" + :scroll="{ y: 240 }" + :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}" + @change="handleTableChange"> + + </a-table> + </div> + <!-- table鍖哄煙-end --> + + + </a-modal> + </div> +</template> + +<script> + import {filterObj} from '@/utils/util' + import {getAction} from '@/api/manage' + + export default { + name: "SelectUserModal", + data() { + return { + title: "娣诲姞浜х嚎浜哄憳", + names: [], + visible: false, + placement: 'right', + description: '', + // 鏌ヨ鏉′欢 + queryParam: {}, + // 琛ㄥご + columns1: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 50, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '鐢ㄦ埛璐﹀彿', + align: "center", + width: 100, + dataIndex: 'username' + }, + { + title: '鐢ㄦ埛鍚嶇О', + align: "center", + width: 100, + dataIndex: 'realname' + }, + { + title: '鎬у埆', + align: "center", + width: 100, + dataIndex: 'sex_dictText' + }, + { + title: '鐢佃瘽', + align: "center", + width: 100, + dataIndex: 'phone' + }, + { + title: '閮ㄩ棬', + align: "center", + width: 150, + dataIndex: 'orgCode' + } + ], + columns2: [ + { + title: '鐢ㄦ埛璐﹀彿', + align: "center", + dataIndex: 'username', + + }, + { + title: '鐢ㄦ埛鍚嶇О', + align: "center", + dataIndex: 'realname', + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: "center", + width: 100, + scopedSlots: {customRender: 'action'}, + } + ], + //鏁版嵁闆� + dataSource1: [], + dataSource2: [], + // 鍒嗛〉鍙傛暟 + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + isorter: { + column: 'createTime', + order: 'desc', + }, + loading: false, + selectedRowKeys: [], + selectedRows: [], + url: { + list: "/sys/user/list", + } + } + }, + created() { + this.loadData(); + }, + methods: { + searchQuery() { + this.loadData(1); + }, + searchReset() { + this.queryParam = {}; + this.loadData(1); + }, + handleCancel() { + this.visible = false; + }, + handleOk() { + this.dataSource2 = this.selectedRowKeys; + console.log("data:" + this.dataSource2); + this.$emit("selectFinished", this.dataSource2); + this.visible = false; + }, + add() { + this.visible = true; + }, + loadData(arg) { + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource1 = res.result.records; + this.ipagination.total = res.result.total; + } + }) + }, + getQueryParams() { + var param = Object.assign({}, this.queryParam, this.isorter); + param.field = this.getQueryField(); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + return filterObj(param); + }, + getQueryField() { + //TODO 瀛楁鏉冮檺鎺у埗 + }, + onSelectAll(selected, selectedRows, changeRows) { + if (selected === true) { + for (var a = 0; a < changeRows.length; a++) { + this.dataSource2.push(changeRows[a]); + } + } else { + for (var b = 0; b < changeRows.length; b++) { + this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1); + } + } + // console.log(selected, selectedRows, changeRows); + }, + onSelect(record, selected) { + if (selected === true) { + this.dataSource2.push(record); + } else { + var index = this.dataSource2.indexOf(record); + //console.log(); + if (index >= 0) { + this.dataSource2.splice(this.dataSource2.indexOf(record), 1); + } + + } + }, + onSelectChange(selectedRowKeys, selectedRows) { + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectedRows; + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + }, + handleDelete: function (record) { + this.dataSource2.splice(this.dataSource2.indexOf(record), 1); + }, + handleTableChange(pagination, filters, sorter) { + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + console.log(sorter); + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" + } + this.ipagination = pagination; + this.loadData(); + } + } + } +</script> +<style lang="less" scoped> + .ant-card-body .table-operator { + margin-bottom: 18px; + } + + .ant-table-tbody .ant-table-row td { + padding-top: 15px; + padding-bottom: 15px; + } + + .anty-row-operator button { + margin: 0 5px + } + + .ant-btn-danger { + background-color: #ffffff + } + + .ant-modal-cust-warp { + height: 100% + } + + .ant-modal-cust-warp .ant-modal-body { + height: calc(100% - 110px) !important; + overflow-y: auto + } + + .ant-modal-cust-warp .ant-modal-content { + height: 90% !important; + overflow-y: hidden + } +</style> \ No newline at end of file -- Gitblit v1.9.3