1.完善导入建垛功能

master
x_z 3 years ago
parent 92c66ac8f6
commit f873639c95

@ -31,3 +31,11 @@ export function uploadStack(data) {
data: data data: data
}); });
} }
export function importStackOrder(data) {
return axios({
url: "/udims/stack/order/importStackOrder",
method: "post",
data: data
})
}

@ -104,13 +104,13 @@
class="upload" class="upload"
:action="this.uploadUrl" :action="this.uploadUrl"
:before-upload="beforeUpload" :before-upload="beforeUpload"
on-success="uploadHandleSuccess" :on-success="uploadHandleSuccess"
:limit="3" :limit="3"
:file-list="fileList"> :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传 xls/xlsx 文件</div> <div slot="tip" class="el-upload__tip">只能上传 xls/xlsx 文件</div>
</el-upload> </el-upload>
<el-button type="primary" style="margin-top: 20px;">提交</el-button> <el-button type="primary" style="margin-top: 20px;" @click.native="importStackOrder">提交</el-button>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
@ -211,7 +211,7 @@
</template> </template>
<script> <script>
import {getStackOrderList, deleteStackOrder, updateStack, uploadStack} from "@/api/production/stackOrder"; import {getStackOrderList, deleteStackOrder, updateStack, uploadStack, importStackOrder} from "@/api/production/stackOrder";
import {getStackCodeList, deleteCode, addStackCode} from "@/api/production/stackCode"; import {getStackCodeList, deleteCode, addStackCode} from "@/api/production/stackCode";
import stackCode from "@/views/production/stackCode"; import stackCode from "@/views/production/stackCode";
import {isBlank} from "@/utils/strUtil"; import {isBlank} from "@/utils/strUtil";
@ -443,6 +443,8 @@ export default {
}, },
importStackCode() { importStackCode() {
this.importVisible = true; this.importVisible = true;
this.filePath = null;
this.fileList = [];
}, },
beforeUpload(file) { beforeUpload(file) {
let fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1); let fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
@ -455,18 +457,34 @@ export default {
}, },
uploadHandleSuccess(response) { uploadHandleSuccess(response) {
if (response.code === 20000) { if (response.code === 20000) {
this.filePath = res.data.path; this.filePath = response.data.path;
} else { } else {
this.$message.error("上传失败:" + response.message); this.$message.error("上传失败:" + response.message);
} }
}, },
importStackOrder() {
if (isBlank(this.filePath)) {
this.$message.error("请上传文件")
return;
}
let params = {filePath: this.filePath};
importStackOrder(params).then((res) => {
if (res.code === 20000) {
this.$message.success("导入成功");
this.importVisible = false;
this.getList();
} else {
this.$message.error(res.message);
}
})
},
exportStackCode(orderId) { exportStackCode(orderId) {
}, },
}, },
created() { created() {
this.getList(); this.getList();
this.uploadUrl = BASE_URL + "/udims/stack/order/importStackOrder"; this.uploadUrl = BASE_URL + "/udims/stack/order/uploadStackFile";
}, },
}; };
</script> </script>

Loading…
Cancel
Save