index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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: 'insideCode',
  100. width: '120px'
  101. }
  102. },
  103. {
  104. columnAttributes: {
  105. label: '外机条码',
  106. prop: 'outCode',
  107. width: '120px'
  108. }
  109. },
  110. {
  111. columnAttributes: {
  112. label: '负责工程师',
  113. prop: 'workerName'
  114. }
  115. },
  116. {
  117. columnAttributes: {
  118. label: '联系电话',
  119. prop: 'workerMobile'
  120. }
  121. },
  122. {
  123. columnAttributes: {
  124. label: '状态',
  125. prop: 'status'
  126. }
  127. },
  128. {
  129. columnAttributes: {
  130. label: '采集时间',
  131. prop: 'giveTime'
  132. }
  133. },
  134. {
  135. columnAttributes: {
  136. label: '采集地址',
  137. prop: 'sumbitAddress',
  138. width: 260
  139. }
  140. },
  141. {
  142. columnAttributes: {
  143. label: '最后采集图片时 (总部结算--GPS定位地址)',
  144. prop: 'giveAddress',
  145. width: 260
  146. }
  147. }
  148. ]
  149. },
  150. repairInfo() {
  151. return [
  152. {
  153. name: 'el-input',
  154. md: 14,
  155. attributes: { disabled: true, placeholder: '' },
  156. formItemAttributes: { label: '故障现象', prop: 'bugRemark' }
  157. },
  158. {
  159. name: 'el-radio',
  160. options: [
  161. { label: '是', value: 'YES' },
  162. { label: '否', value: 'NO' }
  163. ],
  164. md: 10,
  165. attributes: { disabled: true, placeholder: '' },
  166. formItemAttributes: { label: '是否质保', prop: 'isDefend' }
  167. },
  168. {
  169. name: 'el-input',
  170. md: 24,
  171. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  172. formItemAttributes: { label: '备注', prop: 'detailRemark' }
  173. }
  174. ]
  175. },
  176. INSTALL_pgOrderProductImgs() {
  177. return [
  178. {
  179. md: 24,
  180. name: 'slot-component',
  181. formItemAttributes: {
  182. label: '',
  183. prop: '',
  184. 'label-width': '0px'
  185. },
  186. render: (h, { props, onInput }) => {
  187. return (
  188. <ImageUpload
  189. fileList={this.formData?.pgOrderProductDetails
  190. ?.filter(item => item.type === 'INSTALL')
  191. .map(item => ({ url: item.fileUrl, name: item.fileName }))}
  192. limit={1000}
  193. isEdit={false}
  194. viewOnline={false}
  195. download={false}
  196. showName={true}
  197. />
  198. )
  199. }
  200. },
  201. {
  202. show: this.formData.pgOrderBase && this.formData.pgOrderBase.orderType == 'INSTALL',
  203. name: 'el-input',
  204. md: 24,
  205. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  206. formItemAttributes: { label: '备注', prop: 'detailRemark' }
  207. }
  208. ]
  209. },
  210. BUG_pgOrderProductImgs() {
  211. return [
  212. {
  213. md: 24,
  214. name: 'slot-component',
  215. formItemAttributes: {
  216. label: '',
  217. prop: '',
  218. 'label-width': '0px'
  219. },
  220. render: (h, { props, onInput }) => {
  221. return (
  222. <ImageUpload
  223. fileList={this.formData?.pgOrderProductDetails
  224. ?.filter(item => item.type === 'BUG')
  225. .map(item => ({ url: item.fileUrl, name: item.fileName }))}
  226. limit={1000}
  227. isEdit={false}
  228. viewOnline={false}
  229. download={false}
  230. showName={true}
  231. />
  232. )
  233. }
  234. }
  235. ]
  236. }
  237. },
  238. watch: {
  239. id: {
  240. handler(newVal, oldVal) {
  241. if (this.id) {
  242. changeOrderGetOrderProduct({
  243. id: this.id
  244. }).then(res => {
  245. console.log(res.data)
  246. this.completeDetailData = res.data.map(item => {
  247. return {
  248. ...item,
  249. status: { WAIT: '待采集', WAIT_SAVE: '待完善', WAIT_OK: '临时采集', OK: '已采集' }[item.status]
  250. }
  251. })
  252. })
  253. }
  254. },
  255. deep: true,
  256. immediate: true
  257. },
  258. detailId: {
  259. handler(newVal, oldVal) {
  260. if (this.detailId) {
  261. changeOrderProductDetail({
  262. id: this.detailId
  263. }).then(res => {
  264. this.formData = res.data
  265. console.log(res)
  266. })
  267. }
  268. },
  269. deep: true
  270. }
  271. },
  272. methods: {
  273. close() {
  274. this.$data.formData = this.$options.data().formData
  275. this.detailId = ''
  276. }
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .neibuview {
  282. box-sizing: border-box;
  283. padding-left: 16px;
  284. ::v-deep & > .zj-page-fill-scroll {
  285. box-sizing: border-box;
  286. padding-right: 16px;
  287. & > div:nth-child(1) {
  288. margin-top: 20px;
  289. }
  290. }
  291. }
  292. </style>