<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item :label="$t('培训级别')" prop="trainingLevel">
        <el-select v-model="queryParams.trainingLevel" @change="handleQuery" :placeholder="$t('请选择') + $t('培训级别')" clearable size="small">
          <el-option
            v-for="dict in trainingLevelOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('课程名称')" prop="item">
        <el-input
          v-model="queryParams.item"
          :placeholder="$t('请输入') + $t('课程名称')"
          clearable
          size="small"
          @input="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['training:matrix:add']"
        >{{ $t('新增') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['training:matrix:edit']"
        >{{ $t('修改') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['training:matrix:remove']"
        >{{ $t('删除') }}</el-button>
      </el-col>

      <el-col :span="1.5">
          <el-button
                  type="info"
                  icon="el-icon-upload2"
                  size="mini"
                  @click="handleImport"
                  v-hasPermi="['training:matrix:edit']"
          >导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['training:matrix:export']"
        >{{ $t('导出') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchTraining"
          v-hasPermi="['training:matrix:add']"
        >添加到装置计划</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchCompany"
          v-hasPermi="['training:matrix:add']"
        >添加到公司培训</el-button>
      </el-col>
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-row class="colorMark">
      <svg-icon icon-class="rectangleLightgreen" class="rectangleLightgreen"></svg-icon>{{ $t('需要培训') }}
      <svg-icon icon-class="rectangleFlesh" class="rectangleFlesh"></svg-icon>{{ $t('指定人员') }}
      <svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>{{ $t('当被此项目涉及到时，如MOC、事件调查，需要培训') }}
    </el-row>

    <el-table ref="matrixTable" v-loading="loading" :data="matrixList" @selection-change="handleSelectionChange" :cell-class-name="tableCellClassName" :height="clientHeight" border>
      <el-table-column type="selection" width="55" fixed="left" min-width="55" align="center" />
      <el-table-column :label="$t('培训级别')" fixed="left" align="center" prop="trainingLevel" width="150" min-width="55":formatter="trainingLevelFormat" />
      <el-table-column :label="$t('课程名称')" fixed="left" align="center" prop="item" width="250" min-width="55":show-overflow-tooltip="true"/>
      <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="150" min-width="55":show-overflow-tooltip="true"/>
      <el-table-column :label="$t('频率')" align="center" prop="frequency" width="300" min-width="55":show-overflow-tooltip="true"/>
      <el-table-column :label="$t('责任部门')" align="center" prop="responsDept" width="120" min-width="120" :formatter="responsDeptFormat" />
      <el-table-column :label="$t('授课人')" align="center" prop="lecturer" width="100" min-width="100" :formatter="lecturerFormat"/>
      <el-table-column :label="$t('课时')" align="center" prop="hour" width="70" min-width="70"  :show-overflow-tooltip="true"/>
      <el-table-column v-for="(item, index) in actualpostIdOptions" width="150" min-width="150" :label="item.dictLabel" :key="index" align="center">
        <template slot-scope="scope">
          {{scope.row.actualpost[index]}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('备注')" align="center" prop="remarks" width="300" min-width="300" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" min-width="120" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['training:matrix:edit']"
          >{{ $t('修改') }}</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['training:matrix:remove']"
          >{{ $t('删除') }}</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改培训矩阵对话框 -->
    <el-dialog  :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <el-form-item :label="$t('培训级别')" prop="trainingLevel">
          <el-select v-model="form.trainingLevel" :placeholder="$t('请选择') + $t('培训级别')">
            <el-option
              v-for="dict in trainingLevelOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('课程名称')" prop="item">
          <el-input v-model="form.item" :placeholder="$t('请输入') + $t('课程名称')" />
        </el-form-item>
        <el-form-item :label="$t('课程代码')" prop="courseCode">
          <el-input v-model="form.courseCode" :placeholder="$t('请输入') + $t('课程代码')" />
        </el-form-item>
        <el-form-item :label="$t('频率')" prop="frequency">
          <el-input v-model="form.frequency" :placeholder="$t('请输入') + $t('频率')" />
        </el-form-item>
        <el-form-item :label="$t('责任部门')" prop="responsDept">
          <el-select v-model="form.responsDept" :placeholder="$t('请选择') + $t('责任部门')">
            <el-option
              v-for="dict in responsDeptOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('授课人')" prop="lecturer">
          <el-select v-model="form.lecturer" :placeholder="$t('请选择') + $t('授课人')">
            <el-option
              v-for="dict in lecturerOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('课时')" prop="hour">
          <el-input v-model="form.hour" :placeholder="$t('请输入') + $t('课时')" />
        </el-form-item>
        <el-form-item :label="$t('需参培岗位')" prop="actualpostId">
          <el-select v-model="actualpostIds" multiple :placeholder="$t('请选择') + $t('需参培岗位')" @change="changeActualpost">
            <el-option
              v-for="dict in actualpostIdOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('是否存在') +$t('空格') + $t('指定人')" prop="haveDesignated">
          <el-checkbox v-model="haveDesignated"></el-checkbox>
        </el-form-item>
        <el-form-item :label="$t('指定人员岗位')" prop="designatedPositions" v-if="haveDesignated === true">
          <el-select v-model="designatedPositions" multiple :placeholder="$t('请选择') + $t('指定岗位')">
            <el-option
              v-for="dict in designatedPositionOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('是否涉及') + $t('其他部门')" prop="involvedMoc">
          <el-checkbox v-model="form.involvedMoc" @change="changeInvolved"></el-checkbox>
        </el-form-item>
        <el-form-item :label="$t('指定其他部门')" prop="designatedOther" v-if="form.involvedMoc === true">
          <el-select v-model="otherPositions" multiple :placeholder="$t('请选择') + $t('其他部门')">
            <el-option
              v-for="dict in otherPositionOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('备注')" prop="remarks">
          <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
        </el-form-item>
          <el-form-item :label="$t('归属部门')" prop="deptId">
              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
          </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
        <el-button @click="cancel">{{ $t('取 消') }}</el-button>
      </div>
    </el-dialog>
      <!-- 用户导入对话框 -->
      <el-dialog  :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
          <el-upload
                  ref="upload"
                  :limit="1"
                  accept=".xlsx, .xls"
                  :headers="upload.headers"
                  :action="upload.url + '?updateSupport=' + upload.updateSupport"
                  :disabled="upload.isUploading"
                  :on-progress="handleFileUploadProgress"
                  :on-success="handleFileSuccess"
                  :auto-upload="false"
                  drag
          >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                {{ $t('将文件拖到此处，或') }}
                  <em>{{ $t('点击上传') }}</em>
              </div>
              <div class="el-upload__tip" slot="tip">
<!--                  <el-checkbox v-model="upload.updateSupport" />{{ $t('是否更新已经存在的用户数据') }}-->
                  <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
              </div>
              <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
                  <input name="type" :value="upload.type" hidden />
              </form>
              <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示：仅允许导入“xls”或“xlsx”格式文件！')}}</div>
          </el-upload>
          <div slot="footer" class="dialog-footer">
              <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
              <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
          </div>
      </el-dialog>
  </div>
</template>

<script>
import { listMatrix,batchAddCompany,batchAddTraining, getMatrix, delMatrix, addMatrix, updateMatrix, exportMatrix, importTemplate} from "@/api/training/matrix";
import { treeselect } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {batchStatus} from "@/api/training/newstaff/firstplan";

export default {
  name: "Matrix",
  components: { Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 培训矩阵表格数据
      matrixList: [],
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: undefined,
      clientHeight:300,
      // 是否显示弹出层
      open: false,
      // 需参培岗位字典
      actualpostIdOptions: [],
      // 授课人字典
      lecturerOptions: [],
      // 指定岗位字典
      designatedPositionOptions: [],
      // 指定部门字典
      otherPositionOptions: [],
      // 责任部门字典
      responsDeptOptions: [],
      // 培训级别字典
      trainingLevelOptions: [],
      //培训岗位多选
      actualpostIds: [],
      //指定人员岗位多选
      designatedPositions: [],
      //其他部门多选
      otherPositions: [],
      //指定人员id多选
      designatedStaffs: [],
      //是否存在岗位多选
      haveDesignated: false,
      //人员表联查
      stffmgrOptions: undefined,
      //人员表查询参数
      staffmgrQueryParams: {
        actualposts: null
      },
      // 用户导入参数
      upload: {
          downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
          //下载模板类型
          type: "trainingMatrix",
          // 是否显示弹出层（用户导入）
          open: false,
          // 弹出层标题（用户导入）
          title: "",
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的用户数据
          updateSupport: 0,
          // 设置上传的请求头部
          headers: { Authorization: "Bearer " + getToken() },
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + "/training/matrix/importData"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        trainingLevel: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        deptId: [
          { required: true, message: this.$t('部门编号') + this.$t('不能为空'), trigger: "blur" }
        ],
      }
    };
  },
  watch: {
    // 根据名称筛选部门树
    deptName(val) {
        this.$refs.tree.filter(val);
    }
   },
  created() {
    //设置表格高度对应屏幕高度
    this.$nextTick(() => {
        this.clientHeight = document.body.clientHeight -250
    })

    this.getTreeselect();
    this.getDicts("ACTUALPOST").then(response => {
      this.actualpostIdOptions = response.data;
    });
    this.getDicts("ACTUALPOST").then(response => {
      this.designatedPositionOptions = response.data;
    });
    let _this = this
    this.getDicts("ACTUALPOST").then(response => {
      response.data.forEach(function (positionValue, positionkey, arr) {
        if (positionValue.dictValue === "28" || positionValue.dictValue === "30" || positionValue.dictValue === "32") {
          _this.otherPositionOptions.push(positionValue)
        }
      })
      this.getList();
    });
    this.getDicts("ACTUALPOST").then(response => {
      this.lecturerOptions = response.data;
    });
    this.getDicts("RESPONS_DEPT").then(response => {
      this.responsDeptOptions = response.data;
    });
    this.getDicts("TRAINING_LEVEL").then(response => {
      this.trainingLevelOptions = response.data;
    });
  },
  methods: {
    /** 查询培训矩阵列表 */
    getList() {
      this.loading = true;
      listMatrix(this.queryParams).then(response => {
        this.matrixList = response.rows;
        this.total = response.total;
        this.loading = false;
        this.$nextTick(() => {
          this.$refs.matrixTable.doLayout(); // 解决表格错位
        });
      });
    },
    // 授课人字典翻译
    lecturerFormat(row, column) {
      return this.selectDictLabel(this.lecturerOptions, row.lecturer);
    },
    // 责任部门字典翻译
    responsDeptFormat(row, column) {
      return this.selectDictLabel(this.responsDeptOptions, row.responsDept);
    },
    // 培训级别字典翻译
    trainingLevelFormat(row, column) {
      return this.selectDictLabel(this.trainingLevelOptions, row.trainingLevel);
    },
     /** 查询部门下拉树结构 */
     getTreeselect() {
      treeselect().then(response => {
          this.deptOptions = response.data;
      });
     },
    //根据分数显示颜色提示
    tableCellClassName({ row, column, rowIndex, columnIndex }) {
      var postNum = this.actualpostIdOptions.length;
      for (var i = 0; i < postNum; i++) {
        if (columnIndex == 8 + i){
          return this.changeColor(row.actualpost[i])
        }
      }
    },
    changeColor (value) {
      if (value === "M") {
        return 'cellChoose'
      }else if (value === "|") {
        return 'cellDesignated'
      }else if (value === "(M)") {
        return 'cellInvolvedMoc'
      }
    },
    //需培训岗位变动
    changeActualpost() {
      let _this = this
      this.getDicts("ACTUALPOST").then(response => {
        this.designatedPositionOptions = response.data;
        this.actualpostIds.forEach(function (value, key, arr) {
          _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
            if (positionValue.dictValue === value) {
              _this.designatedPositionOptions.splice(positionkey ,1)
            }
          })
        })
      });
    },
    //是否涉及其他部门变动
    changeInvolved() {
       if (this.form.involvedMoc === true) {
         this.otherPositions = ['28','30','32']
       }else {
         this.otherPositions = []
       }
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        courseCode: null,
        item: null,
        actualpostId: null,
        remarks: null,
        delFlag: null,
        createrCode: null,
        createdate: null,
        updaterCode: null,
        updatedate: null,
        deptId: null,
        lecturer: null,
        hour: null,
        designatedPosition: null,
        designatedStaff: null,
        involvedMoc: null,
        designatedOther: null,
        responsDept: null,
        trainingLevel: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.actualpostIds = [];
      this.haveDesignated = false;
      this.designatedPositions = [];
      this.otherPositions = [];
      this.getDicts("ACTUALPOST").then(response => {
        this.designatedPositionOptions = response.data;
      });
      this.open = true;
      this.form.involvedMoc = false
      this.title = this.$t('添加') + this.$t('培训矩阵');
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      let _this = this
      const id = row.id || this.ids
      getMatrix(id).then(response => {
        this.form = response.data;
        //需参培岗位显示下拉框内容
        if (this.form.actualpostId != null) {
          this.actualpostIds = this.form.actualpostId.split(',');
        }else {
          this.actualpostIds = [];
        }
        //指定人员下拉数据
        this.getDicts("ACTUALPOST").then(response => {
          this.designatedPositionOptions = response.data;
          this.actualpostIds.forEach(function (value, key, arr) {
            _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
              if (positionValue.dictValue === value) {
                _this.designatedPositionOptions.splice(positionkey ,1)
              }
            })
          })
        });

        //指定人员下拉框内容
        if (this.form.designatedPosition != null) {
          this.haveDesignated = true;
          this.designatedPositions = this.form.designatedPosition.split(',');
        } else {
          this.haveDesignated = false;
          this.designatedPositions = [];
        }

        //MOC下拉框内容
        if (response.data.involvedMoc === 'true') {
          this.form.involvedMoc = true
        }else {
          this.form.involvedMoc = false
        }

        //指定其他部门下拉框内容
        if (this.form.designatedOther != null) {
          this.otherPositions = this.form.designatedOther.split(',');
        }else {
          this.otherPositions = [];
        }
        this.open = true;
        this.title = this.$t('修改') + this.$t('培训矩阵');
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          var id = null;
          this.actualpostIds.forEach(function (value,key,arr) {
            if (key != 0) {
              id = id + "," + value;
            }else if (key == 0) {
              id = value;
            }
          })
          this.form.actualpostId = id;

          var designatedId = null;
          this.designatedPositions.forEach(function (value,key,arr) {
            if (key != 0) {
              designatedId = designatedId + "," + value;
            }else if (key == 0) {
              designatedId = value;
            }
          })
          // 王子文 2022年4月18日 10点50分 修改
          // 如果 复选框被选中 将指定人信息存入数据传输对象
          if (this.haveDesignated === true) {
            this.form.designatedPosition = designatedId;
          } else {
            this.form.designatedPosition = null;
          }
          // this.form.designatedPosition = designatedId;

          var designatedOther = null;
          this.otherPositions.forEach(function (value,key,arr) {
            if (key != 0) {
              designatedOther = designatedOther + "," + value;
            }else if (key == 0) {
              designatedOther = value;
            }
          })
          this.form.designatedOther = designatedOther;

          if (this.form.id != null) {
            updateMatrix(this.form).then(response => {
              this.msgSuccess(this.$t('修改成功'));
              this.open = false;
              this.getList();
            });
          } else {
            addMatrix(this.form).then(response => {
              this.msgSuccess(this.$t('新增成功'));
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
          confirmButtonText: this.$t('确定'),
          cancelButtonText: this.$t('取消'),
          type: "warning"
        }).then(function() {
          return delMatrix(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess(this.$t('删除成功'));
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm(this.$t('是否确认导出所有培训矩阵数据项?'), this.$t('警告'), {
          confirmButtonText: this.$t('确定'),
          cancelButtonText: this.$t('取消'),
          type: "warning"
        }).then(function() {
          return exportMatrix(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    },
      /** 导入按钮操作 */
      handleImport() {
          this.upload.title = this.$t('用户导入');
          this.upload.open = true;
      },
      /** 下载模板操作 */
      importTemplate() {
          this.$refs['downloadFileForm'].submit()
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
          this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false;
        this.upload.isUploading = false;
        this.$refs.upload.clearFiles();
        if (response.data[0] != null) {
          this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "，" + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
        }else {
          this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
        }
        this.getList();
      },
      // 提交上传文件
      submitFileForm() {
          this.$refs.upload.submit();
      },
    /** 批量按钮操作 */
    handleBatchTraining(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认添加?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return batchAddTraining(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("操作成功");
      })
    },
    handleBatchCompany(row){
      const ids = row.id || this.ids;
      this.$confirm('是否确认添加?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return batchAddCompany(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("操作成功");
      })
    }
  }
};
</script>

<style scoped>
  .colorMark {
    color: #6f6f6f;
    text-align: right;
    font-weight:bold;
    font-size: 13px;
    padding-bottom: 5px;
  }

  .rectangleLightgreen {
    width: 40px !important;
    height: 20px !important;
  }
  .rectangleFlesh {
    width: 40px !important;
    height: 20px !important;
  }
  .rectangleYellow {
    width: 40px !important;
    height: 20px !important;
  }
</style>
