Commit 9e54eb34c543a2b73ae2c6a83980ed4692a2cea0

Authored by 严涛
1 parent 12b7d3a2

工艺路线调整

... ... @@ -86,3 +86,12 @@ export function uploadWarrantyCertificate(params) {
86 86 contentType: ContentTypeEnum.JSON
87 87 })
88 88 }
  89 +
  90 +// 根据ID获取历史生产工艺
  91 +export function getHistoryProductionProcessApi(id) {
  92 + return request({
  93 + url: `${baseUrl}/getHistoryProductionProcess`,
  94 + method: 'get',
  95 + params: { id }
  96 + })
  97 +}
... ...
... ... @@ -237,7 +237,7 @@
237 237 </template>
238 238
239 239 <script>
240   -import { getDetailApi, updateApi } from '@/api/order_list.js'
  240 +import { getDetailApi, updateApi, getHistoryProductionProcessApi } from '@/api/order_list.js'
241 241 import Product from './product.vue'
242 242 import SingleSelectSheet from '@/components/single-select/index.vue'
243 243 import { getDicName } from '@/utils/dic.js'
... ... @@ -284,6 +284,8 @@ export default {
284 284 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] },
285 285 sheet: { visible: false, title: '请选择', options: [], value: '', field: '' },
286 286 isReadonly: false,
  287 + historyProductionProcessLoaded: false,
  288 + historyProductionProcessLoading: false,
287 289 }
288 290 },
289 291 computed: {
... ... @@ -338,10 +340,33 @@ export default {
338 340 this.form = next;
339 341 this.initPurchaseOrderLineList = next.purchaseOrderLineList || [];
340 342 this.refreshStandardName()
  343 + this.fillHistoryProductionProcessIfNeeded()
341 344 } catch (e) {
342 345 uni.showToast({ title: '加载失败', icon: 'none' })
343 346 }
344 347 },
  348 + async fillHistoryProductionProcessIfNeeded() {
  349 + const m = this.form || {}
  350 + const id = m.id || m.code || ''
  351 + if (!id) return
  352 + if (!m.showProductionProcess) return
  353 + if (String(m.productionProcess || '').trim()) return
  354 + if (this.historyProductionProcessLoaded || this.historyProductionProcessLoading) return
  355 + this.historyProductionProcessLoading = true
  356 + try {
  357 + const res = await getHistoryProductionProcessApi(id)
  358 + const data = res && res.data ? res.data : {}
  359 + const text = (data && (data.productionProcess || data.historyProductionProcess || data.value)) ? String(data.productionProcess || data.historyProductionProcess || data.value) : ''
  360 + if (!String(this.form.productionProcess || '').trim() && text.trim()) {
  361 + this.form.productionProcess = text
  362 + }
  363 + this.historyProductionProcessLoaded = true
  364 + } catch (e) {
  365 + this.historyProductionProcessLoaded = true
  366 + } finally {
  367 + this.historyProductionProcessLoading = false
  368 + }
  369 + },
345 370 refreshStandardName() {
346 371 const est = (this.dicOptions.APPLICABLE_STANDARD || []).find(o => String(o.code) === String(this.form.executionStandard))
347 372 this.form.executionStandardName = est ? (est.name || '') : (this.form.executionStandardName || '')
... ...