index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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="培养员工编号" prop="staffId">
  5. <el-input
  6. v-model="queryParams.staffId"
  7. placeholder="请输入培养员工编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="备注" prop="remarks">
  14. <el-input
  15. v-model="queryParams.remarks"
  16. placeholder="请输入备注"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="导师员工编号" prop="mentorStaffId">
  23. <el-input
  24. v-model="queryParams.mentorStaffId"
  25. placeholder="请输入导师员工编号"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd"
  43. v-hasPermi="['spec:successor:add']"
  44. >新增</el-button>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-button
  48. type="success"
  49. icon="el-icon-edit"
  50. size="mini"
  51. :disabled="single"
  52. @click="handleUpdate"
  53. v-hasPermi="['spec:successor:edit']"
  54. >修改</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['spec:successor:remove']"
  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="['spec:successor: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="['spec:successor:export']"
  82. >导出</el-button>
  83. </el-col>
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  85. </el-row>
  86. <el-table v-loading="loading" :data="successorList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="员工编号" align="center" prop="staffId" :show-overflow-tooltip="true"/>
  89. <el-table-column label="培养员工" align="center" prop="staff.name" :show-overflow-tooltip="true"/>
  90. <el-table-column label="当前岗位" align="center" prop="staff.actualpost" :formatter="postFormat" />
  91. <el-table-column label="班值" align="center" prop="staff.team" :formatter="teamFormat" />
  92. <el-table-column label="目标岗位" align="center" prop="actualpost" :formatter="actualpostFormat" />
  93. <el-table-column label="导师" align="center" prop="mentorStaffName" :show-overflow-tooltip="true"/>
  94. <el-table-column label="培养状态" align="center" prop="state" :formatter="stSuccessorStatusFormat"/>
  95. <el-table-column label="一季度" align="center" prop="scoreList[0].quarterOne" :show-overflow-tooltip="true"/>
  96. <el-table-column label="二季度" align="center" prop="scoreList[0].quarterTwo" :show-overflow-tooltip="true"/>
  97. <el-table-column label="三季度" align="center" prop="scoreList[0].quarterThree" :show-overflow-tooltip="true"/>
  98. <el-table-column label="四季度" align="center" prop="scoreList[0].quarterFour" :show-overflow-tooltip="true"/>
  99. <el-table-column label="年度" align="center" prop="scoreList[0].year" :show-overflow-tooltip="true"/>
  100. <el-table-column label="部门" align="center" prop="deptName" :show-overflow-tooltip="true"/>
  101. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  102. <el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
  103. <template slot-scope="scope">
  104. <el-button
  105. size="mini"
  106. type="text"
  107. @click="planList(scope.row)"
  108. >培养计划</el-button>
  109. <el-button
  110. size="mini"
  111. type="text"
  112. @click="openStaffResume(scope.row)"
  113. >一人一档</el-button>
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-edit"
  118. @click="handleUpdate(scope.row)"
  119. v-hasPermi="['spec:successor:edit']"
  120. >修改</el-button>
  121. <el-button
  122. size="mini"
  123. type="text"
  124. icon="el-icon-delete"
  125. @click="handleDelete(scope.row)"
  126. v-hasPermi="['spec:successor:remove']"
  127. >删除</el-button>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <pagination
  132. v-show="total>0"
  133. :total="total"
  134. :page.sync="queryParams.pageNum"
  135. :limit.sync="queryParams.pageSize"
  136. @pagination="getList"
  137. />
  138. <!-- 添加或修改继任者清单对话框 -->
  139. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  140. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  141. <el-form-item label="培养员工" prop="staffId">
  142. <el-select v-model="form.staffId" filterable :placeholder="$t('请选择')+$t('学员')">
  143. <el-option
  144. v-for="item in userOption"
  145. :key="item.staffid"
  146. :label="item.name +' '+ item.deptName"
  147. :value="item.staffid"
  148. :disabled="item.disabled">
  149. </el-option>
  150. </el-select>
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remarks">
  153. <el-input v-model="form.remarks" placeholder="请输入备注" />
  154. </el-form-item>
  155. <el-form-item label="目标岗位" prop="actualpost">
  156. <el-select v-model="form.actualpost" placeholder="请选择目标岗位">
  157. <el-option
  158. v-for="dict in actualpostOptions"
  159. :key="dict.dictValue"
  160. :label="dict.dictLabel"
  161. :value="dict.dictValue"
  162. ></el-option>
  163. </el-select>
  164. </el-form-item>
  165. <el-form-item label="导师员工" prop="mentorStaffId">
  166. <el-select v-model="form.mentorStaffId" filterable :placeholder="$t('请选择')+$t('导师')">
  167. <el-option
  168. v-for="item in userMentorOption"
  169. :key="item.staffid"
  170. :label="item.name +' '+ item.deptName"
  171. :value="item.staffid"
  172. :disabled="item.disabled">
  173. </el-option>
  174. </el-select>
  175. </el-form-item>
  176. <el-form-item label="培养状态" prop="state">
  177. <el-select v-model="form.state" placeholder="请选择培养状态">
  178. <el-option
  179. v-for="dict in stSuccessorStatusOptions"
  180. :key="dict.dictValue"
  181. :label="dict.dictLabel"
  182. :value="dict.dictValue"
  183. ></el-option>
  184. </el-select>
  185. </el-form-item>
  186. <el-form-item label="归属部门" prop="deptId">
  187. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  188. </el-form-item>
  189. </el-form>
  190. <div slot="footer" class="dialog-footer">
  191. <el-button type="primary" :loading="submitLoading" @click="submitForm">确 定</el-button>
  192. <el-button @click="cancel">取 消</el-button>
  193. </div>
  194. </el-dialog>
  195. <!-- 用户导入对话框 -->
  196. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  197. <el-upload
  198. ref="upload"
  199. :limit="1"
  200. accept=".xlsx, .xls"
  201. :headers="upload.headers"
  202. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  203. :disabled="upload.isUploading"
  204. :on-progress="handleFileUploadProgress"
  205. :on-success="handleFileSuccess"
  206. :auto-upload="false"
  207. drag
  208. >
  209. <i class="el-icon-upload"></i>
  210. <div class="el-upload__text">
  211. 将文件拖到此处,或
  212. <em>点击上传</em>
  213. </div>
  214. <div class="el-upload__tip" slot="tip">
  215. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  216. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  217. </div>
  218. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  219. </el-upload>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  222. <el-button @click="upload.open = false">取 消</el-button>
  223. </div>
  224. </el-dialog>
  225. <staff-resume v-if="staffResumeVisible" ref="staffResume"></staff-resume>
  226. </div>
  227. </template>
  228. <script>
  229. import { listSuccessor, getSuccessor, delSuccessor, addSuccessor, updateSuccessor, exportSuccessor, importTemplate ,listPostStaff,listPostMentorStaff} from "@/api/training/spec/successor";
  230. import { treeselect } from "@/api/system/dept";
  231. import { getToken } from "@/utils/auth";
  232. import Treeselect from "@riophae/vue-treeselect";
  233. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  234. import StaffResume from "./staffResume"
  235. export default {
  236. name: "Successor",
  237. components: { Treeselect,StaffResume },
  238. data() {
  239. return {
  240. // 遮罩层
  241. loading: true,
  242. submitLoading: false,
  243. staffResumeVisible: false,
  244. // 选中数组
  245. ids: [],
  246. userOption:[],
  247. userMentorOption: [],
  248. // 非单个禁用
  249. single: true,
  250. // 非多个禁用
  251. multiple: true,
  252. // 显示搜索条件
  253. showSearch: false,
  254. // 总条数
  255. total: 0,
  256. // 继任者清单表格数据
  257. successorList: [],
  258. // 弹出层标题
  259. title: "",
  260. // 部门树选项
  261. deptOptions: undefined,
  262. clientHeight:300,
  263. // 是否显示弹出层
  264. open: false,
  265. // 目标岗位字典
  266. actualpostOptions: [],
  267. teamOptions: [],
  268. stSuccessorStatusOptions: [],
  269. // 用户导入参数
  270. upload: {
  271. // 是否显示弹出层(用户导入)
  272. open: false,
  273. // 弹出层标题(用户导入)
  274. title: "",
  275. // 是否禁用上传
  276. isUploading: false,
  277. // 是否更新已经存在的用户数据
  278. updateSupport: 0,
  279. // 设置上传的请求头部
  280. headers: { Authorization: "Bearer " + getToken() },
  281. // 上传的地址
  282. url: process.env.VUE_APP_BASE_API + "/spec/successor/importData"
  283. },
  284. // 查询参数
  285. queryParams: {
  286. pageNum: 1,
  287. pageSize: 20,
  288. staffId: null,
  289. remarks: null,
  290. mentorStaffId: null,
  291. },
  292. // 表单参数
  293. form: {},
  294. // 表单校验
  295. rules: {
  296. }
  297. };
  298. },
  299. watch: {
  300. // 根据名称筛选部门树
  301. deptName(val) {
  302. this.$refs.tree.filter(val);
  303. }
  304. },
  305. created() {
  306. //设置表格高度对应屏幕高度
  307. this.$nextTick(() => {
  308. this.clientHeight = document.body.clientHeight -250
  309. })
  310. this.getList();
  311. this.getTreeselect();
  312. this.getDicts("ACTUALPOST").then(response => {
  313. this.actualpostOptions = response.data;
  314. });
  315. this.getDicts("TEAM_DIVIDE").then(response => {
  316. this.teamOptions = response.data;
  317. });
  318. this.getDicts("st_successor_status").then(response => {
  319. this.stSuccessorStatusOptions = response.data;
  320. });
  321. listPostStaff(this.queryParams).then(response => {
  322. this.userOption = response.data;
  323. });
  324. listPostMentorStaff(this.queryParams).then(response => {
  325. this.userMentorOption = response.data;
  326. });
  327. },
  328. methods: {
  329. /** 查询继任者清单列表 */
  330. getList() {
  331. this.loading = true;
  332. listSuccessor(this.queryParams).then(response => {
  333. this.successorList = response.rows;
  334. this.total = response.total;
  335. this.loading = false;
  336. });
  337. },
  338. /** 查询部门下拉树结构 */
  339. getTreeselect() {
  340. treeselect().then(response => {
  341. this.deptOptions = response.data;
  342. });
  343. },
  344. // 当前岗位字典翻译
  345. postFormat(row, column) {
  346. return this.selectDictLabel(this.actualpostOptions, row.staff.actualpost);
  347. },
  348. // 目标岗位字典翻译
  349. actualpostFormat(row, column) {
  350. return this.selectDictLabel(this.actualpostOptions, row.actualpost);
  351. },
  352. // 班值字典翻译
  353. teamFormat(row, column) {
  354. return this.selectDictLabel(this.teamOptions, row.staff.team);
  355. },
  356. stSuccessorStatusFormat(row, column) {
  357. return this.selectDictLabel(this.stSuccessorStatusOptions, row.state);
  358. },
  359. // 取消按钮
  360. cancel() {
  361. this.open = false;
  362. this.reset();
  363. },
  364. // 表单重置
  365. reset() {
  366. this.form = {
  367. id: null,
  368. staffId: null,
  369. remarks: null,
  370. delFlag: null,
  371. createrCode: null,
  372. createdate: null,
  373. updaterCode: null,
  374. updatedate: null,
  375. deptId: null,
  376. actualpost: null,
  377. mentorStaffId: null,
  378. state: null
  379. };
  380. this.resetForm("form");
  381. },
  382. /** 搜索按钮操作 */
  383. handleQuery() {
  384. this.queryParams.pageNum = 1;
  385. this.getList();
  386. },
  387. /** 重置按钮操作 */
  388. resetQuery() {
  389. this.resetForm("queryForm");
  390. this.handleQuery();
  391. },
  392. // 多选框选中数据
  393. handleSelectionChange(selection) {
  394. this.ids = selection.map(item => item.id)
  395. this.single = selection.length!==1
  396. this.multiple = !selection.length
  397. },
  398. /** 新增按钮操作 */
  399. handleAdd() {
  400. this.reset();
  401. this.form.state = '0'
  402. this.open = true;
  403. this.title = "添加继任者清单";
  404. },
  405. /** 修改按钮操作 */
  406. handleUpdate(row) {
  407. this.reset();
  408. const id = row.id || this.ids
  409. getSuccessor(id).then(response => {
  410. this.form = response.data;
  411. this.form.state = response.data.state.toString()
  412. this.open = true;
  413. this.title = "修改继任者清单";
  414. });
  415. },
  416. /** 提交按钮 */
  417. submitForm() {
  418. this.$refs["form"].validate(valid => {
  419. if (valid) {
  420. this.submitLoading = true
  421. if (this.form.id != null) {
  422. updateSuccessor(this.form).then(response => {
  423. this.msgSuccess("修改成功");
  424. this.open = false;
  425. this.submitLoading = false
  426. this.getList();
  427. });
  428. } else {
  429. addSuccessor(this.form).then(response => {
  430. this.msgSuccess("新增成功");
  431. this.open = false;
  432. this.submitLoading = false
  433. this.getList();
  434. });
  435. }
  436. }
  437. });
  438. //
  439. },
  440. /** 删除按钮操作 */
  441. handleDelete(row) {
  442. const ids = row.id || this.ids;
  443. this.$confirm('是否确认删除?', "警告", {
  444. confirmButtonText: "确定",
  445. cancelButtonText: "取消",
  446. type: "warning"
  447. }).then(function() {
  448. return delSuccessor(ids);
  449. }).then(() => {
  450. this.getList();
  451. this.msgSuccess("删除成功");
  452. })
  453. },
  454. /** 导出按钮操作 */
  455. handleExport() {
  456. const queryParams = this.queryParams;
  457. this.$confirm('是否确认导出所有继任者清单数据项?', "警告", {
  458. confirmButtonText: "确定",
  459. cancelButtonText: "取消",
  460. type: "warning"
  461. }).then(function() {
  462. return exportSuccessor(queryParams);
  463. }).then(response => {
  464. this.download(response.msg);
  465. })
  466. },
  467. /** 导入按钮操作 */
  468. handleImport() {
  469. this.upload.title = "用户导入";
  470. this.upload.open = true;
  471. },
  472. /** 下载模板操作 */
  473. importTemplate() {
  474. importTemplate().then(response => {
  475. this.download(response.msg);
  476. });
  477. },
  478. // 文件上传中处理
  479. handleFileUploadProgress(event, file, fileList) {
  480. this.upload.isUploading = true;
  481. },
  482. // 文件上传成功处理
  483. handleFileSuccess(response, file, fileList) {
  484. this.upload.open = false;
  485. this.upload.isUploading = false;
  486. this.$refs.upload.clearFiles();
  487. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  488. this.getList();
  489. },
  490. // 提交上传文件
  491. submitFileForm() {
  492. this.$refs.upload.submit();
  493. },
  494. planList(row){
  495. const staffId = row.staffId
  496. this.$router.push("/training/spec/successorPlan/" + staffId);
  497. },
  498. openStaffResume(row){
  499. this.staffResumeVisible = true
  500. this.$nextTick(() => {
  501. this.$refs.staffResume.init(row)
  502. })
  503. }
  504. }
  505. };
  506. </script>