Procházet zdrojové kódy

update carHistory Search Condition

docs_0727
lb před 1 rokem
rodič
revize
c38da0f205
2 změnil soubory, kde provedl 39 přidání a 133 odebrání
  1. +38
    -66
      src/views/modules/pms/carHistory/components/ListViewWithHead.vue
  2. +1
    -67
      src/views/modules/pms/order/components/DialogJustForm.vue

+ 38
- 66
src/views/modules/pms/carHistory/components/ListViewWithHead.vue Zobrazit soubor

@@ -4,51 +4,20 @@
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />

<BaseListTable
v-loading="tableLoading"
:table-config="tableConfig.table"
:column-config="tableConfig.column"
:table-data="dataList"
@operate-event="handleOperate"
:current-page="page"
:current-size="size"
:refresh-layout-key="refreshLayoutKey"
/>
<BaseListTable v-loading="tableLoading" :table-config="tableConfig.table" :column-config="tableConfig.column"
:table-data="dataList" @operate-event="handleOperate" :current-page="page" :current-size="size"
:refresh-layout-key="refreshLayoutKey" />

<el-pagination
class="mt-5 flex justify-end"
@size-change="handleSizeChange"
@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" -->
<el-pagination class="mt-5 flex justify-end" @size-change="handleSizeChange" @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>

<DialogWithMenu
ref="edit-dialog"
v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
:dialog-visible.sync="dialogVisible"
:configs="dialogConfigs"
@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"
/>
<DialogWithMenu ref="edit-dialog" v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
:dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @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>
</template>

@@ -137,6 +106,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@@ -151,9 +121,9 @@ export default {
const params = queryParams
? { ...queryParams, page: this.page, limit: this.size }
: {
page: this.page,
limit: this.size,
};
page: this.page,
limit: this.size,
};

if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
this.listQueryExtra.map((nameOrObj) => {
@@ -173,11 +143,11 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...params,
}
...params,
}
: {
params,
}
params,
}
)
.then(({ data: res }) => {
console.log("[http response] res is: ", res);
@@ -273,7 +243,7 @@ export default {
}
});
})
.catch((err) => {});
.catch((err) => { });
}
case "edit": {
this.openDialog(data); /** data is ==> id */
@@ -460,17 +430,19 @@ export default {
}

case "查询": {
const params = {};
if (typeof payload === "object") {
// BaseSearchForm 给这个组件传递了数据
Object.assign(params, payload);
if ("timerange" in params) {
if (!!params.timerange) {
const [startTime, endTime] = params["timerange"];
params.startTime = moment(startTime).format("YYYY-MM-DDTHH:mm:ss");
params.endTime = moment(endTime).format("YYYY-MM-DDTHH:mm:ss");
Object.assign(this.cachedSearchCondition, payload);
if ("timerange" in payload) {
if (!!payload.timerange) {
const [startTime, endTime] = payload["timerange"];
this.cachedSearchCondition.startTime = moment(startTime).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) => {
if (typeof cond === "string") {
if (!!payload[cond]) {
params[cond] = payload[cond];
this.cachedSearchCondition[cond] = payload[cond];
} else {
params[cond] = "";
this.cachedSearchCondition[cond] = "";
}
} else if (typeof cond === "object") {
Object.keys(cond).forEach((key) => {
params[key] = cond[key];
this.cachedSearchCondition[key] = cond[key];
});
}
});
console.log("查询", params);
this.getList(params);
console.log("查询", this.cachedSearchCondition);
this.getList(this.cachedSearchCondition);
break;
}

@@ -508,12 +480,12 @@ export default {
// val 是新值
this.page = 1;
this.size = val;
this.getList();
this.getList(this.cachedSearchCondition);
},

handlePageChange(val) {
// val 是新值
this.getList();
this.getList(this.cachedSearchCondition);
},

/** 打开对话框 */


+ 1
- 67
src/views/modules/pms/order/components/DialogJustForm.vue Zobrazit soubor

@@ -75,77 +75,11 @@
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
v-bind="col.bind" />
</div>
<!-- add more... -->
</el-form-item>
</el-col>
</el-row>
</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>

<!-- footer -->


Načítá se…
Zrušit
Uložit