TaskList.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. <template>
  2. <div v-loading.fullscreen.lock="cacheobgLoading">
  3. <div class="tasklist-all">
  4. <el-dialog width="500px" title="完成情况" :visible.sync="dialogTasklist">
  5. <el-form>
  6. <el-form-item label="特殊说明:" :label-width="formLabelWidth">
  7. <el-input type="textarea" :rows="5" v-model="shuju.remark" autocomplete="off"></el-input>
  8. </el-form-item>
  9. <el-form-item label="完成时间:" :label-width="formLabelWidth">
  10. <el-date-picker v-model="shuju.overTime" type="datetime" placeholder="选择日期时间">
  11. </el-date-picker>
  12. </el-form-item>
  13. </el-form>
  14. <div slot="footer" class="dialog-footer">
  15. <el-button @click="dialogTasklist = false">取 消</el-button>
  16. <el-button type="primary" @click="PostTaskAllocationSetAuditStatus">确 定</el-button>
  17. </div>
  18. </el-dialog>
  19. <div class="tasklist-head">
  20. <el-form style="display: flex;justify-content: space-between;align-items: center;" label-width="70px"
  21. class="demo-ruleForm">
  22. <div class="tasklist-head-select">
  23. <el-form-item label="任务名称" prop="name">
  24. <el-select :clearable="true" size="medium" @change="changetasknames" filterable
  25. v-model="tasknames" placeholder="请选择">
  26. <el-option v-for="item in tasknamelist" :key="item" :label="item" :value="item">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="完成状态" prop="name">
  31. <el-select @change="changetasknames" size="medium" filterable
  32. v-model="completionstatus" placeholder="请选择">
  33. <el-option v-for="item in completionstatuslist" :key="item.id" :label="item.name"
  34. :value="item.id">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="人员名称" prop="name">
  39. <el-select @change="changetasknames" size="medium" filterable
  40. v-model="taskUserId" placeholder="请选择">
  41. <el-option v-for="item in taskUserIdArr" :key="item.id" :label="item.name"
  42. :value="item.id">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. <!-- <el-form-item label="指派类型" prop="name">
  47. <el-select @change="changeassignmenttype" size="medium" filterable v-model="assignmenttype" placeholder="请选择">
  48. <el-option
  49. v-for="item in assignmenttypelist"
  50. :key="item.id"
  51. :label="item.name"
  52. :value="item.id">
  53. </el-option>
  54. </el-select>
  55. </el-form-item> -->
  56. </div>
  57. <!-- <el-button :disabled="!isAddPerm" size="medium" @click="handleView" type="primary">新增任务</el-button> -->
  58. <el-button size="medium" @click="handleView" type="primary">新增任务</el-button>
  59. </el-form>
  60. </div>
  61. <div class="tasklist-title">任务列表</div>
  62. <div class="tasklist-table">
  63. <el-table :data="tableData" border style="width: 100%">
  64. <!-- <el-table-column type="expand">
  65. <template slot-scope="scopee">
  66. <div v-if="userId==scopee.row.taskerDetails[0].taskCreateUserId" class="table-boxli">
  67. <el-table
  68. :data="scopee.row.taskerDetails"
  69. border
  70. style="width: 100%">
  71. <el-table-column
  72. type="index"
  73. label="序号"
  74. width="50" >
  75. </el-table-column>
  76. <el-table-column
  77. prop="userName"
  78. label="姓名"
  79. width="100">
  80. </el-table-column>
  81. <el-table-column
  82. prop="beginTime"
  83. label="开始日期"
  84. width="180">
  85. </el-table-column>
  86. <el-table-column
  87. prop="overTime"
  88. label="完成日期"
  89. width="180">
  90. </el-table-column>
  91. <el-table-column
  92. label="状态"
  93. width="80">
  94. <template slot-scope="scopeStatus">
  95. <span v-if="scopeStatus.row.taskStatus==-1">
  96. 未开始
  97. </span>
  98. <span v-if="scopeStatus.row.taskStatus==0">
  99. 已知晓
  100. </span>
  101. <span v-if="scopeStatus.row.taskStatus==1">
  102. 进行中
  103. </span>
  104. <span v-if="scopeStatus.row.taskStatus==2">
  105. 待审核
  106. </span>
  107. <span v-if="scopeStatus.row.taskStatus==3">
  108. 未完成
  109. </span>
  110. <span v-if="scopeStatus.row.taskStatus==4">
  111. 已完成
  112. </span>
  113. <span v-if="scopeStatus.row.taskStatus==5">
  114. 任务中止
  115. </span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column
  119. prop="score"
  120. label="评分"
  121. width="180">
  122. <template slot-scope="scopescore">
  123. <span v-if="scopescore.row.score==0">
  124. 未评分
  125. </span>
  126. <span v-if="scopescore.row.score==1">
  127. 不合格
  128. </span>
  129. <span v-if="scopescore.row.score==2">
  130. 一般
  131. </span>
  132. <span v-if="scopescore.row.score==3">
  133. 良好
  134. </span>
  135. <span v-if="scopescore.row.score==4">
  136. 优秀
  137. </span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. prop="scoreRemark"
  142. label="评分备注"
  143. width="250">
  144. </el-table-column>
  145. <el-table-column
  146. prop="cause"
  147. label="备注">
  148. </el-table-column>
  149. <el-table-column
  150. label="操作"
  151. width="180">
  152. <template slot-scope="scopes">
  153. <el-select v-if="scopes.row.taskStatus==2" size="small" @change="statuschange($event,scopes.row)" style="width:100px;margin-right: 15px;" v-model="reviewstatus" placeholder="请选择">
  154. <el-option label="未审核" value="shanghai"></el-option>
  155. <el-option label="已完成" value="4"></el-option>
  156. <el-option label="终止" value="beijing"></el-option>
  157. <el-option label="未完成" value="3"></el-option>
  158. </el-select>
  159. <el-button
  160. v-if="scopes.row.taskStatus==4"
  161. type="text"
  162. size="small"
  163. @click="scoreclick(scopes.$index,scopes.row)">
  164. 评分
  165. </el-button>
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. </div>
  170. </template>
  171. </el-table-column> -->
  172. <el-table-column prop="taskName" label="任务名称">
  173. </el-table-column>
  174. <el-table-column prop="taskPriority" label="优先级" width="70">
  175. </el-table-column>
  176. <el-table-column prop="participant" label="指派给" width="200">
  177. </el-table-column>
  178. <el-table-column prop="status" label="状态" width="80">
  179. <template slot-scope="scopes">
  180. <!-- <div v-if="scopes.row.createUserName==cnName"> -->
  181. <div>
  182. <span v-if="scopes.row.status==0">
  183. 未开始
  184. </span>
  185. <span v-if="scopes.row.status==1">
  186. 进行中
  187. </span>
  188. <span v-if="scopes.row.status==2">
  189. 待审核
  190. </span>
  191. <span v-if="scopes.row.status==3">
  192. 未完成
  193. </span>
  194. <span v-if="scopes.row.status==4">
  195. 已完成
  196. </span>
  197. </div>
  198. <!-- <div v-else-if="scopes.row.createUserName!=cnName">
  199. <span v-if="scopes.row.status==-1">
  200. 未开始
  201. </span>
  202. <span v-if="scopes.row.status==0">
  203. 已知晓
  204. </span>
  205. <span v-if="scopes.row.status==1">
  206. 进行中
  207. </span>
  208. <span v-if="scopes.row.status==2">
  209. 待审核
  210. </span>
  211. <span v-if="scopes.row.status==3">
  212. 未完成
  213. </span>
  214. <span v-if="scopes.row.status==4">
  215. 已完成
  216. </span>
  217. <span v-if="scopes.row.status==5">
  218. 任务中止
  219. </span>
  220. </div> -->
  221. </template>
  222. <!-- <template v-if="status" slot-scope="scope">
  223. {{ scope.row.status==0? scope.row.status==1?:'全部' }}
  224. </template> -->
  225. </el-table-column>
  226. <!-- <el-table-column
  227. prop="consummator"
  228. label="完成者"
  229. width="100">
  230. </el-table-column> -->
  231. <el-table-column prop="depName" label="归属部门" width="100">
  232. </el-table-column>
  233. <el-table-column prop="taskTypeName" label="类型" width="100">
  234. </el-table-column>
  235. <el-table-column prop="date" label="预计起止时间" width="170">
  236. <template slot-scope="scopeTime">
  237. <div class="scopeTimeDQ">
  238. <div>
  239. {{ scopeTime.row.predictBeginTime }}
  240. </div>
  241. <div>
  242. {{ scopeTime.row.predictEndTime }}
  243. </div>
  244. </div>
  245. </template>
  246. </el-table-column>
  247. <el-table-column prop="overTime" label="实际完成时间" width="170">
  248. </el-table-column>
  249. <el-table-column prop="createUserName" label="创建者" width="100">
  250. </el-table-column>
  251. <el-table-column prop="createTime" label="创建时间" width="180">
  252. </el-table-column>
  253. <el-table-column label="操作" width="210">
  254. <template slot-scope="scopebtn">
  255. <!-- //任务创建者
  256. 确认任务完成 编辑 删除
  257. //任务归属者
  258. 开始 完成 -->
  259. <el-button v-if="scopebtn.row.taskHavePerm" type="text" size="small"
  260. @click.native.prevent="PostTaskAllocationSetHaveStatus(scopebtn.$index, scopebtn.row)">
  261. 已知晓
  262. </el-button>
  263. <el-button v-if="scopebtn.row.taskDetailsPerm" @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)" type="text"
  264. size="small">
  265. 详细
  266. </el-button>
  267. <el-button v-if="scopebtn.row.editPerm"
  268. @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)" type="text"
  269. size="small">
  270. 编辑
  271. </el-button>
  272. <el-button v-if="scopebtn.row.taskCompletedPerm" type="text" size="small"
  273. @click.native.prevent="openDialog(scopebtn.row)">
  274. 完成
  275. </el-button>
  276. <!-- <el-button
  277. v-if="cnName!=scopebtn.row.createUserName"
  278. type="text"
  279. size="small"
  280. @click.native.prevent="PostTaskAllocationSetHaveStatus(scopebtn.$index, scopebtn.row)">
  281. 已知晓
  282. </el-button>
  283. <el-button
  284. v-if="cnName!=scopebtn.row.createUserName"
  285. type="text"
  286. size="small"
  287. @click.native.prevent="PostTaskAllocationSetOverStatus(scopebtn.$index, scopebtn.row)">
  288. 完成
  289. </el-button>
  290. <el-button
  291. v-if="cnName==scopebtn.row.createUserName"
  292. @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)"
  293. type="text"
  294. size="small">
  295. 编辑
  296. </el-button>
  297. <el-button
  298. v-if="cnName!=scopebtn.row.createUserName"
  299. @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)"
  300. type="text"
  301. size="small">
  302. 详细
  303. </el-button>
  304. <el-button
  305. v-if="cnName==scopebtn.row.createUserName"
  306. @click.native.prevent="PostTaskAllocationTermination(scopebtn.$index, scopebtn.row)"
  307. type="text"
  308. size="small">
  309. 任务终止
  310. </el-button> -->
  311. <el-button
  312. v-if="scopebtn.row.editPerm"
  313. @click.native.prevent="deleteRow(scopebtn.$index,scopebtn.row,tableData)"
  314. type="text"
  315. size="small">
  316. 移除
  317. </el-button>
  318. </template>
  319. </el-table-column>
  320. </el-table>
  321. <div class="block">
  322. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  323. :current-page="currentPage" :page-sizes="[1,5, 10, 15, 20]" :page-size="pagesize"
  324. layout="total, sizes, prev, pager, next, jumper" :total="count">
  325. </el-pagination>
  326. </div>
  327. </div>
  328. <el-dialog top="30vh" width="900px" title="等级评分" :visible.sync="dialogFormVisible"
  329. :close-on-click-modal="false">
  330. <el-form>
  331. <div class="score-box">
  332. <el-form-item label="姓名" :label-width="labelWidth">
  333. <el-input :disabled="true" v-model="scorename" placeholder="姓名"></el-input>
  334. </el-form-item>
  335. <el-form-item label="评分" :label-width="labelWidth">
  336. <el-radio-group v-model="score">
  337. <el-radio label="不合格"></el-radio>
  338. <el-radio label="一般"></el-radio>
  339. <el-radio label="良好"></el-radio>
  340. <el-radio label="优秀"></el-radio>
  341. </el-radio-group>
  342. </el-form-item>
  343. <el-form-item size="medium" label="评分备注" :label-width="labelWidth">
  344. <el-input rows="1" type="textarea" v-model="scoreRemark"></el-input>
  345. </el-form-item>
  346. </div>
  347. </el-form>
  348. <div slot="footer" class="dialog-footer">
  349. <el-button @click="dialogFormVisible = false">取 消</el-button>
  350. <el-button type="primary" @click="scoreconfirm()">确 定</el-button>
  351. </div>
  352. </el-dialog>
  353. </div>
  354. </div>
  355. </template>
  356. <script>
  357. export default {
  358. beforeRouteLeave(to, from, next) {
  359. if(to.name!='MyTasksinif'||to.name!='AssignTasks'){
  360. from.meta.keepAlive = false;
  361. }
  362. if(to.name!='MyTasksinif'&&to.name!='AssignTasks'){
  363. localStorage.removeItem('cacheobg');
  364. }
  365. next()
  366. },
  367. beforeRouteEnter(to, from, next) {
  368. next();
  369. },
  370. data () {
  371. return {
  372. cacheobgLoading:false,
  373. token:'',
  374. pageId:'',
  375. userId:'',
  376. jobName:'',
  377. tasknames:"",
  378. tasknamelist:[],
  379. completionstatus:-1,
  380. completionstatuslist:[
  381. {
  382. id:-1,
  383. name:'全部'
  384. },
  385. {
  386. id:0,
  387. name:'未开始'
  388. },
  389. {
  390. id:1,
  391. name:'进行中'
  392. },
  393. {
  394. id:2,
  395. name:'待审核'
  396. },
  397. {
  398. id:3,
  399. name:'未完成'
  400. },
  401. {
  402. id:4,
  403. name:'已完成'
  404. },
  405. ],
  406. assignmenttype:0,
  407. assignmenttypelist:[
  408. {
  409. id:0,
  410. name:'全部'
  411. },
  412. {
  413. id:1,
  414. name:'由我指派'
  415. },
  416. {
  417. id:2,
  418. name:'指派给我'
  419. },
  420. ],
  421. tableData: [],
  422. value: '',
  423. pagesize:10,
  424. currentPage: 1,
  425. count:0,
  426. dialogFormVisible:false,
  427. labelWidth:'80px',
  428. scorename:'',
  429. score:'',
  430. scoreid:'',
  431. ID:'',
  432. scoreRemark:'',
  433. cnName:'',//登录用户名
  434. reviewstatus:'',
  435. formLabelWidth: '80px',
  436. dialogTasklist: false,
  437. shuju:{
  438. id:'',
  439. remark:'',
  440. overTime:'',
  441. },
  442. taskUserId:-1,
  443. taskUserIdArr:[],
  444. isAddPerm:false,
  445. }
  446. },
  447. methods: {
  448. //获取列表
  449. PostTaskAllocationPage(){
  450. if(this.jobName.indexOf('经理')!=-1||this.jobName.indexOf('主管')!=-1){
  451. this.assignmenttype=0;
  452. }else{
  453. this.assignmenttype=2;
  454. }
  455. var cacheobg=JSON.parse(localStorage.getItem('cacheobg'))
  456. if (cacheobg!=null) {
  457. this.completionstatus=cacheobg.status;
  458. this.tasknames=cacheobg.taskName;
  459. this.taskUserId=cacheobg.taskUserId;
  460. }
  461. var url = "/api/PersonnelModule/PostTaskAllocationPage"
  462. var that = this
  463. this.$axios({
  464. method: 'post',
  465. url: url,
  466. headers: {
  467. Authorization: 'Bearer ' + that.userId
  468. },
  469. data:{
  470. portType:1,
  471. userId: that.userId,
  472. pageId: that.pageId,
  473. pageIndex: that.currentPage,
  474. pageSize: that.pagesize,
  475. type: that.assignmenttype,
  476. status: that.completionstatus,
  477. taskName: that.tasknames,
  478. taskUserId: that.taskUserId,
  479. }
  480. }).then(function (res) {
  481. if(res.data.code==200){
  482. that.count=res.data.count;
  483. that.tableData=res.data.data;
  484. that.cacheobgLoading=false;
  485. }else{
  486. that.cacheobgLoading=false;
  487. }
  488. }).catch(function (error) {
  489. that.cacheobgLoading=false;
  490. that.$message.error("获取数据源失败!");
  491. });
  492. },
  493. deleteRow(index,row,rows) {
  494. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  495. confirmButtonText: '确定',
  496. cancelButtonText: '取消',
  497. type: 'warning'
  498. }).then(() => {
  499. var url = "/api/PersonnelModule/PostTaskAllocationDel"
  500. var that = this
  501. this.$axios({
  502. method: 'post',
  503. url: url,
  504. headers: {
  505. Authorization: 'Bearer ' + that.userId
  506. },
  507. data:{
  508. portType: 1,
  509. userId: that.userId,
  510. pageId: that.pageId,
  511. id: row.id,
  512. }
  513. }).then(function (res) {
  514. console.log(res)
  515. if(res.data.code==200){
  516. that.$message({
  517. message: res.data.msg,
  518. type: 'success'
  519. });
  520. rows.splice(index, 1);
  521. }else{
  522. that.$message.error(res.data.msg);
  523. }
  524. }).catch(function (error) {
  525. that.$message.error("任务终止失败!");
  526. });
  527. }).catch(() => {
  528. this.$message({
  529. type: 'info',
  530. message: '已取消删除'
  531. });
  532. });
  533. },
  534. //每页条数改变时触发 选择一页显示多少行
  535. handleSizeChange(val) {
  536. this.currentPage = 1;
  537. this.pagesize = val;
  538. this.PostTaskAllocationPage()
  539. },
  540. //当前页改变时触发 跳转其他页
  541. handleCurrentChange(val) {
  542. this.currentPage = val;
  543. this.PostTaskAllocationPage()
  544. },
  545. //xinzhen
  546. handleView() {
  547. this.$router.push({path: '/home/AssignTasks'});
  548. // this.$router.push({path: '/home/Reportstbale?id=' + row.id +''});
  549. },
  550. changetasknames(){
  551. this.currentPage = 1;
  552. var cacheobg={}
  553. cacheobg.status=this.completionstatus;
  554. cacheobg.taskName=this.tasknames;
  555. cacheobg.taskUserId=this.taskUserId;
  556. localStorage.setItem('cacheobg', JSON.stringify(cacheobg));
  557. this.PostTaskAllocationPage()
  558. },
  559. // changecompletionstatus(){
  560. // this.currentPage = 1;
  561. // this.PostTaskAllocationPage()
  562. // },
  563. // changeassignmenttype(){
  564. // this.currentPage = 1;
  565. // this.PostTaskAllocationPage()
  566. // },
  567. //编辑
  568. taskedit(index,val){
  569. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  570. // this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
  571. if (val.editPerm) {
  572. this.$router.push({ path: '/home/AssignTasks?id=' + val.id + '' });
  573. } else {
  574. if (val.participant.indexOf(this.cnName) != -1) {
  575. this.$router.push({ path: '/home/MyTasksinif?id=' + val.id + '' });
  576. } else {
  577. this.$message.error("此任务被指派人没有此账号!");
  578. }
  579. }
  580. // if(val.createUserName==this.cnName){
  581. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  582. // }else{
  583. // if(val.editPerm){
  584. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  585. // }else{
  586. // if(val.participant.indexOf(this.cnName)!=-1){
  587. // this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
  588. // }else{
  589. // this.$message.error("此任务被指派人没有此账号!");
  590. // }
  591. // }
  592. // }
  593. },
  594. //基础数据原
  595. PostTaskAllocationInit(){
  596. this.cacheobgLoading=true;
  597. var url = "/api/PersonnelModule/PostTaskAllocationInit"
  598. var that = this
  599. this.$axios({
  600. method: 'post',
  601. url: url,
  602. headers: {
  603. Authorization: 'Bearer ' + that.userId
  604. },
  605. data:{
  606. portType:1,
  607. userId: that.userId
  608. }
  609. }).then(function (res) {
  610. if(res.data.code==200){
  611. that.tasknamelist=res.data.data.taskNameInfos;
  612. that.taskUserIdArr=res.data.data.executeTaskUserInfos;
  613. that.isAddPerm=res.data.data.operationPerm.isAddPerm;
  614. that.taskUserIdArr.unshift({id:-1,name:'全部'});
  615. that.PostTaskAllocationPage();
  616. that.cacheobgLoading=false;
  617. }else{
  618. that.cacheobgLoading=false;
  619. that.$message.error(res.data.msg);
  620. }
  621. }).catch(function (error) {
  622. that.cacheobgLoading=false;
  623. that.$message.error("获取数据源失败!");
  624. });
  625. },
  626. //开始
  627. PostTaskAllocationSetHaveStatus(index,row){
  628. // if(row.status>=1){
  629. // this.$message.error('此任务已经开始!');
  630. // return false
  631. // }else{
  632. var url = "/api/PersonnelModule/PostTaskAllocationSetHaveStatus"
  633. var that = this
  634. this.$axios({
  635. method: 'post',
  636. url: url,
  637. headers: {
  638. Authorization: 'Bearer ' + that.userId
  639. },
  640. data:{
  641. userId: that.userId,
  642. id: row.id,
  643. }
  644. }).then(function (res) {
  645. console.log(res)
  646. if(res.data.code==200){
  647. that.$message({
  648. message: res.data.msg,
  649. type: 'success'
  650. });
  651. that.PostTaskAllocationPage();
  652. }else{
  653. that.$message.error(res.data.msg);
  654. }
  655. }).catch(function (error) {
  656. that.$message.error("操作失败(开始步骤)");
  657. });
  658. // }
  659. },
  660. //处理日期
  661. datetime(val){
  662. var date=new Date(val);
  663. var y=date.getFullYear();
  664. var m=date.getMonth()+1>=10?date.getMonth()+1:'0'+(date.getMonth()+1).toString();
  665. var d=date.getDate()>=10?date.getDate():'0'+(date.getDate()).toString();
  666. var s=date.getHours()>=10?date.getHours():'0'+(date.getHours()).toString();
  667. var f=date.getMinutes()>=10?date.getMinutes():'0'+(date.getMinutes()).toString();
  668. var mm=date.getSeconds()>=10?date.getSeconds():'0'+(date.getSeconds()).toString();
  669. return y+'-'+m+'-'+d+" "+s+':'+f+':'+mm
  670. },
  671. //完成
  672. PostTaskAllocationSetOverStatus(index,row){
  673. if(row.status==2||row.status==0||row.status==4){
  674. this.$message.error('此任务未开始或待审核,请勿多次提交!');
  675. return false
  676. }else{
  677. var url = "/api/PersonnelModule/PostTaskAllocationSetOverStatus"
  678. var that = this
  679. this.$axios({
  680. method: 'post',
  681. url: url,
  682. headers: {
  683. Authorization: 'Bearer ' + that.userId
  684. },
  685. data:{
  686. userId: that.userId,
  687. id: row.id,
  688. }
  689. }).then(function (res) {
  690. console.log(res)
  691. if(res.data.code==200){
  692. that.$message({
  693. message: res.data.msg,
  694. type: 'success'
  695. });
  696. that.PostTaskAllocationPage();
  697. }else{
  698. that.$message.error(res.data.msg);
  699. }
  700. }).catch(function (error) {
  701. that.$message.error("操作失败(完成步骤)");
  702. });
  703. }
  704. },
  705. //评分
  706. scoreclick(index,row){
  707. console.log(index,row)
  708. this.dialogFormVisible=true;
  709. this.scorename=row.userName;
  710. this.scoreid=row.taId;
  711. this.scoreRemark=row.scoreRemark;
  712. this.ID=row.id;
  713. if(row.score==0){
  714. this.score='良好';
  715. }else{
  716. this.score=row.score==4?'优秀':row.score==3?'良好':row.score==2?'一般':'不合格';
  717. }
  718. },
  719. //评分确认
  720. scoreconfirm(){
  721. var score=3
  722. if(this.score=='不合格'){
  723. score=1
  724. }else if(this.score=='一般'){
  725. score=2
  726. }else if(this.score=='良好'){
  727. score=3
  728. }else{
  729. score=4
  730. }
  731. var url = "/api/PersonnelModule/PostTaskAllocationScore"
  732. var that = this
  733. this.$axios({
  734. method: 'post',
  735. url: url,
  736. headers: {
  737. Authorization: 'Bearer ' + that.userId
  738. },
  739. data:{
  740. portType: 1,
  741. userId: that.userId,
  742. pageId: that.pageId,
  743. subId: that.ID,
  744. score: score,
  745. scoreRemark: that.scoreRemark,
  746. }
  747. }).then(function (res) {
  748. console.log(res)
  749. if(res.data.code==200){
  750. that.dialogFormVisible=false;
  751. that.$message({
  752. message: res.data.msg,
  753. type: 'success'
  754. });
  755. that.PostTaskAllocationPage();
  756. }else{
  757. that.$message.error(res.data.msg);
  758. }
  759. }).catch(function (error) {
  760. that.$message.error("获取数据源失败!");
  761. });
  762. },
  763. //change
  764. statuschange(val,row){
  765. console.log(val,row)
  766. if(val==4){
  767. this.PostTaskAllocationSetAuditStatus(row.id);
  768. }else if(val==3){
  769. this.open(row.id);
  770. }
  771. },
  772. //打开情况传递数据
  773. openDialog(row){
  774. this.dialogTasklist = true;
  775. this.shuju.id = row.id;
  776. this.shuju.remark = row.remark;
  777. this.shuju.overTime = row.overTime;
  778. },
  779. //审核
  780. PostTaskAllocationSetAuditStatus(){
  781. var url = "/api/PersonnelModule/PostTaskAllocationSetAuditStatus"
  782. var that = this
  783. this.$axios({
  784. method: 'post',
  785. url: url,
  786. headers: {
  787. Authorization: 'Bearer ' + that.userId
  788. },
  789. data:{
  790. userId:that.userId,
  791. id:that.shuju.id,
  792. overTime:that.datetime(that.shuju.overTime),
  793. remark:that.shuju.remark,
  794. }
  795. }).then(function (res) {
  796. console.log(res)
  797. if(res.data.code==200){
  798. that.$message({
  799. message: res.data.msg,
  800. type: 'success'
  801. });
  802. that.dialogTasklist = false;
  803. that.PostTaskAllocationPage();
  804. }else{
  805. that.$message.error(res.data.msg);
  806. }
  807. }).catch(function (error) {
  808. that.$message.error("审核失败!");
  809. });
  810. },
  811. open(id) {
  812. this.$prompt('请输入未完成原因', '提示', {
  813. confirmButtonText: '确定',
  814. cancelButtonText: '取消',
  815. inputPattern: /^.+$/,
  816. inputErrorMessage: '原因不能为空'
  817. }).then(({ value }) => {
  818. this.PostTaskAllocationSetUnFinishedStatus(id,value)
  819. // this.$message({
  820. // type: 'success',
  821. // message: '你的邮箱是: ' + value
  822. // });
  823. }).catch(() => {
  824. this.reviewstatus='';
  825. // this.$message({
  826. // type: 'info',
  827. // message: '取消输入'
  828. // });
  829. });
  830. },
  831. //未完成
  832. PostTaskAllocationSetUnFinishedStatus(id,val){
  833. var url = "/api/PersonnelModule/PostTaskAllocationSetUnFinishedStatus"
  834. var that = this
  835. this.$axios({
  836. method: 'post',
  837. url: url,
  838. headers: {
  839. Authorization: 'Bearer ' + that.userId
  840. },
  841. data:{
  842. subId:id,
  843. cause:val,
  844. }
  845. }).then(function (res) {
  846. console.log(res)
  847. if(res.data.code==200){
  848. that.$message({
  849. message: res.data.msg,
  850. type: 'success'
  851. });
  852. that.PostTaskAllocationPage();
  853. }else{
  854. that.$message.error(res.data.msg);
  855. }
  856. }).catch(function (error) {
  857. that.$message.error("审核失败!");
  858. });
  859. },
  860. //任务终止
  861. PostTaskAllocationTermination(index,row){
  862. var url = "/api/PersonnelModule/PostTaskAllocationTermination"
  863. var that = this
  864. this.$axios({
  865. method: 'post',
  866. url: url,
  867. headers: {
  868. Authorization: 'Bearer ' + that.userId
  869. },
  870. data:{
  871. portType: 1,
  872. userId: that.userId,
  873. pageId: that.pageId,
  874. id: row.id,
  875. }
  876. }).then(function (res) {
  877. console.log(res)
  878. if(res.data.code==200){
  879. that.$message({
  880. message: res.data.msg,
  881. type: 'success'
  882. });
  883. that.PostTaskAllocationPage();
  884. }else{
  885. that.$message.error(res.data.msg);
  886. }
  887. }).catch(function (error) {
  888. that.$message.error("任务终止失败!");
  889. });
  890. },
  891. },
  892. filters:{
  893. filter_city(value){
  894. if(value){
  895. return value.replaceAll('|','、')
  896. }
  897. },
  898. filter_time(value){
  899. if(value){
  900. return value.split(" ")[0]
  901. }
  902. }
  903. },
  904. mounted(){
  905. this.token=JSON.parse(localStorage.getItem('userinif')).token;
  906. this.pageId=Number(localStorage.getItem('indexs').split('-')[1]);//页面id
  907. this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  908. this.jobName=JSON.parse(localStorage.getItem('userinif')).userInfo.jobName;
  909. this.cnName=JSON.parse(localStorage.getItem('userinif')).userInfo.cnName;
  910. this.PostTaskAllocationInit()
  911. }
  912. }
  913. </script>
  914. <style>
  915. .tasklist-all{
  916. background-color: #fff;
  917. padding: 10px;
  918. box-shadow: 0 0 5px #0005;
  919. border-radius: 10px;
  920. min-height: 830px;
  921. }
  922. .tasklist-title{
  923. font-size: 17px;
  924. font-weight: 600;
  925. margin-bottom: 5px;
  926. }
  927. .tasklist-head-select{
  928. display: flex;
  929. }
  930. .tasklist-head-select .el-form-item{
  931. margin-bottom: 15px;
  932. margin-right: 15px;
  933. }
  934. .tasklist-head-select .el-select{
  935. width: 200px;
  936. }
  937. .tasklist-table .block{
  938. text-align: center;
  939. margin-top: 15px;
  940. }
  941. .scopeTimeDQ{
  942. display: flex;
  943. flex-direction: column;
  944. font-family: Monaco;
  945. align-items: center;
  946. }
  947. .score-box{
  948. display: flex;
  949. flex-wrap: wrap;
  950. }
  951. .score-box .el-form-item_content{
  952. width: 100%;
  953. }
  954. .score-box .el-form-item:nth-child(1){
  955. width: 50%;
  956. }
  957. .score-box .el-form-item:nth-child(2){
  958. width: 50%;
  959. }
  960. .score-box .el-form-item:nth-child(3){
  961. width: 100%;
  962. }
  963. .tasklist-table .demo-table-expand {
  964. font-size: 0;
  965. }
  966. .tasklist-table .demo-table-expand label {
  967. width: 90px;
  968. color: #99a9bf;
  969. }
  970. .tasklist-table .demo-table-expand .el-form-item {
  971. margin-right: 0;
  972. margin-bottom: 0;
  973. width: 50%;
  974. }
  975. .table-boxli{
  976. text-align: center;
  977. padding: 0 20px;
  978. }
  979. .table-boxli .el-table--border, .el-table--group{
  980. border: 1px solid #b5bfd7;
  981. }
  982. .table-boxli .el-table--border .el-table__cell{
  983. border: 1px solid #b5bfd7;
  984. padding: 12px 0;
  985. min-width: 0;
  986. -webkit-box-sizing: border-box;
  987. box-sizing: border-box;
  988. text-overflow: ellipsis;
  989. vertical-align: middle;
  990. position: relative;
  991. text-align: left;
  992. }
  993. </style>