Browse Source

新增统计接口

master
zhouhaibin 3 months ago
parent
commit
1247c287b7
  1. 12
      src/views/informationSub/countStatistics/countStatistics.api.ts
  2. 69
      src/views/informationSub/countStatistics/countStatistics.data.ts
  3. 51
      src/views/informationSub/countStatistics/index.vue
  4. 61
      src/views/informationSub/countStatistics/modifycountStatistics.vue

12
src/views/informationSub/countStatistics/countStatistics.api.ts

@ -4,7 +4,12 @@ export enum Api {
periodicallabCountPageList = '/huzhouPeriodicallabCount/periodicallabCountPageList', periodicallabCountPageList = '/huzhouPeriodicallabCount/periodicallabCountPageList',
getperiodicallabById = '/huzhouPeriodicallabCount/getperiodicallabById', getperiodicallabById = '/huzhouPeriodicallabCount/getperiodicallabById',
modifyPeriodicallabCount='/huzhouPeriodicallabCount/modifyPeriodicallabCount' modifyPeriodicallabCount='/huzhouPeriodicallabCount/modifyPeriodicallabCount',
addPeriodicallabCount="/huzhouPeriodicallabCount/addPeriodicallabCount",
deletePeriodicallabCount="/huzhouPeriodicallabCount/deletePeriodicallabCount",
getadminDivisionList="/huzhouProject/getadminDivisionList",
getDutyWorkplaceList="/huzhouProject/getDutyWorkplaceList",
} }
/** /**
@ -14,6 +19,11 @@ export const periodicallabCountPageList = (params?) =>defHttp.get({ url: Api.pe
export const getperiodicallabById = (params?) =>defHttp.get({ url: Api.getperiodicallabById, params }); export const getperiodicallabById = (params?) =>defHttp.get({ url: Api.getperiodicallabById, params });
export const modifyPeriodicallabCount = (params?) =>defHttp.post({ url: Api.modifyPeriodicallabCount, params }); export const modifyPeriodicallabCount = (params?) =>defHttp.post({ url: Api.modifyPeriodicallabCount, params });
export const deletePeriodicallabCount = (params?) =>defHttp.post({ url: Api.deletePeriodicallabCount, params });
export const addPeriodicallabCount = (params?) =>defHttp.post({ url: Api.addPeriodicallabCount, params });
export const getDutyWorkplaceList = (params?) =>defHttp.get({ url: Api.getDutyWorkplaceList, params });
export const getadminDivisionList = (params?) =>defHttp.get({ url: Api.getadminDivisionList, params });

69
src/views/informationSub/countStatistics/countStatistics.data.ts

@ -1,23 +1,53 @@
import { FormSchema } from '@/components/Form'; import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table'; import { BasicColumn } from '@/components/Table';
import { useDictStore } from '@/store/modules/dict'; import { useDictStore } from '@/store/modules/dict';
import { getDutyWorkplaceList, getadminDivisionList } from './countStatistics.api';
import { get } from 'sortablejs';
let dutyWorkplaceOption=[]
let adminDivisionOption=[]
async function getDutyWorkplaceOptions() {
let list = await getDutyWorkplaceList();
let uniqueList = [...new Set(list)];
let res= uniqueList.map(item => {
return {
label: item,
value: item
}
})
console.log("wwres",res)
return res
}
async function getadminDivisionOptions() {
let list = await getadminDivisionList();
let uniqueList = [...new Set(list)];
let res= uniqueList.map(item => {
return {
label: item,
value: item
}
})
console.log("wres",res)
return res
}
export const countStatisticsColumns: BasicColumn[] = [ export const countStatisticsColumns: BasicColumn[] = [
{ {
title: '责任单位', title: '责任单位',
width: 150, width: 150,
dataIndex: 'fieldName', dataIndex: 'dutyWorkplace',
}, },
{ {
title: '行政区划', title: '行政区划',
dataIndex: 'ischange', dataIndex: 'adminDivision',
width: 150, width: 150,
}, },
{ {
title: '已提交稿件数量', title: '已提交稿件数量',
dataIndex: 'isuploadfile', dataIndex: 'countNumber',
width: 150, width: 150,
sorter: true, sorter: true,
@ -29,42 +59,47 @@ export const countStatisticsColumns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
label: '责任单位', label: '责任单位',
field: 'fieldName', field: 'dutyWorkplace',
component: 'Input', component: 'Input',
colProps: { span: 6 }, colProps: { span: 6 },
}, },
{ {
label: '行政区划', label: '行政区划',
field: 'fieldName', field: 'adminDivision',
component: 'Input', component: 'Input',
colProps: { span: 6 }, colProps: { span: 6 },
}, },
] ]
export const countStatisticsFormSchema: FormSchema[] = [ export const countStatisticsFormSchema: FormSchema[] = [
{label:"id",
field: 'id',
component: 'Input',
show:false,
},
{ {
label: '责任单位', label: '责任单位',
field: 'fieldName', field: 'dutyWorkplace',
component: 'Input', required: true,
dynamicDisabled: true, component: 'Select',
componentProps: {
options:await getDutyWorkplaceOptions()
},
colProps: { span:12}, colProps: { span:12},
}, },
{ {
label: '行政区划', label: '行政区划',
field: 'ischange', field: 'adminDivision',
component: 'DictSelect', required: true,
component: 'Select',
componentProps: { componentProps: {
dictType: 'whether', options:await getadminDivisionOptions()
}, },
dynamicDisabled: true,
colProps: { span:12 }, colProps: { span:12 },
}, },
{ {
label: '已提交稿件数量', label: '已提交稿件数量',
field: 'isuploadfile', field: 'countNumber',
component: 'DictSelect', component: 'InputNumber',
componentProps: {
dictType: 'whether',
},
required: true, required: true,
colProps: { span: 12 }, colProps: { span: 12 },
} }

51
src/views/informationSub/countStatistics/index.vue

@ -1,6 +1,5 @@
<template> <template>
<PageWrapper dense> <PageWrapper dense>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
@ -9,12 +8,14 @@
<!-- <TableAction :actions="getTableAction(record)" /> --> <!-- <TableAction :actions="getTableAction(record)" /> -->
<TableAction :actions="getTableAction(record)" /> <TableAction :actions="getTableAction(record)" />
</template> </template>
<template #tableTitle>
<el-button type="primary" round @click="handleAdd" v-if="isShowByRoles('manageOrg')"
>新增</el-button
>
</template>
</BasicTable> </BasicTable>
<BasicModal @register="registechangeFieldManageModal" title="变更字段详情" width="1200px" :showOkBtn="false"> <modifycountStatistics @register="register" @exit="close" />
<modifycountStatistics :id="id" @exit="close" />
</BasicModal>
</PageWrapper> </PageWrapper>
</template> </template>
<script lang="ts" name="system-user" setup> <script lang="ts" name="system-user" setup>
@ -22,15 +23,14 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { ActionItem, BasicTable, TableAction, useTable } from '@/components/Table'; import { ActionItem, BasicTable, TableAction, useTable } from '@/components/Table';
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import modifycountStatistics from "./modifycountStatistics.vue" import modifycountStatistics from './modifycountStatistics.vue';
import { BasicModal, useModal } from '@/components/Modal'; import { BasicModal, useModal } from '@/components/Modal';
import { countStatisticsColumns, searchFormSchema } from './countStatistics.data' import { countStatisticsColumns, searchFormSchema } from './countStatistics.data';
import { periodicallabCountPageList } from './countStatistics.api'; import { periodicallabCountPageList,deletePeriodicallabCount } from './countStatistics.api';
import { isShowByRoles } from '@/views/projectLib/projectInfo/projectInfo.api';
let id = ref(); let id = ref();
const [registechangeFieldManageModal, { openModal: openchangeFieldManage,closeModal}] = useModal();// const [register, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({ const [registerTable, { reload }] = useTable({
title: '信息稿件详情', title: '信息稿件详情',
@ -46,7 +46,7 @@ const [registerTable,{reload}] = useTable({
// //
formConfig: { formConfig: {
schemas: searchFormSchema, schemas: searchFormSchema,
} },
}); });
function getTableAction(record): ActionItem[] { function getTableAction(record): ActionItem[] {
@ -55,18 +55,33 @@ function getTableAction(record): ActionItem[] {
label: '修改', label: '修改',
onClick: handlemodifympage.bind(null, record), onClick: handlemodifympage.bind(null, record),
}, },
{
label: '删除',
ifShow: () => {
return isShowByRoles('manageOrg')
},
popConfirm: {
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
},
}
]; ];
} }
function handleAdd() {
openModal(true,{id:null});
}
function handlemodifympage(record) { function handlemodifympage(record) {
id.value = record.id id.value = record.id;
openchangeFieldManage() openModal(true,{id:record.id});
} }
function close() { function close() {
closeModal() reload();
reload() }
async function handleDelete(record) {
await deletePeriodicallabCount({id:record.id})
reload();
} }
</script> </script>

61
src/views/informationSub/countStatistics/modifycountStatistics.vue

@ -1,24 +1,38 @@
<template> <template>
<div> <BasicModal
v-bind="$attrs"
@register="registerModal"
title="变更统计"
width="1200px"
:showOkBtn="false"
>
<BasicForm @register="registerchangeFieldForm" @submit="handleSubmit" /> <BasicForm @register="registerchangeFieldForm" @submit="handleSubmit" />
</div> </BasicModal>
</template> </template>
<script lang="ts" name="changeFieldManageDetail" setup> <script lang="ts" name="changeFieldManageDetail" setup>
//ts //ts
import { defineProps, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { useForm, BasicForm } from '@/components/Form'; import { useForm, BasicForm } from '@/components/Form';
import { countStatisticsFormSchema } from './countStatistics.data' import { countStatisticsFormSchema } from './countStatistics.data';
import { modifyPeriodicallabCount, getperiodicallabById } from './countStatistics.api'; import {
modifyPeriodicallabCount,
let emit = defineEmits(["exit"]) getperiodicallabById,
let dataTo = defineProps(["id"]) addPeriodicallabCount,
} from './countStatistics.api';
onMounted(async () => { import { useModalInner, BasicModal } from '@/components/Modal';
let res = await getperiodicallabById({id: dataTo.id}) const [registerModal, { closeModal }] = useModalInner(init);
console.log("结果是", res) let id = ref('');
setFieldsValue(res) let emit = defineEmits(['exit']);
}) async function init(dataTo) {
id.value = dataTo.id;
if (dataTo.id) {
let res = await getperiodicallabById({ id: dataTo.id });
console.log('结果是', res);
setFieldsValue(res);
}
}
onMounted(async () => {});
const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue }] = useForm({ const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue }] = useForm({
// //
schemas: countStatisticsFormSchema, schemas: countStatisticsFormSchema,
@ -42,17 +56,24 @@ const [registerchangeFieldForm,{ getFieldsValue, validate, setFieldsValue }] = u
labelCol: { style: { width: '120px' } }, labelCol: { style: { width: '120px' } },
wrapperCol: { style: { width: 'auto' } }, wrapperCol: { style: { width: 'auto' } },
// disabled:true // disabled:true
}) });
async function handleSubmit() { async function handleSubmit() {
if (await validate()) { if (await validate()) {
let datas = await getFieldsValue() if (id.value) {
await modifyPeriodicallabCount(datas) let datas = await getFieldsValue();
emit("exit") await modifyPeriodicallabCount(datas);
} else {
let datas = await getFieldsValue();
await addPeriodicallabCount(datas);
}
emit('exit');
closeModal()
} }
} }
async function customResetFunc() { async function customResetFunc() {
emit("exit") emit('exit');
closeModal()
} }
</script> </script>
<style scoped></style> <style scoped></style>
Loading…
Cancel
Save