gaoluyang
2025-03-11 b1b6d5435e244018433b3b1223eee2365cf6fc85
Merge remote-tracking branch 'origin/dev' into dev
已修改3个文件
499 ■■■■ 文件已修改
src/components/Table/lims-table.vue 276 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelList/index.vue 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/Edit.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/lims-table.vue
@@ -1,85 +1,29 @@
<template>
  <div>
    <!-- 表格 -->
    <el-table
      ref="multipleTable"
      v-loading="tableLoading"
      :border="border"
      :data="tableData"
      :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"
      :height="height"
      :highlight-current-row="highlightCurrentRow"
      :row-class-name="rowClassName"
      :row-style="rowStyle"
      :row-key="rowKey"
      :span-method="spanMethod"
      stripe
      style="width: 100%"
      tooltip-effect="dark"
      @row-click="rowClick"
      @current-change="currentChange"
      @selection-change="handleSelectionChange"
      class="lims-table"
    >
      <el-table-column
        align="center"
        type="selection"
        width="55"
        v-if="isSelection"
      />
      <el-table-column
        align="center"
        label="序号"
        type="index"
        width="60"
        :index="indexMethod"
      />
    <el-table ref="multipleTable" v-loading="tableLoading" :border="border" :data="tableData"
      :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" :height="height"
      :highlight-current-row="highlightCurrentRow" :row-class-name="rowClassName" :row-style="rowStyle"
      :row-key="rowKey" :span-method="spanMethod" stripe style="width: 100%" tooltip-effect="dark" @row-click="rowClick"
      @current-change="currentChange" @selection-change="handleSelectionChange" class="lims-table">
      <el-table-column align="center" type="selection" width="55" v-if="isSelection" />
      <el-table-column align="center" label="序号" type="index" width="60" :index="indexMethod" />
      <el-table-column
        v-for="(item, index) in column"
        :key="index"
        :column-key="item.columnKey"
        :filter-method="item.filterHandler"
        :filter-multiple="item.filterMultiple"
        :filtered-value="item.filteredValue"
        :filters="item.filters"
        :fixed="item.fixed"
        :label="item.label"
        :min-width="item.minWidth"
        :prop="item.prop"
        :show-overflow-tooltip="
          item.dataType === 'action' || item.dataType === 'slot' ? false : true
        "
        :sortable="item.sortable ? true : false"
        :type="item.type"
        :width="
          item.dataType === 'action' ? getWidth(item.operation) : item.width
        "
        align="center"
      >
      <el-table-column v-for="(item, index) in column" :key="index" :column-key="item.columnKey"
        :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue"
        :filters="item.filters" :fixed="item.fixed" :label="item.label" :min-width="item.minWidth" :prop="item.prop"
        :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true
          " :sortable="item.sortable ? true : false" :type="item.type" :width="item.dataType === 'action' ? getWidth(item.operation) : item.width
            " align="center">
        <!-- <div class="123" v-if="item.type == ''"> -->
        <template
          v-if="item.hasOwnProperty('colunmTemplate')"
          :slot="item.colunmTemplate"
          slot-scope="scope"
        >
          <slot
            v-if="item.theadSlot"
            :index="index"
            :name="item.theadSlot"
            :row="scope.row"
          />
        <template v-if="item.hasOwnProperty('colunmTemplate')" :slot="item.colunmTemplate" slot-scope="scope">
          <slot v-if="item.theadSlot" :index="index" :name="item.theadSlot" :row="scope.row" />
        </template>
        <template slot-scope="scope">
          <!-- 插槽 -->
          <div v-if="item.dataType == 'slot'">
            <slot
              v-if="item.slot"
              :index="scope.$index"
              :name="item.slot"
              :row="scope.row"
            />
            <slot v-if="item.slot" :index="scope.$index" :name="item.slot" :row="scope.row" />
          </div>
          <!-- 进度条 -->
          <div v-else-if="item.dataType == 'progress'">
@@ -87,140 +31,76 @@
          </div>
          <!-- 图片 -->
          <div v-else-if="item.dataType == 'image'">
            <img
              :src="javaApi + '/img/' + scope.row[item.prop]"
              alt=""
              style="width: 40px; height: 40px; margin-top: 10px"
            />
            <img :src="javaApi + '/img/' + scope.row[item.prop]" alt=""
              style="width: 40px; height: 40px; margin-top: 10px" />
          </div>
          <!-- tag -->
          <div v-else-if="item.dataType == 'tag'">
            <el-tag
              v-if="
                typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
                'string'
              "
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)"
              >{{ scope.row[item.prop] | formatters(item.formatData) }}</el-tag
            >
            <el-tag
              v-for="(tag, index) in dataTypeFn(
                scope.row[item.prop],
                item.formatData
              )"
              v-else-if="
                typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
                'object'
              "
              :key="index"
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(tag, item.formatType)"
              >{{
            <el-tag v-if="
              typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
              'string'
            " :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)">{{ scope.row[item.prop] |
                formatters(item.formatData) }}</el-tag>
            <el-tag v-for="(tag, index) in dataTypeFn(
              scope.row[item.prop],
              item.formatData
            )" v-else-if="
              typeof dataTypeFn(scope.row[item.prop], item.formatData) ==
              'object'
            " :key="index" :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(tag, item.formatType)">{{
                item.tagGroup
                  ? tag[item.tagGroup.label]
                    ? tag[item.tagGroup.label]
                    : tag
                  : tag
              }}</el-tag
            >
            <el-tag
              v-else
              :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)"
              >{{ scope.row[item.prop] | formatters(item.formatData) }}</el-tag
            >
              }}</el-tag>
            <el-tag v-else :title="scope.row[item.prop] | formatters(item.formatData)"
              :type="formatType(scope.row[item.prop], item.formatType)">{{ scope.row[item.prop] |
                formatters(item.formatData) }}</el-tag>
          </div>
          <!-- 按钮 -->
          <div v-else-if="item.dataType == 'action'">
            <template v-for="(o, key) in item.operation">
              <el-button
                v-show="o.type != 'upload'"
                size="mini"
                v-if="o.showHide ? o.showHide(scope.row) : true"
                :disabled="o.disabled ? o.disabled(scope.row) : false"
                :icon="iconFn(o)"
                :plain="o.plain"
                :style="{ color: o.name === '删除' ? '#f56c6c' : o.color }"
                :type="o.type | typeFn(scope.row)"
                @click="o.clickFun(scope.row)"
                :key="key"
              >
              <el-button v-show="o.type != 'upload'" size="mini" v-if="o.showHide ? o.showHide(scope.row) : true"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :icon="iconFn(o)" :plain="o.plain"
                :style="{ color: o.name === '删除' ? '#f56c6c' : o.color }" :type="o.type | typeFn(scope.row)"
                @click="o.clickFun(scope.row)" :key="key">
                {{ o.name }}
              </el-button>
              <el-upload
                :action="
                  javaApi +
                  o.url +
                  '?id=' +
                  (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)
                "
                size="mini"
                ref="upload"
                :multiple="o.multiple ? o.multiple : false"
                :limit="1"
                :disabled="o.disabled ? o.disabled(scope.row) : false"
                :accept="
                  o.accept
                    ? o.accept
                    : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                "
                v-if="o.type == 'upload' && o.url"
                style="display: inline-block; width: 50px"
                v-show="o.showHide ? o.showHide(scope.row) : true"
                :headers="uploadHeader"
                :on-error="onError"
                :on-exceed="onExceed"
                :on-success="handleSuccessUp"
                :show-file-list="false"
                :key="key"
              >
                <el-button
                  :size="o.size ? o.size : 'small'"
                  type="text"
                  :disabled="o.disabled ? o.disabled(scope.row) : false"
                  >{{ o.name }}</el-button
                >
              <el-upload :action="javaApi +
                o.url +
                '?id=' +
                (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)
                " size="mini" ref="upload" :multiple="o.multiple ? o.multiple : false" :limit="1"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept
                  ? o.accept
                  : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                  " v-if="o.type == 'upload' && o.url" style="display: inline-block; width: 50px"
                v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" :on-error="onError"
                :on-exceed="onExceed" :on-success="handleSuccessUp" :show-file-list="false" :key="key">
                <el-button :size="o.size ? o.size : 'small'" type="text"
                  :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button>
              </el-upload>
              <el-upload
                action="#"
                :on-change="
                  (file, fileList) => o.clickFun(scope.row, file, fileList)
                "
                :multiple="o.multiple ? o.multiple : false"
                :limit="o.limit ? o.limit : 1"
                :disabled="o.disabled ? o.disabled(scope.row) : false"
                :accept="
                  o.accept
                    ? o.accept
                    : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                "
                v-if="o.type == 'upload' && !o.url"
                style="display: inline-block; width: 50px"
                v-show="o.showHide ? o.showHide(scope.row) : true"
                :auto-upload="false"
                :on-exceed="onExceed"
                :show-file-list="false"
                :key="key"
              >
                <el-button
                  :size="o.size ? o.size : 'small'"
                  type="text"
                  :disabled="o.disabled ? o.disabled(scope.row) : false"
                  >{{ o.name }}</el-button
                >
              <el-upload action="#" :on-change="(file, fileList) => o.clickFun(scope.row, file, fileList)
                " :multiple="o.multiple ? o.multiple : false" :limit="o.limit ? o.limit : 1"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept
                  ? o.accept
                  : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                  " v-if="o.type == 'upload' && !o.url" style="display: inline-block; width: 50px"
                v-show="o.showHide ? o.showHide(scope.row) : true" :auto-upload="false" :on-exceed="onExceed"
                :show-file-list="false" :key="key">
                <el-button :size="o.size ? o.size : 'small'" type="text"
                  :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button>
              </el-upload>
            </template>
          </div>
          <!-- 可点击的文字 -->
          <div
            v-else-if="item.dataType == 'link'"
            class="cell link"
            style="width: 100%"
            @click="goLink(scope.row, item.linkMethod)"
          >
          <div v-else-if="item.dataType == 'link'" class="cell link" style="width: 100%"
            @click="goLink(scope.row, item.linkMethod)">
            <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          </div>
          <!-- 默认纯展示数据 -->
@@ -233,16 +113,8 @@
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-if="page"
      v-show="page.total > 0"
      :total="page.total"
      :layout="page.layout"
      :page.sync="page.current"
      :limit.sync="page.size"
      @pagination="pagination"
      style="background-color: #fff"
    />
    <pagination v-if="page" v-show="page.total > 0" :total="page.total" :layout="page.layout" :page.sync="page.current"
      :limit.sync="page.size" @pagination="pagination" style="background-color: #fff" />
  </div>
</template>
@@ -331,19 +203,19 @@
    handleSelectionChange: {
      type: Function,
      default: () => {
        return () => {};
        return () => { };
      },
    },
    rowClick: {
      type: Function,
      default: () => {
        return () => {};
        return () => { };
      },
    },
    currentChange: {
      type: Function,
      default: () => {
        return () => {};
        return () => { };
      },
    },
    border: {
@@ -368,7 +240,7 @@
    },
    rowClassName: {
      type: Function,
      default: () => {},
      default: () => { },
    },
    rowStyle: {
      type: Function,
@@ -563,11 +435,11 @@
</script>
<style scoped>
.el-table >>> .el-table__empty-text {
.el-table>>>.el-table__empty-text {
  text-align: center;
}
>>> .cell {
>>>.cell {
  padding: 0 !important;
}
@@ -584,7 +456,7 @@
  cursor: pointer;
}
>>> .el-table__body-wrapper::-webkit-scrollbar {
>>>.el-table__body-wrapper::-webkit-scrollbar {
  height: 14px;
  /* 设置滚动条宽度 */
}
src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelList/index.vue
@@ -15,7 +15,8 @@
        <el-button :loading="synchronousLoading" size="small" type="primary" @click="synchronous"
          :v-show="departId">同步第三方人员信息</el-button>
        <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">导出</el-button>
        <el-button size="small" type="primary" @click="selectUserDia = true">新建</el-button>
        <el-button size="small" type="primary"
          @click="selectUserDia = true, getList(), queryParams.name = '', multipleSelection = []">新建</el-button>
      </span>
    </div>
    <div class="search-table">
@@ -60,13 +61,15 @@
        <div class="search_thing">
          <div class="search_label">用户名:</div>
          <div class="search_input">
            <el-input v-model="addUserTableInfo.entity.name" clearable placeholder="请输入" size="small"
              @keyup.enter.native="$refs.ValueTable.selectList()"></el-input>
            <el-input v-model="queryParams.name" clearable placeholder="请输入" size="small"
              @keyup.enter.native="getList()" style="width: 200px;"></el-input>
          </div>
        </div>
      </div>
      <div v-if="selectUserDia" class="body" style="height: 60vh;">
        <ValueTable ref="ValueTable" :componentData="addUserTableInfo" :url="$api.user.selectUserList" />
        <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 290px)'"
          :page="personPage" @pagination="pagination" :isSelection="true"
          :handleSelectionChange="handleSelectionChange"></lims-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="selectUserDia = false">取 消</el-button>
@@ -77,7 +80,7 @@
</template>
<script>
import ValueTable from '@/components/Table/value-table.vue';
import limsTable from "@/components/Table/lims-table.vue";
import {
  getEmployees,
  basicInformationOfPersonnelSelectPage,
@@ -85,11 +88,12 @@
  upUserDepardLimsId,
  exportPersonBasicInfo,
  exportPersonBasicInfoById,
  selectUserList,
} from '@/api/cnas/personnel/personnelInfo.js'
export default {
  name: 'PersonnelList',
  // import 引入的组件需要注入到对象中才能使用
  components: { ValueTable },
  components: { limsTable },
  props: {
    departId: {
      type: Number,
@@ -109,6 +113,8 @@
  data() {
    // 这里存放数据
    return {
      entity: {},
      multipleSelection: [],
      synchronousLoading: false,
      page: {
        size: 20,
@@ -117,46 +123,61 @@
      outLoading: false,
      tableLoading: false,
      tableData: [], // 人员总列表数据
      selectUserDia: false, // 添加人员弹框
      entity: {
        name: '',
        orderBy: {
          field: 'id',
          order: 'asc'
      selectUserDia: false, // 添加人员弹框,
      stateList: [
        {
          value: 1,
          type: 'success',
          label: '启用'
        },
        {
          value: 0,
          type: 'danger',
          label: '停用'
        }
      ],
      queryParams: {
        name: ''
      },
      addUserTableInfo: {
        name: null,
        entity: {
          isCustom: 0,
          orderBy: {
            field: 'id',
            order: 'asc'
          }
      tableData: [],
      column: [
        { label: "姓名", prop: "name" },
        { label: "账号", prop: "account" },
        {
          label: "角色",
          prop: "roleName",
        },
        isIndex: true,
        showSelect: true,
        select: true,
        do: [],
        tagField: {
          state: {
            select: [
              {
                value: 1,
                type: 'success',
                label: '启用'
              },
              {
                value: 0,
                type: 'danger',
                label: '停用'
              }
            ]
          }
        {
          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;
            }
          },
        },
        selectField: {},
        upUserDepardLimsIdPower: true
        { label: "电话号码", prop: "phone" },
      ],
      personPage: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
    };
  },
  mounted() {
@@ -232,12 +253,15 @@
      this.page.current = val;
      this.refreshTable();
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    selectUser() {
      if (!this.currentCompaniesList.length > 0) {
        this.$message.warning("请选择部门!")
        return;
      }
      let selects = this.$refs.ValueTable.multipleSelection;
      let selects = this.multipleSelection;
      if (selects.length == 0) {
        this.$message.error('未选择数据');
        return;
@@ -265,6 +289,27 @@
      });
      this.$emit('refreshTree')
    },
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.personPage };
      delete param.total;
      selectUserList({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.personPage.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination({ page, limit }) {
      this.personPage.current = page;
      this.personPage.size = limit;
      this.getList();
    },
    handleDown() {
      this.outLoading = true;
      let entity = this.HaveJson(this.entity)
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;