田源
2024-04-15 52e123212f37e214ee4599649adbd743e0d86c2b
Source/ProjectWeb/src/components/dynamic-components/dynamic-TreeTable.vue
@@ -5,6 +5,7 @@
               :data="TreeData"
               :option="option"
               :page.sync="pageType"
               @row-click="rowClickChange"
               @selection-change="TreeSelectChange">
      <template #icon="scope">
        <i :class="scope.row.icon"
@@ -12,14 +13,14 @@
      </template>
      <!--top区域按钮-->
      <template slot="menuLeft" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :selectList="selectList" LocationType="top"
                        type="table"></dynamic-button>
        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="TreeSelectList" :sourceData="sourceData" LocationType="top"
                        type="TreeTable"></dynamic-button>
      </template>
      <!--menu区域按钮-->
      <template slot="menu" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="selectList" LocationType="menu"
                        type="table"></dynamic-button>
        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="TreeSelectList" :sourceData="sourceData" LocationType="menu" default="default"
                        type="TreeTable"></dynamic-button>
      </template>
    </avue-crud>
  </div>
@@ -72,11 +73,11 @@
        currentPage: 1,
        total: 50,
      },
      simplePage:{
      simplePage: {
        currentPage: 1,
        total: 100,
        pagerCount:4,
        layout:"prev, pager, next"
        pagerCount: 4,
        layout: "prev, pager, next"
      },
      //表格树
      form: {},
@@ -86,7 +87,7 @@
        editBtn: false,
        delBtn: false,
        selection: true,
        tip:false,
        tip: false,
        calcHeight: 15,
        indexFixed: false,
        menuFixed: false,
@@ -154,18 +155,205 @@
              ]
            }
          ]
        }
        },
        {
          id: 10,
          event: '事件3',
          timeLine: 50,
          comment: '无'
        },
        {
          id: 10,
          event: '事件4',
          timeLine: 50,
          comment: '无'
        },
        {
          id: 10,
          event: '事件5',
          timeLine: 50,
          comment: '无'
        },
        {
          id: 10,
          event: '事件6',
          timeLine: 50,
          comment: '无'
        },
      ],
      TreeSelectList: []
      TreeSelectList: [],
      // 表单数据
      formList: [
        {
          comboxKey: null,
          customClass: null,
          data: null,
          dateFormate: null,
          defaultValue: "",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "name",
          hidden: false,
          keyAttr: true,
          prefix: null,
          readOnly: false,
          referConfig: null,
          required: true,
          selectLibFlag: null,
          showField: null,
          suffix: '$',
          text: "名称",
          tooltips: '名称',
          type: "text",
          unique: false,
          verify: ""
        },
        {
          comboxKey: null,
          customClass: null,
          data: null,
          dateFormate: null,
          defaultValue: "",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "code",
          hidden: false,
          keyAttr: false,
          prefix: null,
          readOnly: false,
          referConfig: null,
          required: false,
          selectLibFlag: null,
          showField: null,
          suffix: null,
          disabled: true,
          text: "编码",
          tooltips: null,
          type: "text",
          unique: false,
          verify: ""
        },
        {
          comboxKey: "EnumReviewType",
          customClass: null,
          data: null,
          dateFormate: null,
          defaultValue: "department",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "reviewtype",
          hidden: false,
          keyAttr: false,
          prefix: null,
          readOnly: false,
          referConfig: null,
          required: false,
          selectLibFlag: null,
          showField: null,
          suffix: null,
          text: "类型",
          tooltips: null,
          type: "combox",
          unique: false,
          verify: "",
          dicData: [{
            label: '测试1',
            value: 'department'
          }, {
            label: '测试2',
            value: 'departments'
          }]
        },
        {
          comboxKey: null,
          customClass: null,
          data: null,
          dateFormate: null,
          defaultValue: "",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "creator",
          hidden: true,
          keyAttr: false,
          prefix: null,
          readOnly: true,
          referConfig: null,
          required: false,
          selectLibFlag: null,
          showField: null,
          suffix: null,
          text: "创建人",
          tooltips: null,
          type: "text",
          unique: false,
          verify: ""
        },
        {
          comboxKey: null,
          customClass: null,
          data: null,
          dateFormate: "yyyy-MM-dd HH:mm:ss",
          defaultValue: "",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "createtime",
          hidden: true,
          keyAttr: false,
          prefix: null,
          readOnly: false,
          referConfig: null,
          required: false,
          selectLibFlag: null,
          showField: null,
          suffix: null,
          text: "创建时间",
          tooltips: null,
          type: "datetime",
          unique: false,
          verify: ""
        },
        {
          comboxKey: null,
          customClass: null,
          data: null,
          dateFormate: null,
          defaultValue: "",
          displayExtension: "",
          extendAttrMap: null,
          extendAttrString: null,
          field: "content",
          hidden: false,
          keyAttr: false,
          prefix: null,
          readOnly: false,
          referConfig: null,
          required: false,
          selectLibFlag: null,
          showField: null,
          suffix: null,
          text: "备注",
          tooltips: null,
          type: "textarea",
          unique: false,
          verify: ""
        },
      ],
      formName: '',
      visible:false
    }
  },
  watch:{
    parentHeight:{
  watch: {
    parentHeight: {
      handler(newval) {
        if(newval >50){
          this.option.height=newval;
        if (newval > 50) {
          this.option.height = newval;
          //doLayout不生效,手动设置表格高度
          this.$children[0].$children[1].$children[1].$children[0].$el.style.height=newval+'px';
          this.$children[0].$children[1].$children[1].$children[0].$el.style.height = newval + 'px';
          /*this.$nextTick(() => {
            if (this.$refs.dataTable && this.$refs.dataTable.doLayout) {
              this.$refs.dataTable.doLayout();
@@ -174,11 +362,18 @@
        }
      }
    },
    isShow:{
    isShow: {
      handler(newval) {
        if(newval && this.$el.clientHeight>50) {
        if (newval && this.$el.clientHeight > 50) {
          this.parentHeight = this.$el.clientHeight - this.$children[0].$children[1].$children[0].$el.clientHeight - this.$children[0].$children[2].$el.clientHeight - 5;
        }
      }
    },
    sourceData:{
      handler(newval) {
        //源数据有变化时变更当前区域数据
        console.log(this.areasName);
        console.log(newval);
      }
    }
  },
@@ -190,12 +385,23 @@
  },
  computed: {
    pageType() {
      return this.areasName === 'westArea' ? this.simplePage : this.page;
      return this.areasName.indexOf('westArea') == 0  ? this.simplePage : this.page;
    }
  },
  methods: {
    rowClickChange(row){
      this.$refs.treeTable.toggleRowSelection(row);
    },
    TreeSelectChange(row) {
      this.TreeSelectList = row;
      this.$emit("setDataStore", {
        area: this.areasName,
        type:this.componentVO.uiComponentType,
        dataStore:row
      });
    },
    handleRefresh(){
      this.$refs.treeTable.refreshTable();
    }
  }
}