detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view>
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="报修详情"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <view class="tab-title">
  12. <view
  13. v-for="(item, index) in tabList"
  14. :key="index"
  15. class="tab-item"
  16. v-text="item.label"
  17. :class="index === pickTabIndex ? 'active' : ''"
  18. @click="changeChartsTab(index)"
  19. ></view>
  20. </view>
  21. <view class="main">
  22. <!-- 报修信息 -->
  23. <view class="bg" v-show="pickTabIndex == 0">
  24. <CellInfo
  25. label="报修记录编号"
  26. :value="worksheetInfo.repairsCode"
  27. ></CellInfo>
  28. <CellInfo label="报修时间" :value="worksheetInfo.createTime"></CellInfo>
  29. <CellInfo
  30. label="来源"
  31. :value="worksheetInfo.source.desc"
  32. v-if="worksheetInfo.source"
  33. ></CellInfo>
  34. <!-- <CellInfo label="报修单号" :value="worksheetInfo.createUserName"></CellInfo> -->
  35. <CellInfo label="来源编码" :value="worksheetInfo.sourceCode"></CellInfo>
  36. <CellInfo
  37. label="报修部门"
  38. :value="worksheetInfo.repairsDeptName"
  39. ></CellInfo>
  40. <CellInfo
  41. label="报修人"
  42. :value="worksheetInfo.repairsPerson"
  43. ></CellInfo>
  44. <CellInfo
  45. label="报修人电话"
  46. :value="worksheetInfo.repairsDeptPhone"
  47. ></CellInfo>
  48. <CellInfo
  49. label="期望完成时间"
  50. :value="worksheetInfo.expectedTime"
  51. ></CellInfo>
  52. <CellInfo
  53. label="故障描述"
  54. :value="worksheetInfo.repairsDescription"
  55. ></CellInfo>
  56. <view class="CellInfo">
  57. <view class="label"> 接收人 </view>
  58. <view class="wrap">
  59. <view
  60. class="jbr"
  61. v-for="item in worksheetInfo.receiveUser"
  62. :key="item.receiveUserId"
  63. >
  64. {{ item.receiveUserName }}
  65. </view>
  66. </view>
  67. </view>
  68. <view class="CellInfo">
  69. <view class="label"> 图片 </view>
  70. <view class="wrap">
  71. <image
  72. @click="clickImg(worksheetInfo.repairsImg, item)"
  73. class="img"
  74. :src="apiUrl + item"
  75. v-for="(item, index) in worksheetInfo.repairsImg"
  76. :key="index"
  77. ></image>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 设备信息 -->
  82. <view class="" v-show="pickTabIndex == 1">
  83. <CellInfo label="设备编码" :value="device.assetCode"></CellInfo>
  84. <CellInfo label="设备名称" :value="device.assetName"></CellInfo>
  85. <CellInfo
  86. label="设备分类"
  87. :value="device.assetTypeDESC"
  88. ></CellInfo>
  89. <!-- <CellInfo label="报修单号" :value="worksheetInfo.createUserName"></CellInfo> -->
  90. <CellInfo label="固资编码" :value="device.fixAssetCode"></CellInfo>
  91. <CellInfo label="规格型号" :value="device.specification"></CellInfo>
  92. <CellInfo label="权属部门" :value="device.ownershipDeptName"></CellInfo>
  93. <CellInfo label="权属人" :value="device.ownershipUserName"></CellInfo>
  94. <CellInfo label="权属人电话" :value="device.ownershipUserMobile"></CellInfo>
  95. <CellInfo label="设备地址" :value="position"></CellInfo>
  96. </view>
  97. <!-- 维修信息 -->
  98. <view class="wxxx" v-show="pickTabIndex == 2">
  99. <!-- 步骤条 -->
  100. <maintain_course
  101. :repairInfoLogList="worksheetInfo.repairInfoLogs"
  102. ></maintain_course>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import CellInfo from '@/components/CellInfo.vue'
  109. import Step from '@/components/Step/Step.vue'
  110. import StepItem from '@/components/Step/StepItem.vue'
  111. import maintain_course from '@/pages/maintain_service/components/maintain_course.vue'
  112. import { get, postJ } from '@/utils/api.js'
  113. export default {
  114. components: {
  115. CellInfo,
  116. Step,
  117. StepItem,
  118. maintain_course
  119. },
  120. data () {
  121. return {
  122. tabList: [
  123. {
  124. label: '报修信息',
  125. value: '1'
  126. },
  127. {
  128. label: '设备信息',
  129. value: '2'
  130. },
  131. {
  132. label: '维修信息',
  133. value: '3'
  134. }
  135. ],
  136. pickTabIndex: 0,
  137. pageId: '',
  138. worksheetInfo: {},
  139. // 设备信息
  140. device: {}
  141. }
  142. },
  143. computed: {
  144. // 设备地址
  145. position () {
  146. let item = Object.keys(this.device)
  147. if (item.length > 0) {
  148. // 厂房
  149. let positionWorkshop = this.device.factoryPlantName || ''
  150. // 产线
  151. let positionLine = this.device.lineName || ''
  152. // 车间
  153. let positionFarm = this.device.workshopName || ''
  154. // 工位
  155. let positionFactory = this.device.positionFactory || ''
  156. let list = [
  157. positionWorkshop,
  158. positionLine,
  159. positionFarm,
  160. positionFactory
  161. ]
  162. return list.join('-')
  163. } else {
  164. return ''
  165. }
  166. }
  167. },
  168. async onLoad (options) {
  169. this.pageId = options.id
  170. await this.getInfo()
  171. this.getDevice()
  172. },
  173. onShow () {},
  174. methods: {
  175. getInfo () {
  176. return get(this.apiUrl + '/repair/info/getDetail/' + this.pageId).then(
  177. res => {
  178. if (res.success) {
  179. res.data.receiveUser = JSON.parse(res.data.receiveUser)
  180. if (res.data.repairsImg) {
  181. res.data.repairsImg = res.data.repairsImg.split(',')
  182. } else {
  183. res.data.repairsImg = []
  184. }
  185. res.data.repairInfoLogs = res.data.repairInfoLogs.reverse()
  186. res.data.repairInfoLogs = res.data.repairInfoLogs.map(n => {
  187. if (n.content) {
  188. n.content = JSON.parse(n.content)
  189. }
  190. return n
  191. })
  192. this.worksheetInfo = res.data
  193. }
  194. }
  195. )
  196. },
  197. changeChartsTab (index) {
  198. this.pickTabIndex = index
  199. },
  200. // 获取设备信息
  201. getDevice () {
  202. let par = {
  203. code: this.worksheetInfo.equiCode
  204. }
  205. get(this.apiUrl + '/asset/detail', par).then(res => {
  206. if (res.success) {
  207. this.device = res.data
  208. }
  209. })
  210. },
  211. // 查看图片
  212. clickImg (urls, indexUrl) {
  213. urls = urls.map(n => {
  214. return this.apiUrl + n
  215. })
  216. wx.previewImage({
  217. urls: urls, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  218. current: this.apiUrl + indexUrl, // 当前显示图片的http链接,默认是第一个
  219. success: function (res) {},
  220. fail: function (res) {},
  221. complete: function (res) {}
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .wxxx {
  229. padding-bottom: 20rpx;
  230. }
  231. .tab-title {
  232. position: fixed;
  233. width: 100%;
  234. display: flex;
  235. justify-content: space-between;
  236. height: 82rpx;
  237. line-height: 82rpx;
  238. background-color: #ffffff;
  239. border-bottom: 1px solid #f2f2f2;
  240. z-index: 99;
  241. box-sizing: border-box;
  242. .tab-item {
  243. width: 50%;
  244. text-align: center;
  245. font-size: 32rpx;
  246. color: $uni-text-color-grey;
  247. }
  248. .tab-item.active {
  249. color: $j-primary-border-green;
  250. border-bottom: 1px solid $j-primary-border-green;
  251. }
  252. }
  253. .fixed {
  254. position: fixed;
  255. width: 100%;
  256. left: 0;
  257. }
  258. .add {
  259. bottom: 0;
  260. }
  261. .main {
  262. border-top: 10px solid #f0f0f0;
  263. margin-top: 42px;
  264. }
  265. .step-title {
  266. display: flex;
  267. justify-content: space-between;
  268. .s1 {
  269. }
  270. }
  271. .list-xs {
  272. .list-xs-item {
  273. color: #7f7f7f;
  274. display: flex;
  275. .label {
  276. font-size: 28rpx;
  277. width: 120rpx;
  278. text-align: right;
  279. margin-right: 20rpx;
  280. }
  281. .value {
  282. font-size: 28rpx;
  283. &.bj {
  284. padding: 10rpx 0;
  285. color: #4f7f00;
  286. }
  287. }
  288. & + .list-xs-item {
  289. margin-top: 10rpx;
  290. }
  291. }
  292. .img-wrap {
  293. padding-left: 140rpx;
  294. margin-top: 20rpx;
  295. display: flex;
  296. flex-wrap: wrap;
  297. margin-left: -20rpx;
  298. .img {
  299. width: 160rpx;
  300. height: 120rpx;
  301. margin-left: 20rpx;
  302. margin-bottom: 20rpx;
  303. }
  304. }
  305. }
  306. .CellInfo {
  307. padding: 10px 0;
  308. display: flex;
  309. border-bottom: 1px solid #d8d8d8;
  310. .label {
  311. color: #999;
  312. text-align: right;
  313. max-width: 104px;
  314. font-size: 32rpx;
  315. padding: 0 15px;
  316. flex: 1;
  317. }
  318. .wrap {
  319. flex: 1;
  320. display: flex;
  321. flex-wrap: wrap;
  322. .img {
  323. width: 80px;
  324. height: 60px;
  325. margin: 5px;
  326. }
  327. .jbr {
  328. background-color: rgba(242, 242, 242, 1);
  329. padding: 10rpx;
  330. font-size: 28rpx;
  331. margin-left: 10rpx;
  332. margin-bottom: 10rpx;
  333. }
  334. }
  335. }
  336. </style>