Merge branch 'dev-sws' into dev-yxl

v1.0.0
于肖磊 2024-10-11 16:38:29 +08:00
commit 9a7803366d
4 changed files with 68 additions and 36 deletions

View File

@ -30,7 +30,12 @@
</template>
</el-upload>
</div>
<el-button @click="clear_list_event"></el-button>
<div class="flex-row align-c gap-10 size-12">
<div class="cr-success">上传成功:{{ form.file.filter((obj) => obj.status == 'success').length }}</div>
<div class="cr-error">上传失败:{{ form.file.filter((obj) => obj.status == 'error').length }}</div>
<div>等待上传:{{ form.file.filter((obj) => obj.status == 'ready').length }}</div>
<el-button @click="clear_list_event"></el-button>
</div>
</div>
<div class="table mt-10">
<div class="table-header">

View File

@ -9,7 +9,12 @@ const message_error = (info: string) => {
if (messageInstance) {
messageInstance.close();
}
messageInstance = ElMessage.error(info);
messageInstance = ElMessage.error({
type: 'error',
message: info,
duration: 30000,
showClose: true,
});
};
// 创建一个状态变量来跟踪是否已经弹出了退出登录的弹窗
@ -20,7 +25,7 @@ const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API : pro_url + '?s=',
timeout: 50000,
timeout: 3000,
headers: { 'Content-Type': 'application/json;charset=utf-8' },
});
/** @ts-ignore */
@ -68,10 +73,13 @@ service.interceptors.response.use(
}
},
(error: any) => {
if (error.response.data) {
if (error.response && error.response.data) {
const { msg, message } = error.response.data;
message_error(msg || message || '系统出错');
} else {
message_error(error.message);
}
return Promise.reject(error.message);
}
);

View File

@ -16,8 +16,8 @@
<div class="nav-right">
<el-button class="btn-plain" @click="upload_manage"></el-button>
<el-button class="btn-plain" @click="preview_event"></el-button>
<el-button class="btn-plain" :disabled="saveDisabled" @click="save_event"></el-button>
<el-button class="btn-white" :disabled="saveDisabled" @click="save_close_event"></el-button>
<el-button class="btn-plain" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_event"></el-button>
<el-button class="btn-white" :class="saveDisabled ? 'disabled' : ''" :disabled="saveDisabled" @click="save_close_event"></el-button>
</div>
</div>
<el-dialog v-model="dialog_visible" class="radius-lg" width="650" draggable :close-on-click-modal="false" append-to-body>
@ -166,6 +166,14 @@ const confirm_event = async (formEl: FormInstance | undefined) => {
border-color: #fff;
color: $cr-primary;
}
&.disabled {
opacity: 0.5;
&:hover {
background-color: transparent;
border-color: #fff;
color: #fff;
}
}
}
.btn-white {
background-color: #fff;
@ -176,6 +184,14 @@ const confirm_event = async (formEl: FormInstance | undefined) => {
border-color: #1e7ede;
color: #fff;
}
&.disabled {
opacity: 0.5;
&:hover {
background-color: #fff;
border-color: #fff;
color: $cr-primary;
}
}
}
}
}

View File

@ -156,7 +156,7 @@ const init = () => {
//
const data_merge = (list: string[]) => {
list.forEach((item: any) => {
item.com_data = default_merge(item.com_data, item.key);;
item.com_data = default_merge(item.com_data, item.key);
});
return list;
};
@ -291,38 +291,41 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
});
//
const new_data = diy_data_transfor_form_data(clone_form);
DiyAPI.save(new_data).then((res) => {
//
if (!(is_export || is_preview)) {
ElMessage.success('保存成功');
}
if (close) {
ElMessageBox.confirm('您确定要关闭本页吗?', '提示')
.then(() => {
//
window.close();
})
.catch(() => {});
} else {
//
if (is_export) {
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
const new_url = import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url;
window.open(new_url + '?s=diyapi/diydownload/id/' + res.data + '.html', '_blank');
DiyAPI.save(new_data)
.then((res) => {
setTimeout(() => {
save_disabled.value = false;
}, 500);
//
if (!(is_export || is_preview)) {
ElMessage.success('保存成功');
}
if (is_preview) {
preview_dialog.value = true;
diy_id.value = String(res.data);
if (close) {
ElMessageBox.confirm('您确定要关闭本页吗?', '提示')
.then(() => {
//
window.close();
})
.catch(() => {});
} else {
//
if (is_export) {
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
const new_url = import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url;
window.open(new_url + '?s=diyapi/diydownload/id/' + res.data + '.html', '_blank');
}
if (is_preview) {
preview_dialog.value = true;
diy_id.value = String(res.data);
}
form.value.id = String(res.data);
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
}
form.value.id = String(res.data);
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
}
setTimeout(() => {
})
.catch((err) => {
save_disabled.value = false;
}, 500);
});
});
};
//#endregion ---------------------end
//