zxl
2025-03-25 6ae0fcef149ddbe614746023a58a3885b3ac4bde
src/components/Process/panel/PropertiesPanel.vue
@@ -15,15 +15,37 @@
    </div>
    <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
      <div v-for="item in canConfigPropertyList" style="margin-bottom: 20px; display: flex; align-items: center;">
        <!-- Name  -->
        <span style="flex: 0 0 100px; text-align: right; margin-right: 20px;">{{ item.name }}</span>
        <!-- 组件 -->
        <div >
          <!-- Switch -->
          <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>
              inactive-color="#ff4949"
            >
            </el-switch>
          </div>
          <!-- Select -->
          <div v-if="item.vueType === 'select'">
            <el-select
              v-model="item.value"
              @change="(val) => item.method(item.name, val)"
              placeholder="请选择"
            >
              <el-option
                v-for="option in item.options"
                :key="option.value"
                :label="option.label"
                :value="option.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
      </div>
<!--      <el-form :model="propertyForm" label-width="80px" size="mini" ref="attributeFormRef" @submit.native.prevent>-->
@@ -84,6 +106,32 @@
            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: null,
          vueType: 'select',
          options: [
            {label: '储备规划阶段',value: '储备规划阶段'},
            {label: '项目前期阶段',value: '项目前期阶段'},
            {label: '实施阶段',value: '实施阶段'},
            {label: '竣工投用阶段',value: '竣工投用阶段'}
          ],
          method: (name, value) => {
            this.propertyForm.name = name
            this.propertyForm.value = value
            this.saveAttribute()
          }
        }
      ], // 可以配置的属性列表
      elementPropertyList: [], // 扩展属性列表
@@ -106,7 +154,7 @@
  methods: {
    closeProperty() {
      this.propertyFormModelVisible = false
      this.resetList()
      // this.resetList()
    },
    resetList() {
      this.canConfigPropertyList = [
@@ -153,16 +201,23 @@
          return ex.$type === `flowable:Properties`;
        }) ?? [];
      // 保存所有的 扩展属性字段
      this.bpmnElementPropertyList = this.bpmnElementProperties.reduce((pre, current) => pre.concat(current.values), []);
      this.bpmnElementPropertyList = this.bpmnElementProperties.reduce((pre, current) => {
        // 检查 current.values 是否是数组,如果不是则使用空数组
        const values = current.values ? current.values : [];
        return pre.concat(values);
      }, []);
      console.log("bpmnElementProperties",this.bpmnElementProperties)
      // 回显
      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
          }else if (item.vueType === 'select') {
            item.value = find.value
          }
        } else {
          item.value = null
        }
      })
      this.elementPropertyList = JSON.parse(JSON.stringify(this.bpmnElementPropertyList ?? []));