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 @@
// tag // tag
switch (unref(tag)) { switch (unref(tag)) {
case 'add': case 'add':
props.title = '新增第三方'; props.title = '新增企业';
break; break;
case 'edit': case 'edit':
props.title = '编辑第三方'; props.title = '编辑企业';
await setFieldsValue(await getPushThirdParty(refId)); await setFieldsValue(await getPushThirdParty(refId));
break; break;
case 'view': case 'view':
props.title = '查看第三方'; props.title = '查看企业';
await setFieldsValue(await getPushThirdPartyByUserId(refId)); await setFieldsValue(await getPushThirdPartyByUserId(refId));
await setProps({ disabled: true }); await setProps({ disabled: true });
break; break;

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

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

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

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

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

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

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

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

Loading…
Cancel
Save