¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal width="75%" :title="title" :visible="visible" @cancel="visible=false" :maskClosable="false" centered |
| | | @ok="handleAssignDocumentToDevice"> |
| | | <div class="tabs-container"> |
| | | <div style="width: 72%"> |
| | | <a-tabs> |
| | | <a-tab-pane tab="ææ¡£å表"> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | <a-col :md="7" :sm="7"> |
| | | <a-form-item label="æä»¶åç§°"> |
| | | <a-input placeholder="请è¾å
¥æä»¶åç§°" v-model="queryParam.docName" allow-clear></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="11" :sm="11"> |
| | | <a-form-item label="ä¸ä¼ æ¶é´"> |
| | | <a-range-picker v-model="date" value-format="YYYY-MM-DD" |
| | | @change="handleDateChange" allow-clear></a-range-picker> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="7" :sm="7"> |
| | | <a-form-item label="èç¹åç§°"> |
| | | <a-input placeholder="请è¾å
¥èç¹åç§°" v-model="queryParam.treeName" allow-clear></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="7" :sm="7"> |
| | | <a-form-item label="èç¹ä»£å·"> |
| | | <a-input placeholder="请è¾å
¥èç¹ä»£å·" v-model="queryParam.treeCode" allow-clear></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="7" :sm="7"> |
| | | <a-form-item label="æè´¨"> |
| | | <a-input placeholder="请è¾å
¥æè´¨" v-model="queryParam.structureType" allow-clear></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="4" :sm="4"> |
| | | <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | |
| | | |
| | | <a-table :columns="columns" :data-source="dataSource" bordered :pagination="false" :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys,selectedRows:selectionRows, onChange: onSelectChange}" |
| | | @change="handleTableChange" |
| | | :scroll="{y:456}" :size="size" rowKey="docId"> |
| | | |
| | | </a-table> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </div> |
| | | |
| | | <div style="width: 25%"> |
| | | <a-tabs> |
| | | <a-tab-pane tab="设å¤å表"> |
| | | <a-spin :spinning="spinning"> |
| | | <div style="display: flex;flex-direction: column;"> |
| | | <div style="display: flex"> |
| | | <a-input placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" allowClear v-model="searchInput" |
| | | @change="handleSearchInputChange"/> |
| | | <a-button type="primary" @click="isExpandAllTreeNode=!isExpandAllTreeNode" style="margin: 0 8px"> |
| | | å±å¼/æå |
| | | </a-button> |
| | | </div> |
| | | |
| | | <!--产åç»ææ --> |
| | | <div style="overflow:auto;margin-top: 10px;height: 400px"> |
| | | <a-tree blockNode checkable :checkedKeys="checkedKeys" :expandedKeys.sync="expandedKeys" |
| | | :autoExpandParent="autoExpandParent" @select="handleTreeNodeSelect" |
| | | :treeData="treeDataSource" @check="handleTreeNodeCheck" @expand="handleTreeNodeExpand"> |
| | | <template slot="title" slot-scope="{ title, parentId, entity, key:treeKey,type}"> |
| | | <span v-if="title.indexOf(searchValue) > -1">{{ title.substr(0, title.indexOf(searchValue)) }}<span |
| | | class="replaceSearch">{{ |
| | | searchValue |
| | | }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}</span> |
| | | <span v-else>{{ title }}</span> |
| | | </template> |
| | | </a-tree> |
| | | </div> |
| | | |
| | | <div> |
| | | <a-form> |
| | | <a-form-item label="ææ´¾åå "> |
| | | <a-textarea v-model="queryParam.applyReason" rows="3" style="resize: none"></a-textarea> |
| | | </a-form-item> |
| | | </a-form> |
| | | </div> |
| | | </div> |
| | | </a-spin> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </div> |
| | | </div> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | import dncApi from '@/api/dnc' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | |
| | | export default { |
| | | name: 'NcDocumentAssignModal', |
| | | components: {}, |
| | | mixins: [JeecgListMixin], |
| | | props: { |
| | | currentDocumentInfo: { |
| | | type: Object |
| | | }, |
| | | size: { |
| | | type: String |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | disableMixinCreated: true, |
| | | visible: false, |
| | | title: '', |
| | | columns: [ |
| | | { |
| | | title: 'åºå·', |
| | | dataIndex: 'rowIndex', |
| | | key: 'rowIndex', |
| | | width: 50, |
| | | align: 'center', |
| | | customRender: function(t, r, index) { |
| | | return parseInt(index) + 1 |
| | | } |
| | | }, |
| | | { |
| | | title: 'èç¹åç§°', |
| | | dataIndex: 'nodeName', |
| | | align: 'center', |
| | | width: 80, |
| | | sorter: false |
| | | }, |
| | | { |
| | | title: 'èç¹ä»£å·', |
| | | dataIndex: 'nodeCode', |
| | | align: 'center', |
| | | width: 80, |
| | | sorter: false |
| | | }, |
| | | { |
| | | title: 'æä»¶åç§°', |
| | | dataIndex: 'docName', |
| | | key: 'docName', |
| | | align: 'center', |
| | | width: 200, |
| | | sorter: true |
| | | }, |
| | | { |
| | | title: 'åºåºç¶æ', |
| | | dataIndex: 'pullStatus_dictText', |
| | | key: 'pullStatus', |
| | | align: 'center', |
| | | width: 100, |
| | | filters: [ |
| | | { text: 'æªåºåº', value: 1 }, |
| | | { text: 'å·²åºåº', value: 2 } |
| | | ] |
| | | }, |
| | | { |
| | | title: 'ç¶ æ', |
| | | dataIndex: 'docDispatchStatus_dictText', |
| | | key: 'docDispatchStatus', |
| | | align: 'center', |
| | | width: 60, |
| | | filters: [ |
| | | { text: 'ç¼å¶', value: 1 }, |
| | | { text: 'æ ¡å¯¹', value: 2 }, |
| | | { text: 'æ¹å', value: 3 }, |
| | | { text: 'è¯å', value: 4 }, |
| | | { text: 'å®å', value: 5 } |
| | | ] |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | dataIndex: 'createTime', |
| | | align: 'center', |
| | | width: 150, |
| | | sorter: true |
| | | } |
| | | ], |
| | | searchValue: '', |
| | | searchInput: '', |
| | | spinning: false, |
| | | treeDataSource: [], |
| | | allTreeKeys: [], |
| | | checkedKeys: [], |
| | | expandedKeys: [], |
| | | autoExpandParent: true, |
| | | isExpandAllTreeNode: true, |
| | | date: [], |
| | | url: { |
| | | list: '/nc/product/query' |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | | visible: { |
| | | handler(value) { |
| | | if (value) { |
| | | this.resetData() |
| | | this.loadData() |
| | | this.getDocumentAssignDeviceTreeByApi() |
| | | } |
| | | } |
| | | }, |
| | | isExpandAllTreeNode: { |
| | | handler(value) { |
| | | if (value) this.expandedKeys = this.allTreeKeys |
| | | else this.expandedKeys = [] |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) |
| | | }, |
| | | methods: { |
| | | handleSearch() { |
| | | this.visible = true |
| | | }, |
| | | // è·åå½åå¯¹åºææ¡£å表 |
| | | loadData() { |
| | | this.dataSource = [] |
| | | if (!this.url.list) { |
| | | this.$message.error('请设置url.list屿§!') |
| | | return |
| | | } |
| | | var params = this.getQueryParams()//æ¥è¯¢æ¡ä»¶ |
| | | if (!params) return false |
| | | params.attributionType = this.currentDocumentInfo.type |
| | | params.attributionId = this.currentDocumentInfo.key |
| | | this.loading = true |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) this.dataSource = res.result |
| | | else this.$message.warning(res.message) |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | |
| | | // è·åDNCè®¾å¤æ |
| | | getDocumentAssignDeviceTreeByApi() { |
| | | this.spinning = true |
| | | this.treeDataSource = [] |
| | | dncApi.getDeviceTreeDataApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.dataList = [] |
| | | this.allTreeKeys = [] |
| | | this.treeDataSource = res.result |
| | | this.generateList(this.treeDataSource) |
| | | this.expandedKeys = this.allTreeKeys |
| | | } else { |
| | | this.$message.warn(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.spinning = false |
| | | }) |
| | | }, |
| | | |
| | | // æ¶é´éæ©å¨éæ©å®æå触å |
| | | handleDateChange(value) { |
| | | this.queryParam.startTime = value[0] |
| | | this.queryParam.endTime = value[1] |
| | | }, |
| | | |
| | | /** |
| | | * è¡¨æ ¼å页ãæåºæ¹åãçéæ¶è§¦å |
| | | * @param pagination å页å¨é项 |
| | | * @param filters çéé项 |
| | | * @param sorter æåºé项 |
| | | */ |
| | | handleTableChange(pagination, filters, sorter) { |
| | | if (sorter.order) { |
| | | this.isorter.column = sorter.field |
| | | this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc' |
| | | } else { |
| | | this.isorter.column = 'createTime' |
| | | this.isorter.order = 'desc' |
| | | } |
| | | for (let key in filters) { |
| | | this.filters[key] = filters[key].join(',') |
| | | } |
| | | this.loadData() |
| | | }, |
| | | |
| | | // ææ´¾å°è®¾å¤çªå£ç¹å»ç¡®å®ææ´¾è®¾å¤å触å |
| | | handleAssignDocumentToDevice() { |
| | | const { |
| | | checkedKeys, |
| | | selectedRowKeys, |
| | | selectionRows, |
| | | dataList, |
| | | $confirm, |
| | | $notification, |
| | | currentDocumentInfo, |
| | | queryParam: { applyReason }, |
| | | $destroyAll, |
| | | $bus |
| | | } = this |
| | | const { attributionId, attributionType } = currentDocumentInfo |
| | | const paramsArray = [] |
| | | // è¿æ»¤è½¦é´keyä»
æ¾å
¥è®¾å¤key |
| | | const treeCheckedDeviceKeys = [] |
| | | checkedKeys.forEach(checkedKey => { |
| | | const device = dataList.find(item => item.key === checkedKey && item.type === 2) |
| | | if (device) treeCheckedDeviceKeys.push(device.key) |
| | | }) |
| | | |
| | | if (treeCheckedDeviceKeys.length === 0 || selectedRowKeys.length === 0) { |
| | | $notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: 'è¯·éæ©è®¾å¤æææ¡£' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | $confirm({ |
| | | title: 'æç¤º', |
| | | content: `确认æäº¤åï¼`, |
| | | okText: '确认', |
| | | cancelText: 'åæ¶', |
| | | onOk: () => { |
| | | // åé循ç¯ç¡®å®æ¯ä¸ç»è®¾å¤ä¸ææ¡£çåæ° |
| | | treeCheckedDeviceKeys.forEach(deviceId => { |
| | | selectionRows.forEach(({ docId, publishFileId ,attributionId,attributionType}) => { |
| | | paramsArray.push({ |
| | | docId, |
| | | deviceId, |
| | | fileId: publishFileId, |
| | | attributionId, |
| | | attributionType, |
| | | applyReason |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | paramsArray.forEach(item => { |
| | | dncApi.assignDocumentToDeviceApi(item) |
| | | .then(res => { |
| | | if (res.success) { |
| | | $bus.$emit('reloadMainBottomTableData', 'useDocumentEquipment') |
| | | $notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } else { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: err.message |
| | | }) |
| | | }) |
| | | .finally(() => { |
| | | $destroyAll() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel: () => { |
| | | $destroyAll() |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /* è¾å
¥æ¥è¯¢å
容ååæ¶è§¦å */ |
| | | handleSearchInputChange() { |
| | | let search = this.searchInput |
| | | console.log('data', this.dataList) |
| | | console.log('search', search) |
| | | let expandedKeys = this.dataList |
| | | .map(item => { |
| | | if (item.title != null) { |
| | | if (item.title.indexOf(search) > -1) { |
| | | return this.getParentKey(item.key, this.treeDataSource) |
| | | } |
| | | return null |
| | | } |
| | | }) |
| | | .filter((item, i, self) => item && self.indexOf(item) === i) |
| | | Object.assign(this, { |
| | | expandedKeys, |
| | | searchValue: search, |
| | | autoExpandParent: true |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æ èç¹å±å¼åå¹¶æ¶è§¦å |
| | | * @param expandedKeys å±å¼é¡¹key |
| | | */ |
| | | handleTreeNodeExpand(expandedKeys) { |
| | | this.expandedKeys = expandedKeys |
| | | this.autoExpandParent = false |
| | | }, |
| | | |
| | | /** |
| | | * æ èç¹å¤éæ¡é䏿¶è§¦å |
| | | * @param selectedKeys éä¸èç¹key |
| | | * @param {node} node èç¹å¯¹è±¡ |
| | | */ |
| | | handleTreeNodeCheck(checkedKeys, { node }) { |
| | | let record = node.dataRef |
| | | this.checkedKeys = checkedKeys |
| | | }, |
| | | |
| | | /** |
| | | * æ èç¹é䏿¶è§¦åï¼æ¨¡ææ èç¹å¤éæ¡é䏿¶çææï¼ |
| | | * @param selectedKeys éä¸èç¹key |
| | | * @param {node} node èç¹å¯¹è±¡ |
| | | */ |
| | | handleTreeNodeSelect(selectedKeys, { node }) { |
| | | node.$el.childNodes[1].click() |
| | | }, |
| | | |
| | | /** |
| | | * éå½è·å¾è¾å
¥é¡¹çç¶çº§key |
| | | * @param key å项key |
| | | * @param tree å项 |
| | | */ |
| | | getParentKey(key, tree) { |
| | | let parentKey |
| | | for (let i = 0; i < tree.length; i++) { |
| | | const node = tree[i] |
| | | if (node.children) { |
| | | if (node.children.some(item => item.key === key)) { |
| | | parentKey = node.key |
| | | console.log('parentKey', parentKey) |
| | | } else if ( |
| | | this.getParentKey(key, node.children)) { |
| | | parentKey = this.getParentKey(key, node.children) |
| | | } |
| | | } |
| | | } |
| | | return parentKey |
| | | }, |
| | | |
| | | /** |
| | | * éå½è·å¾æææ èç¹key |
| | | * @param data è®¾å¤æ æ°æ® |
| | | */ |
| | | generateList(data) { |
| | | for (let i = 0; i < data.length; i++) { |
| | | const node = data[i] |
| | | const key = node.key |
| | | const title = node.title |
| | | const type = node.type |
| | | this.dataList.push({ key, title, type }) |
| | | this.allTreeKeys.push(key) |
| | | if (node.children) this.generateList(node.children) |
| | | } |
| | | }, |
| | | |
| | | resetData() { |
| | | this.searchInput = '' |
| | | this.expandedKeys = [] |
| | | this.selectedRowKeys = [] |
| | | this.selectionRows = {} |
| | | this.checkedKeys = [] |
| | | this.filters = {} |
| | | this.isorter = Object.assign({}, this.defaultSorter) |
| | | }, |
| | | triggerCorrespondingMethod({ methodName, modalTitle }) { |
| | | if (this[methodName]) { |
| | | this[methodName]() |
| | | this.title = modalTitle |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | /deep/ .ant-modal { |
| | | .tabs-container { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | |
| | | .replaceSearch { |
| | | color: #40a9ff; |
| | | font-weight: bold; |
| | | background-color: rgb(204, 204, 204); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | ::-webkit-scrollbar { |
| | | width: 8px; |
| | | } |
| | | </style> |
| | |
| | | <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--æéé
置弹çª--> |
| | | <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--æ£ç´¢çµå模æ¿å¼¹çª--> |
| | | <NcDocumentSearchModal :currentDocumentInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--产åç»ææ åºæ¬å³é®èå(空ç½å¤è§¦å)--> |
| | | <ProductStructureBaseContextMenu ref="baseContextmenuRef"/> |
| | | </a-card> |
| | |
| | | import ProcessStepModal from './ProcessStep/ProcessStepModal' |
| | | import AssignPermissionModal from './Permission/AssignPermissionModal' |
| | | import DeviceCustomTypeModal from '@views/dnc/base/modules/ProductStructure/DeviceCustomType/DeviceCustomTypeModal.vue' |
| | | import ProductStructureBaseContextMenu |
| | | from '@views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue' |
| | | import ProductStructureBaseContextMenu from '@views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue' |
| | | import NcDocumentSearchModal from '@views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchModal.vue' |
| | | |
| | | export default { |
| | | name: 'ProductStructureTree', |
| | |
| | | PartModal, |
| | | ComponentModal, |
| | | ProductModal, |
| | | ProductStructureTreeContextMenu |
| | | ProductStructureTreeContextMenu, |
| | | NcDocumentSearchModal |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | { label: 'ç¼è¾äº§åä¿¡æ¯', code: 'product_edit', icon: 'edit', isCommonMethod: false }, |
| | | // { label: 'å¯¼åºææ¡£', code: 'product_export', icon: 'export', isCommonMethod: true }, |
| | | { label: '导å
¥å
¶ä»ææ¡£', code: 'product_import', icon: 'import', isCommonMethod: true }, |
| | | { label: 'æ£ç´¢çµåæ ·æ¿', code: 'product_search', icon: 'search', isCommonMethod: true }, |
| | | { label: 'å é¤', code: 'product_delete', icon: 'delete', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ], |
| | |
| | | { label: 'ç¼è¾é¨ä»¶ä¿¡æ¯', code: 'component_edit', icon: 'edit', isCommonMethod: false }, |
| | | // { label: 'å¯¼åºææ¡£', code: 'component_export', icon: 'export', isCommonMethod: true }, |
| | | { label: '导å
¥å
¶ä»ææ¡£', code: 'component_import', icon: 'import', isCommonMethod: true }, |
| | | { label: 'æ£ç´¢çµåæ ·æ¿', code: 'component_search', icon: 'search', isCommonMethod: true }, |
| | | { label: 'å é¤', code: 'component_delete', icon: 'delete', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ], |
| | |
| | | { label: 'ç¼è¾é¶ä»¶ä¿¡æ¯', code: 'parts_edit', icon: 'edit', isCommonMethod: false }, |
| | | // { label: 'å¯¼åºææ¡£', code: 'parts_export', icon: 'export', isCommonMethod: true }, |
| | | { label: '导å
¥å
¶ä»ææ¡£', code: 'parts_import', icon: 'import', isCommonMethod: true }, |
| | | { label: 'æ£ç´¢çµåæ ·æ¿', code: 'parts_search', icon: 'search', isCommonMethod: true }, |
| | | { label: 'å é¤', code: 'parts_delete', icon: 'delete', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ], |
| | |
| | | { label: 'å建工åº', code: 'version_add_child', icon: 'plus', isCommonMethod: false }, |
| | | { label: 'ç¼è¾å·¥èºè§ç¨çæ¬ä¿¡æ¯', code: 'version_edit', icon: 'edit', isCommonMethod: false }, |
| | | { label: '导å
¥å
¶ä»ææ¡£', code: 'version_import', icon: 'import', isCommonMethod: true }, |
| | | { label: 'æ£ç´¢çµåæ ·æ¿', code: 'version_search', icon: 'search', isCommonMethod: true }, |
| | | { label: 'å é¤', code: 'version_delete', icon: 'delete', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ], |