TaskList.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  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="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. token:'',
  373. pageId:'',
  374. userId:'',
  375. jobName:'',
  376. tasknames:"",
  377. tasknamelist:[],
  378. completionstatus:-1,
  379. completionstatuslist:[
  380. {
  381. id:-1,
  382. name:'全部'
  383. },
  384. {
  385. id:0,
  386. name:'未开始'
  387. },
  388. {
  389. id:1,
  390. name:'进行中'
  391. },
  392. {
  393. id:2,
  394. name:'待审核'
  395. },
  396. {
  397. id:3,
  398. name:'未完成'
  399. },
  400. {
  401. id:4,
  402. name:'已完成'
  403. },
  404. ],
  405. assignmenttype:0,
  406. assignmenttypelist:[
  407. {
  408. id:0,
  409. name:'全部'
  410. },
  411. {
  412. id:1,
  413. name:'由我指派'
  414. },
  415. {
  416. id:2,
  417. name:'指派给我'
  418. },
  419. ],
  420. tableData: [],
  421. value: '',
  422. pagesize:10,
  423. currentPage: 1,
  424. count:0,
  425. dialogFormVisible:false,
  426. labelWidth:'80px',
  427. scorename:'',
  428. score:'',
  429. scoreid:'',
  430. ID:'',
  431. scoreRemark:'',
  432. cnName:'',//登录用户名
  433. reviewstatus:'',
  434. formLabelWidth: '80px',
  435. dialogTasklist: false,
  436. shuju:{
  437. id:'',
  438. remark:'',
  439. overTime:'',
  440. },
  441. taskUserId:-1,
  442. taskUserIdArr:[],
  443. isAddPerm:false,
  444. }
  445. },
  446. methods: {
  447. //基础数据原
  448. PostTaskAllocationInit(){
  449. var url = "/api/PersonnelModule/PostTaskAllocationInit"
  450. var that = this
  451. this.$axios({
  452. method: 'post',
  453. url: url,
  454. headers: {
  455. Authorization: 'Bearer ' + that.userId
  456. },
  457. data:{
  458. portType:1,
  459. userId: that.userId
  460. }
  461. }).then(function (res) {
  462. if(res.data.code==200){
  463. that.tasknamelist=res.data.data.taskNameInfos;
  464. that.PostTaskAllocationPage()
  465. }else{
  466. that.$message.error(res.data.msg);
  467. }
  468. }).catch(function (error) {
  469. that.$message.error("获取数据源失败!");
  470. });
  471. },
  472. //获取列表
  473. PostTaskAllocationPage(){
  474. if(this.jobName.indexOf('经理')!=-1||this.jobName.indexOf('主管')!=-1){
  475. this.assignmenttype=0;
  476. }else{
  477. this.assignmenttype=2;
  478. }
  479. var cacheobg=JSON.parse(localStorage.getItem('cacheobg'))
  480. if (cacheobg!=null) {
  481. this.completionstatus=cacheobg.status;
  482. this.tasknames=cacheobg.taskName;
  483. this.taskUserId=cacheobg.taskUserId;
  484. }
  485. var url = "/api/PersonnelModule/PostTaskAllocationPage"
  486. var that = this
  487. this.$axios({
  488. method: 'post',
  489. url: url,
  490. headers: {
  491. Authorization: 'Bearer ' + that.userId
  492. },
  493. data:{
  494. portType:1,
  495. userId: that.userId,
  496. pageId: that.pageId,
  497. pageIndex: that.currentPage,
  498. pageSize: that.pagesize,
  499. type: that.assignmenttype,
  500. status: that.completionstatus,
  501. taskName: that.tasknames,
  502. taskUserId: that.taskUserId,
  503. }
  504. }).then(function (res) {
  505. console.log(res)
  506. if(res.data.code==200){
  507. that.count=res.data.count;
  508. that.tableData=res.data.data;
  509. }else{
  510. }
  511. }).catch(function (error) {
  512. that.$message.error("获取数据源失败!");
  513. });
  514. },
  515. deleteRow(index,row,rows) {
  516. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  517. confirmButtonText: '确定',
  518. cancelButtonText: '取消',
  519. type: 'warning'
  520. }).then(() => {
  521. var url = "/api/PersonnelModule/PostTaskAllocationDel"
  522. var that = this
  523. this.$axios({
  524. method: 'post',
  525. url: url,
  526. headers: {
  527. Authorization: 'Bearer ' + that.userId
  528. },
  529. data:{
  530. portType: 1,
  531. userId: that.userId,
  532. pageId: that.pageId,
  533. id: row.id,
  534. }
  535. }).then(function (res) {
  536. console.log(res)
  537. if(res.data.code==200){
  538. that.$message({
  539. message: res.data.msg,
  540. type: 'success'
  541. });
  542. rows.splice(index, 1);
  543. }else{
  544. that.$message.error(res.data.msg);
  545. }
  546. }).catch(function (error) {
  547. that.$message.error("任务终止失败!");
  548. });
  549. }).catch(() => {
  550. this.$message({
  551. type: 'info',
  552. message: '已取消删除'
  553. });
  554. });
  555. },
  556. //每页条数改变时触发 选择一页显示多少行
  557. handleSizeChange(val) {
  558. this.currentPage = 1;
  559. this.pagesize = val;
  560. this.PostTaskAllocationPage()
  561. },
  562. //当前页改变时触发 跳转其他页
  563. handleCurrentChange(val) {
  564. this.currentPage = val;
  565. this.PostTaskAllocationPage()
  566. },
  567. //xinzhen
  568. handleView() {
  569. this.$router.push({path: '/home/AssignTasks'});
  570. // this.$router.push({path: '/home/Reportstbale?id=' + row.id +''});
  571. },
  572. changetasknames(){
  573. this.currentPage = 1;
  574. var cacheobg={}
  575. cacheobg.status=this.completionstatus;
  576. cacheobg.taskName=this.tasknames;
  577. cacheobg.taskUserId=this.taskUserId;
  578. localStorage.setItem('cacheobg', JSON.stringify(cacheobg));
  579. this.PostTaskAllocationPage()
  580. },
  581. // changecompletionstatus(){
  582. // this.currentPage = 1;
  583. // this.PostTaskAllocationPage()
  584. // },
  585. // changeassignmenttype(){
  586. // this.currentPage = 1;
  587. // this.PostTaskAllocationPage()
  588. // },
  589. //编辑
  590. taskedit(index,val){
  591. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  592. // this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
  593. if (val.editPerm) {
  594. this.$router.push({ path: '/home/AssignTasks?id=' + val.id + '' });
  595. } else {
  596. if (val.participant.indexOf(this.cnName) != -1) {
  597. this.$router.push({ path: '/home/MyTasksinif?id=' + val.id + '' });
  598. } else {
  599. this.$message.error("此任务被指派人没有此账号!");
  600. }
  601. }
  602. // if(val.createUserName==this.cnName){
  603. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  604. // }else{
  605. // if(val.editPerm){
  606. // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
  607. // }else{
  608. // if(val.participant.indexOf(this.cnName)!=-1){
  609. // this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
  610. // }else{
  611. // this.$message.error("此任务被指派人没有此账号!");
  612. // }
  613. // }
  614. // }
  615. },
  616. //基础数据原
  617. PostTaskAllocationInit(){
  618. var url = "/api/PersonnelModule/PostTaskAllocationInit"
  619. var that = this
  620. this.$axios({
  621. method: 'post',
  622. url: url,
  623. headers: {
  624. Authorization: 'Bearer ' + that.userId
  625. },
  626. data:{
  627. portType:1,
  628. userId: that.userId
  629. }
  630. }).then(function (res) {
  631. console.log(res)
  632. if(res.data.code==200){
  633. that.tasknamelist=res.data.data.taskNameInfos;
  634. that.taskUserIdArr=res.data.data.executeTaskUserInfos;
  635. that.isAddPerm=res.data.data.operationPerm.isAddPerm;
  636. that.taskUserIdArr.unshift({id:-1,name:'全部'});
  637. that.PostTaskAllocationPage();
  638. }else{
  639. that.$message.error(res.data.msg);
  640. }
  641. }).catch(function (error) {
  642. that.$message.error("获取数据源失败!");
  643. });
  644. },
  645. //开始
  646. PostTaskAllocationSetHaveStatus(index,row){
  647. // if(row.status>=1){
  648. // this.$message.error('此任务已经开始!');
  649. // return false
  650. // }else{
  651. var url = "/api/PersonnelModule/PostTaskAllocationSetHaveStatus"
  652. var that = this
  653. this.$axios({
  654. method: 'post',
  655. url: url,
  656. headers: {
  657. Authorization: 'Bearer ' + that.userId
  658. },
  659. data:{
  660. userId: that.userId,
  661. id: row.id,
  662. }
  663. }).then(function (res) {
  664. console.log(res)
  665. if(res.data.code==200){
  666. that.$message({
  667. message: res.data.msg,
  668. type: 'success'
  669. });
  670. that.PostTaskAllocationPage();
  671. }else{
  672. that.$message.error(res.data.msg);
  673. }
  674. }).catch(function (error) {
  675. that.$message.error("操作失败(开始步骤)");
  676. });
  677. // }
  678. },
  679. //处理日期
  680. datetime(val){
  681. var date=new Date(val);
  682. var y=date.getFullYear();
  683. var m=date.getMonth()+1>=10?date.getMonth()+1:'0'+(date.getMonth()+1).toString();
  684. var d=date.getDate()>=10?date.getDate():'0'+(date.getDate()).toString();
  685. var s=date.getHours()>=10?date.getHours():'0'+(date.getHours()).toString();
  686. var f=date.getMinutes()>=10?date.getMinutes():'0'+(date.getMinutes()).toString();
  687. var mm=date.getSeconds()>=10?date.getSeconds():'0'+(date.getSeconds()).toString();
  688. return y+'-'+m+'-'+d+" "+s+':'+f+':'+mm
  689. },
  690. //完成
  691. PostTaskAllocationSetOverStatus(index,row){
  692. if(row.status==2||row.status==0||row.status==4){
  693. this.$message.error('此任务未开始或待审核,请勿多次提交!');
  694. return false
  695. }else{
  696. var url = "/api/PersonnelModule/PostTaskAllocationSetOverStatus"
  697. var that = this
  698. this.$axios({
  699. method: 'post',
  700. url: url,
  701. headers: {
  702. Authorization: 'Bearer ' + that.userId
  703. },
  704. data:{
  705. userId: that.userId,
  706. id: row.id,
  707. }
  708. }).then(function (res) {
  709. console.log(res)
  710. if(res.data.code==200){
  711. that.$message({
  712. message: res.data.msg,
  713. type: 'success'
  714. });
  715. that.PostTaskAllocationPage();
  716. }else{
  717. that.$message.error(res.data.msg);
  718. }
  719. }).catch(function (error) {
  720. that.$message.error("操作失败(完成步骤)");
  721. });
  722. }
  723. },
  724. //评分
  725. scoreclick(index,row){
  726. console.log(index,row)
  727. this.dialogFormVisible=true;
  728. this.scorename=row.userName;
  729. this.scoreid=row.taId;
  730. this.scoreRemark=row.scoreRemark;
  731. this.ID=row.id;
  732. if(row.score==0){
  733. this.score='良好';
  734. }else{
  735. this.score=row.score==4?'优秀':row.score==3?'良好':row.score==2?'一般':'不合格';
  736. }
  737. },
  738. //评分确认
  739. scoreconfirm(){
  740. var score=3
  741. if(this.score=='不合格'){
  742. score=1
  743. }else if(this.score=='一般'){
  744. score=2
  745. }else if(this.score=='良好'){
  746. score=3
  747. }else{
  748. score=4
  749. }
  750. var url = "/api/PersonnelModule/PostTaskAllocationScore"
  751. var that = this
  752. this.$axios({
  753. method: 'post',
  754. url: url,
  755. headers: {
  756. Authorization: 'Bearer ' + that.userId
  757. },
  758. data:{
  759. portType: 1,
  760. userId: that.userId,
  761. pageId: that.pageId,
  762. subId: that.ID,
  763. score: score,
  764. scoreRemark: that.scoreRemark,
  765. }
  766. }).then(function (res) {
  767. console.log(res)
  768. if(res.data.code==200){
  769. that.dialogFormVisible=false;
  770. that.$message({
  771. message: res.data.msg,
  772. type: 'success'
  773. });
  774. that.PostTaskAllocationPage();
  775. }else{
  776. that.$message.error(res.data.msg);
  777. }
  778. }).catch(function (error) {
  779. that.$message.error("获取数据源失败!");
  780. });
  781. },
  782. //change
  783. statuschange(val,row){
  784. console.log(val,row)
  785. if(val==4){
  786. this.PostTaskAllocationSetAuditStatus(row.id);
  787. }else if(val==3){
  788. this.open(row.id);
  789. }
  790. },
  791. //打开情况传递数据
  792. openDialog(row){
  793. this.dialogTasklist = true;
  794. this.shuju.id = row.id;
  795. this.shuju.remark = row.remark;
  796. this.shuju.overTime = row.overTime;
  797. },
  798. //审核
  799. PostTaskAllocationSetAuditStatus(){
  800. var url = "/api/PersonnelModule/PostTaskAllocationSetAuditStatus"
  801. var that = this
  802. this.$axios({
  803. method: 'post',
  804. url: url,
  805. headers: {
  806. Authorization: 'Bearer ' + that.userId
  807. },
  808. data:{
  809. userId:that.userId,
  810. id:that.shuju.id,
  811. overTime:that.datetime(that.shuju.overTime),
  812. remark:that.shuju.remark,
  813. }
  814. }).then(function (res) {
  815. console.log(res)
  816. if(res.data.code==200){
  817. that.$message({
  818. message: res.data.msg,
  819. type: 'success'
  820. });
  821. that.dialogTasklist = false;
  822. that.PostTaskAllocationPage();
  823. }else{
  824. that.$message.error(res.data.msg);
  825. }
  826. }).catch(function (error) {
  827. that.$message.error("审核失败!");
  828. });
  829. },
  830. open(id) {
  831. this.$prompt('请输入未完成原因', '提示', {
  832. confirmButtonText: '确定',
  833. cancelButtonText: '取消',
  834. inputPattern: /^.+$/,
  835. inputErrorMessage: '原因不能为空'
  836. }).then(({ value }) => {
  837. this.PostTaskAllocationSetUnFinishedStatus(id,value)
  838. // this.$message({
  839. // type: 'success',
  840. // message: '你的邮箱是: ' + value
  841. // });
  842. }).catch(() => {
  843. this.reviewstatus='';
  844. // this.$message({
  845. // type: 'info',
  846. // message: '取消输入'
  847. // });
  848. });
  849. },
  850. //未完成
  851. PostTaskAllocationSetUnFinishedStatus(id,val){
  852. var url = "/api/PersonnelModule/PostTaskAllocationSetUnFinishedStatus"
  853. var that = this
  854. this.$axios({
  855. method: 'post',
  856. url: url,
  857. headers: {
  858. Authorization: 'Bearer ' + that.userId
  859. },
  860. data:{
  861. subId:id,
  862. cause:val,
  863. }
  864. }).then(function (res) {
  865. console.log(res)
  866. if(res.data.code==200){
  867. that.$message({
  868. message: res.data.msg,
  869. type: 'success'
  870. });
  871. that.PostTaskAllocationPage();
  872. }else{
  873. that.$message.error(res.data.msg);
  874. }
  875. }).catch(function (error) {
  876. that.$message.error("审核失败!");
  877. });
  878. },
  879. //任务终止
  880. PostTaskAllocationTermination(index,row){
  881. var url = "/api/PersonnelModule/PostTaskAllocationTermination"
  882. var that = this
  883. this.$axios({
  884. method: 'post',
  885. url: url,
  886. headers: {
  887. Authorization: 'Bearer ' + that.userId
  888. },
  889. data:{
  890. portType: 1,
  891. userId: that.userId,
  892. pageId: that.pageId,
  893. id: row.id,
  894. }
  895. }).then(function (res) {
  896. console.log(res)
  897. if(res.data.code==200){
  898. that.$message({
  899. message: res.data.msg,
  900. type: 'success'
  901. });
  902. that.PostTaskAllocationPage();
  903. }else{
  904. that.$message.error(res.data.msg);
  905. }
  906. }).catch(function (error) {
  907. that.$message.error("任务终止失败!");
  908. });
  909. },
  910. },
  911. filters:{
  912. filter_city(value){
  913. if(value){
  914. return value.replaceAll('|','、')
  915. }
  916. },
  917. filter_time(value){
  918. if(value){
  919. return value.split(" ")[0]
  920. }
  921. }
  922. },
  923. mounted(){
  924. this.token=JSON.parse(localStorage.getItem('userinif')).token;
  925. this.pageId=Number(localStorage.getItem('indexs').split('-')[1]);//页面id
  926. this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  927. this.jobName=JSON.parse(localStorage.getItem('userinif')).userInfo.jobName;
  928. this.cnName=JSON.parse(localStorage.getItem('userinif')).userInfo.cnName;
  929. this.PostTaskAllocationInit()
  930. }
  931. }
  932. </script>
  933. <style>
  934. .tasklist-all{
  935. background-color: #fff;
  936. padding: 10px;
  937. box-shadow: 0 0 5px #0005;
  938. border-radius: 10px;
  939. min-height: 830px;
  940. }
  941. .tasklist-title{
  942. font-size: 17px;
  943. font-weight: 600;
  944. margin-bottom: 5px;
  945. }
  946. .tasklist-head-select{
  947. display: flex;
  948. }
  949. .tasklist-head-select .el-form-item{
  950. margin-bottom: 15px;
  951. margin-right: 15px;
  952. }
  953. .tasklist-head-select .el-select{
  954. width: 200px;
  955. }
  956. .tasklist-table .block{
  957. text-align: center;
  958. margin-top: 15px;
  959. }
  960. .scopeTimeDQ{
  961. display: flex;
  962. flex-direction: column;
  963. font-family: Monaco;
  964. align-items: center;
  965. }
  966. .score-box{
  967. display: flex;
  968. flex-wrap: wrap;
  969. }
  970. .score-box .el-form-item_content{
  971. width: 100%;
  972. }
  973. .score-box .el-form-item:nth-child(1){
  974. width: 50%;
  975. }
  976. .score-box .el-form-item:nth-child(2){
  977. width: 50%;
  978. }
  979. .score-box .el-form-item:nth-child(3){
  980. width: 100%;
  981. }
  982. .tasklist-table .demo-table-expand {
  983. font-size: 0;
  984. }
  985. .tasklist-table .demo-table-expand label {
  986. width: 90px;
  987. color: #99a9bf;
  988. }
  989. .tasklist-table .demo-table-expand .el-form-item {
  990. margin-right: 0;
  991. margin-bottom: 0;
  992. width: 50%;
  993. }
  994. .table-boxli{
  995. text-align: center;
  996. padding: 0 20px;
  997. }
  998. .table-boxli .el-table--border, .el-table--group{
  999. border: 1px solid #b5bfd7;
  1000. }
  1001. .table-boxli .el-table--border .el-table__cell{
  1002. border: 1px solid #b5bfd7;
  1003. padding: 12px 0;
  1004. min-width: 0;
  1005. -webkit-box-sizing: border-box;
  1006. box-sizing: border-box;
  1007. text-overflow: ellipsis;
  1008. vertical-align: middle;
  1009. position: relative;
  1010. text-align: left;
  1011. }
  1012. </style>