田源
2024-03-22 f9b749d2ae804869b09d035de44ba1ce71214dc1
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -18,7 +18,7 @@
                 :icon="item.paramVOS.webUiButtonIcon ? item.paramVOS.webUiButtonIcon : (item.paramVOS.webUiButtonMethods === 'edit' ? 'el-icon-edit' : (item.paramVOS.webUiButtonMethods === 'delete' ? 'el-icon-delete' : ''))"
                 :type="item.paramVOS.webUiButtonType || 'text'" plain
                 size="small"
                 @click="buttonClick(item,scope)">
                 @click="buttonClick(item)">
        {{ item.name }}
      </el-button>
      <!-- 表格内按钮操作对话框表单   -->
@@ -29,7 +29,7 @@
      <el-button v-for="item in basicButtonList"
                 :key="item.oid"
                 :icon="item.paramVOS.webUiButtonIcon"
                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.buttonType : 'primary') || 'primary'"
                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
                 plain
                 size="small"
                 @click="buttonClick(item)">
@@ -56,6 +56,9 @@
      type: Object,
    },
    butttonList: {
      type: Array
    },
    selectList: {
      type: Array
    }
  },
@@ -228,15 +231,11 @@
  },
  computed: {
    basicButtonList() {
      // const basicColumn = this.butttonList.filter(item => item.id !== 'launchworkflow'); // 首先过滤出来基础表单事件的按钮
      const basicColumn = this.butttonList;
      if (this.type === 'form') {
        return basicColumn;
      } else if (this.type === 'table') {
        const top = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation)); // 过滤出来表格上面区域展示的按钮
        const menu = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'menu'); // 过滤出来操作栏展示的按钮
@@ -256,12 +255,30 @@
      }
      function handleEdit() {
        this.visible = true;
        this.$refs.dynamicForm.form = this.scope.row;
        const location = item.paramVOS.webUiButtonLocation;
        if (location === 'menu') {
          this.visible = true;
          this.$refs.dynamicForm.form = this.scope.row;
        } else if (location === 'top' && this.selectList.length === 1) {
          this.visible = true;
          this.$refs.dynamicForm.form = this.selectList[0];
        } else {
          const messageText = this.selectList.length > 1 ? '只能选择一条数据进行编辑!' : '请选择一条数据进行编辑!';
          this.$message.warning(messageText);
        }
      }
      function handleDelete() {
        this.$message.success('删除成功!');
        const location = item.paramVOS.webUiButtonLocation;
        if (location === 'top') {
          if (this.selectList.length <= 0) {
            this.$message.warning('请至少选择一条数据!')
          } else {
            this.$message.success('删除成功!');
          }
        } else if (location === 'menu') {
          this.$message.success('删除成功!');
        }
      }
      const methodHandlers = {