index.tsx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. import * as React from 'react';
  2. import { observer } from 'mobx-react';
  3. import {
  4. List,
  5. Button,
  6. Divider,
  7. Flex,
  8. Layout,
  9. Empty,
  10. Image,
  11. Modal,
  12. Tag,
  13. message,
  14. Tooltip,
  15. Select,
  16. Form,
  17. Space,
  18. Row,
  19. Col,
  20. Input, Cascader
  21. } from 'antd';
  22. import {
  23. PlusOutlined,
  24. FileOutlined,
  25. SettingOutlined,
  26. DeleteOutlined,
  27. StepForwardOutlined,
  28. SearchOutlined,
  29. ReloadOutlined,
  30. BookOutlined,
  31. TeamOutlined,
  32. AppstoreOutlined,
  33. EditOutlined
  34. } from '@ant-design/icons';
  35. import { apis } from '@/apis';
  36. import './style.less';
  37. import { PaginationConfig } from 'antd/es/pagination';
  38. import router from '@/router';
  39. import LocalStorage from '@/LocalStorage';
  40. import { create } from 'domain';
  41. import audit from '../../audit';
  42. import { set } from 'mobx';
  43. import IconSvg from "@/assets/public/icon.svg";
  44. const { Header, Footer, Sider, Content } = Layout;
  45. const { Option } = Select;
  46. const FormItem = Form.Item;
  47. const headerStyle: React.CSSProperties = {
  48. textAlign: 'center',
  49. height: 24,
  50. paddingInline: 48,
  51. lineHeight: '30px',
  52. backgroundColor: '#fff',
  53. };
  54. const contentStyle: React.CSSProperties = {
  55. textAlign: 'center',
  56. lineHeight: '40px',
  57. backgroundColor: '#fff',
  58. };
  59. const siderStyle: React.CSSProperties = {
  60. paddingLeft: 30,
  61. paddingTop: 30,
  62. height: 80,
  63. backgroundColor: '#fff',
  64. };
  65. const footerStyle: React.CSSProperties = {
  66. textAlign: 'center',
  67. color: '#fff',
  68. height: 24,
  69. backgroundColor: '#4096ff',
  70. };
  71. const layoutStyle = {
  72. borderRadius: 8,
  73. overflow: 'hidden',
  74. width: 'calc(10% - 8px)',
  75. maxWidth: 'calc(20% - 8px)',
  76. };
  77. const QuestionAnswerList: React.FC = () => {
  78. const [form] = Form.useForm();
  79. interface Item {
  80. name: string,
  81. desc: string,
  82. appId: number,
  83. createBy: string,
  84. typeId: string;
  85. status: string;
  86. comment: string;
  87. auditStatus: string;
  88. projectName: string;
  89. updateTime: string;
  90. };
  91. interface PageInfo {
  92. pageNumber: number,
  93. pageSize: number,
  94. total: number,
  95. };
  96. type AppTypeList = {
  97. label: string,
  98. value: string,
  99. }[];
  100. type ProjectTypeList = {
  101. label: string,
  102. value: string,
  103. }[];
  104. const [listLoading, setListLoading] = React.useState(false);
  105. const [list, setList] = React.useState<Item[]>([]);
  106. const [page, setPage] = React.useState<PageInfo>({
  107. pageNumber: 1,
  108. pageSize: 10,
  109. total: 0,
  110. });
  111. const [appCount, setAppCount] = React.useState<string>();
  112. const [knowCount, setKnowCount] = React.useState<string>();
  113. const { Header, Footer, Sider, Content } = Layout;
  114. const [appTypeList, setAppTypeList] = React.useState<AppTypeList>([]);
  115. const [createFlag, setCreateFlag] = React.useState(false);
  116. const [deleteFlag, setDeleteFlag] = React.useState(false);
  117. const [updateFlag, setUpdateFlag] = React.useState(false);
  118. const [projectList, setProjectList] = React.useState<ProjectTypeList>([]);
  119. const [appProjectList, setAppProjectList] = React.useState<AppTypeList>([]);
  120. const [showSubPanel, setShowSubPanel] = React.useState(false);
  121. const [selectedType, setSelectedType] = React.useState<string | null>('全部');
  122. const wrapperRef = React.useRef<HTMLDivElement>(null);
  123. const selectRef = React.useRef<any>(null);
  124. const [levelTypeList, setLevelTypeList] = React.useState<AppTypeList>([]);
  125. const appApi = {
  126. fetchList: async (typeId: any, projectId: any) => {
  127. setListLoading(true);
  128. try {
  129. const userInfo = LocalStorage.getUserInfo();
  130. const userId = (userInfo?.id ?? '').toString();
  131. const keyword = form.getFieldValue('keyword');
  132. const res = await apis.fetchTakaiAppList({
  133. pageSize: page.pageSize,
  134. pageNumber: page.pageNumber,
  135. userId: userId,
  136. typeId: typeId,
  137. projectId: projectId,
  138. keyword: keyword,
  139. })
  140. const list = res.rows.map((item: any) => {
  141. return {
  142. name: item.name,
  143. desc: item.desc,
  144. appId: item.appId,
  145. createBy: item.createBy,
  146. typeId: item.typeId,
  147. status: item.status,
  148. comment: item.comment,
  149. auditStatus: item.auditStatus,
  150. projectName: item.projectName,
  151. updateTime: item.updateTime
  152. }
  153. });
  154. const c = LocalStorage.getStatusFlag('deepseek:application:create');
  155. const u = LocalStorage.getStatusFlag('deepseek:application:delete');
  156. const filteredList = list.filter((item: any) => {
  157. // 如果有 createFlag 或 updateFlag 权限,显示所有数据
  158. if (c || u) {
  159. return true;
  160. }
  161. // 没有权限时排除 status='5' 的数据
  162. return item.status !== '5';
  163. });
  164. setList(filteredList);
  165. setPage({
  166. pageNumber: page.pageNumber,
  167. pageSize: page.pageSize,
  168. total: res.total,
  169. });
  170. } catch (error) {
  171. console.error(error);
  172. } finally {
  173. setListLoading(false);
  174. }
  175. },
  176. auditApplication: async (appId: string, userId: string) => {
  177. const res = await apis.auditTakaiApplicationLibApi(appId, userId);
  178. if (res.data === 9) {
  179. message.error('您没有添加审核人');
  180. }
  181. await appApi.fetchList(null, null);
  182. }
  183. };
  184. // 删除应用
  185. const delApplication = async (appId: string) => {
  186. try {
  187. await apis.deleteTakaiApplicationApi(appId);
  188. await appApi.fetchList(null, null);
  189. } catch (error) {
  190. console.error(error);
  191. }
  192. }
  193. const indexApi = {
  194. fetchIndex: async (typeId: any, projectId: any) => {
  195. try {
  196. const userInfo = LocalStorage.getUserInfo();
  197. const userId = (userInfo?.id ?? '').toString();
  198. const keyword = form.getFieldValue('keyword');
  199. const res = await apis.fetchTakaiIndexCount({
  200. pageSize: page.pageSize,
  201. pageNumber: page.pageNumber,
  202. userId: userId,
  203. typeId: typeId,
  204. projectId: projectId,
  205. keyword: keyword,
  206. })
  207. setAppCount(res.data.applicationCount);
  208. setKnowCount(res.data.knowledgeCount);
  209. } catch (error) {
  210. console.error(error);
  211. } finally {
  212. setListLoading(false);
  213. }
  214. }
  215. };
  216. // 获取应用类型
  217. const appTypeApi = {
  218. fetchAppType: async () => {
  219. try {
  220. const res = await apis.fetchTakaiAppTypeList('app_type');
  221. const list = res.data.map((item: any) => {
  222. return {
  223. label: item.dictLabel,
  224. value: item.dictCode,
  225. }
  226. });
  227. setAppTypeList(list);
  228. } catch (error: any) {
  229. console.error(error);
  230. }
  231. },
  232. };
  233. // 项目级应用下的类型
  234. const appProTypeApi = {
  235. fetchAppProType: async () => {
  236. try {
  237. const res = await apis.fetchTakaiAppTypeList('projectTree');
  238. const list: AppTypeList = res.data;
  239. setAppProjectList(list);
  240. // const res = await apis.fetchTakaiAppTypeList('projectTree');
  241. // const list = res.data.map((item: any) => {
  242. // return {
  243. // label: item.dictLabel,
  244. // value: item.dictCode,
  245. // }
  246. // });
  247. // setAppProjectList(list);
  248. } catch (error: any) {
  249. console.error(error);
  250. }
  251. },
  252. };
  253. const projectApi = {
  254. fetchProject: async () => {
  255. try {
  256. const res = await apis.fetchTakaiProjectLibApi();
  257. const list = res.data.map((item: any) => {
  258. return {
  259. label: item.projectName,
  260. value: item.projectId,
  261. }
  262. });
  263. setProjectList(list);
  264. } catch (error: any) {
  265. console.error(error);
  266. }
  267. },
  268. };
  269. // 获取应用类型
  270. const levelTypeApi = {
  271. fetchLevelAppType: async () => {
  272. try {
  273. const res = await apis.fetchTakaiAppTypeList('project_type');
  274. const list = res.data.map((item: any) => {
  275. return {
  276. label: item.dictLabel,
  277. value: item.dictCode,
  278. }
  279. });
  280. setLevelTypeList(list);
  281. } catch (error: any) {
  282. console.error(error);
  283. }
  284. },
  285. };
  286. const init = async () => {
  287. await appApi.fetchList(null, null);
  288. await indexApi.fetchIndex(null, null);
  289. await appTypeApi.fetchAppType();
  290. await projectApi.fetchProject();
  291. await appProTypeApi.fetchAppProType();
  292. await levelTypeApi.fetchLevelAppType();
  293. // 设置默认选择"全部"
  294. form.setFieldsValue({ typeId: '全部' });
  295. }
  296. React.useEffect(() => {
  297. setCreateFlag(LocalStorage.getStatusFlag('deepseek:application:create'));
  298. setDeleteFlag(LocalStorage.getStatusFlag('deepseek:application:delete'));
  299. setUpdateFlag(LocalStorage.getStatusFlag('deepseek:application:update'));
  300. init();
  301. }, [page.pageSize, page.pageNumber])
  302. const paginationConfig: PaginationConfig = {
  303. // 显示数据总量
  304. showTotal: (total: number) => {
  305. return `共 ${total} 条`;
  306. },
  307. // 展示分页条数切换
  308. showSizeChanger: true,
  309. // 指定每页显示条数
  310. // pageSizeOptions: ['2', '20', '50', '100'],
  311. // 快速跳转至某页
  312. showQuickJumper: true,
  313. current: page.pageNumber,
  314. pageSize: page.pageSize,
  315. total: page.total,
  316. onChange: (pageNumber, pageSize) => {
  317. setPage({
  318. pageNumber: pageNumber,
  319. pageSize: pageSize,
  320. total: page.total,
  321. });
  322. },
  323. };
  324. // 点击查询
  325. const handleClickSearch = async () => {
  326. form.validateFields().then(async (values) => {
  327. if (values.proTypeId) {
  328. values.typeId = values.proTypeId;
  329. }
  330. if (values.typeId === '全部') {
  331. values.typeId = null;
  332. }
  333. if(values.projectId instanceof Array && values.projectId.length == 2) {
  334. values.projectId = values.projectId[1];
  335. }
  336. await indexApi.fetchIndex(values.typeId, values.projectId);
  337. await appApi.fetchList(values.typeId, values.projectId);
  338. }).catch((error) => {
  339. console.error(error);
  340. });
  341. };
  342. // 点击重置
  343. const handleClickReset = async () => {
  344. form.resetFields();
  345. setShowSubPanel(false);
  346. setSelectedType('全部'); // 重置为"全部"
  347. page.pageNumber = 1;
  348. page.pageSize = 10;
  349. await appApi.fetchList(null, null);
  350. await indexApi.fetchIndex(null, null);
  351. };
  352. /** 点击外部关闭面板 */
  353. React.useEffect(() => {
  354. const handleClickOutside = (event: MouseEvent) => {
  355. if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {
  356. setShowSubPanel(false);
  357. }
  358. };
  359. document.addEventListener('mousedown', handleClickOutside, true);
  360. return () => {
  361. document.removeEventListener('mousedown', handleClickOutside, true);
  362. };
  363. }, []);
  364. const handleAppTypeChange = (value: string) => {
  365. if (value === '41') {
  366. // 如果是项目级应用,切换面板状态
  367. // setShowSubPanel(prev => !prev);
  368. setShowSubPanel(true);
  369. } else {
  370. // 其他选项,隐藏面板
  371. setShowSubPanel(false);
  372. }
  373. setSelectedType(value);
  374. form.setFieldsValue({ typeId: value });
  375. // 自动提交逻辑
  376. if (value === '全部') {
  377. // 全部选项,传递null给后端
  378. appApi.fetchList(null, null);
  379. indexApi.fetchIndex(null, null);
  380. } else {
  381. // 其他选项,传递对应的typeId
  382. appApi.fetchList(value, null);
  383. indexApi.fetchIndex(value, null);
  384. }
  385. };
  386. const handleAppProTypeChange = (value: string) => {
  387. console.log(value, 'valuevalue');
  388. setSelectedType(value);
  389. form.setFieldsValue({ typeId: value });
  390. };
  391. return (
  392. <div>
  393. <div style={{ padding: '16px 20px', display: 'flex' }}>
  394. <Form
  395. form={form}
  396. layout='inline'
  397. colon={false}
  398. style={{ flex: 1 }}
  399. >
  400. <div>
  401. {/* 主选择器 - 修改为按钮组形式 */}
  402. <FormItem
  403. name="typeId"
  404. style={{ marginBottom: 0 }}
  405. >
  406. <div className="filter-button-group">
  407. {/* 全部按钮 */}
  408. <Button
  409. key="全部"
  410. type={selectedType === '全部' ? 'primary' : 'default'}
  411. size="small"
  412. onClick={() => handleAppTypeChange('全部')}
  413. >
  414. 全部
  415. </Button>
  416. {/* 动态应用类型按钮 */}
  417. {appTypeList.map(item => {
  418. // 根据label匹配对应的图标
  419. let icon = null;
  420. const isSelected = selectedType === item.value;
  421. if (item.label === '专业知识') {
  422. icon = <BookOutlined style={{ fontSize: '14px', marginRight: '0' }} />;
  423. } else if (item.label === '职能管理') {
  424. icon = <TeamOutlined style={{ fontSize: '14px', marginRight: '0' }} />;
  425. } else if (item.label === '项目级应用') {
  426. icon = <AppstoreOutlined style={{ fontSize: '14px', marginRight: '0' }} />;
  427. }
  428. return (
  429. <Button
  430. key={item.value}
  431. type={isSelected ? 'primary' : 'default'}
  432. size="small"
  433. onClick={() => handleAppTypeChange(item.value)}
  434. >
  435. {icon}
  436. {item.label}
  437. </Button>
  438. );
  439. })}
  440. </div>
  441. </FormItem>
  442. {/* 子选项面板 */}
  443. {showSubPanel && selectedType === '41' && (
  444. <FormItem
  445. label='类型'
  446. name='proTypeId'
  447. rules={[{ required: true, message: '类型不能为空' }]}
  448. >
  449. <Select
  450. placeholder='请选择'
  451. allowClear
  452. // style={ { width: 200 } }
  453. onChange={(value) => {
  454. // 项目类型选择器自动提交逻辑
  455. const currentProjectId = form.getFieldValue('projectId');
  456. appApi.fetchList(value, currentProjectId);
  457. indexApi.fetchIndex(value, currentProjectId);
  458. }}
  459. >
  460. {
  461. appProjectList.map((item, index) => {
  462. return <Option value={item.value} key={index}>
  463. {item.label}
  464. </Option>
  465. })
  466. }
  467. </Select>
  468. </FormItem>
  469. )}
  470. </div>
  471. {/* {
  472. appProjectList.map((subItem, index) => (
  473. <div key={index}>
  474. {subItem.label}
  475. </div>
  476. ))
  477. } */ }
  478. <FormItem name='projectId'>
  479. <Cascader
  480. options={appProjectList}
  481. placeholder="请选择项目"
  482. showSearch
  483. />
  484. {/*<Select*/}
  485. {/* placeholder='请选择项目'*/}
  486. {/* allowClear*/}
  487. {/* onChange={(value) => {*/}
  488. {/* // 项目选择器自动提交逻辑*/}
  489. {/* const currentTypeId = form.getFieldValue('typeId');*/}
  490. {/* const typeId = currentTypeId === '全部' ? null : currentTypeId;*/}
  491. {/* appApi.fetchList(typeId, value);*/}
  492. {/* indexApi.fetchIndex(typeId, value);*/}
  493. {/* }}*/}
  494. {/*>*/}
  495. {/* {*/}
  496. {/* projectList.map((item, index) => {*/}
  497. {/* return <Option value={item.value} key={index}>*/}
  498. {/* {item.label}*/}
  499. {/* </Option>*/}
  500. {/* })*/}
  501. {/* }*/}
  502. {/*</Select>*/}
  503. </FormItem>
  504. {/*<FormItem name='keyword'>*/}
  505. {/* <Input placeholder='请输入关键字' allowClear />*/}
  506. {/*</FormItem>*/}
  507. <FormItem>
  508. <Space size={12}>
  509. <Tooltip title="重置">
  510. <Button
  511. shape="circle"
  512. icon={<ReloadOutlined />}
  513. onClick={handleClickReset}
  514. />
  515. </Tooltip>
  516. <Tooltip title="查询">
  517. <Button
  518. type='primary'
  519. shape="circle"
  520. onClick={handleClickSearch}
  521. icon={<SearchOutlined />}
  522. />
  523. </Tooltip>
  524. </Space>
  525. </FormItem>
  526. {/* {
  527. createFlag && (
  528. <div style={ { marginLeft: 'auto' } }>
  529. <Button type='primary'
  530. icon={ <PlusOutlined /> }
  531. onClick={ () => {
  532. router.navigate( { pathname: '/deepseek/questionAnswer/create' } );
  533. } }>创建问答应用</Button>
  534. </div>
  535. )
  536. }
  537. */}
  538. {/* 创建按钮已移至面包屑组件 */}
  539. </Form>
  540. </div>
  541. {
  542. list.length
  543. ?
  544. <div className='questionAnswerList'>
  545. {/*<div style={ { overflow: 'auto' } }>*/}
  546. {/* <Flex gap="middle" wrap>*/}
  547. {/* <Layout style={ layoutStyle }>*/}
  548. {/* <Sider width="25%" style={ siderStyle }>*/}
  549. {/* <FileOutlined />*/}
  550. {/* </Sider>*/}
  551. {/* <Layout>*/}
  552. {/* <Header style={ headerStyle }>问答应用总数</Header>*/}
  553. {/* <Content style={ contentStyle }>{ appCount }个</Content>*/}
  554. {/* </Layout>*/}
  555. {/* </Layout>*/}
  556. {/* <Layout style={ layoutStyle }>*/}
  557. {/* <Sider width="25%" style={ siderStyle }>*/}
  558. {/* <FileOutlined />*/}
  559. {/* </Sider>*/}
  560. {/* <Layout>*/}
  561. {/* <Header style={ headerStyle }>知识库总数</Header>*/}
  562. {/* <Content style={ contentStyle }>{ knowCount } 个</Content>*/}
  563. {/* </Layout>*/}
  564. {/* </Layout>*/}
  565. {/* </Flex>*/}
  566. {/*</div>*/}
  567. {/*<div style={ { display: 'flex', justifyContent: 'space-between', padding: '16px 20px' } }>*/}
  568. {/* <div>所有问答应用</div>*/}
  569. {/* /!*{*!/*/}
  570. {/* /!* createFlag &&*!/*/}
  571. {/* /!* <Button type='primary'*!/*/}
  572. {/* /!* icon={ <PlusOutlined /> }*!/*/}
  573. {/* /!* onClick={ () => {*!/*/}
  574. {/* /!* router.navigate( { pathname: '/deepseek/questionAnswer/create' } );*!/*/}
  575. {/* /!* } }>创建问答应用</Button>*!/*/}
  576. {/* /!*}*!/*/}
  577. {/*</div>*/}
  578. <div className='applicationList'>
  579. <List grid={{
  580. gutter: 16,
  581. xs: 1,
  582. sm: 1,
  583. md: 2,
  584. lg: 2,
  585. xl: 3,
  586. xxl: 4, // 展示的列数
  587. }}
  588. dataSource={list}
  589. renderItem={(item) => (
  590. <List.Item>
  591. <div className='card'>
  592. <div style={{
  593. display: 'flex',
  594. justifyContent: 'space-between',
  595. alignItems: 'center',
  596. overflow: 'auto'
  597. }}>
  598. <div style={{ display: 'flex', alignItems: 'center', overflow: 'auto' }}>
  599. <div style={{ marginRight: 10, overflow: 'auto' }}>
  600. <Image
  601. width={32}
  602. height={32}
  603. src={IconSvg}
  604. preview={false}
  605. />
  606. </div>
  607. {/*<div style={ { overflow: 'auto' } }>*/}
  608. {/* { item.name }*/}
  609. {/*</div>*/}
  610. <div style={{
  611. display: 'flex',
  612. flexDirection: 'column',
  613. justifyContent: 'center',
  614. height: '100%'
  615. }}>
  616. <Tooltip title={item.name} placement="top">
  617. <div style={{
  618. lineHeight: '18px',
  619. fontSize: 14,
  620. fontWeight: 500,
  621. overflow: 'hidden',
  622. textOverflow: 'ellipsis',
  623. whiteSpace: 'nowrap',
  624. // maxWidth: '200px', // 可以根据需要调整宽度
  625. cursor: 'pointer'
  626. }}>
  627. {item.name.length > 20 ? `${item.name.substring(0, 30)}...` : item.name}
  628. </div>
  629. </Tooltip>
  630. <Space size={4} style={{ lineHeight: '18px' }}>
  631. <span style={{
  632. color: '#999',
  633. fontSize: 12,
  634. margin: 0
  635. }}>ID:{item.appId}</span>
  636. <Divider type="vertical" style={{ color: '999', margin: 0, height: 12 }} />
  637. <span style={{ color: '#999', fontSize: 12 }}>
  638. {
  639. item.projectName && item.projectName.length > 8 ?
  640. `${item.projectName.substring(0, 8)}...` :
  641. item.projectName
  642. }
  643. </span>
  644. </Space>
  645. </div>
  646. </div>
  647. <div>
  648. <>
  649. {/*{ item.projectName } 移动599 line*/}
  650. {
  651. (item.status !== null && item.status !== '3') &&
  652. < Tag style={{
  653. // marginLeft: 16,
  654. width: 65,
  655. color: '#fff',
  656. height: 24,
  657. backgroundColor: item.status === '1' ? '#D26900' : item.status === '2' ? '#408080' : item.auditStatus === '4' ? '#CE0000' : item.status === '5' ? '#5151A2' : ''
  658. }}>
  659. {item.status === '1' ? '待审核' : item.status === '2' ? '审核中' : item.auditStatus === '4' ? '审核拒绝' : item.status === '5' ? '待提交' : '未知'}
  660. </Tag>
  661. }
  662. {
  663. (item.auditStatus === '4') &&
  664. <Tooltip title={item.comment}>
  665. {
  666. item.comment !== '' && item.comment !== null && item.comment.length > 10 ?
  667. item.comment.substring(0, 10) + '......' :
  668. item.comment
  669. }
  670. </Tooltip>
  671. }
  672. </>
  673. </div>
  674. </div>
  675. <Divider plain style={{ margin: '16px 0' }}></Divider>
  676. <div className='desc'>
  677. {
  678. item.desc !== '' && item.desc !== null && item.desc.length > 40 ? item.desc.substring(0, 40) + '......' : item.desc
  679. }
  680. </div>
  681. <div style={{
  682. display: 'flex',
  683. justifyContent: 'space-between',
  684. alignItems: 'center'
  685. }}>
  686. <span style={{
  687. color: '#999',
  688. fontSize: 12,
  689. margin: 0
  690. }}>更新时间: {item.updateTime}</span>
  691. </div>
  692. <div style={{
  693. display: 'flex',
  694. justifyContent: 'space-between',
  695. alignItems: 'flex-end',
  696. overflow: 'auto',
  697. // paddingTop: 16,
  698. // height: '100%'
  699. }}>
  700. <div style={{ overflow: 'auto' }}>
  701. {
  702. (item.status === '5' || item.status === '4' || item.status === '3' || item.status === '' || item.status === null) &&
  703. <>
  704. {
  705. updateFlag &&
  706. <a
  707. className="action-button"
  708. style={{ marginRight: 16 }}
  709. onClick={() => {
  710. router.navigate({ pathname: '/deepseek/questionAnswer/modify' }, { state: { id: item.appId } });
  711. }}>
  712. <EditOutlined /> 编辑
  713. </a>
  714. }
  715. {
  716. deleteFlag &&
  717. <a className='delete-button' onClick={() => {
  718. Modal.confirm({
  719. title: '删除',
  720. content: `确定删除应用: ` + item.name + ` 吗?`,
  721. okType: 'danger',
  722. onOk: async () => {
  723. await delApplication(item.appId.toString());
  724. }
  725. });
  726. }}>
  727. <DeleteOutlined /> 删除
  728. </a>
  729. }
  730. </>
  731. }
  732. {
  733. createFlag && item.status === '5' &&
  734. <a className="action-button" style={{ marginLeft: 16 }} onClick={() => {
  735. Modal.confirm({
  736. title: '提交审核',
  737. content: `确认提交审核应用: ` + item.name + `吗?`,
  738. okType: 'danger',
  739. onOk: async () => {
  740. const userInfo = LocalStorage.getUserInfo();
  741. const userId = (userInfo?.id ?? '').toString();
  742. appApi.auditApplication(item.appId.toString(), userId);
  743. }
  744. });
  745. }}>
  746. <StepForwardOutlined /> 提交审核
  747. </a>
  748. }
  749. </div>
  750. <div>
  751. <Tag
  752. style={{
  753. // padding: '4px 8px',
  754. marginRight: 0,
  755. fontSize: 12,
  756. fontWeight: 600,
  757. background: '#f8f8f8',
  758. // border: '1px solid #d9d9d9'
  759. }}
  760. >
  761. {
  762. appTypeList
  763. .find(item1 => item1.value.toString() === item.typeId)?.label || levelTypeList.find(item2 => item2.value.toString() === item.typeId)?.label || '未分类'
  764. }
  765. </Tag>
  766. </div>
  767. </div>
  768. </div>
  769. </List.Item>
  770. )}
  771. pagination={paginationConfig} // 分页
  772. />
  773. </div>
  774. </div>
  775. :
  776. <div>
  777. {/* {
  778. createFlag &&
  779. <Button type='primary'
  780. icon={ <PlusOutlined /> }
  781. onClick={ () => {
  782. router.navigate( { pathname: '/deepseek/questionAnswer/create' } );
  783. } }>创建问答应用</Button>
  784. } */}
  785. <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
  786. </div>
  787. }
  788. </div>
  789. )
  790. };
  791. export default observer(QuestionAnswerList);