diff --git a/src/api/qc/Inbound_notification.js b/src/api/qc/Inbound_notification.js index 893c90e..8291bcd 100644 --- a/src/api/qc/Inbound_notification.js +++ b/src/api/qc/Inbound_notification.js @@ -1,4 +1,5 @@ -import { createAPI } from "@/utils/httpRequest.js"; +import { createAPI, createFormAPI } from "@/utils/httpRequest.js"; +import httpRequest from '@/utils/httpRequest' // 查询收获入库单 export const searchInboundNotification = data => createAPI('/inbound/searchInboundNotification','post',data) @@ -30,3 +31,14 @@ export const getInboundCategoryList = data => createAPI('/inbound/getInboundCate // 查询部门列表 export const getDepartmentList = data => createAPI('/inbound/getDepartmentList','post',data) +// 标签导入 +export const labelImport = data => createFormAPI('/inbound/labelImport','post',data) +// 下载标签导入模板 +export const downloadLabelTemplate = () => { + return httpRequest({ + url: httpRequest.adornUrl('/inbound/downloadLabelTemplate'), + method: 'get', + responseType: 'blob' + }) +} + diff --git a/src/utils/httpRequest.js b/src/utils/httpRequest.js index 0105d14..b3015eb 100644 --- a/src/utils/httpRequest.js +++ b/src/utils/httpRequest.js @@ -167,3 +167,44 @@ export const createAPI = (url, method, data, type) => { ...config }) } + +// ============================= FormData上传请求 ============================= +const instanceForm = axios.create({ + baseURL: (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.baseUrl), + timeout: 10000 * 30, + withCredentials: true, + headers: { + 'Content-Type': 'multipart/form-data' + } +}) + +/** + * 请求拦截 + */ +instanceForm.interceptors.request.use(config => { + config.headers['token'] = Vue.cookie.get('token') // 请求头带上token + return config +}, error => { + return Promise.reject(error) +}) + +/** + * 响应拦截 + */ +instanceForm.interceptors.response.use(response => { + if (response.data && response.data.code === 401) { // 401, token失效 + clearLoginInfo() + router.push({ name: 'login' }) + } + return response +}, error => { + return Promise.reject(error) +}) + +export const createFormAPI = (url, method, data) => { + return instanceForm({ + url, + method, + data + }) +} diff --git a/src/views/modules/qc/inboundNotification.vue b/src/views/modules/qc/inboundNotification.vue index 52c097b..0da1da0 100644 --- a/src/views/modules/qc/inboundNotification.vue +++ b/src/views/modules/qc/inboundNotification.vue @@ -296,10 +296,11 @@ fixed="right" header-align="center" align="center" - width="90" + width="150" label="操作"> @@ -666,6 +667,9 @@ + + + @@ -691,12 +695,14 @@ } from "@/api/qc/qc.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import Chooselist from '@/views/modules/common/Chooselist_eam' + import LabelImportUpload from './label_import_upload' import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' import excel from "@/utils/excel-util.js" import {verifyData} from "@/api/chooselist/chooselist.js" export default { components: { Chooselist, + LabelImportUpload, }, data () { return { @@ -1995,6 +2001,30 @@ } }) }, + + // 标签导入 + labelImportModal (row) { + // 权限检查:与批量编辑按钮相同的权限控制 + if (this.currentRow.orderStatus !== '草稿' && this.currentRow.orderStatus !== '编辑中') { + this.$message.warning('只有草稿或编辑中状态的单据才能导入标签!') + return + } + // 准备传递给组件的数据 + let currentData = { + site: this.currentRow.site, + buNo: this.currentRow.buNo, + orderNo: this.currentRow.orderNo, + orderType: this.currentRow.orderType, + orderStatus: this.currentRow.orderStatus, + relatedOrderNo: row.relatedOrderNo, + relatedOrderLineNo: row.relatedOrderLineNo, + partNo: row.partNo + } + // 打开标签导入组件 + this.$nextTick(() => { + this.$refs.labelImportUpload.init(currentData) + }) + }, } } diff --git a/src/views/modules/qc/label_import_upload.vue b/src/views/modules/qc/label_import_upload.vue new file mode 100644 index 0000000..2d3c114 --- /dev/null +++ b/src/views/modules/qc/label_import_upload.vue @@ -0,0 +1,155 @@ + + + + +