Browse Source

自定义选择时间修改

dev-V1.10.0
parent
commit
5a822d3ce3
  1. 26
      zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-domain/index.vue
  2. 24
      zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-enforcer/index.vue
  3. 32
      zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-field/index.vue

26
zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-domain/index.vue

@ -27,7 +27,8 @@ const timeMode = ref('month');
const selectedYear = ref<string>(String(new Date().getFullYear())); const selectedYear = ref<string>(String(new Date().getFullYear()));
const selectedQuarter = ref<number>(Math.ceil((new Date().getMonth() + 1) / 3)); const selectedQuarter = ref<number>(Math.ceil((new Date().getMonth() + 1) / 3));
const selectedMonth = ref<string>(''); const selectedMonth = ref<string>('');
const customRange = ref<string[]>([]); // 自定义时段 [beginTime, endTime] const customBeginTime = ref<string>('');
const customEndTime = ref<string>('');
// 季度选项 // 季度选项
const quarterOptions = [ const quarterOptions = [
@ -65,12 +66,12 @@ const buildTimeParams = () => {
}; };
} }
if (timeMode.value === 'custom') { if (timeMode.value === 'custom') {
if (!customRange.value || customRange.value.length !== 2) { if (!customBeginTime.value || !customEndTime.value) {
return { beginTime: undefined, endTime: undefined }; return { beginTime: undefined, endTime: undefined };
} }
return { return {
beginTime: customRange.value[0], beginTime: customBeginTime.value,
endTime: customRange.value[1] endTime: customEndTime.value
}; };
} }
// 月度:未选月份则不按时间过滤 // 月度:未选月份则不按时间过滤
@ -150,7 +151,8 @@ const handleReset = () => {
selectedYear.value = String(n.getFullYear()); selectedYear.value = String(n.getFullYear());
selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3); selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3);
selectedMonth.value = ''; selectedMonth.value = '';
customRange.value = []; customBeginTime.value = '';
customEndTime.value = '';
getList(); getList();
}; };
@ -322,16 +324,10 @@ onMounted(() => {
<el-form-item v-if="timeMode === 'month'"> <el-form-item v-if="timeMode === 'month'">
<el-date-picker v-model="selectedMonth" type="month" placeholder="选择月份" value-format="YYYY-MM" style="width: 150px" /> <el-date-picker v-model="selectedMonth" type="month" placeholder="选择月份" value-format="YYYY-MM" style="width: 150px" />
</el-form-item> </el-form-item>
<el-form-item v-if="timeMode === 'custom'"> <el-form-item v-if="timeMode === 'custom'" label="执法时间">
<el-date-picker <el-date-picker v-model="customBeginTime" type="date" placeholder="开始" value-format="YYYY-MM-DD" style="width: 130px" />
v-model="customRange" <span style="margin: 0 4px">-</span>
type="daterange" <el-date-picker v-model="customEndTime" type="date" placeholder="结束" value-format="YYYY-MM-DD" style="width: 130px" />
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 260px"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button> <el-button type="primary" @click="handleSearch">搜索</el-button>

24
zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-enforcer/index.vue

@ -30,7 +30,8 @@ const selectedQuarter = ref<number>(Math.ceil((new Date().getMonth() + 1) / 3));
const selectedMonth = ref<string>( const selectedMonth = ref<string>(
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}` `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}`
); );
const customRange = ref<string[]>([]); // 自定义时段 [beginTime, endTime] const customBeginTime = ref<string>('');
const customEndTime = ref<string>('');
// 季度选项 // 季度选项
const quarterOptions = [ const quarterOptions = [
@ -66,10 +67,10 @@ const buildTimeParams = () => {
}; };
} }
if (timeMode.value === 'custom') { if (timeMode.value === 'custom') {
if (!customRange.value || customRange.value.length !== 2) { if (!customBeginTime.value || !customEndTime.value) {
return { beginTime: undefined, endTime: undefined }; return { beginTime: undefined, endTime: undefined };
} }
return { beginTime: customRange.value[0], endTime: customRange.value[1] }; return { beginTime: customBeginTime.value, endTime: customEndTime.value };
} }
// 月度:未选月份则不按时间过滤 // 月度:未选月份则不按时间过滤
if (!selectedMonth.value) { if (!selectedMonth.value) {
@ -159,7 +160,8 @@ const handleReset = () => {
selectedYear.value = String(n.getFullYear()); selectedYear.value = String(n.getFullYear());
selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3); selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3);
selectedMonth.value = `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, '0')}`; selectedMonth.value = `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, '0')}`;
customRange.value = []; customBeginTime.value = '';
customEndTime.value = '';
getList(); getList();
}; };
@ -351,16 +353,10 @@ onUnmounted(() => {
style="width: 150px" style="width: 150px"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="timeMode === 'custom'"> <el-form-item v-if="timeMode === 'custom'" label="执法时间">
<el-date-picker <el-date-picker v-model="customBeginTime" type="date" placeholder="开始" value-format="YYYY-MM-DD" style="width: 130px" />
v-model="customRange" <span style="margin: 0 4px">-</span>
type="daterange" <el-date-picker v-model="customEndTime" type="date" placeholder="结束" value-format="YYYY-MM-DD" style="width: 130px" />
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 260px"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button> <el-button type="primary" @click="handleSearch">搜索</el-button>

32
zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/trend/scan-field/index.vue

@ -25,6 +25,8 @@ const queryParams = reactive({
year: String(new Date().getFullYear()), year: String(new Date().getFullYear()),
quarter: Math.ceil((new Date().getMonth() + 1) / 3) as number, quarter: Math.ceil((new Date().getMonth() + 1) / 3) as number,
month: String(new Date().getMonth() + 1).padStart(2, '0') as string, month: String(new Date().getMonth() + 1).padStart(2, '0') as string,
beginTime: undefined as string | undefined,
endTime: undefined as string | undefined,
orderByColumn: '' as string, orderByColumn: '' as string,
isAsc: '' as string isAsc: '' as string
}); });
@ -50,9 +52,6 @@ const yearOptions = (() => {
return Array.from({ length: 5 }, (_, i) => String(curr - i)); return Array.from({ length: 5 }, (_, i) => String(curr - i));
})(); })();
/** 自定义时段 [startTime, endTime] */
const customRange = ref<string[]>([]);
// ======================== 字典 ======================== // ======================== 字典 ========================
const areaOptions = ref<any[]>([]); const areaOptions = ref<any[]>([]);
const fieldOptions = ref<DashboardDomainVo[]>([]); const fieldOptions = ref<DashboardDomainVo[]>([]);
@ -102,11 +101,11 @@ const buildTimeParams = (): ScanTimeParams => {
return queryParams.month ? { year, month: queryParams.month } : { year }; return queryParams.month ? { year, month: queryParams.month } : { year };
} }
if (queryParams.periodType === 'custom') { if (queryParams.periodType === 'custom') {
// 自定义:未选区间则不传时间参数 // 自定义:未选完整区间则不传时间参数
if (!customRange.value || customRange.value.length !== 2) { if (!queryParams.beginTime || !queryParams.endTime) {
return {}; return {};
} }
return { startTime: customRange.value[0], endTime: customRange.value[1] }; return { startTime: queryParams.beginTime, endTime: queryParams.endTime };
} }
return { year }; return { year };
}; };
@ -157,7 +156,8 @@ const handleReset = () => {
queryParams.year = String(n.getFullYear()); queryParams.year = String(n.getFullYear());
queryParams.quarter = Math.ceil((n.getMonth() + 1) / 3); queryParams.quarter = Math.ceil((n.getMonth() + 1) / 3);
queryParams.month = String(n.getMonth() + 1).padStart(2, '0'); queryParams.month = String(n.getMonth() + 1).padStart(2, '0');
customRange.value = []; queryParams.beginTime = undefined;
queryParams.endTime = undefined;
queryParams.orderByColumn = ''; queryParams.orderByColumn = '';
queryParams.isAsc = ''; queryParams.isAsc = '';
currentPage.value = 1; currentPage.value = 1;
@ -398,16 +398,10 @@ onUnmounted(() => {
/> />
</el-form-item> </el-form-item>
<!-- 自定义:选择起止日期 --> <!-- 自定义:选择起止日期 -->
<el-form-item v-if="queryParams.periodType === 'custom'"> <el-form-item v-if="queryParams.periodType === 'custom'" label="执法时间">
<el-date-picker <el-date-picker v-model="queryParams.beginTime" type="date" placeholder="开始" value-format="YYYY-MM-DD" style="width: 130px" />
v-model="customRange" <span style="margin: 0 4px">-</span>
type="daterange" <el-date-picker v-model="queryParams.endTime" type="date" placeholder="结束" value-format="YYYY-MM-DD" style="width: 130px" />
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
class="custom-range"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button> <el-button type="primary" @click="handleSearch">搜索</el-button>
@ -566,10 +560,6 @@ onUnmounted(() => {
width: 120px; width: 120px;
margin-left: 4px; margin-left: 4px;
} }
.custom-range {
width: 260px;
}
} }
.table-panel { .table-panel {

Loading…
Cancel
Save