evaluationDepartmentPage.vue 20 KB

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