新增修改信息

main
wangxia 2 years ago
parent 752a72bf35
commit 2d2aad731b

@ -193,26 +193,10 @@
// debugger // debugger
// editor.setDocument("text/lake", ' '); // editor.setDocument("text/lake", ' ');
console.log("event", event); console.log("event", event);
if (event.data.jobInfoYuQue) { var data = event.data;
editor.setDocument("text/lake", event.data.jobInfoYuQue);
}else if(event.data.jobInfo){
let arr = event.data.jobInfo.split("\n");
console.log(arr);
// let arr = event.data.trim().split("\n");
let newArr = [];
arr.forEach((item, index) => {
if (index >= 1) {
let item1 = "<p>" + item + "</p>";
newArr.push(item1);
}
});
var data = newArr.join(" ");
desp = data.replace(/[*]+/g, "");
console.log(desp);
// 然后就可以获得vue传过来的数据 // 然后就可以获得vue传过来的数据
console.log("从vue中获得的数据", event); console.log("从vue中获得的数据", data);
editor.setDocument("text/lake", desp); editor.setDocument("text/lake", data);
}
// var data = event.data.replace(/\n/g, "<br />"); // var data = event.data.replace(/\n/g, "<br />");
// desp = data.replace(/[*]+/g, ''); // desp = data.replace(/[*]+/g, '');
}, },

@ -1,4 +1,5 @@
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router' import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import noticeData from './modules/message.js';
const router = createRouter({ const router = createRouter({
@ -53,9 +54,9 @@ const router = createRouter({
meta: { meta: {
title: '消息通知', title: '消息通知',
}, },
component: () => import("../views/homePage/message.vue") component: () => import("../views/message/index.vue")
} }
] ].concat(noticeData)
}, },
{ {
path: '/login', path: '/login',

@ -0,0 +1,21 @@
let data = [
{
path: "/merchantManagement/messageAdd",
name: "messageAdd",
meta: {
title: '新增通知',
},
groupName: '消息通知',
component: () => import("../../views/message/add.vue")
},
{
path: "/merchantManagement/messageEdit",
name: "messageEdit",
meta: {
title: '编辑通知',
},
groupName: '消息通知',
component: () => import("../../views/message/add.vue")
},
];
export default data;

@ -79,6 +79,12 @@ watch(
} else if (val.name == "recruit") { } else if (val.name == "recruit") {
secondTitle.value = "配置详情"; secondTitle.value = "配置详情";
firstTitle.value = "小程序配置"; firstTitle.value = "小程序配置";
} else if (val.name == "messageAdd") {
secondTitle.value = "新增通知";
firstTitle.value = "消息通知";
} else if (val.name == "messageEdit") {
secondTitle.value = "编辑通知";
firstTitle.value = "消息通知";
} }
}, },
{ {
@ -113,6 +119,8 @@ const pushFirstPage = () => {
router.push("/merchantManagement/downstream"); router.push("/merchantManagement/downstream");
} else if (firstTitle.value == "小程序配置") { } else if (firstTitle.value == "小程序配置") {
router.push("/merchantManagement/miniProgramList"); router.push("/merchantManagement/miniProgramList");
} else if (firstTitle.value == "消息通知") {
router.push("/merchantManagement/message");
} }
}; };
</script> </script>

@ -57,7 +57,7 @@
</div> </div>
<a-divider class="g_mt_0 g_mb_20" /> <a-divider class="g_mt_0 g_mb_20" />
<div class="g_flex_row_between g_pl_24 g_pr_24 g_pb_20"> <div class="g_flex_row_between g_pl_24 g_pr_24 g_pb_20">
<a-table sticky :columns="columns" :data-source="gpjgList" size="middle" @change="tableChange" :pagination="false" class="g_clear_scroll" :scroll="{ x: '500px' }"> <a-table :columns="columns" :data-source="gpjgList" size="middle" @change="tableChange" :pagination="false" class="g_clear_scroll" :scroll="{ x: '500px' }">
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.key === 'name'"> <template v-if="column.key === 'name'">
<div class="g_fw_600">姓名</div> <div class="g_fw_600">姓名</div>
@ -76,7 +76,7 @@
</div> </div>
<a-divider class="g_mt_0 g_mb_20" /> <a-divider class="g_mt_0 g_mb_20" />
<div class="g_flex_row_between g_pl_24 g_pr_24 g_pb_20"> <div class="g_flex_row_between g_pl_24 g_pr_24 g_pb_20">
<a-table sticky :columns="columns1" :data-source="zzkgList" size="middle" @change="tableChange" :pagination="false" class="g_clear_scroll" :scroll="{ x: '500px' }"> <a-table :columns="columns1" :data-source="zzkgList" size="middle" @change="tableChange" :pagination="false" class="g_clear_scroll" :scroll="{ x: '500px' }">
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.key === 'name'"> <template v-if="column.key === 'name'">
<div class="g_fw_600">姓名</div> <div class="g_fw_600">姓名</div>
@ -90,6 +90,7 @@
</a-table> </a-table>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

@ -0,0 +1,73 @@
<template>
<div class="g_flex_row_center">
<div class="m-job-detail g_pt_24" style="width: 780px">
<div class="g_flex_row_center flex_center g_mb_16">
<div class="g_fs_14">标题</div>
<div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9">
<a-input v-model:value="currentInfo.title"></a-input>
</div>
</div>
<div class="g_flex_row_center">
<div class="g_fs_14">内容</div>
<div class="g_mt_0 g_br_6 g_flex_1" style="border: 1px solid #d9d9d9">
<iframe src="../../../public/static/editor.html" width="100%" height="500px" frameborder="0" ref="iframeDom" style="border-top-left-radius: 6px"></iframe>
</div>
</div>
<div class="g_flex_row_start g_mt_24 g_ml_42">
<a-button class="g_mr_16" @click="cancel"></a-button>
<a-button type="primary">发布</a-button>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance, watch, onBeforeUnmount } from "vue";
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
import { useRouter, useRoute } from "vue-router";
const router = useRouter(); //
const route = useRoute();
import { useStore } from "@/stores/counter";
const storeJS = useStore();
let currentInfo = ref({});
onMounted(() => {
console.log(route);
let newList = [{}, {}, {}];
newList.forEach((item, index) => {
item.rank = index + 1;
item.title = "常用发票主体信息" + index;
item.content = "默认主体:郑州伯才科技有限公司 单位名称:郑州伯才科技有限公司 纳税人识别号91410100MA9L4HDT0L 地址:河南自贸试验区郑州" + index;
item.time = "2024-03-11 13:04:24";
});
if (route.query.id) {
currentInfo.value = newList[Number(route.query.id)];
}
initData();
});
const iframeDom = ref();
window.addEventListener("message", (val) => {
// console.log(val.data);
if (val.data.lake) {
currentInfo.value.desc_yq = val.data.lake;
currentInfo.value.desc = val.data.html;
}
});
const initData = () => {
// iframeDom.value.contentWindow.postMessage("");
iframeDom.value.onload = function () {
console.log(route);
if (route.name == "messageEdit") {
iframeDom.value.contentWindow.postMessage(currentInfo.value.content);
} else {
iframeDom.value.contentWindow.postMessage("");
}
};
};
const cancel = ()=>{
router.back()
}
</script>
<style lang="less" scoped></style>

@ -9,7 +9,7 @@
</div> </div>
<div> <div>
<!-- @click="openAdd" --> <!-- @click="openAdd" -->
<a-button type="primary" :icon="h(PlusOutlined)">新增内容</a-button> <a-button type="primary" @click="openAdd('add')" :icon="h(PlusOutlined)">新增内容</a-button>
<!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> --> <!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> -->
<!-- <!--
<a-dropdown :trigger="['click']"> <a-dropdown :trigger="['click']">
@ -58,7 +58,7 @@
> >
报名 报名
</div> --> </div> -->
<div class="btn g_c_main g_fs_14 g_cursor_point g_mr_13" @click="handleToForm('edit', record)">编辑</div> <div class="btn g_c_main g_fs_14 g_cursor_point g_mr_13" @click="openAdd('edit', record)">编辑</div>
<div class="btn g_c_main g_fs_14 g_cursor_point" @click="handleDel(record)"></div> <div class="btn g_c_main g_fs_14 g_cursor_point" @click="handleDel(record)"></div>
</div> </div>
</template> </template>
@ -74,8 +74,6 @@
</div> </div>
</div> </div>
<!-- <a-modal v-model:open="modalInfo.isShow" <!-- <a-modal v-model:open="modalInfo.isShow"
:title="modalInfo.title" :title="modalInfo.title"
width="640px" width="640px"
@ -115,18 +113,9 @@
</template> </template>
</a-modal> --> </a-modal> -->
<a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true"> <a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true">
<div class="g_pt_30 modal-box"> <div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form" <a-form :model="modalInfo.form" name="basic" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" autocomplete="off" style="width: 80%" class="g_ml_51">
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="姓名" name="name" required> <a-form-item label="姓名" name="name" required>
<a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" /> <a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item> </a-form-item>
@ -138,7 +127,7 @@
</a-form-item> </a-form-item>
<a-form-item label="备注" name="desp"> <a-form-item label="备注" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" /> <a-textarea :rows="6" style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
@ -183,35 +172,33 @@ const handleChangeSearch = (e) => {
} }
}; };
const modalInfo = ref({ const modalInfo = ref({
title:'新增用户', title: "新增用户",
id: 0, id: 0,
form: { form: {
name: "", name: "",
username:'', username: "",
idcard:'', idcard: "",
description:'' description: "",
} },
}) });
const submitForm = () => { const submitForm = () => {
let url = '',params = {}; let url = "",
params = {};
params = { params = {
name: modalInfo.value.form.name, name: modalInfo.value.form.name,
username: modalInfo.value.form.username, username: modalInfo.value.form.username,
idcard: modalInfo.value.form.idcard, idcard: modalInfo.value.form.idcard,
description: modalInfo.value.form.description, description: modalInfo.value.form.description,
password:'123456', password: "123456",
id:modalInfo.value.id id: modalInfo.value.id,
} };
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) { if (!commonJS.regular(modalInfo.value.form.username, "tel")) {
message.warning('请输入正确的手机号') message.warning("请输入正确的手机号");
return false return false;
} }
if (modalInfo.value.id) { if (modalInfo.value.id) {
delete params.password; delete params.password;
updateUserApi(params).then((res) => { updateUserApi(params).then((res) => {
@ -225,25 +212,22 @@ const submitForm = ()=>{
message.success("新增成功"); message.success("新增成功");
getTable(); getTable();
}); });
}
} }
};
const handleToForm = ($type, $data) => { const handleToForm = ($type, $data) => {
showAdd.value = true; showAdd.value = true;
console.log($data.id); console.log($data.id);
modalInfo.value = { modalInfo.value = {
isShow: true, isShow: true,
title:'修改用户', title: "修改用户",
form: { form: {
name: $data.name, name: $data.name,
username: $data.username, username: $data.username,
idcard: $data.idcard, idcard: $data.idcard,
description: $data.description, description: $data.description,
}, },
id:$data.id id: $data.id,
} };
// updateUserApi({ // updateUserApi({
// description: "", // description: "",
@ -277,8 +261,6 @@ const handleToForm = ($type, $data) => {
// } // }
}; };
/* #################### 表格事件 #################### */ /* #################### 表格事件 #################### */
const tableData = ref({ const tableData = ref({
keyword: "", keyword: "",
@ -299,26 +281,31 @@ const getTable = () => {
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size }; tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => { tableData.value.records.forEach((item, index) => {
item.rank = index + 1; item.rank = index + 1;
item.title = '常用发票主体信息'; item.title = "常用发票主体信息";
item.content = "默认主体:郑州伯才科技有限公司 单位名称:郑州伯才科技有限公司 纳税人识别号91410100MA9L4HDT0L 地址:河南自贸试验区郑州"; item.content = "默认主体:郑州伯才科技有限公司 单位名称:郑州伯才科技有限公司 纳税人识别号91410100MA9L4HDT0L 地址:河南自贸试验区郑州";
item.time = "2024-03-11 13:04:24"; item.time = "2024-03-11 13:04:24";
}); });
}); });
}; };
const openAdd = () =>{ const openAdd = (_type,_record) => {
showAdd.value = true if(_type == 'add'){
modalInfo.value.title = "新增用户" router.push({
modalInfo.value.id = 0; path: "messageAdd",
modalInfo.value = { // query: {
form:{ // type: "add",
name:"", // },
username:'', });
idcard:'', } else {
description:'' router.push({
} path: "messageEdit",
} query: {
id: _record.rank,
},
});
} }
};
const columns = ref([ const columns = ref([
{ {
title: "序号", title: "序号",
@ -408,7 +395,6 @@ const handleApplication = (record) => {
}); });
}; };
const handleDel = ($data) => { const handleDel = ($data) => {
commonJS.gConfirmModal( commonJS.gConfirmModal(
"删除", "删除",
@ -440,7 +426,6 @@ const handleModalSize = ($page, $size) => {
</script> </script>
<style lang="less"> <style lang="less">
.ant-table-cell:empty::before { .ant-table-cell:empty::before {
content: "-"; content: "-";
} }
Loading…
Cancel
Save