update SearchForm

This commit is contained in:
lb 2023-02-27 15:24:37 +08:00
parent d906ac949a
commit c012bf7675
4 changed files with 21 additions and 4 deletions

View File

@ -92,7 +92,6 @@ export default {
"select", "select",
res.data.list.map((item) => ({ label: item.name, value: item.id })) res.data.list.map((item) => ({ label: item.name, value: item.id }))
); );
console.log("[update] 更新选项列表", res, field.select);
} }
} else { } else {
this.$message({ this.$message({

View File

@ -50,6 +50,7 @@ import BaseListTable from "@/components/BaseListTable.vue";
import BaseSearchForm from "@/components/BaseSearchForm.vue"; import BaseSearchForm from "@/components/BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue"; import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue"; import DialogJustForm from "@/components/DialogJustForm.vue";
import moment from 'moment'
const DIALOG_WITH_MENU = "DialogWithMenu"; const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm"; const DIALOG_JUST_FORM = "DialogJustForm";
@ -309,6 +310,20 @@ export default {
break; break;
case "查询": { case "查询": {
const params = {}; const params = {};
/** 处理 payload 里的数据 */
if (typeof payload === 'object') {
// BaseSearchForm
Object.assign(params, payload)
if ('timerange' in params && !!params.timerange) {
const [startTime, endTime] = params['timerange']
delete params.timerange
params.startTime = moment(startTime).format('YYYY-MM-DD HH:mm:ss')
params.endTime = moment(endTime).format('YYYY-MM-DD HH:mm:ss')
}
}
/** 处理 listQueryExtra 里的数据 */
this.listQueryExtra?.map((cond) => { this.listQueryExtra?.map((cond) => {
if (typeof cond === "string") { if (typeof cond === "string") {
if (!!payload[cond]) { if (!!payload[cond]) {

View File

@ -32,7 +32,7 @@ export default function () {
const headFormFields = [ const headFormFields = [
{ {
prop: 'materialID', prop: 'materialId',
label: "物料", label: "物料",
// default: { value: "" }, // default: { value: "" },
select: [], select: [],
@ -59,7 +59,10 @@ export default function () {
prop: 'timerange', // 应该是个数组,在提交数据时需单独处理 prop: 'timerange', // 应该是个数组,在提交数据时需单独处理
label: '时间段', label: '时间段',
bind: { bind: {
placeholder: '选择日期时间' placeholder: '选择日期时间',
type: 'datetimerange',
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
} }
}, },
{ {

View File

@ -1,5 +1,5 @@
<template> <template>
<ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" :listQueryExtra="['name']" /> <ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" :listQueryExtra="[]" />
</template> </template>
<script> <script>