Commit cfc5f479 by 前端

add

1 parent 5e660d86
...@@ -14,9 +14,9 @@ import { getImageUrl } from "@/utils/common"; ...@@ -14,9 +14,9 @@ import { getImageUrl } from "@/utils/common";
import { Message } from "@arco-design/web-vue"; import { Message } from "@arco-design/web-vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import * as dayjs from "dayjs"; import * as dayjs from "dayjs";
let route = useRoute() let route = useRoute();
const router = useRouter() const router = useRouter();
let { query } = toRefs(route) let { query } = toRefs(route);
let form = reactive<Partial<DataInfo>>({ let form = reactive<Partial<DataInfo>>({
name: "", name: "",
gwInvnoticeTypeId: "", gwInvnoticeTypeId: "",
...@@ -83,11 +83,11 @@ const handleSubmit = async () => { ...@@ -83,11 +83,11 @@ const handleSubmit = async () => {
const invnoticeProductList = getParams(); const invnoticeProductList = getParams();
if (query.value.id) { if (query.value.id) {
const res = await req("gw.api.invnotice.updateInvnoticeProduct", { const res = await req("gw.api.invnotice.updateInvnoticeProduct", {
invnoticeProduct: invnoticeProductList[0] invnoticeProduct: invnoticeProductList[0],
}) });
if (res) { if (res) {
Message.success("修改成功"); Message.success("修改成功");
router.back() router.back();
} }
} else { } else {
const res = await req("gw.api.invnotice.addInvnoticeProduct", { const res = await req("gw.api.invnotice.addInvnoticeProduct", {
...@@ -126,12 +126,12 @@ const getParams = () => { ...@@ -126,12 +126,12 @@ const getParams = () => {
invnoticeProductTranslationsList: [], // 新增公告list invnoticeProductTranslationsList: [], // 新增公告list
gwInvnoticeTypeId, // 公告类型 gwInvnoticeTypeId, // 公告类型
sendType, // 发布类型 sendType, // 发布类型
} as DataInfo } as DataInfo;
if (query.value.id) { if (query.value.id) {
invnoticeTemplate.id = +query.value.id invnoticeTemplate.id = +query.value.id;
invnoticeTemplate.modifiedBy = 'admin' invnoticeTemplate.modifiedBy = "admin";
} else { } else {
invnoticeTemplate.createdBy = 'admin' invnoticeTemplate.createdBy = "admin";
} }
// const invnoticeProductList = new Array(len).fill(invnotice); // const invnoticeProductList = new Array(len).fill(invnotice);
const invnoticeProductList = new Array(len).fill(null).map(() => ({ const invnoticeProductList = new Array(len).fill(null).map(() => ({
...@@ -140,11 +140,12 @@ const getParams = () => { ...@@ -140,11 +140,12 @@ const getParams = () => {
})); }));
Object.keys(language).forEach((l, index) => { Object.keys(language).forEach((l, index) => {
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
invnoticeProductList[i].invnoticeProductTranslationsList[index].title = form[`${l}_title${i + 1}`]; invnoticeProductList[i].invnoticeProductTranslationsList[index] = {
invnoticeProductList[i].invnoticeProductTranslationsList[index].tags = form[`${l}_tags${i + 1}`]; title: form[`${l}_title${i + 1}`],
invnoticeProductList[i].invnoticeProductTranslationsList[index].filePath = form[`${l}_filePath${i + 1}`]; tags: form[`${l}_tags${i + 1}`],
invnoticeProductList[i].invnoticeProductTranslationsList[index].languageCode = language[l]; filePath: form[`${l}_filePath${i + 1}`],
console.log(i, l) languageCode: language[l],
};
} }
}); });
...@@ -179,8 +180,8 @@ const addInvnotice = () => { ...@@ -179,8 +180,8 @@ const addInvnotice = () => {
data.childPass.push(false); data.childPass.push(false);
}; };
onBeforeMount(() => { onBeforeMount(() => {
if (query.value.id) findById() if (query.value.id) findById();
}) });
/** 接口调用 */ /** 接口调用 */
/** 获取公告 */ /** 获取公告 */
const getList = async () => { const getList = async () => {
...@@ -188,39 +189,39 @@ const getList = async () => { ...@@ -188,39 +189,39 @@ const getList = async () => {
data.sectionList = res; data.sectionList = res;
}; };
const findById = async () => { const findById = async () => {
const id = query.value.id const id = query.value.id;
const res = await req("gw.api.invnotice.findById", { id }); const res = await req("gw.api.invnotice.findById", { id });
console.log(res) console.log(res);
const languageMap = { const languageMap = {
'zh-TW': 'e', "zh-TW": "e",
'en-US': 'u', "en-US": "u",
'zh-CN': 'c' "zh-CN": "c",
}; };
res.invnoticeProductTranslationsList.forEach((item: any, index: number) => { res.invnoticeProductTranslationsList.forEach((item: any, index: number) => {
const langPrefix = languageMap[item.languageCode]; const langPrefix = languageMap[item.languageCode];
form[`${langPrefix}_title1`] = item.title form[`${langPrefix}_title1`] = item.title;
form[`${langPrefix}_tags1`] = item.tags form[`${langPrefix}_tags1`] = item.tags;
form[`${langPrefix}_filePath1`] = item.filePath form[`${langPrefix}_filePath1`] = item.filePath;
}) });
// form = reactive(Object.assign({}, _form)) // form = reactive(Object.assign({}, _form))
form.sendType = res.sendType.toString() form.sendType = res.sendType.toString();
form.gwInvnoticeTypeId = res.gwInvnoticeTypeId form.gwInvnoticeTypeId = res.gwInvnoticeTypeId;
form.externalReleaseDate = res.externalReleaseDate form.externalReleaseDate = res.externalReleaseDate;
form.systemPublishTime = res.systemPublishTime form.systemPublishTime = res.systemPublishTime;
const fileList = [ const fileList = [
{ {
url: res.oaScreenshotUrl url: res.oaScreenshotUrl,
} },
] ];
form.oaFile = fileList form.oaFile = fileList;
// form.oaFile = 'https://wx.glsx.com.cn/upload/biz/fd433878-9963-4dce-ab5e-ecbf4aea5857.png' // form.oaFile = 'https://wx.glsx.com.cn/upload/biz/fd433878-9963-4dce-ab5e-ecbf4aea5857.png'
console.log(form) console.log(form);
// form = res; // form = res;
// data.childPass = res.childPass; // data.childPass = res.childPass;
// form = res; // form = res;
// data.childPass = res.childPass; // data.childPass = res.childPass;
} };
// if (query.value.id) findById() // if (query.value.id) findById()
getList(); getList();
/** 自定义上传 */ /** 自定义上传 */
...@@ -235,8 +236,8 @@ const customRequest = (option: RequestOption) => { ...@@ -235,8 +236,8 @@ const customRequest = (option: RequestOption) => {
console.log(res); console.log(res);
form.oaFile = [ form.oaFile = [
{ {
url: res url: res,
} },
]; ];
data.isLoading = false; data.isLoading = false;
onSuccess(res); onSuccess(res);
...@@ -286,7 +287,7 @@ const translateBase64 = (file: any, fileType: string) => { ...@@ -286,7 +287,7 @@ const translateBase64 = (file: any, fileType: string) => {
// resolve(filePath) // resolve(filePath)
// } // }
// }, 1000); // }, 1000);
resolve(res) resolve(res);
}; };
reader.onerror = (error) => reject(error); reader.onerror = (error) => reject(error);
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!