spring
2025-03-11 bdd5fd12d584a71b03d0f7a7a10f3364b8e5f0e1
src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/Edit.vue
@@ -167,14 +167,17 @@
        <div class="search_thing">
          <div class="search_label">用户名:</div>
          <div class="search_input">
            <el-input v-model="addUserTableInfo.entity.name" clearable placeholder="请输入" size="small"
            <el-input v-model="queryParams.name" clearable placeholder="请输入" size="small"
              @keyup.enter.native="$refs.ValueTable.selectList()"></el-input>
          </div>
        </div>
      </div>
      <div v-if="selectUserDia" class="body" style="height: 60vh;">
        <ValueTable ref="ValueTable" :componentData="addUserTableInfo" :isSelectedList="isSelectedList"
          :url="$api.user.selectUserList" />
        <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 290px)'"
          :page="page" @pagination="pagination" :isSelection="true"
          :handleSelectionChange="handleSelectionChange"></lims-table>
        <!-- <ValueTable ref="ValueTable" :componentData="addUserTableInfo" :isSelectedList="isSelectedList"
          :url="$api.user.selectUserList" /> -->
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="selectUserDia = false">取 消</el-button>
@@ -187,7 +190,7 @@
<script>
import TableCard from '@/components/TableCard/index.vue';
import limsTable from "@/components/Table/lims-table.vue";
import ValueTable from '@/components/Table/value-table.vue';
// import ValueTable from '@/components/Table/value-table.vue';
import filePreview from "@/components/Preview/filePreview.vue";
import {
  fileDownLoad,
@@ -198,13 +201,14 @@
  newPersonnelAddedToTrainingRecords,
  deleteTrainingAndAssessmentRecords,
  trainingAndAssessmentRecordsAdded,
  selectUserList,
} from '@/api/cnas/personnel/personnelInfo.js'
import { selectUserCondition } from "@/api/system/user";
import { mapGetters } from "vuex";
export default {
  name: 'Edit',
  // import 引入的组件需要注入到对象中才能使用
  components: { ValueTable, limsTable, TableCard, filePreview },
  components: { limsTable, TableCard, filePreview },
  props: {
    currentRow: {
      type: Object,
@@ -286,7 +290,60 @@
        upUserDepardLimsIdPower: true
      },
      multipleSelection: [],
      multipleSelections: [],
      userList: [],
      stateList: [
        {
          value: 1,
          type: 'success',
          label: '启用'
        },
        {
          value: 0,
          type: 'danger',
          label: '停用'
        }
      ],
      queryParams: {},
      tableData: [],
      column: [
        { label: "姓名", prop: "name" },
        { label: "账号", prop: "account" },
        {
          label: "角色",
          prop: "roleName",
        },
        {
          label: "状态", prop: "state", dataType: "tag",
          formatData: (params) => {
            let index = this.stateList.findIndex(
              (item) => item.value == params
            );
            if (index > -1) {
              return this.stateList[index].label;
            } else {
              return null;
            }
          },
          formatType: (params) => {
            let index = this.stateList.findIndex(
              (item) => item.value == params
            );
            if (index > -1) {
              return this.stateList[index].type;
            } else {
              return null;
            }
          },
        },
        { label: "电话号码", prop: "phone" },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
    };
  },
  computed: {
@@ -394,12 +451,37 @@
        this.$message.success("操作成功!")
      }
    },
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      selectUserList({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.page.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.getList();
    },
    handleSelectionChange(val) {
      this.multipleSelections = val
    },
    addPerson() {
      this.isSelectedList = this.trainingTableData.map(item => item.userId)
      this.getList()
      this.selectUserDia = true;
    },
    selectUser() {
      let selects = this.$refs.ValueTable.multipleSelection;
      let selects = this.multipleSelections;
      if (selects.length == 0) {
        this.$message.error('未选择数据');
        return;