update carHistory Search Condition
This commit is contained in:
parent
0f85de5943
commit
c38da0f205
@ -4,51 +4,20 @@
|
|||||||
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
|
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
|
||||||
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
|
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
|
||||||
|
|
||||||
<BaseListTable
|
<BaseListTable v-loading="tableLoading" :table-config="tableConfig.table" :column-config="tableConfig.column"
|
||||||
v-loading="tableLoading"
|
:table-data="dataList" @operate-event="handleOperate" :current-page="page" :current-size="size"
|
||||||
:table-config="tableConfig.table"
|
:refresh-layout-key="refreshLayoutKey" />
|
||||||
:column-config="tableConfig.column"
|
|
||||||
:table-data="dataList"
|
|
||||||
@operate-event="handleOperate"
|
|
||||||
:current-page="page"
|
|
||||||
:current-size="size"
|
|
||||||
:refresh-layout-key="refreshLayoutKey"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<el-pagination
|
<el-pagination class="mt-5 flex justify-end" @size-change="handleSizeChange" @current-change="handlePageChange"
|
||||||
class="mt-5 flex justify-end"
|
:current-page.sync="page" :page-sizes="[20, 50, 100]" :page-size="size" :total="totalPage"
|
||||||
@size-change="handleSizeChange"
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
@current-change="handlePageChange"
|
|
||||||
:current-page.sync="page"
|
|
||||||
:page-sizes="[20, 50, 100]"
|
|
||||||
:page-size="size"
|
|
||||||
:total="totalPage"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
></el-pagination>
|
|
||||||
<!-- :current-page.sync="currentPage"
|
|
||||||
:page-size.sync="pageSize" -->
|
|
||||||
|
|
||||||
<DialogWithMenu
|
<DialogWithMenu ref="edit-dialog" v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
|
||||||
ref="edit-dialog"
|
:dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
|
||||||
v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
|
<DialogJustForm ref="edit-dialog" v-if="!!dialogConfigs && dialogType === DIALOG_JUST_FORM"
|
||||||
:dialog-visible.sync="dialogVisible"
|
:dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
|
||||||
:configs="dialogConfigs"
|
<DialogCarPayload ref="car-payload-dialog" v-if="!!carPayloadDialogConfigs"
|
||||||
@refreshDataList="getList"
|
:dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" />
|
||||||
/>
|
|
||||||
<DialogJustForm
|
|
||||||
ref="edit-dialog"
|
|
||||||
v-if="!!dialogConfigs && dialogType === DIALOG_JUST_FORM"
|
|
||||||
:dialog-visible.sync="dialogVisible"
|
|
||||||
:configs="dialogConfigs"
|
|
||||||
@refreshDataList="getList"
|
|
||||||
/>
|
|
||||||
<DialogCarPayload
|
|
||||||
ref="car-payload-dialog"
|
|
||||||
v-if="!!carPayloadDialogConfigs"
|
|
||||||
:dialog-visible.sync="carPayloadDialogVisible"
|
|
||||||
:configs="carPayloadDialogConfigs"
|
|
||||||
@refreshDataList="getList"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -137,6 +106,7 @@ export default {
|
|||||||
dataList: [],
|
dataList: [],
|
||||||
tableLoading: false,
|
tableLoading: false,
|
||||||
refreshLayoutKey: null,
|
refreshLayoutKey: null,
|
||||||
|
cachedSearchCondition: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
inject: ["urls"],
|
inject: ["urls"],
|
||||||
@ -151,9 +121,9 @@ export default {
|
|||||||
const params = queryParams
|
const params = queryParams
|
||||||
? { ...queryParams, page: this.page, limit: this.size }
|
? { ...queryParams, page: this.page, limit: this.size }
|
||||||
: {
|
: {
|
||||||
page: this.page,
|
page: this.page,
|
||||||
limit: this.size,
|
limit: this.size,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
||||||
this.listQueryExtra.map((nameOrObj) => {
|
this.listQueryExtra.map((nameOrObj) => {
|
||||||
@ -173,11 +143,11 @@ export default {
|
|||||||
this.urls.page,
|
this.urls.page,
|
||||||
this.urls.pageIsPostApi
|
this.urls.pageIsPostApi
|
||||||
? {
|
? {
|
||||||
...params,
|
...params,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
params,
|
params,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(({ data: res }) => {
|
.then(({ data: res }) => {
|
||||||
console.log("[http response] res is: ", res);
|
console.log("[http response] res is: ", res);
|
||||||
@ -273,7 +243,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => { });
|
||||||
}
|
}
|
||||||
case "edit": {
|
case "edit": {
|
||||||
this.openDialog(data); /** data is ==> id */
|
this.openDialog(data); /** data is ==> id */
|
||||||
@ -460,17 +430,19 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "查询": {
|
case "查询": {
|
||||||
const params = {};
|
|
||||||
if (typeof payload === "object") {
|
if (typeof payload === "object") {
|
||||||
// BaseSearchForm 给这个组件传递了数据
|
// BaseSearchForm 给这个组件传递了数据
|
||||||
Object.assign(params, payload);
|
Object.assign(this.cachedSearchCondition, payload);
|
||||||
if ("timerange" in params) {
|
if ("timerange" in payload) {
|
||||||
if (!!params.timerange) {
|
if (!!payload.timerange) {
|
||||||
const [startTime, endTime] = params["timerange"];
|
const [startTime, endTime] = payload["timerange"];
|
||||||
params.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
|
this.cachedSearchCondition.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||||
params.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
|
this.cachedSearchCondition.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
|
||||||
|
} else {
|
||||||
|
delete this.cachedSearchCondition.startTime;
|
||||||
|
delete this.cachedSearchCondition.endTime;
|
||||||
}
|
}
|
||||||
delete params.timerange;
|
delete this.cachedSearchCondition.timerange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,18 +450,18 @@ export default {
|
|||||||
this.listQueryExtra?.map((cond) => {
|
this.listQueryExtra?.map((cond) => {
|
||||||
if (typeof cond === "string") {
|
if (typeof cond === "string") {
|
||||||
if (!!payload[cond]) {
|
if (!!payload[cond]) {
|
||||||
params[cond] = payload[cond];
|
this.cachedSearchCondition[cond] = payload[cond];
|
||||||
} else {
|
} else {
|
||||||
params[cond] = "";
|
this.cachedSearchCondition[cond] = "";
|
||||||
}
|
}
|
||||||
} else if (typeof cond === "object") {
|
} else if (typeof cond === "object") {
|
||||||
Object.keys(cond).forEach((key) => {
|
Object.keys(cond).forEach((key) => {
|
||||||
params[key] = cond[key];
|
this.cachedSearchCondition[key] = cond[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("查询", params);
|
console.log("查询", this.cachedSearchCondition);
|
||||||
this.getList(params);
|
this.getList(this.cachedSearchCondition);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,12 +480,12 @@ export default {
|
|||||||
// val 是新值
|
// val 是新值
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.size = val;
|
this.size = val;
|
||||||
this.getList();
|
this.getList(this.cachedSearchCondition);
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePageChange(val) {
|
handlePageChange(val) {
|
||||||
// val 是新值
|
// val 是新值
|
||||||
this.getList();
|
this.getList(this.cachedSearchCondition);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 打开对话框 */
|
/** 打开对话框 */
|
||||||
|
@ -75,77 +75,11 @@
|
|||||||
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
|
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
|
||||||
v-bind="col.bind" />
|
v-bind="col.bind" />
|
||||||
</div>
|
</div>
|
||||||
<!-- add more... -->
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</InputsArea>
|
</InputsArea>
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<el-row v-for="(row, rowIndex) in configs.form.rows" :key="'row_' + rowIndex" :gutter="20">
|
|
||||||
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length" :class="{ h0: col.hidden }">
|
|
||||||
<!-- 通过多个 col === null 可以控制更灵活的 span 大小 -->
|
|
||||||
<el-form-item v-if="col !== null" :label="col.label" :prop="col.prop" :rules="col.rules || null">
|
|
||||||
<el-input
|
|
||||||
v-if="col.input"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
clearable
|
|
||||||
:disabled="detailMode"
|
|
||||||
v-bind="col.elparams" />
|
|
||||||
<el-cascader
|
|
||||||
v-if="col.cascader"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
:options="col.options"
|
|
||||||
:disabled="detailMode"
|
|
||||||
v-bind="col.elparams"></el-cascader>
|
|
||||||
<el-select
|
|
||||||
v-if="col.select"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
clearable
|
|
||||||
:disabled="detailMode"
|
|
||||||
v-bind="col.elparams"
|
|
||||||
@change="handleSelectChange(col, $event)">
|
|
||||||
<el-option
|
|
||||||
v-for="(opt, optIdx) in col.options"
|
|
||||||
:key="'option_' + optIdx"
|
|
||||||
:label="opt.label"
|
|
||||||
:value="opt.value" />
|
|
||||||
</el-select>
|
|
||||||
<el-switch
|
|
||||||
v-if="col.switch"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
:active-value="col.activeValue ?? 1"
|
|
||||||
:inactive-value="col.activeValue ?? 0"
|
|
||||||
@change="handleSwitchChange"
|
|
||||||
:disabled="detailMode" />
|
|
||||||
<el-input
|
|
||||||
v-if="col.textarea"
|
|
||||||
type="textarea"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
:disabled="detailMode"
|
|
||||||
v-bind="col.elparams" />
|
|
||||||
<el-date-picker
|
|
||||||
v-if="col.datetime"
|
|
||||||
v-model="dataForm[col.prop]"
|
|
||||||
:disabled="detailMode"
|
|
||||||
v-bind="col.elparams" />
|
|
||||||
|
|
||||||
<div class="" v-if="col.component" style="margin: 42px 0 0">
|
|
||||||
<!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO:后续可能会根据业务需求创建新的版本 -->
|
|
||||||
<component
|
|
||||||
:is="col.component"
|
|
||||||
:key="'component_' + col.prop"
|
|
||||||
@update:modelValue="handleComponentModelUpdate(col.prop, $event)"
|
|
||||||
:modelValue="dataForm[col.prop] ?? ''"
|
|
||||||
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
|
|
||||||
v-bind="col.bind" />
|
|
||||||
</div>
|
|
||||||
<!-- add more... -->
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
|
Loading…
Reference in New Issue
Block a user