Browse Source

🚀 消息推送模块

master
wangxiang 2 years ago
parent
commit
4cd9dcd427
  1. 6
      src/views/common/push/pushThirdParty/ThirdPartyModal.vue
  2. 2
      src/views/common/push/pushThirdParty/index.vue
  3. 57
      src/views/common/push/pushTodoThirdParty/ThirdPartyModal.vue
  4. 10
      src/views/common/push/pushTodoThirdParty/index.vue
  5. 28
      src/views/common/push/pushTodoThirdParty/thirdParty.data.ts

6
src/views/common/push/pushThirdParty/ThirdPartyModal.vue vendored

@ -41,14 +41,14 @@ @@ -41,14 +41,14 @@
// tag
switch (unref(tag)) {
case 'add':
props.title = '新增第三方';
props.title = '新增企业';
break;
case 'edit':
props.title = '编辑第三方';
props.title = '编辑企业';
await setFieldsValue(await getPushThirdParty(refId));
break;
case 'view':
props.title = '查看第三方';
props.title = '查看企业';
await setFieldsValue(await getPushThirdPartyByUserId(refId));
await setProps({ disabled: true });
break;

2
src/views/common/push/pushThirdParty/index.vue vendored

@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({
title: '第三方列表',
title: '企业列表',
api: listPushThirdParty,
rowKey: 'id',
columns,

57
src/views/common/push/pushTodoThirdParty/ThirdPartyModal.vue vendored

@ -1,9 +1,14 @@ @@ -1,9 +1,14 @@
PushThirdPartyModal<template>
<template>
<BasicModal v-bind="$attrs"
width="720px"
:showCancelBtn="false"
okText="通过"
@register="registerModal"
@ok="handleSubmit"
>
<template #centerFooter>
<a-button danger type="primary" @click="handleReject">驳回</a-button>
</template>
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
@ -14,17 +19,17 @@ PushThirdPartyModal<template> @@ -14,17 +19,17 @@ PushThirdPartyModal<template>
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved.
* author entfrm开发团队-王翔
*/
import { ref, unref } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './thirdParty.data';
import { addPushThirdParty, editPushThirdParty, getPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty';
import { editPushThirdParty, getPushThirdParty, delPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import { ref } from 'vue';
import {useMessage} from '/@/hooks/web/useMessage';
/** 通用变量统一声明区域 */
const tag = ref<Nullable<string>>('');
/** https://v3.cn.vuejs.org/api/options-data.html#emits */
const { createMessage } = useMessage();
const id = ref<string>('');
const emit = defineEmits(['success', 'register']);
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema, setProps }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
@ -35,41 +40,31 @@ PushThirdPartyModal<template> @@ -35,41 +40,31 @@ PushThirdPartyModal<template>
await resetFields();
await clearValidate();
//
tag.value = data._tag;
const refId = data.record?.id;
id.value = data.record?.id;
const props: Partial<ModalProps> = { confirmLoading: false };
// tag
switch (unref(tag)) {
case 'add':
props.title = '新增第三方申请';
break;
case 'edit':
props.title = '编辑第三方申请';
await setFieldsValue(await getPushThirdParty(refId));
break;
}
props.title = '审批企业申请';
await setFieldsValue(await getPushThirdParty(id.value));
await setProps({ disabled: true });
// :
setModalProps(props);
});
/** 处理弹出框提交 */
async function handleReject() {
await delPushThirdParty(id.value);
closeModal();
createMessage.info('审核驳回!');
emit('success');
}
async function handleSubmit() {
try {
//
const formData = await validate();
//
formData.status = '1';
setModalProps({ confirmLoading: true });
// tag
switch (unref(tag)) {
case 'add':
await addPushThirdParty(formData);
break;
case 'edit':
await editPushThirdParty(formData);
break;
}
//
await editPushThirdParty(formData);
closeModal();
createMessage.success('审核通过!');
emit('success');
} finally {
setModalProps({ confirmLoading: false });

10
src/views/common/push/pushTodoThirdParty/index.vue vendored

@ -7,12 +7,12 @@ @@ -7,12 +7,12 @@
<a-button type="primary"
:disabled="state.multiple"
@click="handleDel()"
>删除第三方申请</a-button>
>驳回申请</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '查看',
label: '审批',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({
title: '第三方列表',
title: '企业申请列表',
api: listPushThirdParty,
rowKey: 'id',
columns,
@ -113,10 +113,10 @@ @@ -113,10 +113,10 @@
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认删除编号为${ids}的数据?`,
content: `是否确认驳回编号为${ids}的数据?`,
onOk: async () => {
await delPushThirdParty(ids);
createMessage.success('删除成功!');
createMessage.success('驳回成功!');
handleRefreshTable();
}
});

28
src/views/common/push/pushTodoThirdParty/thirdParty.data.ts vendored

@ -1,7 +1,5 @@ @@ -1,7 +1,5 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
/** 表格列配置 */
export const columns: BasicColumn[] = [
@ -11,7 +9,7 @@ export const columns: BasicColumn[] = [ @@ -11,7 +9,7 @@ export const columns: BasicColumn[] = [
},
{
title: '企业名称',
dataIndex: 'enterpName'
dataIndex: 'entName'
},
{
title: '手机号',
@ -34,7 +32,7 @@ export const columns: BasicColumn[] = [ @@ -34,7 +32,7 @@ export const columns: BasicColumn[] = [
/** 搜索表单配置 */
export const searchFormSchema: FormSchema[] = [
{
field: 'enterpName',
field: 'entName',
label: '企业名称',
component: 'Input',
componentProps: {
@ -56,54 +54,36 @@ export const formSchema: FormSchema[] = [ @@ -56,54 +54,36 @@ export const formSchema: FormSchema[] = [
field: 'statutoryRepName',
label: '法定代表人',
component: 'Input',
required: true,
colProps: {
span: 12
}
required: true
},
{
field: 'idCard',
label: '身份证',
component: 'Input',
required: true,
colProps: {
span: 12
}
},
{
field: 'enterpName',
field: 'entName',
label: '企业名称',
component: 'Input',
required: true,
colProps: {
span: 12
}
},
{
field: 'phone',
label: '手机号',
component: 'Input',
required: true,
colProps: {
span: 12
}
},
{
field: 'creditCode',
label: '信用代码',
component: 'Input',
required: true,
colProps: {
span: 12
}
},
{
field: 'detailedAddress',
label: '详细地址',
component: 'Input',
required: true,
colProps: {
span: 24
}
}
];

Loading…
Cancel
Save