index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('序号')" prop="serialNum">
  5. <el-input
  6. v-model="queryParams.serialNum"
  7. :placeholder="$t('请输入') + $t('序号')"
  8. clearable
  9. size="small"
  10. @input="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('课程代码')" prop="courseCode">
  14. <el-input
  15. v-model="queryParams.courseCode"
  16. :placeholder="$t('请输入') + $t('课程代码')"
  17. clearable
  18. size="small"
  19. @input="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item :label="$t('课程名称')" prop="item">
  23. <el-input
  24. v-model="queryParams.item"
  25. :placeholder="$t('请输入') + $t('课程名称')"
  26. clearable
  27. size="small"
  28. @input="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item :label="$t('参会人员名单')" prop="staffId">
  32. <el-input
  33. v-model="queryParams.staffId"
  34. :placeholder="$t('请输入') + $t('需参会人员')+ $t('空格') + $t('员工号')"
  35. clearable
  36. size="small"
  37. @input="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item :label="$t('备注')" prop="remarks">
  41. <el-input
  42. v-model="queryParams.remarks"
  43. :placeholder="$t('请输入') + $t('备注')"
  44. clearable
  45. size="small"
  46. @input="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  51. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-row :gutter="10" class="mb8">
  55. <el-col :span="1.5">
  56. <el-button
  57. type="primary"
  58. icon="el-icon-plus"
  59. size="mini"
  60. @click="handleAdd"
  61. v-hasPermi="['training:companylevel:add']"
  62. >{{ $t('新增') }}</el-button>
  63. </el-col>
  64. <!--<el-col :span="1.5">
  65. <el-button
  66. type="success"
  67. icon="el-icon-edit"
  68. size="mini"
  69. @click="handleDeleteAll"
  70. v-hasPermi="['training:companylevel:remove']"
  71. >清除历史参会数据</el-button>
  72. </el-col>-->
  73. <el-col :span="1.5">
  74. <el-button
  75. type="danger"
  76. icon="el-icon-delete"
  77. size="mini"
  78. :disabled="multiple"
  79. @click="handleDelete"
  80. v-hasPermi="['training:companylevel:remove']"
  81. >{{ $t('删除') }}</el-button>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-button
  85. type="info"
  86. icon="el-icon-upload2"
  87. size="mini"
  88. @click="handleImport"
  89. v-hasPermi="['training:companylevel:edit']"
  90. >{{ $t('导入培训记录') }}</el-button>
  91. </el-col>
  92. <!-- <el-col :span="1.5">-->
  93. <!-- <el-button-->
  94. <!-- type="warning"-->
  95. <!-- icon="el-icon-download"-->
  96. <!-- size="mini"-->
  97. <!-- @click="handleExport"-->
  98. <!-- >导出</el-button>-->
  99. <!-- </el-col>-->
  100. <el-col :span="1.5">
  101. <el-button
  102. type="warning"
  103. icon="el-icon-refresh"
  104. size="mini"
  105. @click="handleScore"
  106. >{{ $t('更新培训成绩') }}</el-button>
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-button
  110. type="success"
  111. icon="el-icon-tickets"
  112. size="mini"
  113. @click="handleCompany"
  114. >{{ $t('公司级培训记录') }}
  115. </el-button>
  116. </el-col>
  117. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  118. </el-row>
  119. <el-table v-loading="loading" :data="companylevelList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  120. <el-table-column type="selection" width="55" align="center" />
  121. <el-table-column :label="$t('序号')" align="center" prop="serialNum" width="70" :show-overflow-tooltip="true"/>
  122. <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="150" :show-overflow-tooltip="true"/>
  123. <el-table-column :label="$t('课程名称')" align="center" prop="item" width="500" :show-overflow-tooltip="true"/>
  124. <el-table-column :label="$t('频率')" align="center" prop="frequency" width="100" :show-overflow-tooltip="true" >
  125. <template slot-scope="scope">
  126. <span v-if="scope.row.frequency !== null">{{scope.row.frequency}}</span>
  127. <span v-else>一次</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column :label="$t('参会人员名单')" align="center" prop="staffId" width="400" :show-overflow-tooltip="true"/>
  131. <el-table-column :label="$t('备注')" align="center" prop="remarks" width="300" :show-overflow-tooltip="true"/>
  132. <el-table-column :label="$t('操作')" align="center" fixed="right" width="300" class-name="small-padding fixed-width">
  133. <template slot-scope="scope">
  134. <el-button
  135. size="mini"
  136. type="text"
  137. icon="el-icon-edit"
  138. @click="handleUpdate(scope.row)"
  139. v-hasPermi="['training:companylevel:edit']"
  140. >{{ $t('修改') }}</el-button>
  141. <el-button
  142. size="mini"
  143. type="text"
  144. icon="el-icon-user"
  145. @click="handleStaffmgr(scope.row)"
  146. >{{ $t('参会人员名单') }}</el-button>
  147. <el-button
  148. size="mini"
  149. type="text"
  150. icon="el-icon-delete"
  151. @click="handleDelete(scope.row)"
  152. v-hasPermi="['training:companylevel:remove']"
  153. >{{ $t('删除') }}</el-button>
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. <pagination
  158. v-show="total>0"
  159. :total="total"
  160. :page.sync="queryParams.pageNum"
  161. :limit.sync="queryParams.pageSize"
  162. @pagination="getList"
  163. />
  164. <!-- 添加或修改公司级培训对话框 -->
  165. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  166. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  167. <el-form-item :label="$t('序号')" prop="serialNum">
  168. <el-input v-model="form.serialNum" :placeholder="$t('请输入') + $t('序号')" />
  169. </el-form-item>
  170. <el-form-item :label="$t('课程代码')" prop="courseCode">
  171. <el-input v-model="form.courseCode" :placeholder="$t('请输入') + $t('课程代码')" />
  172. </el-form-item>
  173. <el-form-item :label="$t('课程名称')" prop="item">
  174. <el-input v-model="form.item" :placeholder="$t('请输入') + $t('课程名称')" />
  175. </el-form-item>
  176. <el-row>
  177. <el-col :span="8">
  178. <el-form-item :label="$t('是否需要重复培训')" prop="needFrequency" label-width="125px">
  179. <el-checkbox v-model="needFrequency"></el-checkbox>
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="16">
  183. <el-form-item :label="$t('频率')" prop="frequency" v-if="needFrequency === true">
  184. {{ $t('每') }}
  185. <el-input-number v-model="form.frequency" controls-position="right" :min="1" :max="10" size="mini"></el-input-number>
  186. {{ $t('年一次') }}
  187. </el-form-item>
  188. </el-col>
  189. </el-row>
  190. <el-form-item :label="$t('参会人员名单')" prop="staffId">
  191. <el-input v-model="form.staffId" :placeholder="$t('请输入') + $t('参会人员名单')" type="textarea"/>
  192. </el-form-item>
  193. <el-form-item :label="$t('备注')" prop="remarks">
  194. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  195. </el-form-item>
  196. <el-form-item :label="$t('归属部门')" prop="deptId">
  197. <treeselect v-model="form.deptId" :options="deptOptions" :placeholder="$t('请选择') + $t('归属部门')" />
  198. </el-form-item>
  199. </el-form>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  202. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  203. </div>
  204. </el-dialog>
  205. <!-- 添加参与公司级培训人员名单对话框 -->
  206. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="participantsTitle" :visible.sync="participantsOpen" width="1500px" append-to-body>
  207. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  208. <el-form-item :label="$t('序号')" prop="serialNum">
  209. <el-input v-model="form.serialNum" disabled />
  210. </el-form-item>
  211. <el-form-item :label="$t('课程代码')" prop="courseCode">
  212. <el-input v-model="form.courseCode" disabled />
  213. </el-form-item>
  214. <el-form-item :label="$t('课程名称')" prop="item">
  215. <el-input v-model="form.item" disabled />
  216. </el-form-item>
  217. <el-form-item :label="$t('实际岗位')">
  218. <el-checkbox-group v-model="checkboxPost" size="medium" @change="postChange">
  219. <el-checkbox-button v-for="post in actualpostOptions" :label="post.key" :key="post.key">{{post.label}}</el-checkbox-button>
  220. </el-checkbox-group>
  221. </el-form-item>
  222. <el-form-item :label="$t('人员姓名')">
  223. <el-select v-model="searchStaffmgr" filterable :placeholder="$t('请选择') + $t('人员')">
  224. <el-option
  225. v-for="dict in stffmgrOptions"
  226. :key="dict.staffid"
  227. :label="dict.label"
  228. :value="dict.staffid">
  229. <span style="float: left">{{ dict.label }}</span>
  230. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  231. </el-option>
  232. </el-select>
  233. <el-button type="primary" @click="insertSearchStaffmgr" style="margin-left: 15px;">{{ $t('添加') }}</el-button>
  234. </el-form-item>
  235. </el-form>
  236. <div class="staff_checked">
  237. <el-transfer v-model="checked" :data="stffmgrOptions" @change="staffChange" :left-default-checked="leftList" >
  238. <span slot-scope="{ option }">{{ option.label }}
  239. <span style="float: right; color: #8492a6; font-size: 12px; padding-left: 10px;padding-right: 15px;">{{ option.staffid }}</span>
  240. <span style="float: right; color: #8492a6; font-size: 12px; padding-left: 10px;">{{ option.actualpost }}</span>
  241. </span>
  242. </el-transfer>
  243. </div>
  244. <div slot="footer" class="dialog-footer">
  245. <el-button type="primary" @click="submitParticipants">{{ $t('确 定') }}</el-button>
  246. <el-button @click="cancelParticipants">{{ $t('取 消') }}</el-button>
  247. </div>
  248. </el-dialog>
  249. <!-- 用户导入对话框 -->
  250. <el-dialog :close-on-click-modal="false" v-loading="upload.isUploading" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  251. <el-upload
  252. ref="upload"
  253. :limit="1"
  254. accept=".xlsx, .xls"
  255. :headers="upload.headers"
  256. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  257. :disabled="upload.isUploading"
  258. :on-progress="handleFileUploadProgress"
  259. :on-success="handleFileSuccess"
  260. :auto-upload="false"
  261. drag
  262. >
  263. <i class="el-icon-upload"></i>
  264. <div class="el-upload__text">
  265. {{ $t('将文件拖到此处,或') }}
  266. <em>{{ $t('点击上传') }}</em>
  267. </div>
  268. <div class="el-upload__tip" slot="tip">
  269. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  270. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  271. </div>
  272. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  273. <input name="type" :value="upload.type" hidden />
  274. </form>
  275. <div class="el-upload__tip" style="color:#ff0000" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  276. </el-upload>
  277. <div slot="footer" class="dialog-footer">
  278. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  279. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  280. </div>
  281. </el-dialog>
  282. </div>
  283. </template>
  284. <script>
  285. import { listCompanylevel, updateScore, resetCompanylevel, getCompanylevel, delCompanylevel, addCompanylevel, updateCompanylevel, exportCompanylevel, importTemplate} from "@/api/training/companylevel";
  286. import { deleteAll } from "@/api/training/participants";
  287. import {listStaffmgr, selectTimeStaffmgr} from "@/api/plant/staffmgr";
  288. import { treeselect } from "@/api/system/dept";
  289. import { getToken } from "@/utils/auth";
  290. import Treeselect from "@riophae/vue-treeselect";
  291. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  292. export default {
  293. name: "Companylevel",
  294. components: { Treeselect },
  295. data() {
  296. return {
  297. //选择人员数据
  298. checked: [],
  299. //岗位字典数据
  300. actualpostOptions: [],
  301. //人员筛选按钮选择数据
  302. checkboxPost: [],
  303. // 遮罩层
  304. loading: true,
  305. uploadLoading: false,
  306. // 选中数组
  307. ids: [],
  308. // 非单个禁用
  309. single: true,
  310. // 非多个禁用
  311. multiple: true,
  312. // 显示搜索条件
  313. showSearch: false,
  314. // 总条数
  315. total: 0,
  316. // 公司级培训表格数据
  317. companylevelList: [],
  318. // 培训岗位字典
  319. positionOptions: [],
  320. //左侧选框默认选择
  321. leftList: [],
  322. // 弹出层标题
  323. title: "",
  324. participantsTitle: "",
  325. // 部门树选项
  326. deptOptions: undefined,
  327. clientHeight:300,
  328. // 是否显示弹出层
  329. open: false,
  330. participantsOpen: false,
  331. //搜索人员
  332. searchStaffmgr: "",
  333. // 用户导入参数
  334. upload: {
  335. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  336. //下载模板类型
  337. type: "companyLevelRecord",
  338. // 是否显示弹出层(用户导入)
  339. open: false,
  340. // 弹出层标题(用户导入)
  341. title: "",
  342. // 是否禁用上传
  343. isUploading: false,
  344. // 是否更新已经存在的用户数据
  345. updateSupport: 0,
  346. // 设置上传的请求头部
  347. headers: { Authorization: "Bearer " + getToken() },
  348. // 上传的地址
  349. url: process.env.VUE_APP_BASE_API + "/training/hisparticipants/importData"
  350. },
  351. // 查询参数
  352. queryParams: {
  353. pageNum: 1,
  354. pageSize: 20,
  355. serialNum: null,
  356. courseCode: null,
  357. item: null,
  358. staffId: null,
  359. remarks: null,
  360. },
  361. //人员表查询参数
  362. staffmgrQueryParams: {
  363. units: "10,18,20,30",
  364. leftYear: this.getNowTime(),
  365. actualpost: null
  366. },
  367. //人员表联查
  368. stffmgrOptions: undefined,
  369. // 表单参数
  370. form: {},
  371. //是否需要重复培训
  372. needFrequency: '',
  373. // 表单校验
  374. rules: {
  375. deptId: [
  376. { required: true, message: this.$t('部门编号') + this.$t('不能为空') , trigger: "blur" }
  377. ]
  378. }
  379. };
  380. },
  381. watch: {
  382. // 根据名称筛选部门树
  383. deptName(val) {
  384. this.$refs.tree.filter(val);
  385. }
  386. },
  387. created() {
  388. //设置表格高度对应屏幕高度
  389. this.$nextTick(() => {
  390. this.clientHeight = document.body.clientHeight -250
  391. })
  392. this.getStaffmar();
  393. this.getPost();
  394. this.getTreeselect();
  395. this.getDicts("ACTUALPOST").then(response => {
  396. this.positionOptions = response.data;
  397. });
  398. },
  399. methods: {
  400. /** 查询公司级培训列表 */
  401. getList() {
  402. this.loading = true;
  403. let _this = this
  404. listCompanylevel(this.queryParams).then(response => {
  405. this.companylevelList = response.rows;
  406. this.companylevelList.forEach(function (value,key,arr) {
  407. let stffmgrName = "";
  408. if (value.staffId != null) {
  409. let staffId = value.staffId.split(",");
  410. staffId.forEach(function (id, index) {
  411. _this.stffmgrOptions.forEach(function (item) {
  412. if (item.key === id) {
  413. if (index === 0) {
  414. stffmgrName = item.label
  415. }else {
  416. stffmgrName = stffmgrName + "," + item.label
  417. }
  418. }
  419. });
  420. });
  421. }
  422. _this.companylevelList[key].staffId = stffmgrName
  423. });
  424. this.total = response.total;
  425. this.loading = false;
  426. });
  427. },
  428. /** 公司级培训矩阵按钮操作 */
  429. handleCompany() {
  430. this.$router.push({ path: '/trainingrecords/companyRecords'});
  431. },
  432. /** 查询部门下拉树结构 */
  433. getTreeselect() {
  434. treeselect().then(response => {
  435. this.deptOptions = response.data;
  436. });
  437. },
  438. /** 获取当前年份 */
  439. getNowTime() {
  440. var now = new Date();
  441. var year = now.getFullYear(); //得到年份
  442. var defaultDate = `${year}`;
  443. defaultDate = `${year}`
  444. return defaultDate;
  445. },
  446. // 取消按钮
  447. cancel() {
  448. this.open = false;
  449. this.reset();
  450. },
  451. // 选择参会人员取消按钮
  452. cancelParticipants() {
  453. this.participantsOpen = false;
  454. this.reset();
  455. },
  456. // 表单重置
  457. reset() {
  458. this.form = {
  459. id: null,
  460. serialNum: null,
  461. courseCode: null,
  462. item: null,
  463. staffId: null,
  464. remarks: null,
  465. delFlag: null,
  466. createrCode: null,
  467. createdate: null,
  468. updaterCode: null,
  469. updatedate: null,
  470. frequency: null,
  471. deptId: null
  472. };
  473. this.resetForm("form");
  474. },
  475. /** 搜索按钮操作 */
  476. handleQuery() {
  477. this.queryParams.pageNum = 1;
  478. this.getList();
  479. },
  480. /** 重置按钮操作 */
  481. resetQuery() {
  482. this.resetForm("queryForm");
  483. this.handleQuery();
  484. },
  485. //获取人员表
  486. getStaffmar() {
  487. selectTimeStaffmgr(this.staffmgrQueryParams).then(response => {
  488. const allData = response.rows
  489. const data = [];
  490. for (let i = 0; i < allData.length; i++) {
  491. data.push({
  492. key: allData[i].staffid,
  493. label: allData[i].name,
  494. staffid: allData[i].staffid,
  495. actualpost: this.selectDictLabel(this.positionOptions, allData[i].actualpost)
  496. });
  497. }
  498. this.stffmgrOptions = data;
  499. this.getList();
  500. })
  501. },
  502. //获取岗位字典
  503. getPost() {
  504. this.getDicts("ACTUALPOST").then(response => {
  505. const allData = response.data
  506. const data = [];
  507. for (let i = 0; i < allData.length; i++) {
  508. data.push({
  509. key: allData[i].dictValue,
  510. label: allData[i].dictLabel,
  511. });
  512. }
  513. this.actualpostOptions = data
  514. });
  515. },
  516. //选择参会人员变动
  517. staffChange() {
  518. this.form.staffId = this.checked.toString()
  519. },
  520. //岗位筛选变动
  521. postChange() {
  522. this.leftList = [];
  523. if (this.checkboxPost.length > 0) {
  524. this.staffmgrQueryParams.actualposts = this.checkboxPost.toString();
  525. this.$nextTick(() => {
  526. selectTimeStaffmgr(this.staffmgrQueryParams).then(response => {
  527. const allData = response.rows
  528. const data = [];
  529. for (let i = 0; i < allData.length; i++) {
  530. data[i] = allData[i].staffid
  531. }
  532. this.leftList = data;
  533. })
  534. })
  535. }
  536. },
  537. // 多选框选中数据
  538. handleSelectionChange(selection) {
  539. this.ids = selection.map(item => item.id)
  540. this.single = selection.length!==1
  541. this.multiple = !selection.length
  542. },
  543. /** 新增按钮操作 */
  544. handleAdd() {
  545. this.reset();
  546. this.open = true;
  547. this.needFrequency = false;
  548. this.title = this.$t('新增') + this.$t('空格') + this.$t('公司级培训');
  549. },
  550. /** 修改按钮操作 */
  551. handleUpdate(row) {
  552. this.reset();
  553. const id = row.id || this.ids
  554. getCompanylevel(id).then(response => {
  555. this.form = response.data;
  556. //是否需要重复培训内容
  557. if (this.form.frequency != null) {
  558. this.needFrequency = true;
  559. }else {
  560. this.needFrequency = false;
  561. }
  562. this.open = true;
  563. this.title = this.$t('修改') + this.$t('公司级培训');
  564. });
  565. },
  566. /** 参会人员名单按钮操作 */
  567. handleStaffmgr(row) {
  568. this.leftList = [];
  569. const id = row.id || this.ids
  570. getCompanylevel(id).then(response => {
  571. this.form = response.data;
  572. if (response.data.staffId != null) {
  573. this.checked = response.data.staffId.split(",");
  574. }else {
  575. this.checked = [];
  576. }
  577. this.participantsOpen = true;
  578. this.participantsTitle = this.$t('参加') +this.$t('空格')+ this.$t('公司级') + this.$t('空格') + this.$t('培训人员') + this.$t('空格') + this.$t('名单');
  579. });
  580. },
  581. /** 提交按钮 */
  582. submitForm() {
  583. this.$refs["form"].validate(valid => {
  584. if (valid) {
  585. if (this.needFrequency === false) {
  586. this.form.frequency = null
  587. }
  588. if (this.form.id != null) {
  589. updateCompanylevel(this.form).then(response => {
  590. this.msgSuccess(this.$t('修改成功'));
  591. this.open = false;
  592. this.getList();
  593. this.handleScore();
  594. });
  595. } else {
  596. addCompanylevel(this.form).then(response => {
  597. this.msgSuccess(this.$t('新增成功'));
  598. this.open = false;
  599. this.getList();
  600. this.handleScore();
  601. });
  602. }
  603. }
  604. });
  605. },
  606. /** 参会人员提交按钮 */
  607. submitParticipants() {
  608. this.$refs["form"].validate(valid => {
  609. if (valid) {
  610. updateCompanylevel(this.form).then(response => {
  611. this.msgSuccess(this.$t('修改成功'));
  612. this.participantsOpen = false;
  613. this.checkboxPost = [];
  614. this.getList();
  615. this.handleScore();
  616. });
  617. }
  618. });
  619. },
  620. /** 参会人员人名搜索添加按钮 */
  621. insertSearchStaffmgr() {
  622. const data = [];
  623. for (let i = 0; i < this.leftList.length; i++) {
  624. data.push(this.leftList[i])
  625. }
  626. data.push(this.searchStaffmgr)
  627. this.leftList = data
  628. this.$nextTick(() => {
  629. this.searchStaffmgr = "";
  630. })
  631. },
  632. /** 删除按钮操作 */
  633. handleDelete(row) {
  634. const ids = row.id || this.ids;
  635. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  636. confirmButtonText: this.$t('确定'),
  637. cancelButtonText: this.$t('取消'),
  638. type: "warning"
  639. }).then(function() {
  640. return delCompanylevel(ids);
  641. }).then(() => {
  642. this.getList();
  643. this.handleScore();
  644. this.msgSuccess(this.$t('删除成功'));
  645. })
  646. },
  647. /** 导出按钮操作 */
  648. handleExport() {
  649. const queryParams = this.queryParams;
  650. this.$confirm(this.$t('是否确认导出所有公司级培训数据项?'), this.$t('警告'), {
  651. confirmButtonText: this.$t('确定'),
  652. cancelButtonText: this.$t('取消'),
  653. type: "warning"
  654. }).then(function() {
  655. return exportCompanylevel(queryParams);
  656. }).then(response => {
  657. this.download(response.msg);
  658. })
  659. },
  660. /** 导入按钮操作 */
  661. handleImport() {
  662. this.upload.title = this.$t('导入培训记录');
  663. this.upload.open = true;
  664. },
  665. handleScore(){
  666. updateScore().then(response => {
  667. const allData = response
  668. this.msgSuccess(this.$t('更新成功'));
  669. })
  670. },
  671. /** 下载模板操作 */
  672. importTemplate() {
  673. this.$refs['downloadFileForm'].submit()
  674. },
  675. // 文件上传中处理
  676. handleFileUploadProgress(event, file, fileList) {
  677. this.upload.isUploading = true;
  678. },
  679. // 文件上传成功处理
  680. handleFileSuccess(response, file, fileList) {
  681. this.upload.open = false;
  682. this.upload.isUploading = false;
  683. this.$refs.upload.clearFiles();
  684. if (response.data[0] != null) {
  685. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  686. }else {
  687. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  688. }
  689. this.handleScore();
  690. this.getList();
  691. },
  692. // 提交上传文件
  693. submitFileForm() {
  694. this.$refs.upload.submit();
  695. },
  696. //清除所有历史数据
  697. handleDeleteAll() {
  698. let _this = this
  699. this.$confirm(this.$t('是否确认重置公司级培训参会人员信息?'), this.$t('警告'), {
  700. confirmButtonText: this.$t('确定'),
  701. cancelButtonText: this.$t('取消'),
  702. type: "warning"
  703. }).then(function() {
  704. deleteAll().then(response => {
  705. resetCompanylevel(_this.form).then(response => {
  706. _this.msgSuccess(this.$t('清除成功'));
  707. _this.getList();
  708. });
  709. })
  710. })
  711. }
  712. }
  713. };
  714. </script>
  715. <style scoped>
  716. .staff_checked >>> .el-transfer-panel {
  717. width : 600px;
  718. }
  719. .el-transfer-panel__item.el-checkbox {
  720. width: 553px !important;
  721. }
  722. </style>