|
|
@@ -19,17 +19,16 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
label="创建时间"
|
|
|
- prop="createTime"
|
|
|
- :rules="[{ required: true, message: '创建时间不能为空', trigger: 'change' }]"
|
|
|
+ prop="beginTime"
|
|
|
>
|
|
|
<el-date-picker
|
|
|
- v-model="queryParams.createTime"
|
|
|
- type="date"
|
|
|
- placeholder="请选择创建日期"
|
|
|
+ v-model="timeRange"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
- size="small"
|
|
|
- style="width: 180px"
|
|
|
- :clearable="false"
|
|
|
+ size="small" style="width: 240px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
@@ -74,18 +73,25 @@ import { allList } from '@/api/company/company'
|
|
|
export default {
|
|
|
name: "AppRegisterStatistics",
|
|
|
data() {
|
|
|
+
|
|
|
+ // 获取当前日期作为默认值
|
|
|
+ const currentDate = this.getCurrentDate();
|
|
|
return {
|
|
|
loading: true,
|
|
|
total: 0,
|
|
|
appRegisterList: [],
|
|
|
appMallOptions:[],
|
|
|
companyList:[],
|
|
|
+ timeRange: [currentDate, currentDate], // 默认时间范围为当天
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
companyName: null,
|
|
|
appId: null,
|
|
|
- createTime: this.getCurrentDate() // 设置默认值为当前时间
|
|
|
+ companyId: null,
|
|
|
+ beginTime: currentDate,
|
|
|
+ endTime: currentDate,
|
|
|
+ //createTime: this.getCurrentDate() // 设置默认值为当前时间
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
@@ -94,6 +100,21 @@ export default {
|
|
|
this.getMiniProgramList();
|
|
|
this.getAllCompany();
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // 监听时间范围变化,同步到查询参数
|
|
|
+ timeRange: {
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal && newVal.length === 2) {
|
|
|
+ this.queryParams.beginTime = newVal[0];
|
|
|
+ this.queryParams.endTime = newVal[1];
|
|
|
+ } else {
|
|
|
+ this.queryParams.beginTime = null;
|
|
|
+ this.queryParams.endTime = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
/** 获取当前日期(YYYY-MM-DD格式) */
|
|
|
getCurrentDate() {
|
|
|
@@ -131,11 +152,12 @@ export default {
|
|
|
/** 查询列表 */
|
|
|
getList() {
|
|
|
// 验证创建时间是否为空
|
|
|
- if (!this.queryParams.createTime) {
|
|
|
- this.$message.warning('请选择创建时间')
|
|
|
+ if (!this.queryParams.beginTime || !this.queryParams.endTime) {
|
|
|
+ this.$message.warning('请选择开始时间和结束时间')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
this.loading = true;
|
|
|
getAppIdList(this.queryParams).then(response => {
|
|
|
this.appRegisterList = response.rows || [];
|
|
|
@@ -149,22 +171,20 @@ export default {
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
// 验证表单
|
|
|
- this.$refs.queryForm.validate(valid => {
|
|
|
- if (valid) {
|
|
|
+ if (!this.queryParams.beginTime || !this.queryParams.endTime) {
|
|
|
+ this.$message.warning('请选择开始时间和结束时间')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.queryParams.pageNum = 1;
|
|
|
this.getList();
|
|
|
- } else {
|
|
|
- this.$message.warning('请填写完整查询条件')
|
|
|
- }
|
|
|
- });
|
|
|
},
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
// 重置表单
|
|
|
this.$refs.queryForm.resetFields();
|
|
|
- // 重置后恢复默认当前时间
|
|
|
- this.queryParams.createTime = this.getCurrentDate();
|
|
|
+ // 重置时间范围
|
|
|
+ this.timeRange = [];
|
|
|
// 重置后立即查询
|
|
|
this.queryParams.pageNum = 1;
|
|
|
this.getList();
|