detail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="container">
  3. <cu-custom id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
  5. :isBack="true">
  6. <block slot="backText">返回</block>
  7. <block slot="content">
  8. 工单详情
  9. </block>
  10. </cu-custom>
  11. <My_listbox ref="List" @getlist="getDetail">
  12. <view class="header">
  13. <view class="billno">
  14. {{ detail.billno }}
  15. </view>
  16. <view class="row">
  17. <view class="row-label">来源:</view>
  18. <view class="row-value">{{ detail.source || ' --' }}</view>
  19. </view>
  20. <view class="row">
  21. <view class="row-label">设备:</view>
  22. <view class="row-value">{{ detail.devicename || ' --' }}</view>
  23. </view>
  24. <view class="row">
  25. <view class="row-label">任务时间:</view>
  26. <view class="row-value">
  27. {{ detail.begdate && detail.enddate ? detail.begdate + ' 至 ' + detail.enddate : '--' }}
  28. </view>
  29. </view>
  30. <view class="row">
  31. <view class="row-label">地址:</view>
  32. <view class="row-value">{{ detail.address || ' --' }}</view>
  33. </view>
  34. <view class="row">
  35. <view class="row-label">备注说明:</view>
  36. <view class="row-value">{{ detail.remarks || ' --' }}</view>
  37. </view>
  38. <view class="status" :style="[statusStyle(detail.status)]">{{ detail.status }}</view>
  39. </view>
  40. <block v-if="detail.team.length">
  41. <view class="label">巡检人员</view>
  42. <view class="users">
  43. <view class="user" :class="item.isleader ? 'leader' : ''" v-for="item in detail.team"
  44. :key="item.userid">
  45. {{ item.name }}
  46. </view>
  47. </view>
  48. </block>
  49. <nodes :nodes="detail.nodes" @nodeClick="nodeClick" />
  50. <view :style="{ height: isShowBut ? '22vw' : '30px' }" />
  51. </My_listbox>
  52. <but ref="but" :sa_workorderid="sa_workorderid" :status="detail.status" @onUpdate="getDetail"
  53. @unShowBut="onUnShowBut" />
  54. </view>
  55. </template>
  56. <script>
  57. import but from "./modules/but"
  58. import nodes from "./modules/nodes"
  59. export default {
  60. name: "Detail",
  61. components: { but, nodes },
  62. computed: {
  63. statusStyle() {
  64. return function (status) {
  65. let obj = {};
  66. switch (status) {
  67. case '待接单':
  68. obj = { color: '#EB4B5C', background: 'rgba(235, 75, 92, .2)' }
  69. break;
  70. case '待开始':
  71. obj = { color: '#3874F6', background: 'rgba(56, 116, 246, .2)' }
  72. break;
  73. case '进行中':
  74. obj = { color: '#5AB73F', background: 'rgba(90, 183, 63, .2)' };
  75. break;
  76. case '已完成':
  77. obj = { color: '#F27F37', background: 'rgba(242, 127, 55, .2)' };
  78. break;
  79. default:
  80. obj = { color: '#999999', background: 'rgba(153, 153, 153, .2)' }
  81. break;
  82. }
  83. return obj
  84. }
  85. }
  86. },
  87. data() {
  88. return {
  89. detail: {
  90. team: [],
  91. nodes: [],
  92. status: "",
  93. child: null,
  94. },
  95. isShowBut: true,
  96. sa_workorderid: 0,
  97. }
  98. },
  99. onLoad(options) {
  100. this.sa_workorderid = options.id;
  101. this.getDetail(true)
  102. this.$Http.updateNodes = this.getDetail.bind(this);
  103. },
  104. onUnload() {
  105. delete this.$Http.updateNodes;
  106. },
  107. methods: {
  108. getDetail(init = false) {
  109. if (!init) return;
  110. return this.$Http.basic({
  111. "id": 20230208140103,
  112. "content": {
  113. "sa_workorderid": this.sa_workorderid
  114. }
  115. }).then(res => {
  116. console.log("工单详情", res)
  117. if (this.cutoff(res.msg)) return;
  118. let detail = res.data;
  119. switch (detail.sourcetable) {
  120. case "sa_patrolplan":
  121. detail.source = "巡检," + (detail.planno || ' --')
  122. break;
  123. case "w_event_log":
  124. detail.source = "告警," + (detail.eventname || ' --')
  125. break;
  126. default:
  127. detail.source = "现场"
  128. break;
  129. }
  130. this.detail = res.data;
  131. this.$refs.List.RefreshToComplete();
  132. this.$refs.List.setHeight();
  133. if (this.child) this.nodeClick(this.child)
  134. })
  135. },
  136. nodeClick(child) {
  137. if (['待接单', '待开始'].includes(this.detail.status)) {
  138. if (this.detail.status == '待开始') this.child = child;
  139. this.$refs.but.onClick(true)
  140. } else if (['暂停', '作废', '已完成'].includes(this.detail.status)) {
  141. // 3、暂停/作废/已完成的工单,点击工序详情可查询,不可编辑;
  142. uni.navigateTo({
  143. url: `/packageA/workOrder/setNode?isReadOnly=true&sa_workorderid=${this.detail.sa_workorderid}&sa_workorder_nodeid=${child.sa_workorder_nodeid}&w_deviceid=${this.detail.w_deviceid}`
  144. });
  145. } else if (this.detail.status == '进行中') {
  146. // 2、已开始的工单(工单状态为进行中),点击工序进入工序详情,若工序未完成,可查询可编辑;已完成工序仅查询不可编辑
  147. uni.navigateTo({
  148. url: `/packageA/workOrder/setNode?sa_workorderid=${this.detail.sa_workorderid}&sa_workorder_nodeid=${child.sa_workorder_nodeid}&w_deviceid=${this.detail.w_deviceid}`
  149. });
  150. this.child = null;
  151. }
  152. },
  153. onUnShowBut(e) {
  154. this.isShowBut = e;
  155. }
  156. },
  157. onUnload() {
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .container {
  163. position: relative;
  164. .header {
  165. position: relative;
  166. padding: 10px;
  167. width: 355px;
  168. margin: 10px auto;
  169. background: #fff;
  170. border-radius: 4px;
  171. box-sizing: border-box;
  172. overflow: hidden;
  173. .billno {
  174. font-size: 16px;
  175. font-weight: bold;
  176. color: #004684;
  177. }
  178. .row {
  179. display: flex;
  180. font-size: 14px;
  181. margin-top: 6px;
  182. &-label {
  183. flex-shrink: 0;
  184. color: #666;
  185. }
  186. }
  187. .status {
  188. position: absolute;
  189. top: 0;
  190. right: 0;
  191. padding: 4px 8px;
  192. font-size: 12px;
  193. border-radius: 0 0 0 4px;
  194. }
  195. }
  196. .label {
  197. margin: 15px 0 10px 10px;
  198. font-size: 13px;
  199. color: #fff;
  200. }
  201. .users {
  202. display: flex;
  203. flex-wrap: wrap;
  204. padding: 8px 6px 2px 6px;
  205. width: 355px;
  206. margin: 0 auto;
  207. background: #fff;
  208. border-radius: 4px;
  209. box-sizing: border-box;
  210. overflow: hidden;
  211. .user {
  212. padding: 2px 4px;
  213. border: 1px solid #000;
  214. color: #000;
  215. font-size: 13px;
  216. border-radius: 4px;
  217. margin-right: 6px;
  218. margin-bottom: 6px;
  219. box-sizing: border-box;
  220. }
  221. .leader {
  222. background: #2A6AF2;
  223. border: 0;
  224. color: #fff;
  225. }
  226. }
  227. }
  228. </style>