Commit 00ae9982 authored by 水落(YangLei)'s avatar 水落(YangLei)

feat: 代码优化,增加周报页面

parent 1b45a3e4
...@@ -8,11 +8,11 @@ export * from './xunjian'; ...@@ -8,11 +8,11 @@ export * from './xunjian';
export function getUserDetailInfoApi() { export function getUserDetailInfoApi() {
return request('/api/v1/detail', METHOD.GET); return request('/api/v1/detail', METHOD.GET);
} }
export const getStaticParam = async staticKey => { export const getStaticParam = async (staticKey) => {
const res = await request('/api/v1/parameters/business/multi/list', METHOD.GET, { const res = await request('/api/v1/parameters/business/multi/list', METHOD.GET, {
queryList: staticKey, queryList: staticKey,
}); });
const curData = res.find(i => i.key === staticKey); const curData = res.find((i) => i.key === staticKey);
const newData = await formatObj(curData.businessParameterList || [], { const newData = await formatObj(curData.businessParameterList || [], {
value: 'paramValue', value: 'paramValue',
label: 'paramName', label: 'paramName',
...@@ -21,7 +21,7 @@ export const getStaticParam = async staticKey => { ...@@ -21,7 +21,7 @@ export const getStaticParam = async staticKey => {
return newData; return newData;
}; };
export const getStaticDataApi = async data => { export const getStaticDataApi = async (data) => {
const res = await request('/api/v1/parameters/business/list', METHOD.GET, { const res = await request('/api/v1/parameters/business/list', METHOD.GET, {
...data, ...data,
paramLocale: Lang.get(), paramLocale: Lang.get(),
...@@ -33,3 +33,7 @@ export const getStaticDataApi = async data => { ...@@ -33,3 +33,7 @@ export const getStaticDataApi = async data => {
}); });
return newData; return newData;
}; };
export function getStaticDataByTwoParamsApi(paramModule, paramCode) {
return getStaticDataApi({ paramModule, paramCode });
}
import { getReq, postReq } from '@/utils/requestUtil'; import { getReq, postReq } from '@/utils/requestUtil';
import langUtils from '@/utils/langUtils';
export function getXunJianDownloadUrlApi(idList) { export function getXunJianDownloadUrlApi(idList) {
return getReq('/ranger/inspection/api/v1/jobs/export', { jobIdList: idList.join(',') }); return getReq('/ranger/inspection/api/v1/jobs/export', { jobIdList: idList.join(',') });
} }
export function getAreaListDataApi() {
return getReq(`/ranger/inspection/api/v1/region/list`);
}
export function getBusinessListApi() {
return getReq(
`/api/v1/parameters/business/list?paramModule=rpis_route_schedule&paramCode=inspection_state&paramLocale=${langUtils.get()}`,
);
}
export function getBanZuListApi() {
return getReq(
`/api/v1/parameters/business/list?paramModule=rpis_route_schedule&paramCode=shift_type&paramLocale=${langUtils.get()}`,
);
}
export function getTaskTypeApi() {
return getReq(
`/api/v1/parameters/business/list?paramModule=rpis_route_schedule&paramCode=job_type&paramLocale=${langUtils.get()}`,
);
}
export function addXunJianTaskApi(data) { export function addXunJianTaskApi(data) {
return postReq('/ranger/inspection/api/v1/jobs/temporary', data); return postReq('/ranger/inspection/api/v1/jobs/temporary', data);
} }
...@@ -163,6 +163,7 @@ export default { ...@@ -163,6 +163,7 @@ export default {
methods: { methods: {
async getData() { async getData() {
this.loading = true; this.loading = true;
console.log(this.queryForm);
try { try {
this.noPage ? await this.getDataNoPage() : await this.getDataWithPage(); this.noPage ? await this.getDataNoPage() : await this.getDataWithPage();
} catch (error) { } catch (error) {
......
<template>
<a-week-picker
class="tw-w-full"
placeholder="Select week"
@change="change"
v-bind="$attrs"
v-on="$listeners"
/>
</template>
<script>
export default {
props: {
year: String,
week: String,
},
methods: {
change(val) {
this.$emit('update:week', val.week().toString());
this.$emit('update:year', val.year().toString());
},
},
};
</script>
import Index from './index.vue';
export default Index;
<template>
<Table url="/ranger/inspection/api/v1/analysis/reports/inspection/week" rowKey="remotrId">
<template #search="{ query }">
<MoreItem label="周">
<WeeklySelect placeholder="Select week" :week.sync="query.week" :year.sync="query.year" />
</MoreItem>
<MoreItem label="地区">
<UrlSelect
url="/ranger/inspection/api/v1/region/list"
v-model="query.regionId"
labelFiled="regionName"
valueFiled="regionId"
/>
</MoreItem>
<MoreItem label="专业">
<UrlSelect
:url="
query.regionId
? `/ranger/inspection/api/v1/specialities/valid/regions/${query.regionId}/list`
: ''
"
v-model="query.specialityId"
labelFiled="specialityName"
valueFiled="specialityId"
/>
</MoreItem>
</template>
<a-table-column title="报表名称" data-index="routeName" />
<a-table-column title="地区" data-index="specialityName" />
<a-table-column title="专业" data-index="regionName" />
<a-table-column title="年" data-index="shiftTypeName" />
<!-- <a-table-column title="周" data-index="shiftTypeName" />
<a-table-column title="任务数" data-index="shiftTypeName" />
<a-table-column title="项目数" data-index="shiftTypeName" />
<a-table-column title="正常数" data-index="shiftTypeName" />
<a-table-column title="异常数" data-index="shiftTypeName" />
<a-table-column title="已检数" data-index="shiftTypeName" />
<a-table-column title="免检数" data-index="shiftTypeName" />
<a-table-column title="未检数" data-index="shiftTypeName" />
<a-table-column title="未检率" data-index="shiftTypeName" />
<a-table-column title="异常率" data-index="shiftTypeName" /> -->
</Table>
</template>
<script>
import Table from '@/components/table/table.vue';
import MoreItem from '@/components/table/more_item.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import WeeklySelect from '@/components/table/weekly_select.vue';
export default {
components: { Table, MoreItem, UrlSelect, WeeklySelect },
};
</script>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<Wraper :hidden="hidden" :onOk="submit" :refresh="refresh"> <Wraper :hidden="hidden" :onOk="submit" :refresh="refresh">
<a-form-model layout="vertical" :model="form" :rules="rules" ref="form"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="form">
<a-form-model-item label="地区" prop="regionId"> <a-form-model-item label="地区" prop="regionId">
<RequestSelect <UrlSelect
:request="getAreaListDataApi" url="/ranger/inspection/api/v1/region/list"
v-model="form.regionId" v-model="form.regionId"
labelFiled="regionName" labelFiled="regionName"
valueFiled="regionId" valueFiled="regionId"
...@@ -56,7 +56,7 @@ import Wraper from '@/components/table/wraper.vue'; ...@@ -56,7 +56,7 @@ import Wraper from '@/components/table/wraper.vue';
import RequestSelect from '@/components/MySelect/RequestSelect.vue'; import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import SearchSelect from '@/components/MySelect/search_select.vue'; import SearchSelect from '@/components/MySelect/search_select.vue';
import UrlSelect from '@/components/MySelect/url_select.vue'; import UrlSelect from '@/components/MySelect/url_select.vue';
import { getAreaListDataApi, getBanZuListApi, addXunJianTaskApi } from '@/api'; import { getStaticDataByTwoParamsApi, addXunJianTaskApi } from '@/api';
export default { export default {
props: { props: {
...@@ -66,8 +66,7 @@ export default { ...@@ -66,8 +66,7 @@ export default {
components: { Wraper, RequestSelect, SearchSelect, UrlSelect }, components: { Wraper, RequestSelect, SearchSelect, UrlSelect },
data() { data() {
return { return {
getAreaListDataApi, getBanZuListApi: getStaticDataByTwoParamsApi('rpis_route_schedule', 'shift_type'),
getBanZuListApi,
form: {}, form: {},
rules: { rules: {
inspectionIdList: [{ required: true }], inspectionIdList: [{ required: true }],
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
/> />
</MoreItem> </MoreItem>
<MoreItem label="地区"> <MoreItem label="地区">
<RequestSelect <UrlSelect
:request="getAreaListDataApi" url="/ranger/inspection/api/v1/region/list"
v-model="query.regionId" v-model="query.regionId"
labelFiled="regionName" labelFiled="regionName"
valueFiled="regionId" valueFiled="regionId"
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
/> />
</MoreItem> </MoreItem>
<MoreItem label="地区"> <MoreItem label="地区">
<RequestSelect <UrlSelect
:request="getAreaListDataApi" url="/ranger/inspection/api/v1/region/list"
v-model="query.regionId" v-model="query.regionId"
labelFiled="regionName" labelFiled="regionName"
valueFiled="regionId" valueFiled="regionId"
...@@ -151,7 +151,7 @@ import { getXunJianDownloadUrlApi } from '@/api'; ...@@ -151,7 +151,7 @@ import { getXunJianDownloadUrlApi } from '@/api';
import { downloadFileByUrl } from '@/utils'; import { downloadFileByUrl } from '@/utils';
import RequestSelect from '@/components/MySelect/RequestSelect.vue'; import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import SearchSelect from '@/components/MySelect/search_select.vue'; import SearchSelect from '@/components/MySelect/search_select.vue';
import { getAreaListDataApi, getBusinessListApi, getBanZuListApi, getTaskTypeApi } from '@/api'; import { getStaticDataByTwoParamsApi } from '@/api';
import Progress from './progress.vue'; import Progress from './progress.vue';
import Detail from './detail.vue'; import Detail from './detail.vue';
import MoreItem from '@/components/table/more_item.vue'; import MoreItem from '@/components/table/more_item.vue';
...@@ -169,10 +169,9 @@ export default { ...@@ -169,10 +169,9 @@ export default {
}, },
data() { data() {
return { return {
getAreaListDataApi, getBusinessListApi: () => getStaticDataByTwoParamsApi('rpis_route_schedule', 'inspection_state'),
getBusinessListApi, getBanZuListApi: () => getStaticDataByTwoParamsApi('rpis_route_schedule', 'shift_type'),
getBanZuListApi, getTaskTypeApi: () => getStaticDataByTwoParamsApi('rpis_route_schedule', 'job_type'),
getTaskTypeApi,
addBtn: { addBtn: {
title: '新建临时任务', title: '新建临时任务',
}, },
......
...@@ -68,7 +68,19 @@ const hasAuthorityRoutes = [ ...@@ -68,7 +68,19 @@ const hasAuthorityRoutes = [
{ {
path: 'center', path: 'center',
name: '任务中心', name: '任务中心',
component: () => import('@/pages/xunjian/task_managment/center/index'), component: () => import('@/pages/xunjian/task_managment/center'),
},
],
},
{
path: 'report',
name: '报表中心',
component: RouterView,
children: [
{
path: 'week',
name: '巡检周报',
component: () => import('@/pages/xunjian/report/weekly'),
}, },
], ],
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment