From a3dbb8fe40e06f9abd9718f14aaa7311bddbc150 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 13 二月 2025 21:46:05 +0800 Subject: [PATCH] 除了项目中心,其它项目页面都不显示审核状态 --- src/components/Process/panel/PropertiesPanel.vue | 149 +++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 123 insertions(+), 26 deletions(-) diff --git a/src/components/Process/panel/PropertiesPanel.vue b/src/components/Process/panel/PropertiesPanel.vue index 3d9b41c..c895056 100644 --- a/src/components/Process/panel/PropertiesPanel.vue +++ b/src/components/Process/panel/PropertiesPanel.vue @@ -6,28 +6,36 @@ <el-table-column label="灞炴�у��" prop="value" min-width="100px" show-overflow-tooltip /> <el-table-column label="鎿嶄綔" width="90px"> <template slot-scope="{ row, $index }"> - <el-button size="mini" type="text" @click="openAttributesForm(row, $index)">缂栬緫</el-button> - <el-divider direction="vertical" /> <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeAttributes(row, $index)">绉婚櫎</el-button> </template> </el-table-column> </el-table> <div class="element-drawer__button"> - <el-button size="mini" type="primary" icon="el-icon-plus" @click="openAttributesForm(null, -1)">娣诲姞灞炴��</el-button> + <el-button size="mini" type="primary" icon="el-icon-setting" @click="openAttributesForm(null, -1)">灞炴�ц缃�</el-button> </div> - <el-dialog :visible.sync="propertyFormModelVisible" title="灞炴�ч厤缃�" width="600px" append-to-body destroy-on-close> - <el-form :model="propertyForm" label-width="80px" size="mini" ref="attributeFormRef" @submit.native.prevent> - <el-form-item label="灞炴�у悕锛�" prop="name"> - <el-input v-model="propertyForm.name" clearable /> - </el-form-item> - <el-form-item label="灞炴�у�硷細" prop="value"> - <el-input v-model="propertyForm.value" clearable /> - </el-form-item> - </el-form> + <el-dialog :visible.sync="propertyFormModelVisible" title="灞炴�ч厤缃�" width="600px" @close="closeProperty" append-to-body :destroy-on-close="true" :close-on-click-modal="false"> + <div v-for="item in canConfigPropertyList" style="margin-bottom: 20px"> + <div v-if="item.vueType === 'switch'"> + <el-switch + v-model="item.value" + :inactive-text="item.name" + @change="(val) => item.method(item.name, val === true ? '鏄�' : '鍚�')" + active-color="#13ce66" + inactive-color="#ff4949"> + </el-switch> + </div> + </div> +<!-- <el-form :model="propertyForm" label-width="80px" size="mini" ref="attributeFormRef" @submit.native.prevent>--> +<!-- <el-form-item label="灞炴�у悕锛�" prop="name">--> +<!-- <el-input v-model="propertyForm.name" clearable />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="灞炴�у�硷細" prop="value">--> +<!-- <el-input v-model="propertyForm.value" clearable />--> +<!-- </el-form-item>--> +<!-- </el-form>--> <template slot="footer"> - <el-button size="mini" @click="propertyFormModelVisible = false">鍙� 娑�</el-button> - <el-button size="mini" type="primary" @click="saveAttribute">纭� 瀹�</el-button> + <el-button size="mini" @click="closeProperty">鍏� 闂�</el-button> </template> </el-dialog> </div> @@ -46,7 +54,39 @@ }, data() { return { - elementPropertyList: [], + canConfigPropertyList: [ + { + name: '鏄惁瀹℃壒鑺傜偣', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + }, + { + name: '鏄惁鍏佽璺宠繃', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + }, + { + name: '鏄惁鍏佽瀹圭己', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + } + ], // 鍙互閰嶇疆鐨勫睘鎬у垪琛� + elementPropertyList: [], // 鎵╁睍灞炴�у垪琛� otherExtensionList: [], propertyForm: {}, editingPropertyIndex: -1, @@ -64,6 +104,44 @@ } }, methods: { + closeProperty() { + this.propertyFormModelVisible = false + this.resetList() + }, + resetList() { + this.canConfigPropertyList = [ + { + name: '鏄惁瀹℃壒鑺傜偣', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + }, + { + name: '鏄惁鍏佽璺宠繃', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + }, + { + name: '鏄惁鍏佽瀹圭己', + value: false, + vueType: 'switch', + method: (name, value) => { + this.propertyForm.name = name + this.propertyForm.value = value + this.saveAttribute() + } + } + ] + }, resetAttributesList() { this.bpmnElement = this.modelerStore.element; this.otherExtensionList = []; // 鍏朵粬鎵╁睍閰嶇疆 @@ -74,10 +152,19 @@ } return ex.$type === `flowable:Properties`; }) ?? []; - // 淇濆瓨鎵�鏈夌殑 鎵╁睍灞炴�у瓧娈� this.bpmnElementPropertyList = this.bpmnElementProperties.reduce((pre, current) => pre.concat(current.values), []); - // 澶嶅埗 鏄剧ず + + // 鍥炴樉 + this.canConfigPropertyList.forEach(item => { + const find = this.bpmnElementPropertyList.find(el => el.name === item.name); + if (find) { + if (item.vueType === 'switch') { + item.value = find.value === '鏄�' ? true : false + } + + } + }) this.elementPropertyList = JSON.parse(JSON.stringify(this.bpmnElementPropertyList ?? [])); }, openAttributesForm(attr, index) { @@ -107,22 +194,32 @@ }, saveAttribute() { const { name, value } = this.propertyForm; - console.log(this.bpmnElementPropertyList); + console.log(this.bpmnElementPropertyList, "灞炴�у垪琛�"); if (this.editingPropertyIndex !== -1) { this.modelerStore.modeling.updateModdleProperties(this.bpmnElement, this.bpmnElementPropertyList[this.editingPropertyIndex], { name, value }); } else { - // 鏂板缓灞炴�у瓧娈� - const newPropertyObject = this.modelerStore.moddle.create(`flowable:Property`, { name, value }); - // 鏂板缓涓�涓睘鎬у瓧娈电殑淇濆瓨鍒楄〃 - const propertiesObject = this.modelerStore.moddle.create(`flowable:Properties`, { - values: this.bpmnElementPropertyList.concat([newPropertyObject]) - }); - this.updateElementExtensions(propertiesObject); + // 濡傛灉宸茬粡瀛樺湪杩欎釜灞炴��,灏卞仛淇敼 + const find = this.bpmnElementPropertyList.find(item => item.name === name); + if (find) { + this.modelerStore.modeling.updateModdleProperties(this.bpmnElement, this.bpmnElementPropertyList[this.bpmnElementPropertyList.indexOf(find)], { + name, + value + }); + } else { + // 鏂板缓灞炴�у瓧娈� + const newPropertyObject = this.modelerStore.moddle.create(`flowable:Property`, { name, value }); + // 鏂板缓涓�涓睘鎬у瓧娈电殑淇濆瓨鍒楄〃 + const propertiesObject = this.modelerStore.moddle.create(`flowable:Properties`, { + values: this.bpmnElementPropertyList.concat([newPropertyObject]) + }); + this.updateElementExtensions(propertiesObject); + } } - this.propertyFormModelVisible = false; + // this.propertyFormModelVisible = false; + this.$message.success("鎿嶄綔鎴愬姛") this.resetAttributesList(); }, updateElementExtensions(properties) { -- Gitblit v1.8.0