|
@@ -0,0 +1,249 @@
|
|
|
+import { useState, useRef, useMemo } from "react";
|
|
|
+import {
|
|
|
+ ActionType,
|
|
|
+ ProColumns,
|
|
|
+ ModalForm,
|
|
|
+ ProDescriptions,
|
|
|
+ ProFormSelect,
|
|
|
+ ProFormTextArea,
|
|
|
+} from "@ant-design/pro-components";
|
|
|
+import { ProTable } from "@ant-design/pro-components";
|
|
|
+import { Tag, message, Modal, Skeleton } from "antd";
|
|
|
+import { useRequest } from "umi";
|
|
|
+import { GetApplyList, GetApplyDetail, HandleApply } from "@/api/apply";
|
|
|
+
|
|
|
+const handleStatusEnum = {
|
|
|
+ 0: {
|
|
|
+ text: "待审核",
|
|
|
+ status: "default",
|
|
|
+ },
|
|
|
+ 1: {
|
|
|
+ text: "跟踪中",
|
|
|
+ status: "processing",
|
|
|
+ },
|
|
|
+ 2: {
|
|
|
+ text: "已购买",
|
|
|
+ status: "success",
|
|
|
+ },
|
|
|
+ 3: {
|
|
|
+ text: "未购买",
|
|
|
+ status: "error",
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+export default () => {
|
|
|
+ const actionRef = useRef<ActionType>();
|
|
|
+ const [openDetail, setOpenDetail] = useState(false);
|
|
|
+ const [openProcess, setOpenProcess] = useState(false);
|
|
|
+ const [processId, setProcessId] = useState<string>("");
|
|
|
+
|
|
|
+ const { data, loading, run } = useRequest(GetApplyDetail, {
|
|
|
+ defaultParams: [{ id: "" }],
|
|
|
+ manual: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ const columns: ProColumns<any>[] = [
|
|
|
+ {
|
|
|
+ title: "客户名称",
|
|
|
+ dataIndex: "name",
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "联系方式",
|
|
|
+ dataIndex: "tel",
|
|
|
+ ellipsis: true,
|
|
|
+ copyable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "企业名称",
|
|
|
+ dataIndex: "companyName",
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "模版类型",
|
|
|
+ dataIndex: "type",
|
|
|
+ search: false,
|
|
|
+ renderText: (text) => {
|
|
|
+ return text === 0 ? "应用模版" : "模块模版";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "处理状态",
|
|
|
+ dataIndex: "status",
|
|
|
+ valueType: "select",
|
|
|
+ valueEnum: handleStatusEnum,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "备注",
|
|
|
+ dataIndex: "processRemark",
|
|
|
+ search: false,
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "申请时间",
|
|
|
+ dataIndex: "createTime",
|
|
|
+ search: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "最后处理时间",
|
|
|
+ dataIndex: "processTime",
|
|
|
+ search: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ valueType: "option",
|
|
|
+ key: "option",
|
|
|
+ width: 180,
|
|
|
+ render: (text, record, _,) => [
|
|
|
+ <a key="edit" onClick={() => showDetail(record.id)}>
|
|
|
+ 详情
|
|
|
+ </a>,
|
|
|
+ <a
|
|
|
+ target="_blank"
|
|
|
+ rel="noopener noreferrer"
|
|
|
+ key="view"
|
|
|
+ onClick={() => {
|
|
|
+ setProcessId(record.id);
|
|
|
+ setOpenProcess(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 处理
|
|
|
+ </a>,
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const showDetail = (id: string) => {
|
|
|
+ setOpenDetail(true);
|
|
|
+ run({ id: id });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleProcessFinish = async (values: any) => {
|
|
|
+ await HandleApply({
|
|
|
+ ...values,
|
|
|
+ status: Number(values.status),
|
|
|
+ id: processId,
|
|
|
+ });
|
|
|
+ message.success('处理成功');
|
|
|
+ actionRef.current?.reload();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <ProTable
|
|
|
+ columns={columns}
|
|
|
+ actionRef={actionRef}
|
|
|
+ cardBordered
|
|
|
+ headerTitle="应用/模版申请列表"
|
|
|
+ request={async (params, sort, filter) => {
|
|
|
+ console.log(params, sort, filter);
|
|
|
+ const isOnMarket =
|
|
|
+ params?.isOnMarket === "on"
|
|
|
+ ? 1
|
|
|
+ : params?.isOnMarket === "off"
|
|
|
+ ? 0
|
|
|
+ : undefined;
|
|
|
+ const res = await GetApplyList({
|
|
|
+ currentPage: params.current || 1,
|
|
|
+ pageSize: params.pageSize || 10,
|
|
|
+ filters: [
|
|
|
+ { name: "name", value: params?.name },
|
|
|
+ { name: "tel", value: params?.tel },
|
|
|
+ { name: "companyName", value: params?.companyName },
|
|
|
+ { name: "status", value: params?.status },
|
|
|
+ { name: "isOnMarket", value: isOnMarket },
|
|
|
+ { name: "isDel", value: 0 },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ const data = res?.result || {};
|
|
|
+ return {
|
|
|
+ data: data.model || [],
|
|
|
+ success: true,
|
|
|
+ total: data.totalCount || 0,
|
|
|
+ };
|
|
|
+ }}
|
|
|
+ columnsState={{
|
|
|
+ persistenceKey: "shalu-marketplace",
|
|
|
+ persistenceType: "localStorage",
|
|
|
+ defaultValue: {
|
|
|
+ option: { fixed: "right", disable: true },
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ rowKey="id"
|
|
|
+ search={{
|
|
|
+ labelWidth: "auto",
|
|
|
+ }}
|
|
|
+ options={{
|
|
|
+ setting: {
|
|
|
+ listsHeight: 400,
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ pagination={{
|
|
|
+ pageSize: 10,
|
|
|
+ }}
|
|
|
+ dateFormatter="string"
|
|
|
+ />
|
|
|
+
|
|
|
+ {/* 详情弹窗 */}
|
|
|
+ <Modal
|
|
|
+ open={openDetail}
|
|
|
+ width={800}
|
|
|
+ footer={null}
|
|
|
+ onCancel={() => setOpenDetail(false)}
|
|
|
+ >
|
|
|
+ <Skeleton loading={loading}>
|
|
|
+ <ProDescriptions
|
|
|
+ title="基本信息"
|
|
|
+ column={2}
|
|
|
+ dataSource={data?.result || {}}
|
|
|
+ >
|
|
|
+ <ProDescriptions.Item label="申请名称" dataIndex="name" />
|
|
|
+ <ProDescriptions.Item label="联系方式" dataIndex="tel" copyable />
|
|
|
+ <ProDescriptions.Item label="公司名称" dataIndex="companyName" />
|
|
|
+ <ProDescriptions.Item label="公司规模" dataIndex="companySize" />
|
|
|
+ <ProDescriptions.Item label="职位名称" dataIndex="jobTitle" />
|
|
|
+ <ProDescriptions.Item label="申请时间" dataIndex="createTime" />
|
|
|
+ </ProDescriptions>
|
|
|
+ <ProDescriptions
|
|
|
+ className="mt-12px"
|
|
|
+ title="申请产品"
|
|
|
+ column={2}
|
|
|
+ dataSource={data?.result || {}}
|
|
|
+ >
|
|
|
+ <ProDescriptions.Item
|
|
|
+ label="应用类型"
|
|
|
+ dataIndex="type"
|
|
|
+ renderText={(text) => (text === 0 ? "应用模版" : "模块模版")}
|
|
|
+ />
|
|
|
+ <ProDescriptions.Item label="模版名称" dataIndex="name" />
|
|
|
+ </ProDescriptions>
|
|
|
+ </Skeleton>
|
|
|
+ </Modal>
|
|
|
+
|
|
|
+ {/* 处理弹窗 */}
|
|
|
+ <ModalForm
|
|
|
+ open={openProcess}
|
|
|
+ onOpenChange={setOpenProcess}
|
|
|
+ width={440}
|
|
|
+ onFinish={handleProcessFinish}
|
|
|
+ >
|
|
|
+ <ProFormSelect
|
|
|
+ name="status"
|
|
|
+ label="处理结果"
|
|
|
+ rules={[{ required: true, message: "请选择处理结果" }]}
|
|
|
+ valueEnum={{
|
|
|
+ 1: handleStatusEnum[1],
|
|
|
+ 2: handleStatusEnum[2],
|
|
|
+ 3: handleStatusEnum[3],
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <ProFormTextArea
|
|
|
+ name="processRemark"
|
|
|
+ label="处理备注"
|
|
|
+ rules={[{ required: true, message: "请输入处理备注" }]}
|
|
|
+ />
|
|
|
+ </ModalForm>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+};
|