TaskList.vue 41 KB

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