evaluationDepartmentPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <div class="evaluationDepartment">
  3. <div class="evaluationDepartmentBtn">
  4. <div class="collectSeach" :style="$utils.collectSeachSty()">
  5. <div class="exceed">
  6. <span class="exceedSpan">部门名称:</span>
  7. <el-input v-model="departmentS" placeholder="请输入部门名称"></el-input>
  8. </div>
  9. <div class="exceed">
  10. <span class="exceedSpan">部门领导:</span>
  11. <el-input v-model="leaderS" placeholder="请输入部门领导"></el-input>
  12. </div>
  13. <seachs @handleSeach="getSeachData" @handleRest="resetSeach"></seachs>
  14. </div>
  15. <div class="PeriodBtn" :style="$utils.PeriodBtnSty()">
  16. <btns
  17. :showImport="false"
  18. :showExport="false"
  19. :showAdd="$utils.havePurview('evaldepartment:oneLevel:add')"
  20. :showSave="$utils.havePurview('evaldepartment:oneLevel:save')"
  21. :showDelete="$utils.havePurview('evaldepartment:oneLevel:delete')"
  22. :disSave="changeDateSelect.length === 0 || changeDateSelect.length>1"
  23. :disDelete="changeDateSelect.length === 0"
  24. :disImport="true"
  25. :disExport="true"
  26. @handleAdd="handleAdd"
  27. @handleEdit="handleEdit"
  28. @handleDelete="handleDelete"
  29. ></btns>
  30. </div>
  31. <div class="evaluationDepartmentTableData">
  32. <el-table :data="evaluationDepartmentData" style="width: 100%" :class="departmentTableSty()"
  33. @select="rowClick" @select-all="rowClick">
  34. <el-table-column type="selection" label="操作" align="center"></el-table-column>
  35. <el-table-column label="序号" prop="serialNumber" width="100" />
  36. <el-table-column label="部门名称" prop="deptName" />
  37. <el-table-column label="部门领导名称" prop="chargePersonName" />
  38. <el-table-column label="部门应用">
  39. <template #default="scope">
  40. <span v-if="scope.row.yjzbjhType === '1'">业绩指标计划</span>
  41. <span v-if="scope.row.yjzbjhType === '1' && scope.row.jxjgkhsbType === '1'">,</span>
  42. <span v-if="scope.row.jxjgkhsbType === '1'">绩效考核申报</span>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <el-pagination
  47. @size-change="handleSizeChange"
  48. @current-change="handleCurrentChange"
  49. :current-page="page.currentPage"
  50. :page-size="page.pagesize"
  51. layout="total, prev, pager, next, jumper"
  52. :total="page.total">
  53. </el-pagination>
  54. </div>
  55. <el-dialog :title="title" v-model="dialogVisible" width="600px" :close-on-click-modal="false">
  56. <div class="periodFrom">
  57. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" :validate-on-rule-change="false">
  58. <el-form-item label="一级部门" prop="department">
  59. <el-select v-model="ruleForm.department" placeholder="请选择所属部门" :disabled="isSave"
  60. filterable @change="changedepart2Data">
  61. <el-option
  62. v-for="item in departData"
  63. :key="item.id"
  64. :label="item.name"
  65. :value="item.id">
  66. </el-option>
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item label="二级部门">
  70. <el-select v-model="ruleForm.depart2ment" placeholder="请选择所属部门" :disabled="isSave" >
  71. <el-option
  72. v-for="item in depart2Data"
  73. :key="item.id"
  74. :label="item.name"
  75. :value="item.id">
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="部门领导" prop="departmentLeader">
  80. <el-select v-model="ruleForm.departmentLeader" placeholder="请选择部门领导" filterable>
  81. <el-option
  82. v-for="item in deptLeaderOption"
  83. :key="item.id"
  84. :label="item.name"
  85. :value="item.id">
  86. <span style="float: left;display:inline-block;width:100px">{{ item.name }}</span>
  87. <span style="float: right;color: #909399;font-size: 13px;" >{{ item.no }}</span>
  88. </el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="部门应用" prop="departmentIn">
  92. <el-checkbox-group v-model="ruleForm.departmentIn">
  93. <el-checkbox label="业绩指标计划" name="type" :disabled="ruleForm.depart2ment !== ''" />
  94. <el-checkbox label="绩效考核申报" name="type" />
  95. </el-checkbox-group>
  96. </el-form-item>
  97. <el-form-item label="排序" >
  98. <el-input-number v-model="ruleForm.serialNumber" :min="1" />
  99. </el-form-item>
  100. </el-form>
  101. </div>
  102. <template #footer>
  103. <span class="dialog-footer">
  104. <el-button @click="dialogVisible = false">取 消</el-button>
  105. <el-button type="primary" @click="saveevaluationDepartmentMsg('ruleForm')">确 定</el-button>
  106. </span>
  107. </template>
  108. </el-dialog>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import importDailog from '../importPage/importDailog.vue'
  114. import btns from '../elbuttonS.vue'
  115. import seachs from '../seachGroup.vue'
  116. import addW from '../../assets/btnIcon/addW.png'
  117. import addIcon from '../../assets/btnIcon/add.png'
  118. import {apiGetEvaluationDeptList, apiGetevaluationdeptSave, apiGetevaluationdeptremoveAll, apiGetorganizationstructureFromTree,
  119. apiGetDepartmentallocationLeader,
  120. apievaluationdeptallocationgetDept,apievaluationdeptallocationgetDept2, apievaluationdeptallocationgetUser} from '../../api/api'
  121. export default {
  122. components: { importDailog, btns, seachs },
  123. data() {
  124. return {
  125. dialogVisible: false,
  126. title: '',
  127. isSave: false,
  128. changeDateSelect: [],
  129. departmentS: '',
  130. leaderS: '',
  131. evaluationDepartmentData:[],
  132. departData: [],
  133. depart2Data: [],
  134. deptLeaderOption: [],
  135. addW: addW,
  136. addIcon: addIcon,
  137. ruleForm: {
  138. department: '',
  139. depart2ment: '',
  140. departmentLeader: '',
  141. serialNumber: 1,
  142. departmentIn: []
  143. },
  144. rules: {
  145. department: [
  146. { required: true, message: '请选择部门名称', trigger: 'change' }
  147. ],
  148. departmentLeader: [
  149. { required: true, message: '请选择部门领导', trigger: 'change' }
  150. ],
  151. departmentIn: [
  152. {
  153. type: 'array',
  154. required: true,
  155. message: '请选择部门应用',
  156. trigger: 'change',
  157. },
  158. ]
  159. },
  160. page:{
  161. pagesize: 12,
  162. currentPage: 1,
  163. total: 0
  164. },
  165. evalradio: {},
  166. winPix: window.devicePixelRatio,
  167. innerWidth: window.innerWidth
  168. }
  169. },
  170. created() {
  171. this.getEvalCompanyData()
  172. this.getDepartmentFromTreeData()
  173. this.indicatorCategorys = [
  174. {
  175. label: '指标计划',
  176. value: '指标计划'
  177. },
  178. {
  179. label: '指标结果',
  180. value: '指标结果'
  181. }
  182. ]
  183. },
  184. methods:{
  185. // 查询部门列表数据
  186. getEvalCompanyData() {
  187. let that = this
  188. let params = {
  189. pageNum: that.page.currentPage,
  190. pageSize: that.page.pagesize,
  191. deptName: that.departmentS,
  192. chargePersonName: that.leaderS
  193. }
  194. apiGetEvaluationDeptList(params).then(datas =>{
  195. if (datas && datas.data) {
  196. that.evaluationDepartmentData = datas.data.records
  197. that.page.total = datas.data.total
  198. }
  199. })
  200. },
  201. // 一级部门
  202. getDepartmentFromTreeData() {
  203. let that = this
  204. let params = {
  205. id: '23031001',
  206. num: 1
  207. }
  208. apiGetorganizationstructureFromTree(params).then(datas =>{
  209. if (datas && datas.data) {
  210. that.departData = datas.data[0].children
  211. }
  212. })
  213. // 测试数据
  214. // apievaluationdeptallocationgetDept().then(datas =>{
  215. // if (datas && datas.data) {
  216. // that.departData = datas.data
  217. // }
  218. // })
  219. },
  220. // 二级部门
  221. changedepart2Data(val) {
  222. let that = this
  223. that.ruleForm.depart2ment = ''
  224. let params = {
  225. id: val,
  226. num: 2
  227. }
  228. apiGetorganizationstructureFromTree(params).then(datas =>{
  229. if (datas && datas.data) {
  230. that.depart2Data = datas.data[0].children
  231. if (that.isSave) {
  232. that.ruleForm.depart2ment = ''
  233. if (that.evalradio.parentId !== '') {
  234. that.ruleForm.depart2ment = that.evalradio.deptId
  235. }
  236. }
  237. that.getuserPageList(val)
  238. }
  239. })
  240. // 测试数据
  241. // apievaluationdeptallocationgetDept2(val).then(datas =>{
  242. // if (datas && datas.data) {
  243. // that.depart2Data = datas.data
  244. // if (that.isSave) {
  245. // that.ruleForm.depart2ment = ''
  246. // if (that.evalradio.parentId !== '') {
  247. // that.ruleForm.depart2ment = that.evalradio.deptId
  248. // }
  249. // }
  250. // that.getuserPageList(val)
  251. // }
  252. // })
  253. },
  254. // 查询人员
  255. getuserPageList(val) {
  256. let that = this
  257. apiGetDepartmentallocationLeader(val).then(datas =>{
  258. if (datas && datas.data) {
  259. that.deptLeaderOption = datas.data
  260. if (that.isSave) {
  261. that.ruleForm.departmentLeader = that.evalradio.chargePersonId
  262. }
  263. }
  264. })
  265. // 测试数据
  266. // apievaluationdeptallocationgetUser().then(datas =>{
  267. // if (datas && datas.data) {
  268. // that.deptLeaderOption = datas.data
  269. // }
  270. // })
  271. },
  272. handleAdd() {
  273. this.dialogVisible = true
  274. this.isSave = false
  275. this.title = '新增考评部门'
  276. this.$nextTick(() =>{
  277. this.ruleForm = {
  278. department: '',
  279. departmentLeader: '',
  280. serialNumber: 1,
  281. departmentIn: []
  282. }
  283. })
  284. },
  285. handleEdit() {
  286. this.dialogVisible = true
  287. this.isSave = true
  288. this.title = '修改考评部门'
  289. this.evalradio = this.changeDateSelect[0]
  290. let departmentInStr = []
  291. if (this.evalradio.yjzbjhType === '1') {
  292. departmentInStr.push('业绩指标计划')
  293. }
  294. if (this.evalradio.jxjgkhsbType === '1') {
  295. departmentInStr.push('绩效考核申报')
  296. }
  297. this.ruleForm = {
  298. // departmentLeader: this.evalradio.chargePersonId,
  299. serialNumber: this.evalradio.serialNumber,
  300. departmentIn: departmentInStr
  301. }
  302. if (this.evalradio.parentId !== '') {
  303. this.ruleForm.department = this.evalradio.parentId
  304. this.changedepart2Data(this.evalradio.parentId)
  305. // this.getuserPageList(this.evalradio.parentId)
  306. } else {
  307. this.ruleForm.department = this.evalradio.deptId
  308. this.changedepart2Data(this.evalradio.deptId)
  309. // this.getuserPageList(this.evalradio.deptId)
  310. }
  311. },
  312. saveevaluationDepartmentMsg(formName) {
  313. let that = this
  314. that.$refs[formName].validate((valid) => {
  315. if (valid) {
  316. that.saveAndEditIndicatorData()
  317. }
  318. });
  319. },
  320. //新增/修改指标数据
  321. saveAndEditIndicatorData() {
  322. let that = this
  323. let deptNameS = ''
  324. let dept2NameS = ''
  325. let deptLeaderNameS = ''
  326. that.departData.forEach(item =>{
  327. if (item.id === that.ruleForm.department) {
  328. deptNameS = item.name
  329. }
  330. })
  331. that.depart2Data.forEach(item =>{
  332. if (item.id === that.ruleForm.depart2ment) {
  333. dept2NameS = item.name
  334. }
  335. })
  336. that.deptLeaderOption.forEach(item =>{
  337. if (item.id === that.ruleForm.departmentLeader) {
  338. deptLeaderNameS = item.name
  339. }
  340. })
  341. let yjzbjhTypeIn = '0'
  342. let jxjgkhsbTypeIn = '0'
  343. that.ruleForm.departmentIn.forEach(it => {
  344. if (it === '业绩指标计划') {
  345. yjzbjhTypeIn = '1'
  346. } else if (it === '绩效考核申报') {
  347. jxjgkhsbTypeIn = '1'
  348. }
  349. })
  350. let params = {
  351. chargePersonId: that.ruleForm.departmentLeader,
  352. chargePersonName: deptLeaderNameS,
  353. serialNumber: that.ruleForm.serialNumber,
  354. yjzbjhType: yjzbjhTypeIn,
  355. jxjgkhsbType: jxjgkhsbTypeIn
  356. }
  357. if (that.ruleForm.depart2ment === '') {
  358. params.deptId = that.ruleForm.department
  359. params.deptName = deptNameS
  360. } else {
  361. params.parentId = that.ruleForm.department
  362. params.deptId = that.ruleForm.depart2ment
  363. params.deptName = dept2NameS
  364. }
  365. if (that.isSave) {
  366. params.id = that.evalradio.id
  367. }
  368. apiGetevaluationdeptSave(params).then(datas =>{
  369. if (!datas.success) {
  370. that.$message({
  371. message: datas.message,
  372. type: 'error'
  373. });
  374. } else {
  375. if (!that.isSave) {
  376. that.$message({
  377. message: '考评部门新增成功',
  378. type: 'success'
  379. });
  380. } else {
  381. that.$message({
  382. message: '考评部门修改成功',
  383. type: 'success'
  384. });
  385. }
  386. that.dialogVisible = false
  387. that.changeDateSelect = []
  388. that.getEvalCompanyData()
  389. }
  390. })
  391. },
  392. //删除部门数据
  393. handleDelete() {
  394. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  395. confirmButtonText: '确定',
  396. cancelButtonText: '取消',
  397. type: 'warning'
  398. }).then(() => {
  399. let that = this
  400. let paramsArr = []
  401. that.changeDateSelect.forEach(it =>{
  402. paramsArr.push(it.id)
  403. })
  404. apiGetevaluationdeptremoveAll(paramsArr.join(',')).then(datas =>{
  405. if (datas) {
  406. that.$message({
  407. type: 'success',
  408. message: '删除成功!'
  409. });
  410. that.changeDateSelect = []
  411. that.getEvalCompanyData()
  412. }
  413. })
  414. })
  415. },
  416. rowClick(selection, row) {
  417. this.changeDateSelect = selection
  418. },
  419. getSeachData() {
  420. this.page.currentPage = 1
  421. this.getEvalCompanyData()
  422. },
  423. resetSeach() {
  424. this.page.currentPage = 1
  425. this.departmentS = ''
  426. this.leaderS = ''
  427. this.getEvalCompanyData()
  428. },
  429. handleSizeChange(val){
  430. this.page.pagesize = val
  431. this.getEvalCompanyData()
  432. },
  433. handleCurrentChange(val){
  434. this.page.currentPage =val
  435. this.getEvalCompanyData()
  436. },
  437. departmentTableSty() {
  438. if (this.winPix === 1.25 || this.innerWidth < 1800) {
  439. return 'department125Table'
  440. } else {
  441. return 'department100Table'
  442. }
  443. }
  444. }
  445. }
  446. </script>
  447. <style lang="less">
  448. .evaluationDepartment{
  449. .evaluationDepartmentBtn{
  450. .collectSeach{
  451. display: flex;
  452. padding: 24px 20px;
  453. border-bottom: 1px solid#D6DBEA;
  454. .exceed{
  455. display: flex;
  456. .exceedSpan{
  457. width: 100px;
  458. height: 12px;
  459. font-size: 14px;
  460. font-family: Microsoft YaHei;
  461. font-weight: 400;
  462. color: #8991B0;
  463. line-height: 12px;
  464. margin-top: 14px;
  465. }
  466. .el-input{
  467. margin-right:10px;
  468. .el-input__inner{
  469. height:30px;
  470. }
  471. .el-input__suffix{
  472. .el-select__caret{
  473. line-height:30px;
  474. }
  475. }
  476. }
  477. }
  478. .el-select{
  479. margin-right:10px;
  480. .el-input__inner{
  481. height:30px;
  482. }
  483. .el-input__suffix{
  484. .el-select__caret{
  485. line-height:30px;
  486. }
  487. }
  488. }
  489. }
  490. span{
  491. font-size:14px;
  492. }
  493. .PeriodBtn{
  494. display: flex;
  495. justify-content: flex-end;
  496. padding: 20px 0;
  497. }
  498. .el-button{
  499. height: 30px;
  500. // width:100px;
  501. padding: 0 30px ;
  502. // padding-top: 8px;
  503. span{
  504. margin:0;
  505. }
  506. }
  507. .el-overlay{
  508. .el-dialog{
  509. margin-top: 10vh;
  510. .el-dialog__body{
  511. padding: 30px 60px 30px 20px !important;
  512. .periodFrom{
  513. .el-select, .el-input{
  514. width: 100%;
  515. }
  516. .el-input{
  517. height: 30px;
  518. }
  519. }
  520. }
  521. .el-dialog__footer{
  522. .dialog-footer{
  523. display: flex;
  524. justify-content: center;
  525. .el-button{
  526. width: 180px !important;
  527. height: 40px !important;
  528. }
  529. }
  530. }
  531. }
  532. }
  533. }
  534. .evaluationDepartmentTableData{
  535. .department125Table{
  536. .el-table__body-wrapper{
  537. height: 53vh !important;
  538. }
  539. }
  540. .department100Table{
  541. .el-table__body-wrapper{
  542. height: 60vh !important;
  543. }
  544. }
  545. .el-table{
  546. .el-input__inner{
  547. height: 30px !important;
  548. }
  549. .el-radio__label{
  550. display: none;
  551. }
  552. .indicitem{
  553. color: #409EFF;
  554. font-size: 12px;
  555. margin-right: 20px;
  556. cursor:pointer;
  557. &:hover{
  558. text-decoration: underline;
  559. }
  560. }
  561. }
  562. .el-pagination{
  563. margin-top: 20px;
  564. text-align: end;
  565. position: relative;
  566. }
  567. }
  568. }
  569. </style>