submitted_ministry.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="维修工单报工" @clickLeft="goBack">
  4. <!-- <view class="nav-right" slot="right">
  5. <view class="text-box" @click="goRegister" style="width: 150rpx">备件使用登记</view>
  6. </view> -->
  7. </uni-nav-bar>
  8. <view class="content">
  9. <view class="fixed-top-bar">
  10. <view class="item">
  11. {{ worksheetInfo.deviceName }}
  12. </view>
  13. <view class="item">
  14. {{ worksheetInfo.workOrderCode }}
  15. </view>
  16. </view>
  17. <view class="bxjlbh-wrap">
  18. <view class="item">
  19. <view class="label">工单编号</view>
  20. <view class="value-wrap text">
  21. {{ worksheetInfo.code }}
  22. </view>
  23. </view>
  24. </view>
  25. <view class="clsm">
  26. <view class="title">处理说明</view>
  27. <textarea class="textarea" v-model="form.repairReportExplain"></textarea>
  28. </view>
  29. <view class="sc-wrap">
  30. <view class="title">附件</view>
  31. <fileMain v-model="form.attachments"></fileMain>
  32. <!-- <uni-file-picker :limit="4" v-model="FileImgList" fileMediatype="image" mode="grid" @select="handlImageSelect" @delete="handlImagDeletee" /> -->
  33. </view>
  34. <view class="bpbj" v-if="form.stockOutApplyPartList.length > 0">
  35. <view class="title">备件使用登记</view>
  36. <view class="detail-content">
  37. <view class="col" v-for="(item, index) in form.stockOutApplyPartList" :key="index">
  38. {{ item.name }}({{ item.code + '/' + item.model }}
  39. <u-number-box v-model="item.usedNum" :step="1" :min="0" :max="item.max"
  40. :disabledInput="true"></u-number-box>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="fixed-bottom-bar">
  46. <view class="item s1" @click="submit">提交</view>
  47. <view class="item s2" @click="goBack">返回</view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. getWorkOrderDetail,
  54. getDeviceList,
  55. startExecuting,
  56. signingWork,
  57. devicestatistics
  58. } from '@/api/myTicket/index.js'
  59. import {
  60. get,
  61. postJ,
  62. post
  63. } from '@/utils/api.js'
  64. import fileMain from "@/pages/doc/index.vue"
  65. export default {
  66. components: {
  67. fileMain
  68. },
  69. data() {
  70. return {
  71. form: {
  72. // 图片
  73. workOrderImg: [],
  74. // 说明
  75. repairReportExplain: '',
  76. // 工单id
  77. workOrderId: '',
  78. // 备品备件
  79. stockOutApplyPartList: [],
  80. attachments: [],
  81. },
  82. workOrderCode: '',
  83. // 选择的图片
  84. FileImgList: [],
  85. // 工单信息
  86. worksheetInfo: {},
  87. equiCode: ''
  88. }
  89. },
  90. async onLoad(options) {
  91. this.worksheetInfo = options
  92. // this.equiCode = options.equiCode
  93. // await this.getInfo()
  94. // this.getbpbj()
  95. },
  96. onShow() {},
  97. methods: {
  98. // 请求信息
  99. getInfo() {
  100. return get(this.apiUrl + '/repair/info/getWorkOrderDetail/' + this.workOrderCode).then(res => {
  101. if (res.success) {
  102. this.worksheetInfo = res.data
  103. }
  104. })
  105. },
  106. // 返回
  107. goBack() {
  108. uni.navigateBack({
  109. delta: 1
  110. })
  111. },
  112. // 选择图片
  113. async handlImageSelect(e) {
  114. let element = e.tempFiles[0]
  115. let url = await this.uploadFiles(element.path)
  116. if (url) {
  117. // element.url = url
  118. this.form.workOrderImg.push(url)
  119. }
  120. },
  121. // 图片删除
  122. handlImagDeletee(e) {
  123. let index = this.form.workOrderImg.findIndex(n => {
  124. return n.uuid == e.tempFile.uuid
  125. })
  126. if (index !== -1) {
  127. this.form.workOrderImg.splice(index, 1)
  128. }
  129. },
  130. // 文件上传
  131. uploadFiles(tempFilePaths) {
  132. let that = this
  133. return new Promise((resolve, reject) => {
  134. uni.uploadFile({
  135. url: this.apiUrl + '/main/file/upload', //后端用于处理图片并返回图片地址的接口
  136. filePath: tempFilePaths,
  137. name: 'multiPartFile',
  138. header: {
  139. Authorization: wx.getStorageSync('token')
  140. },
  141. formData: {
  142. module: 'eam'
  143. },
  144. success: res => {
  145. console.log(res)
  146. let data = JSON.parse(res.data) //返回的是字符串,需要转成对象格式
  147. console.log('res-----------')
  148. console.log(data)
  149. resolve(data.data.storePath)
  150. },
  151. fail: err => {
  152. reject(null)
  153. uni.showToast({
  154. title: '图片上传失败',
  155. icon: 'none'
  156. })
  157. }
  158. })
  159. })
  160. },
  161. // 提交
  162. async submit() {
  163. signingWork({
  164. id: this.worksheetInfo.id,
  165. remark: this.form.repairReportExplain,
  166. attachments: this.form.attachments,
  167. workOrderImg: this.form.workOrderImg.join(',')
  168. }).then(() => {
  169. uni.showToast({
  170. title: '报工成功',
  171. icon: 'success',
  172. duration: 2000
  173. })
  174. this.back()
  175. })
  176. // let par = JSON.parse(JSON.stringify(this.form))
  177. // par.stockOutApplyPartList = par.stockOutApplyPartList.map(n => {
  178. // delete n.max
  179. // return n
  180. // })
  181. // par.workOrderId = this.worksheetInfo.workOrderId
  182. // let workOrderImg = par.workOrderImg.map(n => {
  183. // return n.url
  184. // })
  185. // par.workOrderImg = workOrderImg.join(',')
  186. // postJ(this.apiUrl + '/workOrder/repairReportWork', par).then(res => {
  187. // if (res.success) {
  188. // uni.showToast({
  189. // title: '报工成功',
  190. // icon: 'success',
  191. // duration: 2000
  192. // })
  193. // this.back()
  194. // }
  195. // })
  196. },
  197. // 获取备品备件
  198. getbpbj() {
  199. post(this.apiUrl + '/stockOutApply/getApplyEquiPartList', {
  200. workOrderId: this.worksheetInfo.workOrderId
  201. }).then(res => {
  202. if (res.success) {
  203. this.form.stockOutApplyPartList = res.data.map(n => {
  204. n.max = n.usedNum
  205. n.usedNum = 0
  206. delete n.id
  207. delete n.createTime
  208. delete n.updateTime
  209. return n
  210. })
  211. }
  212. })
  213. },
  214. // 返回
  215. back() {
  216. uni.navigateBack({
  217. delta: 1
  218. })
  219. },
  220. // 跳转到备品备件使用登记页面
  221. goRegister() {
  222. uni.navigateTo({
  223. url: `/pages/maintenance/check/register?workOrderCode=${this.workOrderCode}&equipmentCode=${this.equiCode}&from=maintain_service`
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. .fixed-top-bar {
  231. display: flex;
  232. background: #fff;
  233. width: 100%;
  234. height: 80rpx;
  235. justify-content: space-between;
  236. align-items: center;
  237. padding: 0 20rpx;
  238. box-sizing: border-box;
  239. .item {
  240. font-size: 28rpx;
  241. color: #333333;
  242. font-weight: bold;
  243. }
  244. }
  245. .content {
  246. margin: 0 0 81rpx 0;
  247. padding: 0 20rpx;
  248. position: relative;
  249. }
  250. .bxjlbh-wrap {
  251. margin-top: 30rpx;
  252. .item {
  253. height: 30px;
  254. display: flex;
  255. border: 1px solid #d7d7d7;
  256. &+.item {
  257. margin-top: 3px;
  258. }
  259. .label {
  260. width: 100px;
  261. height: 100%;
  262. line-height: 30px;
  263. text-align: center;
  264. background: #d7d7d7;
  265. font-size: 32rpx;
  266. color: rgb(62, 62, 62);
  267. }
  268. .value-wrap {
  269. flex: 1;
  270. display: flex;
  271. align-items: center;
  272. padding-left: 10px;
  273. &.text {
  274. background: #f2f2f2;
  275. font-size: 32rpx;
  276. }
  277. .picker {
  278. width: 100%;
  279. color: rgb(153, 153, 153);
  280. font-size: 32rpx;
  281. }
  282. }
  283. }
  284. }
  285. .clsm {
  286. margin-top: 20rpx;
  287. .textarea {
  288. width: 100%;
  289. border: 1px solid #f2f2f2;
  290. margin-top: 10rpx;
  291. box-sizing: border-box;
  292. }
  293. }
  294. .sc-wrap {
  295. margin-top: 20rpx;
  296. .title {
  297. margin-bottom: 7px;
  298. }
  299. }
  300. .bpbj {
  301. margin-top: 20rpx;
  302. .title {
  303. margin-bottom: 7px;
  304. }
  305. .detail-content {
  306. border: 1rpx solid rgba(242, 242, 242, 1);
  307. .col {
  308. font-size: 28rpx;
  309. border-bottom: 1rpx solid rgba(242, 242, 242, 1);
  310. display: flex;
  311. padding: 10rpx;
  312. align-items: center;
  313. justify-content: space-between;
  314. background-color: rgba(242, 242, 242, 0.372549019607843);
  315. }
  316. .plus {
  317. width: 40rpx;
  318. height: 40rpx;
  319. line-height: 38rpx;
  320. text-align: center;
  321. background-color: $j-primary-border-green;
  322. color: #fff;
  323. margin: 16rpx 0 0 16rpx;
  324. }
  325. }
  326. /deep/.u-number-box {
  327. .u-number-box__minus,
  328. .u-number-box__plus,
  329. .u-number-box__input {
  330. font-size: 30rpx;
  331. height: 1.6em !important;
  332. }
  333. .u-number-box__input {
  334. width: 2em !important;
  335. }
  336. .u-number-box__minus,
  337. .u-number-box__plus {
  338. background-color: $j-primary-border-green !important;
  339. .u-icon__icon {
  340. color: #fff !important;
  341. }
  342. }
  343. }
  344. }
  345. .fixed-bottom-bar {
  346. display: flex;
  347. position: fixed;
  348. bottom: 0;
  349. left: 0;
  350. width: 100%;
  351. height: 80rpx;
  352. box-sizing: border-box;
  353. border-top: 1px solid #f2f2f2;
  354. .item {
  355. flex: 1;
  356. height: 100%;
  357. line-height: 80rpx;
  358. text-align: center;
  359. &.s1 {
  360. background-color: #157a2c;
  361. color: #fff;
  362. }
  363. }
  364. }
  365. </style>