From 697082adae9e0225bf5ab20b33353970dd8b3f3a Mon Sep 17 00:00:00 2001 From: zhuzhuanzhuan Date: 星期一, 04 三月 2024 16:59:31 +0800 Subject: [PATCH] 1、用户管理页面表单填写界面新增选择设备功能 2、避免命名冲突,更改原选择设备组件名称为selectDeviceDrawer,用户管理页面选择设备组件名称为selectDeviceModal --- src/views/system/modules/SelectDeviceModal.vue | 304 ++++++++++++-------------------------------------- 1 files changed, 74 insertions(+), 230 deletions(-) diff --git a/src/views/system/modules/SelectDeviceModal.vue b/src/views/system/modules/SelectDeviceModal.vue index f91e1d4..4b28bc2 100644 --- a/src/views/system/modules/SelectDeviceModal.vue +++ b/src/views/system/modules/SelectDeviceModal.vue @@ -1,65 +1,26 @@ <template> - <div> - <a-drawer - :title="title" - :visible="visible" - width="650" - @ok="handleOk" - @close="handleCancel" - > + <a-modal + :title="title" + :visible="visible" + @ok="handleOk" + @cancel="handleCancel" + > - <!--<!– 鏌ヨ鍖哄煙 –>--> - <!--<div class="table-page-search-wrapper">--> - <!--<a-form layout="inline" @keyup.enter.native="searchQuery">--> - <!--<a-row :gutter="24">--> + <a-spin :spinning="loading"> + <!-- showLine --> + <a-form> + <a-form-item label="杞﹂棿灞傜骇锛�"> + <a-tree showLine ref="tree" :expandedKeys.sync="expandedKeys" + :treeData="treeDataSource" checkable @check="onCheck" v-model="checkedKeys" + @expand="onExpand"> + </a-tree> + </a-form-item> + </a-form> - <!--<a-col :span="10">--> - <!--<a-form-item label="璁惧鍚嶇О">--> - <!--<a-input placeholder="璇疯緭鍏ヨ澶囧悕绉�" v-model="queryParam.equipmentName"></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-spin> - <!--</a-row>--> - <!--</a-form>--> - <!--</div>--> - <!--<!– table鍖哄煙-begin –>--> - <!--<div>--> - <!--<a-table--> - <!--size="small"--> - <!--bordered--> - <!--rowKey="equipmentId"--> - <!--: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-spin :spinning="loading"> - <!-- showLine --> - <a-form> - <a-form-item label="杞﹂棿灞傜骇锛�"> - <a-tree showLine ref="tree" :expandedKeys.sync="expandedKeys" - :treeData="treeDataSource" checkable @check="onCheck" v-model="checkedKeys" - @expand="onExpand"> - </a-tree> - </a-form-item> - </a-form> - - </a-spin> - - - <div class="drawer-bottom-button"> + <template slot="footer"> + <div> <a-dropdown style="float: left" :trigger="['click']" @@ -84,14 +45,12 @@ >纭畾 </a-button> </div> + </template> - </a-drawer> - </div> + </a-modal> </template> <script> - // import { filterObj } from '@/utils/util' - // import { getAction } from '@/api/manage' import { getAction, postAction, @@ -99,7 +58,6 @@ } from '@/api/manage' import BaseTree from '@/views/mdc/common/BaseTree' import DepartTree from '@/views/mdc/base/modules/DepartList/DepartListTree/DepartTree' - import { mapActions } from 'vuex' export default { name: 'SelectDeviceModal', @@ -115,122 +73,83 @@ }, title: { type: String + }, + selectedProduction: { + type: String } }, data() { return { - cardLoading: false, loading: false, treeDataSource: [], expandedKeys: [], checkedKeys: [], url: { - getBaseTree: '/mdc/mdcEquipment/queryTreeListByProduction' + getDeviceTree: '/mdc/mdcEquipment/loadTreeListByProductionIds' }, + selectedWorkshopIds: '', dataList: [], allTreeKeys: [], visible: false, dataSource: [] - - // names: [], - // 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: 'equipmentId' - // }, - // { - // title: '璁惧鍚嶇О', - // align: 'center', - // width: 100, - // dataIndex: 'equipmentName' - // }, - // { - // title: '璁惧绫诲瀷', - // align: 'center', - // width: 100, - // dataIndex: 'equipmentType' - // }, - // { - // title: '椹卞姩绫诲瀷', - // align: 'center', - // width: 100, - // dataIndex: 'driveType' - // } - // ], - // //鏁版嵁闆� - // 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 - // }, - // loading: false, - // selectedRowKeys: [], - // selectedRows: [], - // url: { - // list: '/mdc/mdcEquipment/list' - // }, - // activeKey: '1', - // isDepartType: '' } }, created() { - // this.loadData() - this.queryTreeData() this.closeAll() }, methods: { - ...mapActions(['QueryProduction']), - onExpand(expandedKeys) { this.expandedKeys = expandedKeys this.autoExpandParent = false }, - - queryTreeData() { + queryTreeData(value) { + // this.loading = true + // this.cardLoading = true + // this.QueryProduction().then(res => { + // if (res.success) { + // this.dataList = [] + // this.allTreeKeys = [] + // this.getTreeDataSouce(res.result) + // this.treeDataSource = res.result + // this.generateList(this.treeDataSource) + // console.log('treeDataSource', this.treeDataSource) + // this.expandedKeys = this.allTreeKeys + // } else { + // this.$message.warn(res.message) + // } + // }).finally(() => { + // this.loading = false + // this.cardLoading = false + // }) this.loading = true - this.cardLoading = true - this.QueryProduction().then(res => { - if (res.success) { - this.dataList = [] - this.allTreeKeys = [] - this.getTreeDataSouce(res.result) - this.treeDataSource = res.result - this.generateList(this.treeDataSource) - console.log('treeDataSource', this.treeDataSource) - this.expandedKeys = this.allTreeKeys - } else { - this.$message.warn(res.message) - } - }).finally(() => { - this.loading = false - this.cardLoading = false - }) + this.selectedWorkshopIds = value + getAction(this.url.getDeviceTree, { ids: value }) + .then(res => { + console.log('res===============', res) + if (res.success) { + this.dataList = [] + this.allTreeKeys = [] + this.getTreeDataSouce(res.result) + this.treeDataSource = res.result + this.generateList(this.treeDataSource) + console.log('treeDataSource', this.treeDataSource) + this.expandedKeys = this.allTreeKeys + } else { + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .catch(err => { + this.$notification.error({ + message: '娑堟伅', + description: err.message + }) + }) + .finally(() => { + this.loading = false + }) }, generateList(data) { @@ -265,7 +184,7 @@ this.expandedKeys = ['-1'] }, refreshTree() { - this.queryTreeData() + this.queryTreeData(this.selectedWorkshopIds) }, onCheck(value, obj) { this.checkedKeys = value @@ -280,81 +199,6 @@ this.$emit('selectFinished', this.deviceNodes) 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) { - // console.log(this.selectedRowKeys) - // 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) { - // console.log('selectedRowKeys', selectedRowKeys) - // 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() - // }, - } } -- Gitblit v1.9.3