Commit cd35987f by 胡悦

提交

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