|
@@ -87,7 +87,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <work-order-dialog ref="workOrderDialog" @event="setchecksuccess" v-if="inputData" :checksuccess="checksuccess" :data="inputData"></work-order-dialog>
|
|
|
+ <work-order-dialog ref="workOrderDialog" @resubmit="resubmitFrom" @event="setchecksuccess" :checksuccess="checksuccess" :data="inputData"></work-order-dialog>
|
|
|
</template>
|
|
|
|
|
|
|
|
@@ -120,11 +120,38 @@ const visible = ref(false);
|
|
|
const fullLoading = ref(false);
|
|
|
const addType = ref(1);
|
|
|
const webHost = import.meta.env.VITE_APP_BASE_API;
|
|
|
-const workOrderDialog = ref();
|
|
|
+const workOrderDialog = ref(null);
|
|
|
const checksuccess = ref(0);
|
|
|
const setchecksuccess = (val)=>{
|
|
|
checksuccess.value = val;
|
|
|
}
|
|
|
+let refile = null;
|
|
|
+const resubmitFrom = ()=>{
|
|
|
+ fullLoading.value = true;
|
|
|
+ visible.value = false;
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append("file", refile);
|
|
|
+ importLoop(formData).then((res)=>{
|
|
|
+ fullLoading.value = false;
|
|
|
+ proxy.$alert(
|
|
|
+ "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ res.msg +
|
|
|
+ "</div>",
|
|
|
+ "导入结果",
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
+ );
|
|
|
+ getList.value();
|
|
|
+ }).catch((e)=>{
|
|
|
+ fullLoading.value = false;
|
|
|
+ proxy.$alert(
|
|
|
+ "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ e.msg +
|
|
|
+ "</div>",
|
|
|
+ "导入结果",
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
+ );
|
|
|
+ });
|
|
|
+}
|
|
|
const setHeaders = {
|
|
|
Authorization: getToken(),
|
|
|
};
|
|
@@ -142,7 +169,7 @@ const uploadLoop = reactive({
|
|
|
// 设置上传的请求头部
|
|
|
headers: { Authorization: "Bearer " + getToken(), tenantId: getTenant() },
|
|
|
// 上传的地址
|
|
|
- url: "/ezhizao-yzbh-crm/upgrade/crm/order/importLoop",
|
|
|
+ url: "/ezhizao-yzbh-crm/upgrade/crm/order/checkInput",
|
|
|
});
|
|
|
const uploadOnce = reactive({
|
|
|
// 是否禁用上传
|
|
@@ -251,7 +278,6 @@ function cancel() {
|
|
|
}
|
|
|
|
|
|
function submitForm() {
|
|
|
-
|
|
|
submitFileForm();
|
|
|
}
|
|
|
|
|
@@ -266,8 +292,9 @@ const importTemplate = () => {
|
|
|
};
|
|
|
|
|
|
function handleBeforeUpload(file) {
|
|
|
- const formData = new FormData();
|
|
|
- formData.append("file", file);
|
|
|
+ //const formData = new FormData();
|
|
|
+ refile = file
|
|
|
+ // formData.append("file", file);
|
|
|
if (
|
|
|
file.type !==
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
|
|
@@ -277,29 +304,6 @@ function handleBeforeUpload(file) {
|
|
|
return false;
|
|
|
}
|
|
|
fullLoading.value = true;
|
|
|
- if(checksuccess.value === 0){
|
|
|
- checkInput(formData).then(res =>{
|
|
|
- fullLoading.value = false;
|
|
|
- inputData.value = res.data;
|
|
|
- if(res.data != null && res.msg !== "错误数据"){
|
|
|
- return Promise.resolve()
|
|
|
- }else if(res.msg === "错误数据"){
|
|
|
- return Promise.reject(res.data);
|
|
|
- }
|
|
|
- }).then(()=>{
|
|
|
- workOrderDialog.value.open()
|
|
|
- }).catch((res)=>{
|
|
|
- fullLoading.value = false;
|
|
|
- proxy.$alert(
|
|
|
- "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- res +
|
|
|
- "</div>",
|
|
|
- "导入结果",
|
|
|
- { dangerouslyUseHTMLString: true }
|
|
|
- );
|
|
|
- })
|
|
|
- return false;
|
|
|
- }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -313,24 +317,30 @@ const handleFileUploadProgress = (event, file, fileList) => {
|
|
|
};
|
|
|
/** 文件上传成功处理 */
|
|
|
const handleFileSuccess = (response, file, fileList) => {
|
|
|
+ inputData.value = response.data;
|
|
|
fullLoading.value = false;
|
|
|
checksuccess.value = 0;
|
|
|
- if (addType === 1) {
|
|
|
+ if (addType.value === 1) {
|
|
|
uploadLoop.open = false;
|
|
|
uploadLoop.isUploading = false;
|
|
|
- proxy.$refs["uploadRef"].handleRemove(file);
|
|
|
- proxy.$alert(
|
|
|
- "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- response.msg +
|
|
|
- "</div>",
|
|
|
- "导入结果",
|
|
|
- { dangerouslyUseHTMLString: true }
|
|
|
- );
|
|
|
+ if("错误数据" === response.msg){
|
|
|
+ proxy.$alert(
|
|
|
+ "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ response.data +
|
|
|
+ "</div>",
|
|
|
+ "导入结果",
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
+ );
|
|
|
+ }else{
|
|
|
+ workOrderDialog.value.open();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
getList.value();
|
|
|
} else {
|
|
|
+ fullLoading.value = false;
|
|
|
uploadOnce.open = false;
|
|
|
uploadOnce.isUploading = false;
|
|
|
- proxy.$refs["uploadRef"].handleRemove(file);
|
|
|
proxy.$alert(
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
response.msg +
|
|
@@ -341,6 +351,10 @@ const handleFileSuccess = (response, file, fileList) => {
|
|
|
getList.value();
|
|
|
}
|
|
|
};
|
|
|
+function remove(files, fileList) {
|
|
|
+ // file = files;
|
|
|
+ // importLoop(file).then(res =>{})
|
|
|
+}
|
|
|
/** 提交上传文件 */
|
|
|
function submitFileForm() {
|
|
|
proxy.$refs["uploadRef"].submit();
|