Commit cd35987f by 胡悦

提交

1 parent e5022f66
<script lang="ts" setup>
import { useRouter } from "vue-router";
import { reactive, onMounted } from 'vue'
import { useRouter, useRoute } from "vue-router";
import { reactive, onMounted, toRefs } from 'vue'
import { DataInfo } from "./addInterface";
import AddForm from "./components/AddForm.vue";
let route = useRoute()
let { query } = toRefs(route)
const router = useRouter();
const form = reactive<Partial<DataInfo>>({
name: ''
......@@ -19,10 +21,10 @@ const handleSubmit = () => {
<template>
<a-breadcrumb>
<a-breadcrumb-item class="back" @click="back">投资者相关</a-breadcrumb-item>
<a-breadcrumb-item>新增公告</a-breadcrumb-item>
<a-breadcrumb-item>{{query.id ? '编辑' : '新增'}}公告</a-breadcrumb-item>
</a-breadcrumb>
<div class="add-box">
<a-page-header :style="{ background: 'var(--color-bg-2)' }" title="新增公告" :show-back="false"></a-page-header>
<a-page-header :style="{ background: 'var(--color-bg-2)' }" :title="`${query.id ? '编辑' : '新增'}公告`" :show-back="false"></a-page-header>
<div class="form">
<AddForm></AddForm>
</div>
......
......@@ -3,16 +3,23 @@
* @Author: huyue
* @Date: 2024-07-26 10:46:04
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 16:13:48
* @LastEditTime: 2024-07-29 17:17:48
-->
<script lang="ts" setup>
import { reactive, ref, nextTick } from "vue";
import { reactive, ref, nextTick, toRefs, onMounted } from "vue";
import { DataInfo } from "../addInterface";
import {RequestOption, FileItem} from "@arco-design/web-vue"
import { req, uploadReq } from "../../../utils/request";
import { getImageUrl } from "@/utils/common"
import { Message } from '@arco-design/web-vue';
import * as dayjs from 'dayjs'
import { useRoute } from "vue-router";
let route = useRoute()
let { query } = toRefs(route)
onMounted(() => {
console.log(query.value);
});
const form = reactive<Partial<DataInfo>>({
name: "",
gwInvnoticeTypeId: "",
......@@ -75,7 +82,7 @@ const handleSubmit = async () => {
const invnoticeProductList = getParams()
const res = await req("gw.api.invnotice.addInvnoticeProduct", { invnoticeProductList })
console.log(res)
Message.success("新增成功")
if(res) Message.success("新增成功")
}
})
formRef.value.clearValidate('invnoticeProductList')
......@@ -93,14 +100,16 @@ const getParams = () => {
{ title: '', tags: '', filePath: '', languageCode: language['u'] },
{ title: '', tags: '', filePath: '', languageCode: language['e'] }
];
const invnoticeProductList = new Array(len).fill({
systemPublishTime: sendType == 2 ? systemPublishTime : '', // 系统发布时间
const invnotice = {
// systemPublishTime: sendType == 2 ? systemPublishTime : null, // 系统发布时间
oaScreenshotUrl: oaFile, // OA截图
externalReleaseDate: externalReleaseDate, // 外网发布时间
invnoticeProductTranslationsList: invnoticeProductTranslationsList, // 新增公告list
gwInvnoticeTypeId: gwInvnoticeTypeId.gwInvnoticeTypeId, // 公告类型
sendType // 发布类型
})
} as DataInfo
if (sendType == 2) invnotice.systemPublishTime = systemPublishTime
const invnoticeProductList = new Array(len).fill(invnotice)
Object.keys(language).forEach((l, index) => {
for (let i = 0; i < len; i++) {
invnoticeProductList[i].invnoticeProductTranslationsList[index].title = form[`${l}_title${i+1}`];
......@@ -146,6 +155,14 @@ const getList = async () => {
const res = await req("gw.api.invnotice.findAllTypeByLanguageCode");
data.sectionList = res;
};
const findById = async () => {
const id = query.value.id
const res = await req("gw.api.invnotice.findById", { id });
console.log(res)
// form = res;
// data.childPass = res.childPass;
}
findById()
getList();
/** 自定义上传 */
// 图片的
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2024-07-23 16:43:07
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 16:21:16
* @LastEditTime: 2024-07-29 16:57:27
-->
<!--
* @Description:
......@@ -13,7 +13,7 @@
* @LastEditTime: 2024-07-29 15:46:54
-->
<script lang="ts" setup>
import { h, reactive } from "vue";
import { h, reactive, ref } from "vue";
import { useRouter } from "vue-router";
import { DataInfo, TableItem, BasicItem } from "./interface";
import { req } from "../../utils/request";
......@@ -28,7 +28,8 @@ const data = reactive<Partial<DataInfo>>({
pageNum: 1,
pageSize: 10
},
imgVisible: false
imgVisible: false,
imgUrl: ''
})
/** table列配置 */
const columns = [
......@@ -57,7 +58,6 @@ const columns = [
const vnode = (record: Partial<TableItem>) => {
const { invnoticeProductTranslationsList, externalReleaseDate, zhTag } = record;
const _CN = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode == 'zh-CN')
console.log(_CN)
const _US = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode == 'en-US')
const _TW = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode == 'zh-TW')
return h('div', {}, [
......@@ -147,10 +147,16 @@ const down = (record: Partial<TableItem>) => {
}
const edit = (record: Partial<TableItem>) => {
router.push({
path: "/layout/addInvnotice",
query: {
id: record?.id
}
});
}
const previewOA = () => {
const previewOA = (record: Partial<TableItem>) => {
data.imgVisible = true
data.imgUrl = record?.oaScreenshotUrl
}
// 接口定义、调用
const getList = async () => {
......@@ -191,9 +197,9 @@ getTableData()
<a-button type="text" @click="publish(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">发布</a-button>
<a-button type="text" @click="down(record)" v-if="record.systemPublishStatus === 3">下架</a-button>
<a-button type="text" @click="edit(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">编辑</a-button>
<a-button type="text" @click="previewOA">OA截图</a-button>
<a-button type="text" @click="previewOA(record)">OA截图</a-button>
<a-image-preview
:src="record.oaScreenshotUrl"
:src="data.imgUrl"
v-model:visible="data.imgVisible"
/>
</template>
......
......@@ -20,6 +20,7 @@ export interface DataInfo {
total: Number;
page: Page;
imgVisible: Boolean;
imgUrl: String;
}
export interface TableItem {
......@@ -31,4 +32,5 @@ export interface TableItem {
invnoticeProductTranslationsList: Partial<BasicItem>[],
externalReleaseDate: String;
zhTag: String;
oaScreenshotUrl: String;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!