田源
2024-09-27 322b236f53f9aa8e12c6e019c861e2ea1bc4ab16
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/rightRegion/bottomTable/index.vue
@@ -68,9 +68,9 @@
      append-to-body="true"
      class="avue-dialog"
      title="配置按钮"
      width="70%"
      width="75%"
      @close="dialogClose">
      <el-container>
      <el-container v-loading="dialogLoading">
        <el-header style="height: 40px !important;">
          <div style="display: flex">
            <el-button :disabled="!disabledBtn" plain size="mini" type="primary" @click="addClickBtnHandler">添加
@@ -129,7 +129,7 @@
                  <el-form-item label="Action:" prop="Action">
                    <el-col :span="14">
                      <el-input v-model="basicForm.actionOId" :readonly="disabledBtn"></el-input>
                      <el-input v-model="basicForm.actionName" :readonly="disabledBtn" @focus="actionFoucus"></el-input>
                    </el-col>
                  </el-form-item>
@@ -190,6 +190,15 @@
        </el-container>
      </el-container>
    </el-dialog>
    <el-dialog
      v-dialogDrag
      :visible.sync="btnActionVisible"
      append-to-body="true"
      class="avue-dialog"
      title="选择Action"
      width="70%">
      <action-dialog></action-dialog>
    </el-dialog>
  </basic-container>
</template>
@@ -197,73 +206,35 @@
import basicOption from "@/util/basic-option";
import func from "@/util/func";
import {
  getPLPageDefinations,
  getBtmDatasByPage,
  getPortalVIDatasByPage,
  getQTInfoDatasByPage,
  getTabButtons,
  addTapButton,
  updateTapButton
} from "@/api/UI/uiDefine/api";
  updateTapButton, getTabByContextIdAndType
} from "@/api/UI/uiDefine";
import actionDialog from '@/views/modelingMenu/ui/uiDefine/rightRegion/bottomTable/components/action';
export default {
  props: {
    sourceData: {
      type: Array,
      default: () => [
        {
          "controlPath": "",
          "description": "",
          "eventKey": "",
          "eventMap": null,
          "eventValue": "",
          "expandCols": "",
          "expandMode": "",
          "extAttr": "",
          "id": "ABAE25CE-867E-9C73-AC1A-B316FD91C65B",
          "isShowImage": "",
          "linkType": "parttodocument",
          "name": "技术文件",
          "navigatorType": "",
          "orderField": "",
          "orderMode": "",
          "orientation": "",
          "qryType": null,
          "queryTemplateName": "QueryPartEngineeringTechnology",
          "refTreeSet": "",
          "returnRows": "",
          "rootContent": "",
          "searchTarger": "2",
          "separator": "",
          "seq": "1",
          "showAbs": "",
          "showContent": "",
          "showContentRelation": "",
          "showContentTable": "",
          "showContentType": "",
          "showExpression": "",
          "showExpressionRoot": "",
          "showLinkAbs": "",
          "showType": "document",
          "subUILayout": "",
          "subUIObjType": "",
          "tabPageOId": "98F9082F-BAF4-FB81-3230-32590B34A329",
          "templateId": "PartEngineeringTechnology_list",
          "templateType": "1",
          "type": 3,
          "uiLayout": null,
          "uiParser": "",
          "validity": ""
        }
      ]
      type: Object,
      default: () => {}
    },
    height: {
      type: String,
      default: () => "auto"
    }
  },
  components: {
    actionDialog
  },
  name: "index",
  data() {
    return {
      btnActionVisible: false,
      dialogLoading: false,
      saveType: '',
      disabledBtn: true,
      paramsData: [],
@@ -299,13 +270,7 @@
      basicForm: {
        seq: 1
      },
      treeData: [
        {
          label: this.sourceData[0].name,
          oId: 'parentNode',
          children: []
        }
      ],
      treeData: [],
      treeOption: {
        menu: false,
        addBtn: false,
@@ -320,7 +285,7 @@
      btnDesignVisible: false,
      FormData: [],
      form: {},
      data: this.sourceData,
      data: [],
      option: {
        ...basicOption,
        height: this.height,
@@ -816,8 +781,31 @@
      formDataRow: {},
    }
  },
  watch: {
    sourceData:{
      handler(val) {
        if(val && val.plOId) {
          this.getTableList()
        }
      },
      immediate: true,
      deep:true
    }
  },
  computed: {},
  methods: {
    //获取列表数据
    getTableList(){
      const params = {
        pageContextOId:this.sourceData.plOId
      }
      getPLPageDefinations( params).then(res => {
        this.data = res.data.data;
        this.selectList=[];
        this.$refs.crud.clearSelection();
        this.tableLoading = false;
      })
    },
    // 根据不同值区分类型
    templateTypeValueHandler(val) {
      const componentMap = {
@@ -960,8 +948,8 @@
    moveUp() {
      const index = this.findIndexByEventValue(this.FormData, this.formDataRow.eventValue);
      if (index > 0) {
        // 使用 splice 方法来模拟交换
        const temp = this.FormData.splice(index - 1, 1, this.FormData[index])[0]; // 移除 index-1 的元素,并在相同位置插入 index 的元素,返回被移除的元素
        // 使用 splice 来模拟交换
        const temp = this.FormData.splice(index - 1, 1, this.FormData[index])[0]; // 移除 index-1 的元素 并在相同位置插入 index 的元素 返回被移除的元素
        this.FormData.splice(index, 1, temp); // 在 index 位置插入之前被移除的元素
      }
    },
@@ -983,12 +971,8 @@
    // 按钮设计
    btnDesignClickHandler() {
      if (this.selectList.length <= 0) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      if (this.selectList.length > 1) {
        this.$message.error('最多选择一条数据');
      if (this.selectList.length !=1) {
        this.$message.error('请选择一条数据');
        return;
      }
      this.btnDesignVisible = true;
@@ -1004,7 +988,11 @@
      getTabButtons(params).then(res => {
        if (res.data.code === 200) {
          const data = res.data.data;
          this.treeData[0].children = data;
          this.treeData=[{
              label: this.selectList[0].name,
              oId: 'parentNode',
              children:data
            }];
          this.treeLoading = false;
        } else {
          this.$message.error('请检查控制台错误');
@@ -1064,7 +1052,7 @@
    // 按钮设计修改
    editClickBtnHandler() {
      if (func.isEmptyObject(this.nodeTreeRow)) {
        this.$message.error('请选择节点进行添加');
        this.$message.error('请选择节点进行修改');
        return;
      }
@@ -1087,6 +1075,7 @@
    // 按钮设计保存
    saveClickBtnHandler() {
      this.dialogLoading = true;
      const saveFunction = this.saveType === 'add' ? addTapButton : updateTapButton;
      const bottomParams = {};
      if (this.paramsData.length > 0) {
@@ -1112,7 +1101,10 @@
          this.getTabBtnTree();
          this.basicForm = {};
          this.paramsData = [];
          this.dialogLoading = false;
        }
      }).catch(err => {
        this.dialogLoading = false;
      })
    },
@@ -1141,6 +1133,11 @@
        });
      });
    },
    // 选择action
    actionFoucus() {
      this.btnActionVisible = true;
    }
  }
}
</script>