index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  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="year">
  5. <el-date-picker clearable size="small" style="width: 200px"
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. :placeholder="$t('请选择') + $t('年份')"
  10. @input="handleQuery">
  11. </el-date-picker>
  12. </el-form-item>
  13. <el-form-item :label="$t('课程名称')" prop="item">
  14. <el-input
  15. v-model="queryParams.item"
  16. :placeholder="$t('请输入') + $t('课程名称')"
  17. clearable
  18. size="small"
  19. @input="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. icon="el-icon-plus"
  32. size="mini"
  33. @click="handleAdd"
  34. v-hasPermi="['training:regular:add']"
  35. >{{ $t('新增') }}</el-button>
  36. </el-col>
  37. <el-col :span="1.5">
  38. <el-button
  39. type="success"
  40. icon="el-icon-edit"
  41. size="mini"
  42. :disabled="single"
  43. @click="handleUpdate"
  44. v-hasPermi="['training:regular:edit']"
  45. >{{ $t('修改') }}</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. icon="el-icon-delete"
  51. size="mini"
  52. :disabled="multiple"
  53. @click="handleDelete"
  54. v-hasPermi="['training:regular:remove']"
  55. >{{ $t('删除') }}</el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="primary"
  60. icon="el-icon-plus"
  61. size="mini"
  62. @click="handleAddBatch"
  63. v-hasPermi="['training:regular:add']"
  64. >矩阵自动添加</el-button>
  65. </el-col>
  66. <!--<el-col :span="1.5">
  67. <el-button
  68. type="info"
  69. icon="el-icon-upload2"
  70. size="mini"
  71. @click="handleImport"
  72. v-hasPermi="['training:regular:edit']"
  73. >导入</el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="warning"
  78. icon="el-icon-download"
  79. size="mini"
  80. @click="handleExport"
  81. v-hasPermi="['training:regular:export']"
  82. >{{ $t('导出') }}</el-button>
  83. </el-col>-->
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  85. </el-row>
  86. <el-row class="colorMark">
  87. <svg-icon icon-class="rectangleLightgreen" class="rectangleLightgreen"></svg-icon>{{ $t('需要培训') }}
  88. <svg-icon icon-class="rectangleFlesh" class="rectangleFlesh"></svg-icon>{{ $t('指定人员') }}
  89. <svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>{{ $t('当被此项目涉及到时,如MOC、事件调查,需要培训') }}
  90. </el-row>
  91. <el-table ref="regularTable" v-loading="loading" :data="regularList" @selection-change="handleSelectionChange" :cell-class-name="tableCellClassName" :height="clientHeight" border>
  92. <el-table-column type="selection" width="55" align="center" />
  93. <el-table-column :label="$t('年份')" align="center" prop="year" width="50" :show-overflow-tooltip="true"/>
  94. <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="150" :show-overflow-tooltip="true"/>
  95. <el-table-column :label="$t('课程名称')" align="center" prop="item" width="350" :show-overflow-tooltip="true"/>
  96. <el-table-column :label="$t('计划培训时间')" align="center" prop="planTrainingdate" width="100">
  97. <template slot-scope="scope">
  98. <span v-if="scope.row.notPlan === 'false'">{{ scope.row.notTrainingdate }}</span>
  99. <span v-else>{{ scope.row.planTrainingdate }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column :label="$t('授课人')" align="center" prop="lecturerName" width="230" :show-overflow-tooltip="true" />
  103. <el-table-column :label="$t('课时')" align="center" prop="hour" :show-overflow-tooltip="true"/>
  104. <el-table-column v-for="(item, index) in actualpostIdOptions" width="150" :label="item.dictLabel" :key="index" align="center">
  105. <template slot-scope="scope">
  106. {{scope.row.actualpost[index]}}
  107. </template>
  108. </el-table-column>
  109. <el-table-column :label="$t('备注')" align="center" prop="remarks" width="300" :show-overflow-tooltip="true"/>
  110. <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-button
  113. size="mini"
  114. type="text"
  115. icon="el-icon-edit"
  116. @click="handleUpdate(scope.row)"
  117. v-hasPermi="['training:regular:edit']"
  118. >{{ $t('修改') }}</el-button>
  119. <el-button
  120. size="mini"
  121. type="text"
  122. icon="el-icon-delete"
  123. @click="handleDelete(scope.row)"
  124. v-hasPermi="['training:regular:remove']"
  125. >{{ $t('删除') }}</el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <pagination
  130. v-show="total>0"
  131. :total="total"
  132. :page.sync="queryParams.pageNum"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="getList"
  135. />
  136. <!-- 添加或修改装置培训计划对话框 -->
  137. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  138. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  139. <el-form-item :label="$t('年份')" prop="year">
  140. <el-date-picker clearable size="small" style="width: 200px"
  141. v-model="form.year"
  142. type="year"
  143. value-format="yyyy"
  144. @change="getLecturer"
  145. :placeholder="$t('请选择') + $t('年份')">
  146. </el-date-picker>
  147. </el-form-item>
  148. <el-form-item :label="$t('课程代码')" prop="courseCode">
  149. <el-input v-model="form.courseCode" :placeholder="$t('请输入') + $t('课程代码')" />
  150. </el-form-item>
  151. <el-form-item :label="$t('课程名称')" prop="item">
  152. <el-input v-model="form.item" :placeholder="$t('请输入') + $t('课程名称')" />
  153. </el-form-item>
  154. <el-form-item :label="$t('需参培岗位')" prop="actualpostId">
  155. <el-select v-model="actualpostIds" multiple :placeholder="$t('请选择') + $t('需参培岗位')" @change="changeActualpost">
  156. <el-option
  157. v-for="dict in actualpostOptions"
  158. :key="dict.dictValue"
  159. :label="dict.dictLabel"
  160. :value="dict.dictValue"
  161. ></el-option>
  162. </el-select>
  163. </el-form-item>
  164. <el-form-item :label="$t('是否存在')+$t('空格') +$t('指定人员')" prop="haveDesignated">
  165. <el-checkbox v-model="haveDesignated"></el-checkbox>
  166. </el-form-item>
  167. <el-form-item :label="$t('指定人员')+$t('空格') + $t('岗位')" prop="designatedPosition" v-if="haveDesignated === true">
  168. <el-select v-model="designatedPositions" multiple :placeholder="$t('请选择') + $t('指定岗位')" @change="changeDesignated">
  169. <el-option
  170. v-for="dict in designatedPositionOptions"
  171. :key="dict.dictValue"
  172. :label="dict.dictLabel"
  173. :value="dict.dictValue"
  174. ></el-option>
  175. </el-select>
  176. </el-form-item>
  177. <el-form-item :label="$t('指定人员')" prop="designatedStaff" v-if="haveDesignated === true && designatedPositions.length > 0">
  178. <el-select v-model="designatedStaffs" filterable multiple :placeholder="$t('请选择') + $t('指定人员')">
  179. <el-option
  180. v-for="dict in stffmgrOptions"
  181. :key="dict.staffid"
  182. :label="dict.name"
  183. :value="dict.staffid">
  184. <span style="float: left">{{ dict.name }}</span>
  185. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  186. </el-option>
  187. </el-select>
  188. </el-form-item>
  189. <el-form-item :label="$t('是否涉及') + $t('其他部门')" prop="involvedMoc">
  190. <el-checkbox v-model="form.involvedMoc" @change="changeInvolved"></el-checkbox>
  191. </el-form-item>
  192. <el-form-item :label="$t('指定其他部门')" prop="designatedOther" v-if="form.involvedMoc === true">
  193. <el-select v-model="otherPositions" multiple :placeholder="$t('请选择') + $t('其他部门')">
  194. <el-option
  195. v-for="dict in otherPositionOptions"
  196. :key="dict.dictValue"
  197. :label="dict.dictLabel"
  198. :value="dict.dictValue"
  199. ></el-option>
  200. </el-select>
  201. </el-form-item>
  202. <el-form-item :label="$t('备注')" prop="remarks">
  203. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  204. </el-form-item>
  205. <el-form-item :label="$t('是否') + $t('计划培训时间')" prop="notPlan">
  206. <el-checkbox v-model="form.notPlan"></el-checkbox>
  207. </el-form-item>
  208. <el-form-item :label="$t('计划培训时间')" >
  209. <el-date-picker clearable size="small" style="width: 200px"
  210. v-model="form.planTrainingdate"
  211. type="month"
  212. value-format="yyyy-MM"
  213. v-if="form.notPlan === true"
  214. :placeholder="$t('请选择') + $t('计划培训时间')">
  215. </el-date-picker>
  216. <el-input v-model="form.notTrainingdate" :placeholder="$t('请输入') + $t('计划培训时间')" v-if="form.notPlan === false" />
  217. </el-form-item>
  218. <el-form-item :label="$t('授课人')" prop="lecturer">
  219. <el-select v-model="lecturers" filterable multiple :placeholder="$t('请选择') +$t('授课人')">
  220. <el-option
  221. v-for="dict in lecturerOptions"
  222. :key="dict.staffid"
  223. :label="dict.name"
  224. :value="dict.staffid">
  225. <span style="float: left">{{ dict.name }}</span>
  226. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  227. </el-option>
  228. </el-select>
  229. </el-form-item>
  230. <el-form-item :label="$t('课时')" prop="hour">
  231. <el-input v-model="form.hour" :placeholder="$t('请输入') + $t('课时')" />
  232. </el-form-item>
  233. </el-form>
  234. <div slot="footer" class="dialog-footer">
  235. <el-button type="primary" @click="submitForm" :disabled="submitDisabled">{{ $t('确 定') }}</el-button>
  236. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  237. </div>
  238. </el-dialog>
  239. </div>
  240. </template>
  241. <script>
  242. import {batchAddTraining, listBccregular, getBccregular, delBccregular, addBccregular, updateBccregular, exportBccregular} from "@/api/training/bccregular";
  243. import { listStaffmgr, listAllStaffmgr } from "@/api/plant/staffmgr";
  244. import { treeselect } from "@/api/system/dept";
  245. import { getToken } from "@/utils/auth";
  246. import Treeselect from "@riophae/vue-treeselect";
  247. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  248. export default {
  249. name: "Regular",
  250. components: { Treeselect },
  251. data() {
  252. return {
  253. // 遮罩层
  254. loading: true,
  255. // 选中数组
  256. ids: [],
  257. // 非单个禁用
  258. single: true,
  259. // 非多个禁用
  260. multiple: true,
  261. // 显示搜索条件
  262. showSearch: false,
  263. // 总条数
  264. total: 0,
  265. // 装置培训计划表格数据
  266. regularList: [],
  267. // 弹出层标题
  268. title: "",
  269. // 部门树选项
  270. deptOptions: undefined,
  271. clientHeight:300,
  272. // 是否显示弹出层
  273. open: false,
  274. // 台账显示岗位字典
  275. actualpostIdOptions: [],
  276. // 需参培岗位字典
  277. actualpostOptions: [],
  278. // 授课人字典
  279. lecturerOptions: [],
  280. // 指定岗位字典
  281. designatedPositionOptions: [],
  282. // 指定部门字典
  283. otherPositionOptions: [],
  284. //培训岗位多选
  285. actualpostIds: [],
  286. //指定人员岗位多选
  287. designatedPositions: [],
  288. //其他部门多选
  289. otherPositions: [],
  290. //指定人员id多选
  291. designatedStaffs: [],
  292. //授课人多选
  293. lecturers: [],
  294. //是否存在岗位多选
  295. haveDesignated: false,
  296. //人员表联查
  297. stffmgrOptions: undefined,
  298. //人员表查询参数
  299. staffmgrQueryParams: {
  300. actualposts: null
  301. },
  302. //确认按钮是否可点
  303. submitDisabled: false,
  304. // 用户导入参数
  305. upload: {
  306. // 是否显示弹出层(用户导入)
  307. open: false,
  308. // 弹出层标题(用户导入)
  309. title: "",
  310. // 是否禁用上传
  311. isUploading: false,
  312. // 是否更新已经存在的用户数据
  313. updateSupport: 0,
  314. // 设置上传的请求头部
  315. headers: { Authorization: "Bearer " + getToken() },
  316. // 上传的地址
  317. url: process.env.VUE_APP_BASE_API + "/training/regular/importData"
  318. },
  319. // 查询参数
  320. queryParams: {
  321. pageNum: 1,
  322. pageSize: 20,
  323. year: this.getNowTime()
  324. },
  325. // 表单参数
  326. form: {},
  327. // 表单校验
  328. rules: {
  329. year: [
  330. { required: true, message: this.$t('年份') + this.$t('不能为空'), trigger: "blur" }
  331. ],
  332. courseCode: [
  333. { required: true, message: this.$t('课程代码') + this.$t('不能为空'), trigger: "blur" }
  334. ],
  335. item: [
  336. { required: true, message: this.$t('课程名称') + this.$t('不能为空'), trigger: "blur" }
  337. ],
  338. deptId: [
  339. { required: true, message: this.$t('部门编号')+ this.$t('不能为空'), trigger: "blur" }
  340. ],
  341. }
  342. };
  343. },
  344. watch: {
  345. // 根据名称筛选部门树
  346. deptName(val) {
  347. this.$refs.tree.filter(val);
  348. }
  349. },
  350. created() {
  351. //设置表格高度对应屏幕高度
  352. this.$nextTick(() => {
  353. this.clientHeight = document.body.clientHeight -250
  354. })
  355. this.getDicts("ACTUALPOST").then(response => {
  356. this.actualpostIdOptions = response.data;
  357. });
  358. this.getDicts("ACTUALPOST").then(response => {
  359. this.actualpostOptions = response.data;
  360. });
  361. this.getDicts("ACTUALPOST").then(response => {
  362. this.designatedPositionOptions = response.data;
  363. });
  364. let _this = this
  365. this.getDicts("ACTUALPOST").then(response => {
  366. response.data.forEach(function (positionValue, positionkey, arr) {
  367. if (positionValue.dictValue === "28" || positionValue.dictValue === "30" || positionValue.dictValue === "32") {
  368. _this.otherPositionOptions.push(positionValue)
  369. }
  370. })
  371. this.getStaffmar();
  372. this.getLecturer();
  373. this.getTreeselect();
  374. });
  375. },
  376. methods: {
  377. /** 查询装置培训计划列表 */
  378. getList() {
  379. this.loading = true;
  380. let _this = this
  381. listBccregular(this.queryParams).then(response => {
  382. this.regularList = response.rows;
  383. this.regularList.forEach(function (value,key,arr) {
  384. let stffmgrName = "";
  385. if (value.lecturer != null) {
  386. let staffId = value.lecturer.split(",");
  387. staffId.forEach(function (id, index) {
  388. _this.stffmgrOptions.forEach(function (item) {
  389. if (item.staffid === id) {
  390. if (index === 0) {
  391. stffmgrName = item.name
  392. }else {
  393. stffmgrName = stffmgrName + "," + item.name
  394. }
  395. }
  396. });
  397. });
  398. }
  399. _this.regularList[key].lecturerName = stffmgrName
  400. });
  401. this.total = response.total;
  402. this.loading = false;
  403. this.$nextTick(() => {
  404. this.$refs.regularTable.doLayout(); // 解决表格错位
  405. });
  406. });
  407. },
  408. /** 获取当前年份 */
  409. getNowTime() {
  410. var now = new Date();
  411. var year = now.getFullYear(); //得到年份
  412. var defaultDate = `${year}`;
  413. defaultDate = `${year}`
  414. return defaultDate;
  415. },
  416. /** 查询部门下拉树结构 */
  417. getTreeselect() {
  418. treeselect().then(response => {
  419. this.deptOptions = response.data;
  420. });
  421. },
  422. //获取人员表
  423. getStaffmar() {
  424. listStaffmgr(this.staffmgrQueryParams).then(response => {
  425. this.stffmgrOptions = response.rows;
  426. this.$nextTick(() => {
  427. this.getList();
  428. })
  429. });
  430. },
  431. getLecturer(year) {
  432. this.staffmgrQueryParams.leftYear = year
  433. listAllStaffmgr(this.staffmgrQueryParams).then(response => {
  434. this.lecturerOptions = response.rows;
  435. });
  436. },
  437. //根据分数显示颜色提示
  438. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  439. var postNum = this.actualpostIdOptions.length;
  440. for (var i = 0; i < postNum; i++) {
  441. if (columnIndex == 7 + i){
  442. return this.changeColor(row.actualpost[i])
  443. }
  444. }
  445. },
  446. changeColor (value) {
  447. if (value === "M") {
  448. return 'cellChoose'
  449. }else if (value === "|") {
  450. return 'cellDesignated'
  451. }else if (value === "(M)") {
  452. return 'cellInvolvedMoc'
  453. }
  454. },
  455. //需培训岗位变动
  456. changeActualpost() {
  457. let _this = this
  458. this.getDicts("ACTUALPOST").then(response => {
  459. this.designatedPositionOptions = response.data;
  460. this.actualpostIds.forEach(function (value, key, arr) {
  461. _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
  462. if (positionValue.dictValue === value) {
  463. _this.designatedPositionOptions.splice(positionkey ,1)
  464. }
  465. })
  466. })
  467. });
  468. },
  469. //指定人员训岗位变动
  470. changeDesignated() {
  471. if (this.designatedPositions.length > 0) {
  472. var designatedId = null;
  473. this.designatedPositions.forEach(function (value,key,arr) {
  474. if (key != 0) {
  475. designatedId = designatedId + "," + value;
  476. }else if (key == 0) {
  477. designatedId = value;
  478. }
  479. })
  480. this.staffmgrQueryParams.actualposts = designatedId;
  481. this.staffmgrQueryParams.leftYear = this.form.year
  482. listAllStaffmgr(this.staffmgrQueryParams).then(response => {
  483. this.stffmgrOptions = response.rows;
  484. });
  485. let _this = this
  486. this.getDicts("ACTUALPOST").then(response => {
  487. this.actualpostOptions = response.data;
  488. this.designatedPositions.forEach(function (value, key, arr) {
  489. _this.actualpostOptions.forEach(function (positionValue, positionkey, arr) {
  490. if (positionValue.dictValue === value) {
  491. _this.actualpostOptions.splice(positionkey ,1)
  492. }
  493. })
  494. })
  495. });
  496. }else {
  497. this.designatedStaffs = [];
  498. }
  499. },
  500. //是否涉及其他部门变动
  501. changeInvolved() {
  502. if (this.form.involvedMoc === true) {
  503. this.otherPositions = ['28','30','32']
  504. }else {
  505. this.otherPositions = []
  506. }
  507. },
  508. // 取消按钮
  509. cancel() {
  510. this.open = false;
  511. this.reset();
  512. },
  513. // 表单重置
  514. reset() {
  515. this.form = {
  516. id: null,
  517. courseCode: null,
  518. item: null,
  519. actualpostId: null,
  520. remarks: null,
  521. delFlag: null,
  522. createrCode: null,
  523. createdate: null,
  524. updaterCode: null,
  525. updatedate: null,
  526. deptId: null,
  527. planTrainingdate: null,
  528. actualCompletedate: null,
  529. lecturer: null,
  530. hour: null,
  531. year: null,
  532. designatedPosition: null,
  533. designatedStaff: null,
  534. involvedMoc: null,
  535. designatedOther: null,
  536. notPlan: null,
  537. notTrainingdate: null
  538. };
  539. this.resetForm("form");
  540. },
  541. /** 搜索按钮操作 */
  542. handleQuery() {
  543. this.queryParams.pageNum = 1;
  544. this.getList();
  545. },
  546. /** 重置按钮操作 */
  547. resetQuery() {
  548. this.resetForm("queryForm");
  549. this.handleQuery();
  550. },
  551. // 多选框选中数据
  552. handleSelectionChange(selection) {
  553. this.ids = selection.map(item => item.id)
  554. this.single = selection.length!==1
  555. this.multiple = !selection.length
  556. },
  557. /** 新增按钮操作 */
  558. handleAdd() {
  559. this.reset();
  560. this.open = true;
  561. this.submitDisabled = false;
  562. this.form.involvedMoc = false
  563. this.form.notPlan = true
  564. this.actualpostIds = [];
  565. this.lecturers = [];
  566. this.haveDesignated = false;
  567. this.designatedPositions = [];
  568. this.otherPositions = [];
  569. this.getDicts("ACTUALPOST").then(response => {
  570. this.actualpostOptions = response.data;
  571. });
  572. this.getDicts("ACTUALPOST").then(response => {
  573. this.designatedPositionOptions = response.data;
  574. });
  575. this.title = this.$t('添加') + this.$t('装置') +this.$t('空格') + this.$t('培训计划');
  576. },
  577. handleAddBatch(){
  578. batchAddTraining(null).then(response => {
  579. this.getList()
  580. this.msgSuccess('操作成功');
  581. })
  582. },
  583. /** 修改按钮操作 */
  584. handleUpdate(row) {
  585. this.reset();
  586. let _this = this
  587. this.submitDisabled = false;
  588. const id = row.id || this.ids
  589. getBccregular(id).then(response => {
  590. this.form = response.data;
  591. if (this.form.actualpostId != null) {
  592. this.actualpostIds = this.form.actualpostId.split(',');
  593. this.getDicts("ACTUALPOST").then(response => {
  594. this.designatedPositionOptions = response.data;
  595. this.actualpostIds.forEach(function (value, key, arr) {
  596. _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
  597. if (positionValue.dictValue === value) {
  598. _this.designatedPositionOptions.splice(positionkey ,1)
  599. }
  600. })
  601. })
  602. });
  603. }else {
  604. this.getDicts("ACTUALPOST").then(response => {
  605. this.designatedPositionOptions = response.data;
  606. })
  607. this.actualpostIds = [];
  608. }
  609. if (this.form.designatedPosition != null) {
  610. this.designatedPositions = this.form.designatedPosition.split(',');
  611. this.getDicts("ACTUALPOST").then(response => {
  612. this.actualpostOptions = response.data;
  613. this.designatedPositions.forEach(function (value, key, arr) {
  614. _this.actualpostOptions.forEach(function (positionValue, positionkey, arr) {
  615. if (positionValue.dictValue === value) {
  616. _this.actualpostOptions.splice(positionkey ,1)
  617. }
  618. })
  619. })
  620. });
  621. this.haveDesignated = true;
  622. var designatedId = null;
  623. this.designatedPositions.forEach(function (value,key,arr) {
  624. if (key != 0) {
  625. designatedId = designatedId + "," + value;
  626. }else if (key == 0) {
  627. designatedId = value;
  628. }
  629. })
  630. this.staffmgrQueryParams.actualposts = designatedId;
  631. this.staffmgrQueryParams.leftYear = this.form.year
  632. this.$nextTick(() => {
  633. listStaffmgr(this.staffmgrQueryParams).then(response => {
  634. this.stffmgrOptions = response.rows;
  635. });
  636. })
  637. }else {
  638. this.haveDesignated = false;
  639. this.designatedPositions = [];
  640. this.getDicts("ACTUALPOST").then(response => {
  641. this.actualpostOptions = response.data;
  642. })
  643. }
  644. if (this.form.designatedStaff != null) {
  645. this.designatedStaffs = this.form.designatedStaff.split(',');
  646. }else {
  647. this.designatedStaffs = [];
  648. }
  649. if (this.form.lecturer != null) {
  650. this.lecturers = this.form.lecturer.split(',');
  651. }else {
  652. this.lecturers =[];
  653. }
  654. if (response.data.involvedMoc === 'true') {
  655. this.form.involvedMoc = true
  656. }else {
  657. this.form.involvedMoc = false
  658. }
  659. //指定其他部门下拉框内容
  660. if (this.form.designatedOther != null) {
  661. this.otherPositions = this.form.designatedOther.split(',');
  662. }else {
  663. this.otherPositions = [];
  664. }
  665. if (response.data.notPlan === 'true') {
  666. this.form.notPlan = true
  667. }else {
  668. this.form.notPlan = false
  669. }
  670. this.open = true;
  671. this.title = this.$t('修改') + this.$t('装置') +this.$t('空格') + this.$t('培训计划');
  672. });
  673. },
  674. /** 提交按钮 */
  675. submitForm() {
  676. this.$refs["form"].validate(valid => {
  677. this.submitDisabled = true;
  678. if (valid) {
  679. var id = null;
  680. this.actualpostIds.forEach(function (value,key,arr) {
  681. if (key != 0) {
  682. id = id + "," + value;
  683. }else if (key == 0) {
  684. id = value;
  685. }
  686. })
  687. this.form.actualpostId = id;
  688. var designatedId = null;
  689. this.designatedPositions.forEach(function (value,key,arr) {
  690. if (key != 0) {
  691. designatedId = designatedId + "," + value;
  692. }else if (key == 0) {
  693. designatedId = value;
  694. }
  695. })
  696. // 王子文 2022年4月18日 13点31分 修改
  697. // 如果 复选框被选中 将指定人信息存入数据传输对象
  698. if (this.haveDesignated === true) {
  699. this.form.designatedPosition = designatedId;
  700. } else {
  701. this.form.designatedPosition = null;
  702. }
  703. // this.form.designatedPosition = designatedId;
  704. var designatedOther = null;
  705. this.otherPositions.forEach(function (value,key,arr) {
  706. if (key != 0) {
  707. designatedOther = designatedOther + "," + value;
  708. }else if (key == 0) {
  709. designatedOther = value;
  710. }
  711. })
  712. this.form.designatedOther = designatedOther;
  713. var staffId = null;
  714. this.designatedStaffs.forEach(function (value,key,arr) {
  715. if (key != 0) {
  716. staffId = staffId + "," + value;
  717. }else if (key == 0) {
  718. staffId = value;
  719. }
  720. })
  721. this.form.designatedStaff = staffId;
  722. var lecturerId = null;
  723. this.lecturers.forEach(function (value,key,arr) {
  724. if (key != 0) {
  725. lecturerId = lecturerId + "," + value;
  726. }else if (key == 0) {
  727. lecturerId = value;
  728. }
  729. })
  730. this.form.lecturer = lecturerId;
  731. if (this.form.id != null) {
  732. updateBccregular(this.form).then(response => {
  733. this.msgSuccess(this.$t('修改成功'));
  734. this.open = false;
  735. this.submitDisabled = false;
  736. this.getList();
  737. });
  738. } else {
  739. addBccregular(this.form).then(response => {
  740. this.msgSuccess(this.$t('新增成功'));
  741. this.open = false;
  742. this.submitDisabled = false;
  743. this.getList();
  744. });
  745. }
  746. }
  747. });
  748. },
  749. /** 删除按钮操作 */
  750. handleDelete(row) {
  751. const ids = row.id || this.ids;
  752. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  753. confirmButtonText: this.$t('确定'),
  754. cancelButtonText: this.$t('取消'),
  755. type: "warning"
  756. }).then(function() {
  757. return delBccregular(ids);
  758. }).then(() => {
  759. this.getList();
  760. this.msgSuccess(this.$t('删除成功'));
  761. })
  762. },
  763. /** 导出按钮操作 */
  764. handleExport() {
  765. const queryParams = this.queryParams;
  766. this.$confirm(this.$t('是否确认导出所有装置培训计划数据项?'), this.$t('警告'), {
  767. confirmButtonText: this.$t('确定'),
  768. cancelButtonText: this.$t('取消'),
  769. type: "warning"
  770. }).then(function() {
  771. return exportBccregular(queryParams);
  772. }).then(response => {
  773. this.download(response.msg);
  774. })
  775. },
  776. /** 导入按钮操作 */
  777. handleImport() {
  778. this.upload.title = this.$t('用户导入');
  779. this.upload.open = true;
  780. },
  781. // 文件上传中处理
  782. handleFileUploadProgress(event, file, fileList) {
  783. this.upload.isUploading = true;
  784. },
  785. // 文件上传成功处理
  786. handleFileSuccess(response, file, fileList) {
  787. this.upload.open = false;
  788. this.upload.isUploading = false;
  789. this.$refs.upload.clearFiles();
  790. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  791. this.getList();
  792. },
  793. // 提交上传文件
  794. submitFileForm() {
  795. this.$refs.upload.submit();
  796. }
  797. }
  798. };
  799. </script>
  800. <style scoped>
  801. .colorMark {
  802. color: #6f6f6f;
  803. text-align: right;
  804. font-weight:bold;
  805. font-size: 13px;
  806. padding-bottom: 5px;
  807. }
  808. .rectangleLightgreen {
  809. width: 40px !important;
  810. height: 20px !important;
  811. }
  812. .rectangleFlesh {
  813. width: 40px !important;
  814. height: 20px !important;
  815. }
  816. .rectangleYellow {
  817. width: 40px !important;
  818. height: 20px !important;
  819. }
  820. </style>