index.tsx 31 KB

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