submitted_ministry.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单报工" @clickLeft="back">
  4. <!-- <template slot="float">
  5. <view class="nav-icon-caozuo iconfont icon-caozuo" @click="setOptionShow"></view>
  6. </template> -->
  7. </uni-nav-bar>
  8. <!-- 进度组件 根据状态显示不同列表 -->
  9. <!-- <popupOper :optionShow="optionShow" @operate="operate"
  10. :operationList="operationList.filter(el=> el.type == status)"></popupOper> -->
  11. <view class="page-bottom-padding">
  12. <!-- 巡点检事项 -->
  13. <!-- <template v-if="worksheetInfo.rule">
  14. <CellTip title="巡点检事项"> </CellTip>
  15. <view v-for="(items,indexs) in worksheetInfo.rule.ruleItem" :key="indexs">
  16. <view class="cell cell-box">
  17. <view class="tip">
  18. <text class="dian">检测事项:</text> <text class="content">{{items.itemContent}}</text>
  19. <text class="status font-sm" v-text="'检测内容:'+items.itemName"></text>
  20. </view>
  21. <view class="status-info font-sm">
  22. <view>
  23. <text class="font-grey ">检测标准:</text><text>{{items.itemStandard }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template> -->
  29. <!-- 待处理 -->
  30. <template v-if="detailsIng.length">
  31. <CellTip title="待处理"> </CellTip>
  32. <uni-collapse ref="collapse" v-for="item in detailsIng" :key="item.id">
  33. <uni-collapse-item :open="false" :typeOpen="false" titleStyle="background-color: #ffffff">
  34. <OrderDetail slot="typeOpenShow" :value1="item.equiName" :value2="item.equiCode"
  35. :value3="'通用设备-' + item.equiTypeName" :value4="item.equiTypeId" :value5="item.equiLocation">
  36. <!-- <template slot="custSlot">
  37. <view class="btn-status">
  38. <view class="btn btn-primary" @click="changeStatus(1,item.id)">
  39. 正常
  40. </view>
  41. <view class="btn btn-warning" @click="changeStatus(2,item.id,item)">
  42. 缺陷
  43. </view>
  44. </view>
  45. </template> -->
  46. </OrderDetail>
  47. <view class="content-status">
  48. <view class="title cell font-grey">
  49. 巡点检事项
  50. </view>
  51. <view v-for="(items,indexs) in item.ruleItems" :key="indexs">
  52. <view class="cell cell-box">
  53. <view class="tip">
  54. <text class="dian">检测事项:</text> <text
  55. class="content">{{items.itemContent}}</text>
  56. <text class="status font-sm" v-text="'检测内容:'+items.itemName"></text>
  57. </view>
  58. <view class="status-info font-sm">
  59. <view>
  60. <text class="font-grey ">检测标准:</text><text>{{items.itemStandard }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="btn-status" v-if="items.status === null">
  65. <view class="btn btn-primary" @click="changeStatus(1,items.id,item.id)">
  66. 正常
  67. </view>
  68. <view class="btn btn-warning" @click="changeStatus(2,items.id,item.id,item)">
  69. 缺陷
  70. </view>
  71. </view>
  72. <view class="btn-status" v-else>
  73. <text
  74. :class="['showBtn',items.status===1?'green':'red']">{{items.status==1?"正常":"缺陷"}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. </uni-collapse-item>
  79. </uni-collapse>
  80. </template>
  81. <!-- 已处理 -->
  82. <template v-if="detailsEd.length">
  83. <CellTip title="已处理"> </CellTip>
  84. <uni-collapse ref="collapse" v-for="item in detailsEd" :key="item.id">
  85. <uni-collapse-item :open="false" :typeOpen="false" titleStyle="background-color: #ffffff">
  86. <OrderDetail slot="typeOpenShow" :value1="item.equiName" :value2="item.equiCode"
  87. :value3="'通用设备-' + item.equiTypeName" :value4="item.equiTypeId" :value5="item.equiLocation">
  88. <!-- <template slot="custSlot">
  89. <text
  90. :class="['showBtn',item.status===1?'green':'red']">{{item.status==1?"正常":"缺陷"}}</text>
  91. </template> -->
  92. </OrderDetail>
  93. <view class="content-status">
  94. <view class="title cell font-grey">
  95. 巡点检事项
  96. </view>
  97. <view v-for="(items,indexs) in item.ruleItems" :key="indexs">
  98. <view class="cell cell-box">
  99. <view class="tip">
  100. <text class="dian">检测事项:</text> <text
  101. class="content">{{items.itemContent}}</text>
  102. <text class="status font-sm" v-text="'检测内容:'+items.itemName"></text>
  103. </view>
  104. <view class="status-info font-sm">
  105. <view>
  106. <text class="font-grey ">检测标准:</text><text>{{items.itemStandard }}</text>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="btn-status">
  111. <text
  112. :class="['showBtn',items.status===1?'green':'red']">{{items.status==1?"正常":"缺陷"}}</text>
  113. </view>
  114. </view>
  115. </view>
  116. </uni-collapse-item>
  117. </uni-collapse>
  118. </template>
  119. </view>
  120. <view class="btn-submit" @click="bindSubmitFn">
  121. 报工
  122. </view>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. get,
  128. postJ,
  129. post
  130. } from "@/utils/api.js"
  131. import CellTip from '@/components/CellTip.vue'
  132. import OrderDetail from '../components/OrderDetail.vue'
  133. import popupOper from '@/components/PopupOper.vue'
  134. export default {
  135. components: {
  136. CellTip,
  137. OrderDetail,
  138. popupOper
  139. },
  140. data() {
  141. return {
  142. worksheetInfo: {},
  143. details: [],
  144. detailsIng: [],
  145. detailsEd: [],
  146. optionShow: false,
  147. status: '1', //1 执行 0 暂停
  148. // operationList: [{
  149. // title: '暂停',
  150. // class: 'iconfont icon-zhuanpai',
  151. // type: 1
  152. // }, {
  153. // title: '执行',
  154. // class: 'iconfont icon-zhuanpai',
  155. // type: 0
  156. // }],
  157. }
  158. },
  159. onLoad(options) {
  160. this.pageId = options.id;
  161. this.getInfo();
  162. },
  163. onShow() {
  164. if (this.worksheetInfo) {
  165. this.getInfo();
  166. }
  167. },
  168. methods: {
  169. //自动执行
  170. toImplement(state) {
  171. postJ(this.apiUrl + "/api/feature/worksheet/implement", {
  172. id: this.pageId,
  173. state: state
  174. }).then(res => {
  175. this.state = state == "1" ? "0" : "1"; //状态更换
  176. if (state === '0') {
  177. //暂停,回退到详情
  178. this.back()
  179. }
  180. console.log(res)
  181. }).catch(err => {
  182. console.log(err)
  183. })
  184. },
  185. changeStatus(status,ruleItemId, bizEquiId,item) {
  186. if (status === 1) {
  187. postJ(this.apiUrl + "/rule/item/editStatus", {
  188. ruleItemId,
  189. status
  190. }).then(
  191. res => {
  192. // console.log(res)
  193. if (res.success) {
  194. uni.showToast({
  195. title: '操作成功'
  196. })
  197. this.getInfo();
  198. }
  199. })
  200. } else {
  201. get(this.apiUrl + "/repair/info/isExistRepair/" + bizEquiId).then(res => {
  202. // console.log(res)
  203. if (res.success) {
  204. if (res.data) {
  205. uni.showToast({
  206. title: "当前设备不能报修",
  207. icon: "none"
  208. })
  209. return
  210. }
  211. uni.navigateTo({
  212. url: '../defects/defects?id=' + this.pageId + "&executeUserName=" + this
  213. .worksheetInfo
  214. .workOrder.executeUserName + "&equiName=" + item.equiName +
  215. "&equiCode=" + item
  216. .equiCode + "&cycleType=" + this
  217. .worksheetInfo.rule.cycleType + "&cycleValue=" + this.worksheetInfo
  218. .rule.cycleValue +
  219. "&bizEquiId=" + bizEquiId +"&ruleItemId="+ruleItemId
  220. })
  221. }
  222. })
  223. }
  224. },
  225. getInfo() {
  226. get(this.apiUrl + "/patrol/order/getDetail/" + this.pageId).then(res => {
  227. this.worksheetInfo = res.data;
  228. this.detailsIng = res.data.equiList.filter(item => !item.status)
  229. this.detailsEd = res.data.equiList.filter(item => item.status)
  230. })
  231. },
  232. bindSubmitFn() {
  233. get(this.apiUrl + "/patrol/order/report/" + this.pageId).then(res => {
  234. uni.navigateTo({
  235. url: '/pages/promp/promp?title=巡点检工单'
  236. })
  237. }).catch(err => {
  238. uni.showToast({
  239. title: err.message || '报工失败',
  240. icon: 'none',
  241. duration: 3000
  242. })
  243. })
  244. },
  245. // goDetail(id, status) {
  246. // //已报修-已消缺
  247. // // uni.navigateTo({
  248. // // url: '../defects/defects?id=' + id + "&type=details" + "&parentsId=" + this.pageId
  249. // // })
  250. // },
  251. //点击显示弹窗
  252. setOptionShow() {
  253. this.optionShow = !this.optionShow;
  254. },
  255. //选择对应的操作
  256. operate(type) {
  257. if (type === 1) { //暂停
  258. this.toImplement('0');
  259. this.setOptionShow();
  260. }
  261. },
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .content-status {
  267. padding: 20rpx 0 40rpx;
  268. background-color: $page-bg;
  269. line-height: 1.5;
  270. font-size: $uni-font-size-base;
  271. color: $uni-text-color;
  272. .cell {
  273. padding: 10rpx 30rpx;
  274. }
  275. .cell-box {
  276. width: 94%;
  277. margin: 0 auto;
  278. padding: 20rpx;
  279. border-radius: 20rpx;
  280. box-sizing: border-box;
  281. // background-color: #fff;
  282. .tip {
  283. position: relative;
  284. margin-bottom: 20rpx;
  285. .content {
  286. font-size: $uni-font-size-sm;
  287. }
  288. }
  289. .tip .dian {
  290. padding-right: 10rpx;
  291. font-size: $uni-font-size-sm;
  292. font-weight: bold;
  293. color: $uni-text-color;
  294. }
  295. .tip .status {
  296. position: absolute;
  297. right: 0;
  298. color: $uni-text-color-grey;
  299. }
  300. // margin-bottom: 20rpx;
  301. }
  302. .status-info {
  303. position: relative;
  304. }
  305. .title {
  306. margin-bottom: 20rpx;
  307. font-weight: 700;
  308. text-indent: 0;
  309. }
  310. .font-grey {
  311. color: $uni-text-color-grey;
  312. }
  313. }
  314. .btn-status {
  315. display: flex;
  316. justify-content: flex-end;
  317. font-size: $uni-font-size-base;
  318. padding-right: 20rpx;
  319. }
  320. .showBtn {
  321. display: flex;
  322. justify-content: flex-end;
  323. }
  324. .green {
  325. color: green
  326. }
  327. .red {
  328. color: red;
  329. }
  330. .font-sm {
  331. font-size: $uni-font-size-sm;
  332. }
  333. </style>