From 43cf1a348650fc00b3e638396406814bf5f7ebfd Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期三, 15 一月 2025 17:55:02 +0800 Subject: [PATCH] 1、产品结构树页面新增工步功能 2、产品结构树页面新增导入文档或NC程序功能 --- src/views/dnc/base/modules/ProductStructure/Part/PartModal.vue | 24 + src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepInfo.vue | 12 src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue | 5 src/views/dnc/common/TableContextMenu.vue | 59 +-- src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue | 26 + src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue | 27 + src/views/dnc/base/ProductStructure.vue | 2 src/views/dnc/base/modules/ProductStructure/Component/ComponentModal.vue | 18 src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue | 2 src/views/dnc/common/ImportFileModal.vue | 102 +++++-- src/views/dnc/base/modules/ProductStructure/Process/ProcessInfo.vue | 8 src/views/dnc/base/modules/ProductStructure/Process/ProcessModal.vue | 66 +++- src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModal.vue | 112 ++++++++ src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue | 2 src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue | 43 -- src/api/dnc.js | 8 src/views/dnc/base/modules/ProductStructure/Product/ProductModal.vue | 8 src/views/dnc/base/modules/ProductStructure/Product/ProductModalForm.vue | 5 src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue | 55 +-- src/views/dnc/base/modules/ProductStructure/Component/ComponentModalForm.vue | 5 src/views/dnc/base/modules/ProductStructure/Part/PartModalForm.vue | 5 src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModalForm.vue | 158 ++++++++++++ src/views/dnc/base/modules/ProductStructure/ProductStructureMainBottom.vue | 8 23 files changed, 531 insertions(+), 229 deletions(-) diff --git a/src/api/dnc.js b/src/api/dnc.js index 99a74d1..165751b 100644 --- a/src/api/dnc.js +++ b/src/api/dnc.js @@ -1,7 +1,13 @@ -import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage' +import { getAction, deleteAction, putAction, postAction, httpAction, uploadAction } from '@/api/manage' +import querystring from 'querystring' export default { //-------------------------浜у搧缁撴瀯鏍�------------------------------------------------ getProductStructureTreeApi: () => getAction('/nc/product/load/tree'), + // 瀵煎叆鏂囨。 + importDocumentFromLocalApi: (params, formData) => { + const paramsStringify = querystring.stringify(params) + return uploadAction(`/nc/doc/add?${paramsStringify}`, formData) + } } \ No newline at end of file diff --git a/src/views/dnc/base/ProductStructure.vue b/src/views/dnc/base/ProductStructure.vue index 373fc27..2095795 100644 --- a/src/views/dnc/base/ProductStructure.vue +++ b/src/views/dnc/base/ProductStructure.vue @@ -15,7 +15,7 @@ </template> <script> - import ProductStructureTree from '../common/ProductStructureTree' + import ProductStructureTree from './modules/ProductStructure/ProductStructureTree' import ProductStructureMain from './modules/ProductStructure/ProductStructureMain' import ImportFileModal from '../common/ImportFileModal' diff --git a/src/views/dnc/base/modules/ProductStructure/Component/ComponentModal.vue b/src/views/dnc/base/modules/ProductStructure/Component/ComponentModal.vue index f7a3045..575f890 100644 --- a/src/views/dnc/base/modules/ProductStructure/Component/ComponentModal.vue +++ b/src/views/dnc/base/modules/ProductStructure/Component/ComponentModal.vue @@ -44,7 +44,9 @@ this.visible = true this.isAddNextLevel = true this.$nextTick(() => { - this.$refs.realForm.add({ productId: this.currentTreeNodeInfo.id }) + if (this.$refs.realForm) { + this.$refs.realForm.add({ productId: this.currentTreeNodeInfo.entity.productId }) + } }) }, @@ -55,10 +57,12 @@ this.visible = true this.isAddNextLevel = true this.$nextTick(() => { - this.$refs.realForm.add({ - productId: this.currentTreeNodeInfo.parentId, - parentId: this.currentTreeNodeInfo.id - }) + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + parentId: this.currentTreeNodeInfo.entity.componentId + }) + } }) }, @@ -69,7 +73,9 @@ this.visible = true this.isAddNextLevel = false this.$nextTick(() => { - this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + if (this.$refs.realForm) { + this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + } }) }, diff --git a/src/views/dnc/base/modules/ProductStructure/Component/ComponentModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Component/ComponentModalForm.vue index 69dc447..d6097b5 100644 --- a/src/views/dnc/base/modules/ProductStructure/Component/ComponentModalForm.vue +++ b/src/views/dnc/base/modules/ProductStructure/Component/ComponentModalForm.vue @@ -117,11 +117,6 @@ } } }, - computed: { - formDisabled() { - return this.disabled - } - }, created() { //澶囦唤model鍘熷鍊� this.modelDefault = JSON.parse(JSON.stringify(this.model)) diff --git a/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue index 6a66dae..d279d9b 100644 --- a/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue +++ b/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue @@ -66,11 +66,6 @@ } } }, - computed: { - formDisabled() { - return this.disabled - } - }, created() { //澶囦唤model鍘熷鍊� this.modelDefault = JSON.parse(JSON.stringify(this.model)) diff --git a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue index d7cfd63..42cb9ee 100644 --- a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue +++ b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue @@ -68,10 +68,12 @@ //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 if (arg === 1) this.ipagination.current = 1 var params = this.getQueryParams()//鏌ヨ鏉′欢 + console.log('currentTreeNodeInfo', this.currentTreeNodeInfo) params.attributionId = this.currentTreeNodeInfo.id params.attributionType = this.currentTreeNodeInfo.type params.docClassCode = 'NC' if (!params) return false + this.dataSource = [] this.loading = true getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => { if (res.success) { diff --git a/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue index 22d4d31..b21d552 100644 --- a/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue +++ b/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue @@ -65,10 +65,12 @@ //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 if (arg === 1) this.ipagination.current = 1 var params = this.getQueryParams()//鏌ヨ鏉′欢 + console.log('currentTreeNodeInfo', this.currentTreeNodeInfo) params.attributionId = this.currentTreeNodeInfo.id params.attributionType = this.currentTreeNodeInfo.type params.docClassCode = 'OTHER' if (!params) return false + this.dataSource = [] this.loading = true getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => { if (res.success) { diff --git a/src/views/dnc/base/modules/ProductStructure/Part/PartModal.vue b/src/views/dnc/base/modules/ProductStructure/Part/PartModal.vue index 5e64f94..54016ff 100644 --- a/src/views/dnc/base/modules/ProductStructure/Part/PartModal.vue +++ b/src/views/dnc/base/modules/ProductStructure/Part/PartModal.vue @@ -44,10 +44,12 @@ this.visible = true this.isAddNextLevel = true this.$nextTick(() => { - this.$refs.realForm.add({ - productId: this.currentTreeNodeInfo.rfield, - componentId: this.currentTreeNodeInfo.id - }) + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId + }) + } }) }, @@ -58,10 +60,12 @@ this.visible = true this.isAddNextLevel = false this.$nextTick(() => { - this.$refs.realForm.add({ - productId: this.currentTreeNodeInfo.rfield, - componentId: this.currentTreeNodeInfo.parentId - }) + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.productId, + componentId: this.currentTreeNodeInfo.componentId + }) + } }) }, @@ -72,7 +76,9 @@ this.visible = true this.isAddNextLevel = false this.$nextTick(() => { - this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + if (this.$refs.realForm) { + this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + } }) }, diff --git a/src/views/dnc/base/modules/ProductStructure/Part/PartModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Part/PartModalForm.vue index 5d70dd7..832042f 100644 --- a/src/views/dnc/base/modules/ProductStructure/Part/PartModalForm.vue +++ b/src/views/dnc/base/modules/ProductStructure/Part/PartModalForm.vue @@ -117,11 +117,6 @@ } } }, - computed: { - formDisabled() { - return this.disabled - } - }, created() { //澶囦唤model鍘熷鍊� this.modelDefault = JSON.parse(JSON.stringify(this.model)) diff --git a/src/views/dnc/base/modules/ProductStructure/Process/ProcessInfo.vue b/src/views/dnc/base/modules/ProductStructure/Process/ProcessInfo.vue index ab46336..ec530a9 100644 --- a/src/views/dnc/base/modules/ProductStructure/Process/ProcessInfo.vue +++ b/src/views/dnc/base/modules/ProductStructure/Process/ProcessInfo.vue @@ -4,11 +4,9 @@ <a-descriptions-item label="宸ュ簭鍙�">{{currentLevelDetails.processCode}}</a-descriptions-item> <a-descriptions-item label="宸ヨ壓缂栧彿 ">{{currentLevelDetails.craftNo}}</a-descriptions-item> <a-descriptions-item label="宸ュ簭绫诲瀷">{{currentLevelDetails.processType}}</a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧鍨嬪彿">{{currentLevelDetails.processingEquipmentModel}} - </a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧绫诲瀷">{{currentLevelDetails.processingEquipmentOs}}</a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧缂栧彿">{{currentLevelDetails.processingEquipmentCode}} - </a-descriptions-item> + <a-descriptions-item label="鍔犲伐璁惧鍨嬪彿">{{currentLevelDetails.processingEquipmentModel}}</a-descriptions-item> + <!--<a-descriptions-item label="鍔犲伐璁惧绫诲瀷">{{currentLevelDetails.processingEquipmentOs}}</a-descriptions-item>--> + <a-descriptions-item label="鍔犲伐璁惧缂栧彿">{{currentLevelDetails.processingEquipmentCode}}</a-descriptions-item> <a-descriptions-item label="宸ヨ缂栧彿">{{currentLevelDetails.assembleStep}}</a-descriptions-item> <a-descriptions-item label="宸ヨ鍚嶇О ">{{currentLevelDetails.assembleName}}</a-descriptions-item> <a-descriptions-item label="鎻忚堪" :span="3">{{currentLevelDetails.description}}</a-descriptions-item> diff --git a/src/views/dnc/base/modules/ProductStructure/Process/ProcessModal.vue b/src/views/dnc/base/modules/ProductStructure/Process/ProcessModal.vue index 9f265d2..57f3e4c 100644 --- a/src/views/dnc/base/modules/ProductStructure/Process/ProcessModal.vue +++ b/src/views/dnc/base/modules/ProductStructure/Process/ProcessModal.vue @@ -29,7 +29,8 @@ return { title: '', width: 700, - visible: false + visible: false, + isAddNextLevel: false // 鏄惁涓烘坊鍔犱笅绾э紝浣滀负鏍戣妭鐐规槸鍚﹀睍寮�鐨勫垽鏂� } }, created() { @@ -37,38 +38,66 @@ }, methods: { /** - * 鍒涘缓 - * @param modalTitle + * 鐐瑰嚮閮ㄤ欢鍒涘缓閮ㄤ欢涓嬬骇宸ュ簭 */ - handleComponentAddRelative(modalTitle) { - this.title = modalTitle + handleComponentAddRelative() { + this.isAddNextLevel = true this.visible = true this.$nextTick(() => { - this.$refs.realForm.add() + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId + }) + } }) }, - handleProcessAdd(modalTitle) { - this.title = modalTitle + + /** + * 鐐瑰嚮闆朵欢鍒涘缓闆朵欢涓嬬骇宸ュ簭 + */ + handlePartsAddRelative() { + this.isAddNextLevel = true this.visible = true this.$nextTick(() => { - this.$refs.realForm.add() + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId, + partsId: this.currentTreeNodeInfo.entity.partsId + }) + } }) }, - handlePartsAddRelative(modalTitle) { - this.title = modalTitle + /** + * 鐐瑰嚮宸ュ簭娣诲姞鍚岀骇宸ュ簭 + */ + handleProcessAdd() { + this.isAddNextLevel = false this.visible = true this.$nextTick(() => { - this.$refs.realForm.add() + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId, + partsId: this.currentTreeNodeInfo.entity.partsId + }) + } }) }, - handleProcessEdit(modalTitle) { - this.title = modalTitle + /** + * 缂栬緫宸ュ簭淇℃伅 + */ + handleProcessEdit() { + this.isAddNextLevel = false this.visible = true this.$nextTick(() => { - this.$refs.realForm.edit(this.currentTreeNodeInfo.entity) + if (this.$refs.realForm) { + this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + } }) }, @@ -77,7 +106,7 @@ }, submitCallback() { - this.$emit('submitSuccess') + this.$emit('submitSuccess', this.isAddNextLevel) this.visible = false }, @@ -87,7 +116,10 @@ }, triggerCorrespondingMethod({ methodName, modalTitle }) { - if (this[methodName]) this[methodName](modalTitle) + if (this[methodName]) { + this[methodName]() + this.title = modalTitle + } } } } diff --git a/src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue index 34603da..d077f67 100644 --- a/src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue +++ b/src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue @@ -61,22 +61,19 @@ </a-col> </a-row> </a-form-model> - - <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'閫夋嫨璁惧'"/> </a-spin> </template> <script> import { httpAction, getAction } from '@/api/manage' - import SelectDeviceDrawer from '@/views/system/modules/SelectDeviceDrawer' export default { name: 'ProcessModalForm', - components: { SelectDeviceDrawer }, + components: {}, data() { return { model: { - passCount: 0 + processType: 0 }, labelCol: { xs: { span: 24 }, @@ -104,14 +101,9 @@ ] }, url: { - add: '/mdc/mdcPartProcessInfo/add', - edit: '/mdc/mdcPartProcessInfo/edit' + add: '/nc/stream/process/add', + edit: '/nc/stream/process/edit' } - } - }, - computed: { - formDisabled() { - return this.disabled } }, created() { @@ -119,13 +111,12 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)) }, methods: { - add() { - this.edit(this.modelDefault) + add(params) { + this.edit({ ...this.modelDefault, ...params }) }, edit(record) { - this.model = Object.assign({}, { equipmentIds: record.equipmentId }, record) + this.model = Object.assign({}, record) console.log('model', this.model) - this.visible = true }, submitForm() { const that = this @@ -134,11 +125,13 @@ if (valid) { that.confirmLoading = true let httpUrl = '' - let method = 'post' + let method = '' if (!this.model.id) { httpUrl += this.url.add + method = 'post' } else { - httpUrl += this.url.edit + httpUrl += this.url.edit + `/${this.model.id}` + method = 'put' } httpAction(httpUrl, this.model, method).then((res) => { if (res.success) { @@ -159,20 +152,6 @@ } }) - }, - deviceSearch() { - this.$refs.selectDeviceDrawer.visible = true - this.$refs.selectDeviceDrawer.selectedRowKeys = [] - this.$refs.selectDeviceDrawer.selectedRows = [] - this.$refs.selectDeviceDrawer.checkedKeys = this.model.equipmentIds ? this.model.equipmentIds.split(',') : [] - }, - /** - * 閫夋嫨宸叉湁璁惧鍚庣偣鍑荤‘瀹氭椂瑙﹀彂 - * @param data 宸查�夋嫨鐨勮澶� - */ - selectOK(data) { - this.$set(this.model, 'equipmentIds', data.join(',')) - if (this.model.equipmentIds) this.$refs.form.clearValidate('equipmentIds') } } } diff --git a/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepInfo.vue b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepInfo.vue index 3264e39..ceb18bb 100644 --- a/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepInfo.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepInfo.vue @@ -1,14 +1,10 @@ <template> <a-descriptions bordered :size="size"> - <a-descriptions-item label="宸ユ鍚嶇О">{{currentLevelDetails.processName}}</a-descriptions-item> - <a-descriptions-item label="宸ユ鍙�">{{currentLevelDetails.processCode}}</a-descriptions-item> + <a-descriptions-item label="宸ユ鍚嶇О">{{currentLevelDetails.stepName}}</a-descriptions-item> + <a-descriptions-item label="宸ユ鍙�">{{currentLevelDetails.stepCode}}</a-descriptions-item> <a-descriptions-item label="宸ヨ壓缂栧彿 ">{{currentLevelDetails.craftNo}}</a-descriptions-item> - <a-descriptions-item label="宸ュ簭绫诲瀷">{{currentLevelDetails.processType}}</a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧鍨嬪彿">{{currentLevelDetails.processingEquipmentModel}} - </a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧绫诲瀷">{{currentLevelDetails.processingEquipmentOs}}</a-descriptions-item> - <a-descriptions-item label="鍔犲伐璁惧缂栧彿">{{currentLevelDetails.processingEquipmentCode}} - </a-descriptions-item> + <a-descriptions-item label="宸ユ绫诲瀷">{{currentLevelDetails.stepType}}</a-descriptions-item> + <a-descriptions-item label="鍔犲伐璁惧缂栧彿">{{currentLevelDetails.deviceNo}}</a-descriptions-item> <a-descriptions-item label="宸ヨ缂栧彿">{{currentLevelDetails.assembleStep}}</a-descriptions-item> <a-descriptions-item label="宸ヨ鍚嶇О ">{{currentLevelDetails.assembleName}}</a-descriptions-item> <a-descriptions-item label="鎻忚堪" :span="3">{{currentLevelDetails.description}}</a-descriptions-item> diff --git a/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModal.vue b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModal.vue new file mode 100644 index 0000000..c430569 --- /dev/null +++ b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModal.vue @@ -0,0 +1,112 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + :maskClosable="false" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <ProcessStepModalForm ref="realForm" @ok="submitCallback"/> + </j-modal> +</template> + +<script> + import ProcessStepModalForm from './ProcessStepModalForm.vue' + + export default { + name: 'ProcessStepModal', + components: { + ProcessStepModalForm + }, + props: { + currentTreeNodeInfo: { + type: Object + } + }, + data() { + return { + title: '', + width: 700, + visible: false, + isAddNextLevel: false // 鏄惁涓烘坊鍔犱笅绾э紝浣滀负鏍戣妭鐐规槸鍚﹀睍寮�鐨勫垽鏂� + } + }, + created() { + this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) + }, + methods: { + /** + * 鐐瑰嚮宸ュ簭鍒涘缓宸ュ簭涓嬬骇宸ユ + */ + handleProcessAddChild() { + this.isAddNextLevel = true + this.visible = true + this.$nextTick(() => { + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId, + partsId: this.currentTreeNodeInfo.entity.partsId, + processId: this.currentTreeNodeInfo.entity.processId + }) + } + }) + }, + + + /** + * 鐐瑰嚮宸ユ娣诲姞鍚岀骇宸ユ + */ + handleProcessStepAdd() { + this.isAddNextLevel = false + this.visible = true + this.$nextTick(() => { + if (this.$refs.realForm) { + this.$refs.realForm.add({ + productId: this.currentTreeNodeInfo.entity.productId, + componentId: this.currentTreeNodeInfo.entity.componentId, + partsId: this.currentTreeNodeInfo.entity.partsId, + processId: this.currentTreeNodeInfo.entity.processId + }) + } + }) + }, + + /** + * 缂栬緫宸ュ簭淇℃伅 + */ + handleProcessStepEdit() { + this.isAddNextLevel = false + this.visible = true + this.$nextTick(() => { + if (this.$refs.realForm) { + this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + } + }) + }, + + handleOk() { + this.$refs.realForm.submitForm() + }, + + submitCallback() { + this.$emit('submitSuccess', this.isAddNextLevel) + this.visible = false + }, + + handleCancel() { + this.$emit('close') + this.visible = false + }, + + triggerCorrespondingMethod({ methodName, modalTitle }) { + if (this[methodName]) { + this[methodName]() + this.title = modalTitle + } + } + } + } +</script> \ No newline at end of file diff --git a/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModalForm.vue b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModalForm.vue new file mode 100644 index 0000000..d6982b6 --- /dev/null +++ b/src/views/dnc/base/modules/ProductStructure/ProcessStep/ProcessStepModalForm.vue @@ -0,0 +1,158 @@ +<template> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-row> + <a-col :span="12"> + <a-form-model-item label="宸ユ鍙�" prop="stepCode"> + <a-input v-model="model.stepCode" placeholder="璇疯緭鍏ュ伐搴忓彿"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ユ鍚嶇О" prop="stepName"> + <a-input v-model="model.stepName" placeholder="璇疯緭鍏ュ伐搴忓悕绉�"></a-input> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="24"> + <a-form-model-item label="鍔犲伐璁惧缂栧彿" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> + <a-select v-model="model.deviceNo" placeholder="璇烽�夋嫨鍔犲伐璁惧缂栧彿"></a-select> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="12"> + <a-form-model-item label="宸ヨ壓缂栧彿"> + <a-input v-model="model.craftNo" placeholder="璇疯緭鍏ュ伐鑹虹紪鍙�"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ヨ壓瑙勭▼鐗堟湰"> + <a-input v-model="model.craftVersion" placeholder="璇疯緭鍏ュ伐鑹鸿绋嬬増鏈�"></a-input> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="12"> + <a-form-model-item label="宸ユ绫诲瀷"> + <a-input v-model="model.stepType" placeholder="璇疯緭鍏ュ伐姝ョ被鍨�"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ユ鎻忚堪"> + <a-input v-model="model.description" placeholder="璇疯緭鍏ュ伐姝ユ弿杩�"></a-input> + </a-form-model-item> + </a-col> + </a-row> + + <a-row> + <a-col :span="12"> + <a-form-model-item label="宸ヨ缂栧彿"> + <a-input v-model="model.assembleNo" placeholder="璇疯緭鍏ュ伐瑁呯紪鍙�"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ヨ鍚嶇О"> + <a-input v-model="model.assembleName" placeholder="璇疯緭鍏ュ伐瑁呭悕绉�"></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> +</template> + +<script> + import { httpAction } from '@/api/manage' + + export default { + name: 'ProcessStepModalForm', + components: {}, + data() { + return { + model: { + stepType: 0 + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 14 } + }, + labelColLong: { + xs: { span: 24 }, + sm: { span: 4 } + }, + wrapperColLong: { + xs: { span: 24 }, + sm: { span: 19 } + }, + confirmLoading: false, + validatorRules: { + stepCode: [ + { required: true, message: '璇疯緭鍏ュ伐姝ュ彿!' } + ], + stepName: [ + { required: true, message: '璇疯緭鍏ュ伐姝ュ悕绉�!' } + ] + }, + url: { + add: '/nc/workStep/add', + edit: '/nc/workStep/edit' + } + } + }, + created() { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)) + }, + methods: { + add(params) { + this.edit({ ...this.modelDefault, ...params }) + }, + edit(record) { + this.model = Object.assign({}, record) + console.log('model', this.model) + }, + submitForm() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let httpUrl = '' + let method = '' + if (!this.model.id) { + httpUrl += this.url.add + method = 'post' + } else { + httpUrl += this.url.edit + `/${this.model.id}` + method = 'put' + } + httpAction(httpUrl, this.model, method).then((res) => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.$emit('ok') + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + }) + } + + }) + } + } + } +</script> \ No newline at end of file diff --git a/src/views/dnc/base/modules/ProductStructure/Product/ProductModal.vue b/src/views/dnc/base/modules/ProductStructure/Product/ProductModal.vue index ceaa455..72a6960 100644 --- a/src/views/dnc/base/modules/ProductStructure/Product/ProductModal.vue +++ b/src/views/dnc/base/modules/ProductStructure/Product/ProductModal.vue @@ -29,7 +29,7 @@ return { title: '', width: 500, - visible: false, + visible: false } }, created() { @@ -42,7 +42,7 @@ handleProductAdd() { this.visible = true this.$nextTick(() => { - this.$refs.realForm.add() + if (this.$refs.realForm) this.$refs.realForm.add() }) }, @@ -52,7 +52,9 @@ handleProductEdit() { this.visible = true this.$nextTick(() => { - this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + if (this.$refs.realForm) { + this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) + } }) }, diff --git a/src/views/dnc/base/modules/ProductStructure/Product/ProductModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Product/ProductModalForm.vue index 7e73ef9..5a12866 100644 --- a/src/views/dnc/base/modules/ProductStructure/Product/ProductModalForm.vue +++ b/src/views/dnc/base/modules/ProductStructure/Product/ProductModalForm.vue @@ -69,11 +69,6 @@ } } }, - computed: { - formDisabled() { - return this.disabled - } - }, created() { //澶囦唤model鍘熷鍊� this.modelDefault = JSON.parse(JSON.stringify(this.model)) diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainBottom.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainBottom.vue index 2556e05..5774215 100644 --- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainBottom.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainBottom.vue @@ -12,12 +12,12 @@ <PartInfo :currentLevelDetails="currentLevelInfo.entity" :size="descriptionsContainerSize"/> </a-tab-pane> - <a-tab-pane :key="1" tab="宸ュ簭灞炴��" v-if="currentLevelInfo.type===4"> - <ProcessInfo :currentLevelDetails="currentLevelInfo" :size="descriptionsContainerSize"/> + <a-tab-pane :key="1" tab="宸ュ簭灞炴��" v-if="currentLevelInfo.type===5"> + <ProcessInfo :currentLevelDetails="currentLevelInfo.entity" :size="descriptionsContainerSize"/> </a-tab-pane> - <a-tab-pane :key="1" tab="宸ユ灞炴��" v-if="currentLevelInfo.type===5"> - <ProcessStepInfo :currentLevelDetails="currentLevelInfo" :size="descriptionsContainerSize"/> + <a-tab-pane :key="1" tab="宸ユ灞炴��" v-if="currentLevelInfo.type===6"> + <ProcessStepInfo :currentLevelDetails="currentLevelInfo.entity" :size="descriptionsContainerSize"/> </a-tab-pane> <template v-if="currentLevelInfo.hasOwnProperty('attributionType')"> diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue index 790df03..3d1233e 100644 --- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue @@ -1,12 +1,12 @@ <template> - <a-tabs v-model="activeTabKey" @change="handleTabChange" @contextmenu.native="e=>e.preventDefault()" + <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()" v-if="Object.keys(currentTreeNodeInfo).length!==0"> - <a-tab-pane :key="1" tab="NC鏂囨。" v-if="currentTreeNodeInfo.type!==1"> + <a-tab-pane :key="1" tab="NC鏂囨。" v-if="currentTreeNodeInfo.type===5||currentTreeNodeInfo.type===6"> <NcDocumentTableList ref="ncDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo" @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/> </a-tab-pane> - <a-tab-pane :key="2" tab="鍏朵粬鏂囨。"> + <a-tab-pane :key="1" tab="鍏朵粬鏂囨。" v-else> <OtherDocumentTableList ref="otherDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo" @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/> </a-tab-pane> @@ -25,8 +25,7 @@ components: { TableContextMenu, OtherDocumentTableList, NcDocumentTableList }, data() { return { - activeTabKey: null, - hasLoadingDataTabKey: [], + activeTabKey: 1, tableContainerSize: 'small', currentRightClickedTableRowInfo: {}, currentTreeNodeInfo: {} @@ -34,19 +33,7 @@ }, created() { this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo) - }, - watch: { - activeTabKey: { - handler(value) { - // tab鍒囨崲鏃跺姞杞藉搴旀枃妗e垪琛紝褰撳墠鏍戣妭鐐逛笅宸茬粡鍔犺浇杩囩殑鏂囨。鍒楄〃涓嶅啀閲嶅鍔犺浇 - if (!this.hasLoadingDataTabKey.includes(value)) { - if (value === 1) this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1)) - else this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1)) - this.hasLoadingDataTabKey.push(value) - } - }, - deep: true - } + this.$bus.$on('importFileSuccess', this.reloadDocumentListData) }, methods: { /** @@ -70,23 +57,29 @@ // 浠庢爲缁勪欢鎺ュ彈鏍戣妭鐐逛俊鎭悗浠庣埗缁勪欢娴佸叆瀛愮粍浠� this.currentTreeNodeInfo = treeNodeInfo // 娓呯┖涓婁竴鑺傜偣宸茬粡鍔犺浇杩囧緱鏂囨。鍒楄〃tabKey - this.hasLoadingDataTabKey = [] - if (treeNodeInfo.type !== 1) { - this.activeTabKey = 1 - this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1)) + if (treeNodeInfo.type === 5 || treeNodeInfo.type === 6) { + this.$nextTick(() => { + if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1) + }) } else { - this.activeTabKey = 2 - this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1)) + this.$nextTick(() => { + if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1) + }) } - this.hasLoadingDataTabKey.push(this.activeTabKey) }, - handleTabChange(activeTabKey) { - // tab鍒囨崲鏃跺姞杞藉搴旀枃妗e垪琛紝褰撳墠鏍戣妭鐐逛笅宸茬粡鍔犺浇杩囩殑鏂囨。鍒楄〃涓嶅啀閲嶅鍔犺浇 - if (!this.hasLoadingDataTabKey.includes(activeTabKey)) { - if (activeTabKey === 1) this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1)) - else this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1)) - this.hasLoadingDataTabKey.push(activeTabKey) + /** + * 涓婁紶鏂囦欢鎴愬姛鍚庤Е鍙� + * @param docClassCode 鏂囨。绫诲埆 + * @param attributionId 鑺傜偣Id + */ + reloadDocumentListData({ docClassCode, attributionId }) { + // 濡傛灉涓婁紶鐨勬枃妗d笉鏄墍灞炰簬褰撳墠鎵�灞曠ず鑺傜偣鐨勬枃妗e垯涓嶉噸鏂拌幏鍙栨枃妗e垪琛� + if (this.currentTreeNodeInfo.id !== attributionId) return + if (docClassCode === 'NC') { + if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1) + } else { + if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1) } }, diff --git a/src/views/dnc/common/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue similarity index 93% rename from src/views/dnc/common/ProductStructureTree.vue rename to src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue index c6d958f..fc006c1 100644 --- a/src/views/dnc/common/ProductStructureTree.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue @@ -2,7 +2,6 @@ <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native="e=>e.preventDefault()"> <a-spin :spinning="loading"> <div style="display: flex;flex-direction: column;height: 100%"> - <div style="display: flex"> <a-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" allowClear v-model="searchInput" @change="handleSearchInputChange"/> @@ -24,7 +23,7 @@ </div> <!--浜у搧缁撴瀯鏍�--> - <div style="flex: 1;overflow:auto;margin-top: 10px"> + <div class="" style="flex: 1;overflow:auto;margin-top: 10px"> <a-tree ref="tree" show-icon :checkStrictly="checkStrictly" :expandedKeys.sync="expandedKeys" :selectedKeys="selectedKeys" :treeData="treeDataSource" :autoExpandParent="autoExpandParent" @select="handleTreeSelect" @expand="handleTreeExpand" @rightClick="handleTreeRightClick"> @@ -53,21 +52,25 @@ <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> <!--宸ュ簭寮圭獥--> <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> + <!--宸ユ寮圭獥--> + <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> </a-card> </template> <script> import dncApi from '@/api/dnc' import { deleteAction } from '@/api/manage' - import ProductStructureTreeContextMenu from './modules/ProductStructureTree/ProductStructureTreeContextMenu' - import ProductModal from '../base/modules/ProductStructure/Product/ProductModal' - import ComponentModal from '../base/modules/ProductStructure/Component/ComponentModal' - import PartModal from '../base/modules/ProductStructure/Part/PartModal' - import ProcessModal from '../base/modules/ProductStructure/Process/ProcessModal' + import ProductStructureTreeContextMenu from './ProductStructureTreeContextMenu' + import ProductModal from './Product/ProductModal' + import ComponentModal from './Component/ComponentModal' + import PartModal from './Part/PartModal' + import ProcessModal from './Process/ProcessModal' + import ProcessStepModal from './ProcessStep/ProcessStepModal' export default { name: 'ProductStructureTree', components: { + ProcessStepModal, ProcessModal, PartModal, ComponentModal, @@ -274,10 +277,10 @@ case 3: treeNode.slots = { icon: 'part' } break - case 4: + case 5: treeNode.slots = { icon: 'process' } break - case 5: + case 6: treeNode.slots = { icon: 'processStep' } break default: @@ -288,7 +291,6 @@ </script> <style lang="less" scoped> - /deep/ .ant-card-body { padding: 0 12px 0 0; } @@ -306,8 +308,8 @@ width: calc(100% - 24px) !important; } - .tree_con { - overflow: hidden; + ::-webkit-scrollbar { + width: 8px; } @media screen and (min-width: 1920px) { diff --git a/src/views/dnc/common/modules/ProductStructureTree/ProductStructureTreeContextMenu.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue similarity index 82% rename from src/views/dnc/common/modules/ProductStructureTree/ProductStructureTreeContextMenu.vue rename to src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue index f8cdee9..f7116e7 100644 --- a/src/views/dnc/common/modules/ProductStructureTree/ProductStructureTreeContextMenu.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue @@ -6,12 +6,10 @@ <template #overlay> <a-menu @click="({ key: menuKey }) => onContextMenuClick(treeParams.treeKey, menuKey)" @contextmenu="event=>event.preventDefault()"> - <template v-for="item in defaultContextMenuList[getCurrentMenuLevel]"> - <a-menu-item :key="item.code" v-if="item.show"> - <a-icon :type="item.icon"/> - {{item.label}} - </a-menu-item> - </template> + <a-menu-item v-for="item in defaultContextMenuList[getCurrentMenuLevel]" :key="item.code" v-has="item.code"> + <a-icon :type="item.icon"/> + {{item.label}} + </a-menu-item> </a-menu> </template> </a-dropdown> @@ -63,10 +61,19 @@ //宸ュ簭 process: [ { show: true, label: '鍒涘缓宸ュ簭', code: 'process_add', icon: 'plus', isCommonMethod: false }, + { show: true, label: '鍒涘缓宸ユ', code: 'process_add_child', icon: 'plus', isCommonMethod: false }, { show: true, label: '缂栬緫宸ュ簭淇℃伅', code: 'process_edit', icon: 'edit', isCommonMethod: false }, { show: true, label: '鍒犻櫎', code: 'process_delete', icon: 'delete', isCommonMethod: true }, { show: false, label: '瀵煎嚭NC绋嬪簭', code: 'process_export', icon: 'import', isCommonMethod: true }, { show: true, label: '瀵煎叆NC绋嬪簭', code: 'process_import', icon: 'export', isCommonMethod: true } + ], + //宸ユ + processStep: [ + { show: true, label: '鍒涘缓宸ユ', code: 'processStep_add', icon: 'plus', isCommonMethod: false }, + { show: true, label: '缂栬緫宸ユ淇℃伅', code: 'processStep_edit', icon: 'edit', isCommonMethod: false }, + { show: true, label: '鍒犻櫎', code: 'processStep_delete', icon: 'delete', isCommonMethod: true }, + { show: false, label: '瀵煎嚭NC绋嬪簭', code: 'processStep_export', icon: 'import', isCommonMethod: true }, + { show: true, label: '瀵煎叆NC绋嬪簭', code: 'processStep_import', icon: 'export', isCommonMethod: true } ] } } @@ -80,9 +87,9 @@ return 'component' case 3: return 'part' - case 4: - return 'process' case 5: + return 'process' + case 6: return 'processStep' } } @@ -90,6 +97,7 @@ methods: { onContextMenuClick(treeKey, menuKey) { const level = this.getCurrentMenuLevel + console.log('level---------------------', level) const menuKeyArray = menuKey.split('_') const isCommonMethod = this.defaultContextMenuList[level].find(item => item.code === menuKey).isCommonMethod // product_add => handleAdd 瑙﹀彂瀵瑰簲缁勪欢浜嬩欢 @@ -101,8 +109,9 @@ methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('') } console.log('methodName------------------------------------', methodName) + console.log('treeParams------------------------------------', this.treeParams) const modalTitle = this.defaultContextMenuList[level].find(item => item.code === menuKey).label - this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle }) + this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle, treeNodeInfo: this.treeParams }) } } } diff --git a/src/views/dnc/common/ImportFileModal.vue b/src/views/dnc/common/ImportFileModal.vue index 13aee43..653ad41 100644 --- a/src/views/dnc/common/ImportFileModal.vue +++ b/src/views/dnc/common/ImportFileModal.vue @@ -1,7 +1,7 @@ <template> <a-modal :title="title" :visible="visible" @cancel="handleModalClose" :maskClosable="false"> <a-upload :multiple="true" :file-list="fileList" :remove="handleRemove" :before-upload="beforeUpload"> - <a-button type="primary"> + <a-button type="primary" :disabled="uploading"> <a-icon type="import"/> 閫夊彇鏂囦欢 </a-button> @@ -26,6 +26,8 @@ </template> <script> + import dncApi from '@/api/dnc' + export default { name: 'ImportFileModal', components: {}, @@ -34,6 +36,7 @@ visible: false, title: '', fileList: [], + uploadParams: {}, uploading: false } }, @@ -42,8 +45,26 @@ this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod) }, methods: { - handleImport(modalTitle) { - this.handleModalOpen(modalTitle) + /** + * 鐐瑰嚮瀵煎叆鏂囨。鎴朜C绋嬪簭鏃惰Е鍙� + * @param treeNodeInfo 鐐瑰嚮鏍戣妭鐐瑰彸閿彍鍗曞鍏ョ▼搴忔椂浼犲叆鏍戣妭鐐逛俊鎭� + * @param tableRowInfo 鐐瑰嚮琛ㄦ牸琛屽彸閿彍鍗曞鍏ョ▼搴忔椂浼犲叆琛屼俊鎭� + */ + handleImport(treeNodeInfo, tableRowInfo) { + let attributionId // 鏂囨。鎵�灞炲眰绾d + let attributionType // 鏂囨。鎵�灞炲眰绾х被鍨� + let docClassCode // 鏂囨。绫诲瀷 + if (treeNodeInfo) { + attributionId = treeNodeInfo.treeKey + attributionType = treeNodeInfo.type + } else { + attributionId = tableRowInfo.attributionId + attributionType = tableRowInfo.attributionType + } + if (attributionType === 5 || attributionType === 6) docClassCode = 'NC' + else docClassCode = 'OTHER' + this.uploadParams = Object.assign({}, { attributionId, attributionType, docClassCode }) + this.visible = true }, handleRemove(file) { @@ -54,43 +75,48 @@ }, beforeUpload(file) { - this.fileList = [...this.fileList, file] + if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file] return false }, handleUpload() { - const { fileList } = this - const formData = new FormData() - fileList.forEach(file => { - formData.append('files[]', file) - }) + const { fileList, $notification } = this this.uploading = true - - // You can use any AJAX library you like - request({ - url: 'https://www.mocky.io/v2/5cc8019d300000980a055e76', - method: 'post', - processData: false, - data: formData, - success: () => { - this.fileList = [] - this.uploading = false - this.$message.success('upload successfully.') - }, - error: () => { - this.uploading = false - this.$message.error('upload failed.') - } + let uploadedFileCount = 0 + let uploadSuccessFileCount = 0 + fileList.forEach((file, index) => { + const formData = new FormData() + formData.append('file', file) + file.status = 'uploading' + dncApi.importDocumentFromLocalApi(this.uploadParams, formData) + .then(res => { + if (res.success) { + file.status = 'done' + uploadSuccessFileCount++ + $notification.success({ + message: '娑堟伅', + description: res.message + }) + } else { + file.status = 'error' + $notification.error({ + message: '娑堟伅', + description: res.message + }) + } + }) + .catch(err => { + file.status = 'error' + }) + .finally(() => { + uploadedFileCount++ + fileList.splice(index, 1, file) + if (uploadedFileCount === fileList.length) { + if (uploadSuccessFileCount > 0) this.$bus.$emit('importFileSuccess', this.uploadParams) + this.uploading = false + } + }) }) - }, - - /** - * 鎺у埗鏂囦欢涓婁紶绐楀彛寮�鍚苟璁剧疆绐楀彛鏍囬 - * @param modalTitle 绐楀彛鏍囬 - */ - handleModalOpen(modalTitle) { - this.title = modalTitle - this.visible = true }, /** @@ -101,8 +127,12 @@ this.fileList = [] }, - triggerCorrespondingMethod({ methodName, modalTitle }) { - if (this[methodName]) this[methodName](modalTitle) + triggerCorrespondingMethod({ methodName, modalTitle, treeNodeInfo, tableRowInfo }) { + if (this[methodName]) { + this[methodName](treeNodeInfo, tableRowInfo) + this.title = modalTitle + + } } } } diff --git a/src/views/dnc/common/TableContextMenu.vue b/src/views/dnc/common/TableContextMenu.vue index b9dcdbe..e7aa417 100644 --- a/src/views/dnc/common/TableContextMenu.vue +++ b/src/views/dnc/common/TableContextMenu.vue @@ -43,51 +43,40 @@ defaultContextMenuList: { //鏂囨。 document: [ - { show: true, label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false }, + { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false }, + { label: '鎸囨淳鍒拌澶�', code: 'document_assign', subMenu: [], icon: 'cluster', isCommonMethod: false }, + { label: '瀵煎嚭NC绋嬪簭', code: 'document_export', subMenu: [], icon: 'export', isCommonMethod: true }, + { label: '瀵煎叆NC绋嬪簭', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true }, + { label: '涓嬭浇', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true }, + { label: '鍒犻櫎', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true }, + { label: '鎵归噺鍒犻櫎', code: 'document_batch_remove', subMenu: [], icon: 'delete', isCommonMethod: false }, { - show: true, - label: '鎸囨淳鍒拌澶�', - code: 'document_assign', - subMenu: [], - icon: 'cluster', - isCommonMethod: false - }, - { - show: false, - label: '瀵煎嚭NC绋嬪簭', - code: 'document_export', - subMenu: [], - icon: 'export', - isCommonMethod: true - }, - { show: true, label: '瀵煎叆NC绋嬪簭', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true }, - { show: true, label: '涓嬭浇', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true }, - { show: true, label: '鍒犻櫎', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true }, - { - show: true, - label: '鎵归噺鍒犻櫎', - code: 'document_batch_remove', - subMenu: [], - icon: 'delete', - isCommonMethod: false - }, - { - show: true, label: '鐢熷懡鍛ㄦ湡', subMenu: [ - { show: true, label: '鍑哄簱', code: 'document_pull', icon: 'export', isCommonMethod: false }, - { show: true, label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: false }, - { show: true, label: '鍏ュ簱', code: 'document_push', icon: 'import', isCommonMethod: true }, - { show: true, label: '鍙戝竷', code: 'document_publish', icon: 'flag', isCommonMethod: false }, - { show: true, label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload', isCommonMethod: false }, - { show: true, label: '褰掓。', code: 'document_pigeonhole', icon: 'database', isCommonMethod: false } + { label: '鍑哄簱', code: 'document_pull', icon: 'export', isCommonMethod: false }, + { label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: false }, + { label: '鍏ュ簱', code: 'document_push', icon: 'import', isCommonMethod: true }, + { label: '鍙戝竷', code: 'document_publish', icon: 'flag', isCommonMethod: false }, + { label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload', isCommonMethod: false }, + { label: '褰掓。', code: 'document_pigeonhole', icon: 'database', isCommonMethod: false } ], icon: 'hourglass' } + ], + //鏂囦欢 + file: [ + { label: '鎸囧畾褰撳墠鐗堟湰', code: 'file_assign', isCommonMethod: false },//鏂囦欢-鎸囧畾褰撳墠鐗堟湰 + { label: '姣斿', code: 'file_add_relative', isCommonMethod: false }//姣斿 ] } } }, + computed: { + getCurrentDocumentType() { + if (this.tableRowInfo.attributionType === 5 || this.tableRowInfo.attributionType === 6) return 'NC' + else return 'OTHER' + } + }, methods: { menuItemClick({ item, key }) { const menuKeyArray = key.split('_') -- Gitblit v1.9.3