index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <zj-page-container>
  3. <zj-page-fill class="neibuview">
  4. <zj-form-container v-if="!detailId" key="completeDetail">
  5. <zj-form-module title="完工明细">
  6. <zj-table :columns="completeDetailColumns" :table-data="completeDetailData" />
  7. </zj-form-module>
  8. </zj-form-container>
  9. <zj-form-container v-else key="details">
  10. <template v-if="formData.pgOrderBase && formData.pgOrderBase.orderType !== 'INSTALL'">
  11. <zj-form-module title="维修信息" :form-data="formData" :form-items="repairInfo" />
  12. <zj-form-module title="采集图片" :form-data="formData" :form-items="INSTALL_pgOrderProductImgs" />
  13. <zj-form-module title="故障图片" :form-data="formData" :form-items="BUG_pgOrderProductImgs" />
  14. </template>
  15. <zj-form-module v-else title="采集信息" :form-data="formData" :form-items="INSTALL_pgOrderProductImgs" />
  16. </zj-form-container>
  17. </zj-page-fill>
  18. <div v-if="detailId" style="box-sizing: border-box; padding: 16px">
  19. <el-button @click="close" size="mini">关闭</el-button>
  20. </div>
  21. </zj-page-container>
  22. </template>
  23. <script>
  24. import { changeOrderGetOrderProduct, changeOrderProductDetail } from '@/api/workOrderPool.js'
  25. import ImageUpload from '@/components/file-upload'
  26. export default {
  27. components: {
  28. ImageUpload
  29. },
  30. props: {
  31. id: {
  32. type: [String, Number],
  33. default: null
  34. }
  35. },
  36. data() {
  37. return {
  38. completeDetailData: [],
  39. detailId: '',
  40. formData: {
  41. bugRemark: '',
  42. detailRemark: '',
  43. isDefend: '',
  44. pgOrderProductDetails: []
  45. }
  46. }
  47. },
  48. computed: {
  49. completeDetailColumns() {
  50. return [
  51. {
  52. columnAttributes: {
  53. label: '操作',
  54. prop: '',
  55. width: 60
  56. },
  57. render: (h, { row, column, index }) => {
  58. return (
  59. <div style="padding-left:10px">
  60. <el-button
  61. type="text"
  62. onClick={() => {
  63. this.detailId = row.id
  64. }}
  65. >
  66. 查看
  67. </el-button>
  68. </div>
  69. )
  70. }
  71. },
  72. {
  73. columnAttributes: {
  74. label: '品牌名称',
  75. prop: 'brandName'
  76. }
  77. },
  78. {
  79. columnAttributes: {
  80. label: '产品大类',
  81. prop: 'mainName'
  82. }
  83. },
  84. {
  85. columnAttributes: {
  86. label: '产品小类',
  87. prop: 'smallName'
  88. }
  89. },
  90. {
  91. columnAttributes: {
  92. label: '机型名称',
  93. prop: 'productName'
  94. }
  95. },
  96. {
  97. columnAttributes: {
  98. label: '负责工程师',
  99. prop: 'workerName'
  100. }
  101. },
  102. {
  103. columnAttributes: {
  104. label: '联系电话',
  105. prop: 'workerMobile'
  106. }
  107. },
  108. {
  109. columnAttributes: {
  110. label: '状态',
  111. prop: 'status'
  112. }
  113. },
  114. {
  115. columnAttributes: {
  116. label: '采集时间',
  117. prop: 'giveTime'
  118. }
  119. },
  120. {
  121. columnAttributes: {
  122. label: '采集地址',
  123. prop: 'sumbitAddress',
  124. width: 260
  125. }
  126. },
  127. {
  128. columnAttributes: {
  129. label: '最后采集图片时 (总部结算--GPS定位地址)',
  130. prop: 'giveAddress',
  131. width: 260
  132. }
  133. }
  134. ]
  135. },
  136. repairInfo() {
  137. return [
  138. {
  139. name: 'el-input',
  140. md: 14,
  141. attributes: { disabled: true, placeholder: '' },
  142. formItemAttributes: { label: '故障现象', prop: 'bugRemark' }
  143. },
  144. {
  145. name: 'el-radio',
  146. options: [
  147. { label: '是', value: 'YES' },
  148. { label: '否', value: 'NO' }
  149. ],
  150. md: 10,
  151. attributes: { disabled: true, placeholder: '' },
  152. formItemAttributes: { label: '是否质保', prop: 'isDefend' }
  153. },
  154. {
  155. name: 'el-input',
  156. md: 24,
  157. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  158. formItemAttributes: { label: '备注', prop: 'detailRemark' }
  159. }
  160. ]
  161. },
  162. INSTALL_pgOrderProductImgs() {
  163. return [
  164. {
  165. md: 24,
  166. name: 'slot-component',
  167. formItemAttributes: {
  168. label: '',
  169. prop: '',
  170. 'label-width': '0px'
  171. },
  172. render: (h, { props, onInput }) => {
  173. return (
  174. <ImageUpload
  175. fileList={this.formData?.pgOrderProductDetails
  176. ?.filter(item => item.type === 'INSTALL')
  177. .map(item => ({ url: item.fileUrl, name: item.fileName }))}
  178. limit={1000}
  179. isEdit={false}
  180. viewOnline={false}
  181. download={false}
  182. showName={true}
  183. />
  184. )
  185. }
  186. },
  187. {
  188. show: this.formData.pgOrderBase && this.formData.pgOrderBase.orderType == 'INSTALL',
  189. name: 'el-input',
  190. md: 24,
  191. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  192. formItemAttributes: { label: '备注', prop: 'detailRemark' }
  193. }
  194. ]
  195. },
  196. BUG_pgOrderProductImgs() {
  197. return [
  198. {
  199. md: 24,
  200. name: 'slot-component',
  201. formItemAttributes: {
  202. label: '',
  203. prop: '',
  204. 'label-width': '0px'
  205. },
  206. render: (h, { props, onInput }) => {
  207. return (
  208. <ImageUpload
  209. fileList={this.formData?.pgOrderProductDetails
  210. ?.filter(item => item.type === 'BUG')
  211. .map(item => ({ url: item.fileUrl, name: item.fileName }))}
  212. limit={1000}
  213. isEdit={false}
  214. viewOnline={false}
  215. download={false}
  216. showName={true}
  217. />
  218. )
  219. }
  220. }
  221. ]
  222. }
  223. },
  224. watch: {
  225. id: {
  226. handler(newVal, oldVal) {
  227. if (this.id) {
  228. changeOrderGetOrderProduct({
  229. id: this.id
  230. }).then(res => {
  231. this.completeDetailData = res.data.map(item => {
  232. return {
  233. ...item,
  234. status: { WAIT: '待采集', WAIT_SAVE: '待完善', WAIT_OK: '临时采集', OK: '已采集' }[item.status]
  235. }
  236. })
  237. })
  238. }
  239. },
  240. deep: true,
  241. immediate: true
  242. },
  243. detailId: {
  244. handler(newVal, oldVal) {
  245. if (this.detailId) {
  246. changeOrderProductDetail({
  247. id: this.detailId
  248. }).then(res => {
  249. this.formData = res.data
  250. console.log(res)
  251. })
  252. }
  253. },
  254. deep: true
  255. }
  256. },
  257. methods: {
  258. close() {
  259. this.$data.formData = this.$options.data().formData
  260. this.detailId = ''
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .neibuview {
  267. box-sizing: border-box;
  268. padding-left: 16px;
  269. ::v-deep & > .zj-page-fill-scroll {
  270. box-sizing: border-box;
  271. padding-right: 16px;
  272. & > div:nth-child(1) {
  273. margin-top: 20px;
  274. }
  275. }
  276. }
  277. </style>