detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <view class="task-detail-wrap">
  3. <view class="table-wrap">
  4. <view class="table-title">
  5. <view class="tab-item" @click="changeTab(index)"
  6. v-for="(item,index) in tabItems"
  7. :key="index"
  8. :class="tabIndex === index?'active':''"
  9. >
  10. <text>{{item}}</text>
  11. </view>
  12. </view>
  13. <view class="table-contain">
  14. <uni-collapse accordion>
  15. <uni-collapse-item title="详情">
  16. <view class="table-cont baseInfo">
  17. <!-- 基本信息 -->
  18.   <view class="row">
  19. <text>执行部门:{{baseInfo.executeGroupName}}</text>
  20. </view>
  21.   <view class="row">
  22. <text>执行人:{{baseInfo.executeAccountName}}</text>
  23. </view>
  24.   <view class="row">
  25. <text>优先级:{{baseInfo.taskPriority | taskPriorityFilter}}</text>
  26. </view>
  27.   <view class="row">
  28. <text>状态:{{baseInfo.status | taskStatusFilter}}</text>
  29. </view>
  30.   <view class="row">
  31. <text>任务类别:{{baseInfo.taskCatTitle}}</text>
  32. </view>
  33.   <view class="row">
  34. <text>风险点:{{baseInfo.riskPointTitle}}</text>
  35. </view>
  36.   <view class="row">
  37. <text>清单:{{baseInfo.checklistTitle}}</text>
  38. </view>  
  39.   <view class="row">
  40. <text>预计开始时间:{{baseInfo.expectedStartTime|isNull}}</text>
  41. </view>
  42.   <view class="row">
  43. <text>预计结束时间:{{baseInfo.expectedEndTime|isNull}}</text>
  44. </view>
  45.   <view class="row">
  46. <text>实际开始时间:{{baseInfo.actualStartTime|isNull}}</text>
  47. </view>
  48.   <view class="row">
  49. <text>实际结束时间:{{baseInfo.actualEndTime|isNull}}</text>
  50. </view>  
  51. </view>
  52. </uni-collapse-item>
  53. </uni-collapse>
  54. </view>
  55. </view>
  56. <view class="handle-wrap" v-if="handleStatus">
  57. <button type="warn" size="mini" @click="showTransferTask">转交任务</button>
  58. <button type="success" size="mini" @click="completeTask">完成任务</button>
  59. <button type="default" size="mini" @click="cancelTask">撤消任务</button>
  60. <button type="primary" size="mini" @click="allPass">全部通过</button>
  61. </view>
  62. <!-- 转交 -->
  63. <view class="transferTask-wrap">
  64. <uni-drawer ref="transferTask"
  65. mode="right" :width="260"
  66. maskClick>
  67. <view class="uni-drawer-cont">
  68. <uni-forms ref="form">
  69. <uni-forms-item label="执行人" required>
  70. <picker :range="userList" range-key="accountRealName" @change="bindPickerChangeUser" :value="indexUser">
  71. <view class="uni-input">{{userList[indexUser].accountRealName}}</view>
  72. </picker>
  73. </uni-forms-item>
  74. <uni-forms-item label="意见" name="actionRemark" required>
  75. <textarea v-model="formData.actionRemark"
  76. class="textarea" name="actionRemark"
  77. placeholder-style="color:gray"
  78. placeholder="请输入隐患评审意见/说明/备注" />
  79. </uni-forms-item>
  80. </uni-forms>
  81. <button class="submit-BT" @click="transferTask" type="primary">提交</button>
  82. </view>
  83. </uni-drawer>
  84. </view>
  85. <view v-for="(item, index) in dataList.hazardList" :key="item.hazardId" class="hazardList-wrap">
  86. <view class="hazardList">
  87. <view class="hazardTitle-wrap">
  88. <view class="hazardTitle">标题:{{item.hazardTitle}}</view>
  89. <view class="hazardCode">编号:{{item.hazardCode}}</view>
  90. </view>
  91. <view class="hazard-cont">
  92. <view v-for="(item1, riskIndex) in item.riskList"
  93. :key="item1.riskId" class="hazardItem"
  94. :class="(item.riskList.length-1)===riskIndex?'delBorder':''">
  95. <view class="riskList">
  96. <view class="hazardHead">
  97. <view>风险源:{{item1.riskSource}}</view>
  98. <view>危险因素:{{item1.riskReason}}</view>
  99. <view>等级:{{item1.riskLevel}}</view>
  100. </view>
  101. <view class="riskItem"
  102. v-for="(measure, index) in item1.measureList"
  103. :key="measure.measureId"
  104. @click="checkTask(measure,item)">
  105. <view>措施分类:{{measure.measureTypeTitle}}</view>
  106. <view>管控措施:{{measure.measureContent}}</view>
  107. <text>法律依据:{{measure.measureReference}}</text>
  108. <text class="risk-desc">描述:{{measure.measureDesc}}</text>
  109. <template v-if="measure.checkResult===0">
  110. <text class="status primary">处理</text>
  111. </template>
  112. <template v-if="measure.checkResult===1">
  113. <text class="status success">通过</text>
  114. </template>
  115. <template v-if="measure.checkResult===2">
  116. <text class="status error">不通过</text>
  117. </template>
  118. <template v-if="measure.checkResult===3">
  119. <text class="status warn">有隐患</text>
  120. </template>
  121. <text class="zhcx-iconfont zhcx-icon-youbianjiantoujiaoduxiao"></text>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </template>
  130. <script>
  131. import {taskStatus, taskPriority, riskType, riskLevel, checkResult} from '@/libs/enum';
  132. import { getUserList} from "@/api/danger.js"
  133. // import {manageTaskById} from '@/api/task'
  134. import {getCheckTaskView } from '@/api/entRiskPoint.js'
  135. import {getTaskDetailById,batchUpdateCheckTaskDoingItem,completeCheckTask,cancelCheckTask,transferCheckTask} from '@/api/task'
  136. export default {
  137. filters:{
  138. riskTypeFilter(val) {
  139. return riskType(val)
  140. },
  141. riskLevelFilter(val) {
  142. return riskLevel(val)
  143. },
  144. taskPriorityFilter(val) {
  145. return taskPriority(val)
  146. },
  147. taskStatusFilter(val) {
  148. return taskStatus(val)
  149. },
  150. checkResultFilter(val) {
  151. return checkResult(val)
  152. },
  153. isNull(value){
  154. if(!value)
  155. {
  156. return '--';
  157. }
  158. return value;
  159. }
  160. },
  161. data() {
  162. return {
  163. taskId: undefined,
  164. userId:undefined,
  165. indexUser:0,
  166. tabItems:[],
  167. handleStatus:false,
  168. dataList:[],
  169. baseInfo:{
  170. taskTitle: '',
  171. taskCatId: undefined,
  172. taskCatTitle: '',
  173. launchGroupId: undefined,
  174. launchGroupName: '',
  175. launchPositionId: undefined,
  176. launchPositionName: '',
  177. launchAccountId: undefined,
  178. launchAccountName: '',
  179. executeGroupId: undefined,
  180. executeGroupName: '',
  181. executePositionId: undefined,
  182. executePositionName: '',
  183. executeAccountId: undefined,
  184. executeAccountName: '',
  185. status: undefined,
  186. taskDesc: '',
  187. expectedStartTime: undefined,
  188. expectedEndTime: undefined,
  189. actualStartTime: undefined,
  190. actualEndTime: undefined,
  191. riskPointId: undefined,
  192. riskPointTitle: '',
  193. checklistId: undefined,
  194. checklistTitle: '',
  195. checklistCatId: undefined,
  196. checklistCatTitle: '',
  197. checklistDesc: '',
  198. checklistVersion: '',
  199. hazardCount: 0,
  200. hazardList: []
  201. },
  202. userList:[],
  203. formData: {
  204. riskPointId: undefined,
  205. executeGroupId: undefined,
  206. executePositionId: undefined,
  207. executeAccountId: undefined
  208. }
  209. }
  210. },
  211. onLoad(options) {
  212. this.taskId=options.id;
  213. this.riskPointId=options.riskPointId;
  214. this.getTaskDetails(options.id);
  215. this.getUserList();
  216. this.getTaskView(options.id)
  217. },
  218. methods: {
  219. getTaskView(taskId) {
  220. getCheckTaskView(taskId).then((resp) => {
  221. const { code, data, count } = resp
  222. if (code === 0) {
  223. this.dataList = data
  224. }
  225. }).catch((error) => {
  226. console.log(error)
  227. })
  228. },
  229. checkTask(measure,item) {
  230. //跳转到分级管控检查表页面
  231. let riskPointId=this.riskPointId;
  232. let taskId=this.taskId;
  233. if(!riskPointId){
  234. uni.showToast({
  235. title:"riskPointId未找到"
  236. })
  237. return;
  238. }
  239. if(!taskId){
  240. uni.showToast({
  241. title:"taskId未找到"
  242. })
  243. return;
  244. }
  245. measure.hazardId=item.hazardId;
  246. uni.setStorageSync('entRiskPointMeasure',measure)
  247. uni.navigateTo({
  248. url: `/views/entRiskPointCheck/checkInfo?taskId=${taskId}&riskPointId=${riskPointId}&type=taskdetail`
  249. });
  250. },
  251. getTaskDetails(id){
  252. getTaskDetailById(id).then((res)=>{
  253. this.baseInfo=res.data;
  254. let executeAccountId=res.data.executeAccountId;
  255. let accountInfo=uni.getStorageSync('accountInfo');
  256. if(accountInfo){
  257. let userId=(JSON.parse(accountInfo)).userId;
  258. this.userId=userId;
  259. this.handleStatus=executeAccountId==userId;//登录用户是executeAccount
  260. }
  261. })
  262. },
  263. completeTask(){
  264. const taskId=this.taskId;
  265. uni.showModal({
  266. title: '提示',
  267. content: '此操作将完成任务, 是否继续?',
  268. success: function (res) {
  269. if (res.confirm) {
  270. completeCheckTask(taskId).then((res)=>{
  271. uni.showToast({
  272. "title":"操作成功!",
  273. "icon":"none",
  274. success() {
  275. setTimeout(()=>{
  276. uni.navigateBack({
  277. animationType:"pop-out"
  278. })
  279. },1500)
  280. }
  281. })
  282. }).catch((res)=>{
  283. uni.showToast({
  284. "title":"操作失败!",
  285. "icon":"none"
  286. })
  287. })
  288. }
  289. }
  290. });
  291. },
  292. cancelTask(){
  293. uni.showModal({
  294. title: '提示',
  295. content: '是否要撤销',
  296. success: function (res) {
  297. if (res.confirm) {
  298. cancelCheckTask(this.taskId).then((res)=>{
  299. uni.showToast({
  300. "title":"操作成功!",
  301. "icon":"none",
  302. success() {
  303. setTimeout(()=>{
  304. uni.navigateBack({
  305. animationType:"pop-out"
  306. })
  307. },1500)
  308. }
  309. })
  310. }).catch((res)=>{
  311. uni.showToast({
  312. "title":"操作失败!",
  313. "icon":"none"
  314. })
  315. })
  316. }
  317. }
  318. });
  319. },
  320. //用户列表
  321. getUserList() {
  322. getUserList().then((resp) => {
  323. const { code, data } = resp
  324. if (code === 0) {
  325. this.userList = data
  326. this.formData.accountIdTo = this.userList[1].accountId
  327. this.formData.groupIdTo = this.userList[1].groupId
  328. this.formData.positionIdTo = this.userList[1].positionId
  329. }
  330. }).catch((error) => {
  331. console.log(error)
  332. })
  333. },
  334. bindPickerChangeUser: function(e) {
  335. this.indexUser = e.target.value
  336. this.formData.accountId = this.userList[this.indexUser].accountId
  337. this.formData.accountIdTo = this.userList[this.indexUser].accountId
  338. this.formData.groupIdTo = this.userList[this.indexUser].groupId
  339. this.formData.positionIdTo = this.userList[this.indexUser].positionId
  340. },
  341. showTransferTask(){
  342. this.$refs.transferTask.open();
  343. },
  344. transferTask(){
  345. let formData={
  346. taskId:this.taskId,
  347. riskPointId: this.baseInfo.riskPointId,
  348. executeGroupId: this.formData.groupIdTo,
  349. executePositionId: this.formData.positionIdTo,
  350. executeAccountId: this.formData.accountId
  351. };
  352. transferCheckTask(formData).then((res)=>{
  353. if(res.code===0){
  354. this.$refs.transferTask.close();
  355. uni.showToast({
  356. "title":"操作成功!",
  357. "icon":"none",
  358. success() {
  359. setTimeout(()=>{
  360. uni.navigateBack({
  361. animationType:"pop-out"
  362. })
  363. },1500)
  364. }
  365. })
  366. }
  367. }).catch((res)=>{
  368. console.log(res)
  369. uni.showToast({
  370. "title":"操作失败!",
  371. "icon":"none"
  372. })
  373. })
  374. },
  375. allPass(){
  376. batchUpdateCheckTaskDoingItem(this.taskId,1).then((res)=>{
  377. console.log(res)
  378. uni.showToast({
  379. "title":"操作成功!",
  380. "icon":"none",
  381. success() {
  382. setTimeout(()=>{
  383. uni.navigateBack({
  384. animationType:"pop-out"
  385. })
  386. },1500)
  387. }
  388. })
  389. }).catch((res)=>{
  390. console.log(res)
  391. uni.showToast({
  392. "title":"操作失败!",
  393. "icon":"none"
  394. })
  395. })
  396. },
  397. getTaskById(taskId){
  398. //通告id查询任务
  399. console.log({taskId})
  400. manageTaskById(taskId).then((resp) => {
  401. const { code, data, msg } = resp
  402. if (code === 0) {
  403. // this.taskTitle = data.taskTitle
  404. this.viewData = data
  405. } else {
  406. this.$message.error(msg)
  407. }
  408. }).catch((error) => {
  409. console.log(error)
  410. })
  411. }
  412. }
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. .task-detail-wrap{
  417. padding:20upx 20upx 200upx;
  418. .table-wrap{
  419. .table-title{
  420. display: flex;
  421. .tab-item {
  422. height: 80upx;
  423. line-height: 80upx;
  424. flex-grow: 1;
  425. text-align: center;
  426. transition: 0.3s;
  427. &.active{
  428. color: #FFFFFF;
  429. background: #00A0FF;
  430. }
  431. }
  432. }
  433. .table-contain{
  434. .table-cont {
  435. .row{
  436. height: 78upx;
  437. line-height: 78upx;
  438. border-bottom: 2upx solid #EDE1D9;
  439. // background-color: #fff;
  440. &.desc{
  441. height: auto;
  442. line-height: 1.5;
  443. min-height: 78upx;
  444. border-bottom: none;
  445. padding-top: 16upx;
  446. display: flex;
  447. justify-content: flex-start;
  448. .desc-txt{
  449. width: 600upx;
  450. word-break: break-word;
  451. }
  452. }
  453. }
  454. }
  455. }
  456. }
  457. .handle-wrap{
  458. width:710upx;
  459. display: flex;
  460. justify-content: space-around;
  461. padding: 20upx;
  462. position: fixed;
  463. bottom: 0;
  464. left: 0;
  465. z-index: 99;
  466. background-color: rgba(255,255,255,0.6);
  467. button{
  468. width: 200upx;
  469. line-height: 2;
  470. margin: 0;
  471. margin-right: 20upx;
  472. padding: 15upx 0;
  473. &:last-child{
  474. margin-right: 0;
  475. }
  476. &[type="success"]{
  477. background: #09BB07 !important;
  478. color: #fff;
  479. }
  480. }
  481. }
  482. .uni-drawer-cont{
  483. padding: 20upx;
  484. .textarea{
  485. width: 85%;
  486. border: 1px solid #eaeaea;
  487. padding: 20upx;
  488. font-size: 28upx;
  489. }
  490. .submit-BT{
  491. background-color: #0081FF;
  492. color: #fff;
  493. }
  494. }
  495. .uni-tr-hazard {
  496. font-size: 13px;
  497. font-weight: bold;
  498. text-indent: 12px;
  499. background: #0081FF;
  500. padding: 10px 20px;
  501. color: #fff;
  502. }
  503. .hazardList-wrap{
  504. .hazardList {
  505. padding:30upx;
  506. margin-bottom:30upx;
  507. background-color: #f5f5f5;
  508. // border-radius: 10upx;
  509. box-shadow: 0 0 6upx rgba(0,0,0,0.5);
  510. .hazardHead{
  511. background-color:#fff;
  512. font-weight: 600;
  513. padding-bottom: 10px;
  514. }
  515. .hazardTitle-wrap{
  516. .hazardTitle{
  517. font-weight: 600;
  518. font-size: 34upx;
  519. }
  520. .hazardCode{
  521. font-weight: 600;
  522. font-size: 34upx;
  523. padding-bottom: 15upx;
  524. }
  525. }
  526. .hazardItem{
  527. background-color: #fff;
  528. margin-top: 28upx;
  529. border-top: 1px solid #eaeaea;
  530. padding:10upx 0;
  531. &.delBorder{
  532. border-top:none;
  533. }
  534. }
  535. .risk-desc{
  536. margin-left: 16upx;
  537. }
  538. .riskList{
  539. .riskItem{
  540. border-top: 1px solid #eaeaea;
  541. position: relative;
  542. padding: 20upx 0;
  543. .zhcx-iconfont{
  544. font-size: 16px;
  545. position: absolute;
  546. right: 10upx;
  547. top: 50%;
  548. transform: translateY(-50%);
  549. }
  550. .status{
  551. &.primary{
  552. color: #1aad19;
  553. }
  554. &.warn{
  555. color: #e6a23c;
  556. }
  557. &.success{
  558. color:#0081FF;
  559. }
  560. &.error{
  561. color: red;
  562. }
  563. }
  564. }
  565. }
  566. }
  567. }
  568. }
  569. </style>