wangyi
2026-01-19 7fb0a8f0ab16c149484bf043754cd10cfa94de2f
src/views/component/gyDuty/index.vue
@@ -1,41 +1,62 @@
<template>
  <div style="padding: 10px">
    <el-table
      v-loading="loading"
      :data="tableData"
      ref="workTypeTable"
      max-height="550"
      @selection-change="handleSelectionChange"
      show-summary
      border
      @row-click="handleRowClick"
      :row-style="rowStyle"
      @cell-dblclick="handleDblclick"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column align="center" label="sorderid" type="index" sortable width="80" />
      <el-table-column
        align="center"
        v-for="(item, index) in tableColumns"
        :key="index"
        :prop="item.ColmCols"
        :label="item.ColmCols"
        :width="flexWidth(item.ColmCols, tableData, item.ColmCols)"
        sortable
      >
        <template slot-scope="{ row, column }">
          <span>{{ row[column.label] }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="page"
      :limit.sync="pageSize"
      @pagination="currentPage"
    />
  </div>
  <el-row>
    <el-col :span="4">
      <div style="padding: 10px">
        <el-tree
          :data="treeData"
          :props="treeProps"
          accordion
          @node-click="handleNodeClick"
        >
        </el-tree>
      </div>
    </el-col>
    <el-col :span="20">
      <div style="padding: 10px">
        <el-table
          v-loading="loading"
          :data="tableData"
          ref="workTypeTable"
          max-height="550"
          @selection-change="handleSelectionChange"
          show-summary
          border
          @row-click="handleRowClick"
          :row-style="rowStyle"
          @cell-dblclick="handleDblclick"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
            align="center"
            label="sorderid"
            type="index"
            sortable
            width="80"
          />
          <el-table-column
            align="center"
            v-for="(item, index) in tableColumns"
            :key="index"
            :prop="item.ColmCols"
            :label="item.ColmCols"
            :width="flexWidth(item.ColmCols, tableData, item.ColmCols)"
            sortable
          >
            <template slot-scope="{ row, column }">
              <span>{{ row[column.label] }}</span>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="page"
          :limit.sync="pageSize"
          @pagination="currentPage"
        />
      </div>
    </el-col>
  </el-row>
</template>
<script>
@@ -130,9 +151,13 @@
          ColmType: "VARCHAR",
        },
      ],
      treeData: [], // 树状图数据
      treeProps: {}, // 树状图属性
    };
  },
  created() {
  async created() {
    await this.getTreeList();
    this.getList();
  },
  props: {
@@ -142,12 +167,33 @@
    },
  },
  methods: {
    // 工种
    // 树状图节点点击事件
    handleNodeClick(e) {
      console.log(e)
      this.form.userId = e.id
      this.getList()
    },
    // 获取树状图结构
    async getTreeList() {
      this.treeData = []
      let res = await axios.get(this.$baseUrl + "/Gy_DutyBill/Gy_DutyBillTreeList");
      console.log(res.data.data);
      this.treeData = [...JSON.parse(res.data.data)];
      Object.assign(this.treeProps, {
        children: "children",
        label: 'title',
        key: 'id'
      })
    },
    // 职务
    getList() {
      let sWhere = "";
      this.loading = true;
      if(this.form.userId){
        sWhere += " and 组织架构代码 like'" + this.form.userId + "%' ";
      }
      axios
        .get(this.baseURL + "/Gy_DutyBill/Gy_DutyBillList", {
        .get(this.$baseUrl + "/Gy_DutyBill/Gy_DutyBillList", {
          params: { sWhere: sWhere, user: this.user },
        })
        .then((response) => {