新增修改信息

main
wangxia 2 years ago
parent 752a72bf35
commit 2d2aad731b

@ -193,26 +193,10 @@
// debugger
// editor.setDocument("text/lake", ' ');
console.log("event", event);
if (event.data.jobInfoYuQue) {
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传过来的数据
console.log("从vue中获得的数据", event);
editor.setDocument("text/lake", desp);
}
var data = event.data;
// 然后就可以获得vue传过来的数据
console.log("从vue中获得的数据", data);
editor.setDocument("text/lake", data);
// var data = event.data.replace(/\n/g, "<br />");
// desp = data.replace(/[*]+/g, '');
},

@ -1,4 +1,5 @@
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import noticeData from './modules/message.js';
const router = createRouter({
@ -53,9 +54,9 @@ const router = createRouter({
meta: {
title: '消息通知',
},
component: () => import("../views/homePage/message.vue")
component: () => import("../views/message/index.vue")
}
]
].concat(noticeData)
},
{
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") {
secondTitle.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");
} else if (firstTitle.value == "小程序配置") {
router.push("/merchantManagement/miniProgramList");
} else if (firstTitle.value == "消息通知") {
router.push("/merchantManagement/message");
}
};
</script>

@ -57,7 +57,7 @@
</div>
<a-divider class="g_mt_0 g_mb_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 v-if="column.key === 'name'">
<div class="g_fw_600">姓名</div>
@ -76,7 +76,7 @@
</div>
<a-divider class="g_mt_0 g_mb_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 v-if="column.key === 'name'">
<div class="g_fw_600">姓名</div>
@ -90,6 +90,7 @@
</a-table>
</div>
</div>
</div>
</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>

@ -8,8 +8,8 @@
</div>
</div>
<div>
<!-- @click="openAdd" -->
<a-button type="primary" :icon="h(PlusOutlined)">新增内容</a-button>
<!-- @click="openAdd" -->
<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-dropdown :trigger="['click']">
@ -58,7 +58,7 @@
>
报名
</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>
</template>
@ -74,9 +74,7 @@
</div>
</div>
<!-- <a-modal v-model:open="modalInfo.isShow"
<!-- <a-modal v-model:open="modalInfo.isShow"
:title="modalInfo.title"
width="640px"
centered
@ -115,37 +113,28 @@
</template>
</a-modal> -->
<a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true">
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
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-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="电话" name="name" required>
<a-input style="width: 100%" placeholder="请输入电话" v-model:value="modalInfo.form.username" />
</a-form-item>
<a-form-item label="身份证号" name="name">
<a-input style="width: 100%" placeholder="请输入身份证号" v-model:value="modalInfo.form.idcard" />
</a-form-item>
<a-form-item label="备注" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="showAdd = false" >关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
<a-form :model="modalInfo.form" 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-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="电话" name="name" required>
<a-input style="width: 100%" placeholder="请输入电话" v-model:value="modalInfo.form.username" />
</a-form-item>
<a-form-item label="身份证号" name="name">
<a-input style="width: 100%" placeholder="请输入身份证号" v-model:value="modalInfo.form.idcard" />
</a-form-item>
<a-form-item label="备注" name="desp">
<a-textarea :rows="6" style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="showAdd = false">关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal>
</div>
</template>
@ -155,7 +144,7 @@ import { ref, onMounted, getCurrentInstance, h, watch } from "vue";
import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi } from "../../api/userList/userList";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi, updateUserApi } from "../../api/userList/userList";
import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue";
@ -183,69 +172,64 @@ const handleChangeSearch = (e) => {
}
};
const modalInfo = ref({
title:'新增用户',
id:0,
form:{
name:"",
username:'',
idcard:'',
description:''
}
})
title: "新增用户",
id: 0,
form: {
name: "",
username: "",
idcard: "",
description: "",
},
});
const submitForm = ()=>{
let url = '',params = {};
const submitForm = () => {
let url = "",
params = {};
params = {
name:modalInfo.value.form.name,
username:modalInfo.value.form.username,
idcard:modalInfo.value.form.idcard,
description:modalInfo.value.form.description,
password:'123456',
id:modalInfo.value.id
}
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) {
message.warning('请输入正确的手机号')
return false
}
name: modalInfo.value.form.name,
username: modalInfo.value.form.username,
idcard: modalInfo.value.form.idcard,
description: modalInfo.value.form.description,
password: "123456",
id: modalInfo.value.id,
};
if(modalInfo.value.id){
delete params.password;
updateUserApi(params).then((res)=>{
showAdd.value = false;
message.success("修改成功");
getTable();
});
}else{
addUserApi(params).then((res)=>{
showAdd.value = false;
message.success("新增成功");
getTable();
});
if (!commonJS.regular(modalInfo.value.form.username, "tel")) {
message.warning("请输入正确的手机号");
return false;
}
}
}
if (modalInfo.value.id) {
delete params.password;
updateUserApi(params).then((res) => {
showAdd.value = false;
message.success("修改成功");
getTable();
});
} else {
addUserApi(params).then((res) => {
showAdd.value = false;
message.success("新增成功");
getTable();
});
}
};
const handleToForm = ($type, $data) => {
showAdd.value = true;
console.log($data.id);
modalInfo.value = {
isShow:true,
title:'修改用户',
form:{
name:$data.name,
username:$data.username,
idcard:$data.idcard,
description:$data.description,
},
id:$data.id
}
showAdd.value = true;
console.log($data.id);
modalInfo.value = {
isShow: true,
title: "修改用户",
form: {
name: $data.name,
username: $data.username,
idcard: $data.idcard,
description: $data.description,
},
id: $data.id,
};
// updateUserApi({
// updateUserApi({
// description: "",
// idcard: "123123123123123123",
// name: "",
@ -277,8 +261,6 @@ const handleToForm = ($type, $data) => {
// }
};
/* #################### 表格事件 #################### */
const tableData = ref({
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.records.forEach((item, index) => {
item.rank = index + 1;
item.title = '常用发票主体信息';
item.title = "常用发票主体信息";
item.content = "默认主体:郑州伯才科技有限公司 单位名称:郑州伯才科技有限公司 纳税人识别号91410100MA9L4HDT0L 地址:河南自贸试验区郑州";
item.time = "2024-03-11 13:04:24";
});
});
};
const openAdd = () =>{
showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0;
modalInfo.value = {
form:{
name:"",
username:'',
idcard:'',
description:''
}
}
const openAdd = (_type,_record) => {
if(_type == 'add'){
router.push({
path: "messageAdd",
// query: {
// type: "add",
// },
});
} else {
router.push({
path: "messageEdit",
query: {
id: _record.rank,
},
});
}
};
const columns = ref([
{
title: "序号",
@ -347,7 +334,7 @@ const columns = ref([
width: "200px",
ellipsis: true,
},
{
title: "操作",
key: "state",
@ -408,7 +395,6 @@ const handleApplication = (record) => {
});
};
const handleDel = ($data) => {
commonJS.gConfirmModal(
"删除",
@ -440,9 +426,8 @@ const handleModalSize = ($page, $size) => {
</script>
<style lang="less">
.ant-table-cell:empty::before{
content: "-";
.ant-table-cell:empty::before {
content: "-";
}
.p-manage-myJob {
position: relative;
Loading…
Cancel
Save