fix:阳采

20240912_adapter
chenhc 1 week ago
parent be301ec430
commit 5fd0749dac

@ -10,7 +10,7 @@
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
"server": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack-dev-server --env.server --env.develop --inline --max-old-space-size=3000", "server": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack-dev-server --env.server --env.develop --inline --max-old-space-size=3000",
"dev": "vue-cli-service serve --open" "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --open"
}, },
"husky": { "husky": {
"hooks": { "hooks": {

@ -12,7 +12,7 @@
<el-button-group <el-button-group
style="display: flex; margin: 0px 0 15px 0; height: 35px;float: right" style="display: flex; margin: 0px 0 15px 0; height: 35px;float: right"
> >
<el-button size="mini" type="primary" @click="triggerFileUpload2" <el-button size="mini" type="primary" @click="triggerFileUpload2" icon="el-icon-upload"
> >
上传阳采单据 上传阳采单据
</el-button> </el-button>
@ -361,7 +361,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="viewType != 1"> <el-row v-if="viewType != 1">
<el-col :span="20"> <el-col :span="18">
<el-form-item prop="code" label="扫码录入校验:"> <el-form-item prop="code" label="扫码录入校验:">
<el-input <el-input
id="inputer" id="inputer"
@ -374,7 +374,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="4">
<el-button-group <el-button-group
style="display: flex; height: 35px"> style="display: flex; height: 35px">
<el-button <el-button
@ -389,11 +389,20 @@
size="mini" size="mini"
@click.native="selectOrder()" @click.native="selectOrder()"
v-if="curAction.checkWebNew != 2 || viewType !=1" v-if="curAction.checkWebNew != 2 || viewType !=1"
icon="el-icon-document-add"
>下载码上放心追溯码 >下载码上放心追溯码
<!-- v-if="(curAction.checkWebNew !== 2 || viewType !== 1) && orderFormData.billNo"--> <!-- v-if="(curAction.checkWebNew !== 2 || viewType !== 1) && orderFormData.billNo"-->
</el-button </el-button
> >
<el-button <el-button size="mini" type="primary" @click="triggerFileUpload" icon="el-icon-upload2"
v-if="curAction.checkWebNew != 2 || viewType !=1"
>
导入阳采追溯码
</el-button>
<!-- 隐藏的文件输入元素 -->
<input type="file" ref="fileInput" accept=".xlsx,.xls" style="display: none;" @change="handleFileUpload"/>
<el-button
type="primary" type="primary"
size="mini" size="mini"
v-if="curAction.useDyCount == 2" v-if="curAction.useDyCount == 2"
@ -828,9 +837,74 @@ export default {
} }
this.selectOrderVisible = true this.selectOrderVisible = true
}, },
triggerFileUpload() {
this.$refs.fileInput.click();
},
triggerFileUpload2() { triggerFileUpload2() {
this.$refs.fileInput2.click(); this.$refs.fileInput2.click();
}, },
handleFileUpload(event) {
const file = event.target.files[0];
const billNo = this.orderFormData.billNo;
const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/fileUpload';
if (this.$isBlank(this.orderFormData.billNo)) {
this.$message.error("单据编号不可以为空!");
return;
}
if (file) {
const formData = new FormData();
formData.append('billNo', billNo);
formData.append('file', file);
fetch(uploadUrl, {
method: 'POST',
headers: {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
},
body: formData,
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then(data => {
if (data.code === 20000) {
//
if (data.data && data.data.billNo) {
this.orderFormData.billNo = data.data.billNo;
}
//
this.isCodeAlive = false;
this.isBizDetailAlive = false;
this.isCodeDetailAlive = false;
this.$nextTick(() => {
this.isCodeAlive = true;
this.isBizDetailAlive = true;
this.isCodeDetailAlive = true;
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
this.$message.success("上传成功!");
});
} else {
this.$message.error(data.message);
}
})
.catch(error => {
console.error('File upload failed:', error);
this.$message.error('文件上传失败:' + error.message);
});
}
//
event.target.value = '';
},
handleFileUpload2(event) { handleFileUpload2(event) {
const file = event.target.files[0]; const file = event.target.files[0];
const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/orderFileUpload'; const uploadUrl = process.env.VUE_APP_BASE_API + '/udiwms/inout/order/yc/orderFileUpload';

Loading…
Cancel
Save