diff --git a/admin/src/pages/course/subject/service.ts b/admin/src/pages/course/subject/service.ts index 5b4d863..e8d8b47 100644 --- a/admin/src/pages/course/subject/service.ts +++ b/admin/src/pages/course/subject/service.ts @@ -62,6 +62,7 @@ export async function copySubject(data: { [key: string]: any }, options?: { [key + // /** 新建规则 PUT /api/rule */ // export async function updateRule(data: { [key: string]: any }, options?: { [key: string]: any }) { // return request('/api/rule', { @@ -93,8 +94,8 @@ export async function copySubject(data: { [key: string]: any }, options?: { [key /** * 获取主题列表 * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 - * @param params - * @returns + * @param params + * @returns */ export async function querySubjectList(params: { page_size: number; @@ -108,8 +109,8 @@ export async function querySubjectList(params: { /** * 根据主题获取章节列表 * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6428 - * @param params - * @returns + * @param params + * @returns */ export async function queryListChapterBySubject(params: { page_number: number; //页码 number 非必填;默认为1 @@ -122,9 +123,9 @@ export async function querySubjectList(params: { }); } -/** +/** * 新建/修改章节 POST /dsideal_yy/ypt/careerTraining/course/save - * + * */ export async function saveChapter(data: Record, options?: Record) { return request('/dsideal_yy/ypt/careerTraining/subject/saveChapter', { @@ -135,9 +136,9 @@ export async function saveChapter(data: Record, options?: Record, options?: Record) { return request('/dsideal_yy/ypt/careerTraining/subject/commitSubject', { @@ -157,4 +158,17 @@ export async function removeSubject(data: { key: number[] }, options?: Record) { + console.log('data:::', data); + return request>(' /dsideal_yy/ypt/careerTraining/subject/deleteChapter', { + data: { chapter_id: data?.key[0].chapter_id,subject_id: data?.key[0].subject_id}, // 当前接口不支持批量操作 + method: 'POST', + requestType: 'form', + ...(options || {}), + }); +} diff --git a/admin/src/pages/course/subject/step/index.tsx b/admin/src/pages/course/subject/step/index.tsx index 2b4254e..08655ae 100644 --- a/admin/src/pages/course/subject/step/index.tsx +++ b/admin/src/pages/course/subject/step/index.tsx @@ -23,167 +23,16 @@ import ProFormRichEdit from '../components/ProFormRichEdit'; import type { ActionType, ProColumns } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; import type { TableListItem, TableListPagination } from '../../option/data'; -import { queryCourseList, queryCourseListByTag, queryTagList, saveSubject } from '../../option/service'; -import { commitSubject, getSubjectInfo, queryListChapterBySubject, saveChapter } from '../service'; +import {queryCourseList, queryCourseListByTag, queryTagList, removeCourse, saveSubject} from '../../option/service'; +import { commitSubject, getSubjectInfo, queryListChapterBySubject, saveChapter,deleteChapter } from '../service'; import { v4 as uuidv4 } from 'uuid'; +import {DataItem} from "@antv/data-set/lib/transform/tag-cloud"; +import {removeTrain} from "@/pages/training/option/service"; +import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service"; +const { confirm } = Modal; -/** 列表项定义 */ -const columns: ProColumns[] = [ - { - title: '序号', - key: 'index', - valueType: 'indexBorder', - width: 48, - }, - { - title: '章节名称', - dataIndex: 'chapter_name', - valueType: 'text', - hideInTable: false, - hideInDescriptions: false, - hideInForm: false, - hideInSearch: true, - formItemProps: { - rules: [ - { - required: true, - message: '请填写章节名称', - }, - ] - }, - }, - { - title: '简介', - dataIndex: 'chapter_describe', - valueType: 'textarea', - sorter: false, - hideInTable: false, - hideInForm: false, - hideInSearch: true, - formItemProps: { - rules: [ - { - required: true, - message: '请填写章节简介', - }, - ] - }, - renderText: (val: string) => (
), - renderFormItem: (item, { defaultRender, ...rest }, form) => ( - - ), - }, - { - title: '标签', - valueType: 'select', - dataIndex: 'tags', - sorter: false, - hideInTable: true, - hideInForm: false, - hideInSearch: true, - fieldProps: { - mode: "multiple" - }, - renderText: (val: string) => `${val}`, - request: async () => { - const { data: Items } = await queryTagList({}); - console.log('queryTagList...') - const tags = [] - for (let i = 0; i < Items.length; i++) { - tags.push({ label: Items[i].tag_name, value: Items[i].tag_id }) - } - console.log(tags, 'tags:::'); - return tags; - }, - }, - { - title: '课程', - valueType: 'select', - dataIndex: 'course_ids', - sorter: false, - hideInTable: false, - hideInForm: false, - hideInSearch: true, - fieldProps: { - mode: "multiple" - }, - formItemProps: { - rules: [ - { - required: true, - message: '请填选择课程', - }, - ] - }, - renderText: (val: string) => `${val}`, - dependencies: ['tags'], - request: async (params) => { - const {tags} = params; - const { data: Items } = await queryCourseListByTag({tag_ids: tags?.toString()}); - console.log('queryCourseListByTag...') - const courses = [] - for (let i = 0; i < Items?.length; i++) { - courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id }) - } - console.log(courses, 'courses:::'); - return courses; - }, - - }, - { - title: '学时', - dataIndex: 'course_minutes', - valueType: 'text', - sorter: false, - hideInTable: false, - hideInForm: true, - hideInSearch: true, - renderText: (val: string) => `${val}`, - }, - - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - width: 200, - render: (_dom: any, record: React.SetStateAction) => [ - { - //console.log('entity', entity); - //setCurrentRow(record); - //handleDetailModalVisible(true); - }} - > - 查看 - , - { - //setCurrentRow(record); - //handleUpdateModalVisible(true); - }} - > - 编辑 - , - { }}> - 删除 - , - ], - }, -]; /** * 添加章节 @@ -221,30 +70,224 @@ export default () => { const [createModalVisible, handleCreateModalVisible] = useState(false); const [detailModalVisible, handleDetailModalVisible] = useState(false); const [updateModalVisible, handleUpdateModalVisible] = useState(false); - + const [selectedRowsState, setSelectedRows] = useState([]); const [uploadFileName, SetUploadFileName] = useState(); const [uploadFileExt, SetUploadFileExt] = useState(); const [subjectIntro, setSubjectIntro] = useState({}); - + const [currentRow, setCurrentRow] = useState(); const formMapRef = useRef | undefined>[]>([]); + /** 列表项定义 */ + const columns: ProColumns[] = [ + { + title: '序号', + key: 'index', + valueType: 'indexBorder', + width: 48, + align:'center' + }, + { + title: '章节名称', + dataIndex: 'chapter_name', + valueType: 'text', + hideInTable: false, + hideInDescriptions: false, + hideInForm: false, + hideInSearch: true, + formItemProps: { + rules: [ + { + required: true, + message: '请填写章节名称', + }, + ] + }, + align:'center' + }, + { + title: '简介', + dataIndex: 'chapter_describe', + valueType: 'textarea', + sorter: false, + hideInTable: false, + hideInForm: false, + hideInSearch: true, + formItemProps: { + rules: [ + { + required: true, + message: '请填写章节简介', + }, + ] + }, + renderText: (val: string) => (
), + renderFormItem: (item, { defaultRender, ...rest }, form) => ( + + ), + align:'center' + }, + { + title: '标签', + valueType: 'select', + dataIndex: 'tags', + sorter: false, + hideInTable: true, + hideInForm: false, + hideInSearch: true, + fieldProps: { + mode: "multiple" + }, + renderText: (val: string) => `${val}`, + request: async () => { + const { data: Items } = await queryTagList({}); + console.log('queryTagList...') + const tags = [] + for (let i = 0; i < Items.length; i++) { + tags.push({ label: Items[i].tag_name, value: Items[i].tag_id }) + } + console.log(tags, 'tags:::'); + return tags; + }, + align:'center' + }, + { + title: '课程', + valueType: 'select', + dataIndex: 'course_ids', + sorter: false, + hideInTable: false, + hideInForm: false, + hideInSearch: true, + fieldProps: { + mode: "multiple" + }, + formItemProps: { + rules: [ + { + required: true, + message: '请填选择课程', + }, + ] + }, + renderText: (val: string) => `${val}`, + dependencies: ['tags'], + request: async (params) => { + const {tags} = params; + const { data: Items } = await queryCourseListByTag({tag_ids: tags?.toString()}); + console.log('queryCourseListByTag...') + const courses = [] + for (let i = 0; i < Items?.length; i++) { + courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id }) + } + console.log(courses, 'courses:::'); + return courses; + }, + align:'center' + }, + { + title: '学时', + dataIndex: 'course_minutes', + valueType: 'text', + sorter: false, + hideInTable: false, + hideInForm: true, + hideInSearch: true, + renderText: (val: string) => `${val}`, + align:'center' + }, + + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + width: 200, + align:'center', + render: (_dom: any, record: React.SetStateAction) => [ + { + setCurrentRow(record); + handleUpdateModalVisible(true); + }} + > + 编辑 + , + { + showConfirm(record) + + }}> + 删除 + , + ], + }, + ]; + + const params = useParams(); - //console.log('params', params); + console.log('params', params); const {data:subjectInfo} = useRequest(() => { return getSubjectInfo({subject_id: params?.id}); }); - + + + const showConfirm=async (record)=>{ + confirm({ + title: '确认删除章节吗?', + centered:true, + onOk() { + handleRemove([record]); + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }, + onCancel() { + }, + }); + }; + + const handleRemove = async (selectedRows: TableListItem[]) => { + const hide = message.loading('正在删除'); + if (!selectedRows) return true; + try { + const {code, msg} = await deleteChapter({ + key: selectedRows, + }); + hide(); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } + return true; + } catch (error) { + // console.log('error', error) + hide(); + message.error('删除失败,请重试'); + return false; + } + }; + useEffect(() => { - console.log('getSubjectInfo', subjectInfo); + console.log('getSubjectInfo', subjectInfo); console.log('url', subjectInfo?.attachment_json?.url); // 编辑场景下需要使用formMapRef循环设置formData formMapRef.current.forEach((formInstanceRef) => { let fieldsValue; const subjectValue = { - subject_name:subjectInfo?.subject_name, - subject_describe:subjectInfo?.subject_describe, + subject_name:subjectInfo?.subject_name, + subject_describe:subjectInfo?.subject_describe, } if(params?.id && subjectInfo?.attachment_json?.url){ fieldsValue = { @@ -266,6 +309,19 @@ export default () => { }, [subjectInfo]); + /** 获取列数据初始值 */ + const getInitialValues = (cols: any[], vals: any) => { + console.log('getInitialValues-columns', columns); + console.log('getInitialValues-values', vals); + const initialValues: any[] = []; + cols.forEach((column: { dataIndex: string }) => { + const key: any = column?.dataIndex || ''; + initialValues.push({ ...column, initialValue: key ? vals[key] : '' }); + }); + console.log('initialValues::', initialValues); + return initialValues || []; + }; + return ( @@ -314,7 +370,7 @@ export default () => { attachment_json: `{ "url": "${url}"}` }); setSubjectIntro({subject_id:data?.subject_id, subject_name: value?.subject_name, subject_describe:value?.subject_describe}); - + return true; }} > @@ -504,6 +560,54 @@ export default () => { columns={columns} /> + { + handleUpdateModalVisible(false); + }} + footer={null} + > + {console.log('currentRow',currentRow)} + {currentRow?.chapter_id && ( + + layout="horizontal" + layoutType="Form" + labelCol={{ span: 8 }} + wrapperCol={{ span: 12 }} + onFinish={async (values) => { + console.log('values', values) + console.log('currentRow', currentRow) + //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; + //console.log('url', url) + // await handleUpdate({ + // ...values, + // attachment_filesize: attachment_json?.size || 0, // Bit 字节 + // course_id: currentRow?.course_id, + // attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}` + // }); + handleUpdateModalVisible(false); // 隐藏编辑窗口 + actionRef.current?.reloadAndRest?.(); + console.log(values); + }} + submitter={{ + render: (props, doms) => ( + + + {doms} + + + ), + }} + // action = '' + title="编辑" + columns={getInitialValues(columns, currentRow)} + /> + )} +
@@ -544,4 +648,4 @@ export default () => { ); -}; \ No newline at end of file +}; diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 267d4a3..150901a 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -5,12 +5,13 @@ import numeral from 'numeral'; import { ChartCard, Field } from './Charts'; import type { DataItem } from '../data.d'; -import { getAsyncOrgTree, getEduUnitList } from '../service'; +import { getAsyncOrgTree, getEduUnitList,getExaminationStatistics } from '../service'; const { Option } = Select; import styles from '../style.less'; import ProForm, { ProFormSelect } from '@ant-design/pro-form'; import { useRequest } from 'umi'; +import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service"; const { RangePicker } = DatePicker; const topColResponsiveProps = { @@ -28,13 +29,16 @@ const layout = { wrapperCol: { span: 16 }, }; +let city_id=0; +let area_id=0; +let school=0; const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => { const [provinceId, setProvinceId] = useState("100007") const [cityList, setCityList] = useState([]); const [areaList, setAreaList] = useState([]); const [schoolList, setSchoolList] = useState([]); - + const [options, setOptions] = useState([]); const [fetching, setFetching] = useState(false); const fetchRef = useRef(0); @@ -57,6 +61,30 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat }); + const {data: examinationData, run } = useRequest(() => { + return getExaminationStatistics({ + bureau_id:school, + city_id:city_id, + district_id: area_id, + province_id: provinceId + }); + },{ + formatResult: (result) => { + if(result.credential_person_count===0||result.apply_person_count===0){ + const num=0; + result.num=num; + }else { + const percent=result.credential_person_count/result.apply_person_count; + const num=percent.toFixed(4); + result.num=num; + } + + return result; + } + }); + + + // 获取市数据 const { data: cityData, loading: cityLoading } = useRequest(() => { return getAsyncOrgTree({ @@ -66,7 +94,6 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat }); },{ formatResult: (result) => { - console.log('result') return result; } }); @@ -75,13 +102,11 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(() => { - console.log('cityData', cityData); setCityList(cityData || []); }, [cityData]); const getAreaData = async (e: any) => { - // console.log(e, 'eeeeeeeeeeeee2ee'); const areaData = await getAsyncOrgTree({ org_id: e, org_type: 2, @@ -89,28 +114,29 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat }); form.setFieldsValue({ area: 0 }) setAreaList(areaData || []); + run() } - const getSchoolData = async () => { - - const schoolData = await getEduUnitList({ - random_num: 277470, - area_id: provinceId, - edu_type: -1, - // main_school_id: 200125116, - org_name: e, - org_type: 2, - pageNumber: 1, - pageSize: 1000, - school_type: -1, - showPassWord: true, - }) - retrun [{label:'aaaa', value:'1111'},{label:'aaaa', value:'1111'}] - } + // const getSchoolData = async (e) => { + // + // const schoolData = await getEduUnitList({ + // random_num: 277470, + // area_id: provinceId, + // edu_type: -1, + // // main_school_id: 200125116, + // org_name: e, + // org_type: 2, + // pageNumber: 1, + // pageSize: 1000, + // school_type: -1, + // showPassWord: true, + // }) + // retrun [{label:'aaaa', value:'1111'},{label:'aaaa', value:'1111'}] + // } const onFinish = (values: any) => { - console.log(values); + // console.log(values); }; const onGenderChange = (value: string) => { @@ -122,14 +148,15 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat /** * 学校下拉搜索 - * @param value + * @param value */ const handleSearch = async (value: any) => { if (value >= 'a' && value <= 'z') { return false; } if (value) { - console.log('value::', value) + school=value; + // console.log('value::', value) // setOptions([{ORG_NAME:"aaa", ORG_ID:"111"},{ORG_NAME:"aab", ORG_ID:"112"}]) const { table_List } = await getEduUnitList({ random_num: 277470, @@ -143,10 +170,13 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat school_type: -1, showPassWord: true, }); + + setOptions(table_List); } else { setOptions([]); } + }; return ( @@ -157,28 +187,39 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat @@ -194,13 +235,32 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat filterOption={false} // onChange={getSchoolData} notFoundContent={fetching ? : null} - fieldNames={{ value: "ORG_ID", label: "ORG_NAME" }} + // fieldNames={{ value: "ORG_ID", label: "ORG_NAME" }} onSearch={handleSearch} - options={options} - /> - {console.log(schoolList, 'schoolList111')} + allowClear={true} + onClear={()=>{ + console.log('清空') + school=0; + run(); + }} + onChange={(e)=>{ + console.log('e.target.value',e) + if(e!==undefined){ + school=e; + run(); + } + + }} + // options={options} + > + { + options.length!==0? + options.map((item)=>{ + return + }):'' + } + - @@ -208,13 +268,13 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat - + - + - + @@ -230,7 +290,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat style={{ textAlign: 'center', marginBottom: 0 , padding:12, border:'solid 1px #f0f0f0'}} bodyStyle={{padding:0}} > - + diff --git a/admin/src/pages/history/analysis/service.ts b/admin/src/pages/history/analysis/service.ts index 41ded79..646688c 100644 --- a/admin/src/pages/history/analysis/service.ts +++ b/admin/src/pages/history/analysis/service.ts @@ -38,8 +38,8 @@ export async function fakeChartData(): Promise<{ data: AnalysisData }> { /** * 获取省市区 * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 - * @param params - * @returns + * @param params + * @returns */ export async function getAsyncOrgTree(params: { page_size: number; @@ -54,8 +54,8 @@ export async function getAsyncOrgTree(params: { /** * 获取学校列表 * /dsideal_yy/ypt/sys/org/getEduUnitList - * @param params - * @returns + * @param params + * @returns */ export async function getEduUnitList(params: { page_size: number; @@ -68,8 +68,8 @@ export async function getEduUnitList(params: { /** * 市获取资质证书 * /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics - * @param params - * @returns + * @param params + * @returns */ export async function getCredentialPersonStatistics(params: { province_id: { province_id: number }; @@ -82,8 +82,8 @@ export async function getCredentialPersonStatistics(params: { /** * 市获取资质证书 * /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics - * @param params - * @returns + * @param params + * @returns */ export async function getExaminationPersonStatistics(params: { page_number: number, @@ -96,7 +96,17 @@ export async function getExaminationPersonStatistics(params: { }); } - +//获取 获取资质考试数据 +export async function getExaminationStatistics(params: { + bureau_id: number, + city_id: number, + district_id: number, + province_id: number, +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/statistics/getExaminationStatistics', { + params, + }); +} @@ -111,4 +121,4 @@ http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=100025&org_type=1&get_ 获取市区下的区列表: http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=200265&org_type=2&get_next=1 参数:org_id(市ID),org_type(默认传2),get_next(默认传1) -*/ \ No newline at end of file +*/