update 查询条件没应用上的问题

This commit is contained in:
lb 2023-04-23 17:03:01 +08:00
parent c38da0f205
commit c371516064
8 changed files with 402 additions and 255 deletions

View File

@ -4,22 +4,50 @@
<!-- <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"
<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="[10, 20, 50, 100]" :page-size="size" :total="totalPage"
<el-pagination
class="mt-5 flex justify-end"
@size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page.sync="page"
:page-sizes="[10, 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"
<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"
@emit-data="handleOperate" />
<DialogCarPayload ref="car-payload-dialog" v-if="!!carPayloadDialogConfigs"
:dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" />
<DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入配方" filename="bomTemplate.xlsx"
<DialogCarPayload
ref="car-payload-dialog"
v-if="!!carPayloadDialogConfigs"
:dialog-visible.sync="carPayloadDialogVisible"
:configs="carPayloadDialogConfigs"
@refreshDataList="getList" />
<DialogUpload
ref="upload-dialog"
v-if="uploadDialogVisible"
title="导入配方"
filename="bomTemplate.xlsx"
@refresh-list="getList" />
<Overlay v-if="overlayVisible" />
</div>
@ -32,7 +60,7 @@ import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue";
import DialogCarPayload from "@/components/DialogCarPayload.vue";
import DialogUpload from "@/components/DialogUpload.vue";
import Overlay from '@/components/Overlay.vue';
import Overlay from "@/components/Overlay.vue";
import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu";
@ -41,7 +69,15 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload";
export default {
name: "ListViewWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload, Overlay },
components: {
BaseSearchForm,
BaseListTable,
DialogWithMenu,
DialogJustForm,
DialogCarPayload,
DialogUpload,
Overlay,
},
props: {
tableConfig: {
type: Object,
@ -92,7 +128,7 @@ export default {
if (val && val !== oldVal) {
// get list
this.page = 1;
this.size = 'defaultPageSize' in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
this.size = "defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
this.getList();
}
},
@ -113,12 +149,13 @@ export default {
refreshLayoutKey: null,
uploadDialogVisible: false,
overlayVisible: false,
cachedSearchCondition: {}
};
},
inject: ["urls"],
mounted() {
// size
const size = 'defaultPageSize' in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
const size = "defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
this.size = size;
this.initDataWhenLoad && this.getList();
@ -131,9 +168,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) => {
@ -150,11 +187,11 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...params,
}
...params,
}
: {
params,
}
params,
}
)
.then(({ data: res }) => {
console.log("[http response] res is: ", res);
@ -239,7 +276,8 @@ export default {
this.$message.success("删除成功!");
this.page = 1;
this.size = 'defaultPageSize' in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
this.size =
"defaultPageSize" in this.tableConfig.column ? this.tableConfig.column.defaultPageSize : 20;
this.getList();
} else {
this.$message({
@ -250,7 +288,7 @@ export default {
}
});
})
.catch((err) => { });
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */
@ -316,18 +354,20 @@ export default {
}
case "copy": {
//
let shouldShowOverlay = false
let payload = ''
console.log('copying...', type, data)
if (typeof data === 'object') {
const head = data.head
const copyOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'copy')) || null
if (copyOpt && 'showOverlay' in copyOpt && copyOpt.showOverlay) {
this.overlayVisible = true
shouldShowOverlay = true
payload = data.id
let shouldShowOverlay = false;
let payload = "";
console.log("copying...", type, data);
if (typeof data === "object") {
const head = data.head;
const copyOpt =
("options" in head && Array.isArray(head.options) && head.options.find((item) => item.name === "copy")) ||
null;
if (copyOpt && "showOverlay" in copyOpt && copyOpt.showOverlay) {
this.overlayVisible = true;
shouldShowOverlay = true;
payload = data.id;
}
} else payload = data
} else payload = data;
return this.$http
.post(this.urls.copyUrl, payload, {
@ -350,7 +390,7 @@ export default {
duration: 1500,
});
}
if (shouldShowOverlay) this.overlayVisible = false
if (shouldShowOverlay) this.overlayVisible = false;
})
.catch((errMsg) => {
this.$message({
@ -358,7 +398,7 @@ export default {
type: "error",
duration: 1500,
});
if (shouldShowOverlay) this.overlayVisible = false
if (shouldShowOverlay) this.overlayVisible = false;
});
}
case "change-category": {
@ -450,21 +490,23 @@ export default {
break;
}
case "sync": {
let shouldShowOverlay = false
let payload = ''
console.log('sync...', type, data)
if (typeof data === 'object') {
const head = data.head
const syncOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'sync')) || null
if (syncOpt && 'showOverlay' in syncOpt && syncOpt.showOverlay) {
this.overlayVisible = true
shouldShowOverlay = true
payload = data.id
let shouldShowOverlay = false;
let payload = "";
console.log("sync...", type, data);
if (typeof data === "object") {
const head = data.head;
const syncOpt =
("options" in head && Array.isArray(head.options) && head.options.find((item) => item.name === "sync")) ||
null;
if (syncOpt && "showOverlay" in syncOpt && syncOpt.showOverlay) {
this.overlayVisible = true;
shouldShowOverlay = true;
payload = data.id;
}
} else payload = data
} else payload = data;
this.$message({
message: '正在发起同步...',
message: "正在发起同步...",
type: "success",
});
@ -478,10 +520,10 @@ export default {
.then(({ data: res }) => {
this.$message({
message: res.msg,
type: res.code === 0 ? "success" : 'error',
type: res.code === 0 ? "success" : "error",
});
this.getList();
if (shouldShowOverlay) this.overlayVisible = false
if (shouldShowOverlay) this.overlayVisible = false;
});
}
}
@ -507,18 +549,20 @@ export default {
this.openDialog();
return;
}
case "查询": {
const params = {};
case "查询": {
if (typeof payload === "object") {
// BaseSearchForm
Object.assign(params, payload);
if ("timerange" in params) {
if (!!params.timerange) {
Object.assign(this.cachedSearchCondition, payload);
if ("timerange" in payload) {
if (!!payload.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");
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;
}
}
@ -526,25 +570,25 @@ 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;
}
case "同步":
case "全部同步":
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
console.log("同步", res);
this.$message({ message: res.msg, type: res.code === 0 ? "success" : 'error' });
this.$message({ message: res.msg, type: res.code === 0 ? "success" : "error" });
this.getList();
});
break;
@ -556,12 +600,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);
},
/** 打开对话框 */

View File

@ -3,20 +3,35 @@
<div class="list-view-with-head">
<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"
<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="[1, 5, 10, 20, 50, 100]" :page-size="size" :total="totalPage"
<el-pagination
class="mt-5 flex justify-end"
@size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page.sync="page"
:page-sizes="[1, 5, 10, 20, 50, 100]"
:page-size="size"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<DialogJustForm ref="edit-dialog" v-if="!!dialogConfigs" :dialog-visible.sync="dialogVisible" :configs="dialogConfigs"
<DialogJustForm
ref="edit-dialog"
v-if="!!dialogConfigs"
:dialog-visible.sync="dialogVisible"
:configs="dialogConfigs"
@refreshDataList="getList" />
<!-- :bom-code="dialogBomCode" -->
<Overlay v-if="overlayVisible" />
</div>
</template>
@ -24,7 +39,7 @@
import BaseListTable from "@/components/BaseListTable.vue";
import BaseSearchForm from "@/components/BaseSearchForm.vue";
import DialogJustForm from "./edit-dialog.vue";
import Overlay from '@/components/Overlay.vue';
import Overlay from "@/components/Overlay.vue";
import moment from "moment";
@ -69,7 +84,8 @@ export default {
tableLoading: false,
refreshLayoutKey: null,
dialogBomCode: "",
overlayVisible: false
overlayVisible: false,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@ -84,9 +100,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) => {
@ -106,11 +122,11 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...params,
}
...params,
}
: {
params,
}
params,
}
)
.then(({ data: res }) => {
console.log("[http response] res is: ", res);
@ -187,7 +203,7 @@ export default {
}
});
})
.catch((err) => { });
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */
@ -211,36 +227,44 @@ export default {
case "pause-blender":
case "start-blender": {
//
this.$confirm(`确定${(type === 'detach') ? '下发' : (type === 'pause-blender') ? '暂停' : '开始'}该订单吗?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "我再想想",
type: "warning",
})
.then(() => {
this.overlayVisible = true;
const realUrl = type === 'detach' ? this.urls.detach : type === 'pause-blender' ? this.urls.pauseBlender : this.urls.startBlender
return this.$http
.post(realUrl, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
.then(({ data: res }) => {
if (res.code === 0) {
this.$message({
message: `${(type === 'detach') ? '下发' : (type === 'pause-blender') ? '暂停' : '开始'}成功`,
type: "success",
duration: 1500,
onClose: () => {
this.getList();
},
});
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 1500,
});
}
this.overlayVisible = false;
});
});
this.$confirm(
`确定${type === "detach" ? "下发" : type === "pause-blender" ? "暂停" : "开始"}该订单吗?`,
"提示",
{
confirmButtonText: "确认",
cancelButtonText: "我再想想",
type: "warning",
}
).then(() => {
this.overlayVisible = true;
const realUrl =
type === "detach"
? this.urls.detach
: type === "pause-blender"
? this.urls.pauseBlender
: this.urls.startBlender;
return this.$http
.post(realUrl, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
.then(({ data: res }) => {
if (res.code === 0) {
this.$message({
message: `${type === "detach" ? "下发" : type === "pause-blender" ? "暂停" : "开始"}成功`,
type: "success",
duration: 1500,
onClose: () => {
this.getList();
},
});
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 1500,
});
}
this.overlayVisible = false;
});
});
}
}
},
@ -252,17 +276,20 @@ export default {
this.openDialog();
break;
case "查询": {
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");
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 this.cachedSearchCondition.timerange;
}
}
@ -270,18 +297,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;
}
}
@ -292,12 +319,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);
},
/** 打开对话框 */

View File

@ -4,20 +4,44 @@
<!-- <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"
<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"
<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>
@ -106,7 +130,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
cachedSearchCondition: {}
cachedSearchCondition: {},
};
},
inject: ["urls"],
@ -121,9 +145,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) => {
@ -143,11 +167,11 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...params,
}
...params,
}
: {
params,
}
params,
}
)
.then(({ data: res }) => {
console.log("[http response] res is: ", res);
@ -243,7 +267,7 @@ export default {
}
});
})
.catch((err) => { });
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */

View File

@ -146,6 +146,7 @@ export default {
tableLoading: false,
refreshLayoutKey: null,
updateCarPayloadKey: 1,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@ -468,14 +469,17 @@ export default {
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;
}
}
@ -483,18 +487,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;
}
@ -513,12 +517,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);
},
/** 打开对话框 */

View File

@ -4,18 +4,32 @@
<!-- <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"
<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="[1, 5, 10, 20, 50, 100]" :page-size="size" :total="totalPage"
<el-pagination
class="mt-5 flex justify-end"
@size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page.sync="page"
:page-sizes="[1, 5, 10, 20, 50, 100]"
:page-size="size"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
<DialogWithMenu ref="edit-dialog" v-if="!!dialogConfigs && dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
<!-- :dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" /> -->
<DialogWithMenu
ref="edit-dialog"
v-if="!!dialogConfigs && dialogVisible"
:configs="dialogConfigs"
@refreshDataList="getList" />
<!-- :dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" /> -->
</div>
</template>
@ -102,6 +116,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
cachedSearchCondition: {},
};
},
inject: ["urls"],
@ -116,9 +131,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) => {
@ -135,11 +150,11 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...params,
}
...params,
}
: {
params,
}
params,
}
)
.then(({ data: res }) => {
if (res.code === 0) {
@ -223,7 +238,7 @@ export default {
}
});
})
.catch((err) => { });
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */
@ -249,17 +264,19 @@ export default {
return;
}
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;
}
}
@ -267,26 +284,26 @@ 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;
}
case "同步":
case "全部同步":
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
console.log('全部同步', res)
console.log("全部同步", res);
if (res.code === 0) {
this.$message({ message: '同步成功', type: 'success' })
this.$message({ message: "同步成功", type: "success" });
this.getList();
}
});
@ -299,20 +316,20 @@ export default {
// val
this.page = 1;
this.size = val;
this.getList();
this.getList(this.cachedSearchCondition);
},
handlePageChange(val) {
// val
this.getList();
this.getList(this.cachedSearchCondition);
},
/** 打开对话框 */
openDialog(row, detail) {
this.dialogVisible = true;
console.log("row detail", row, detail)
console.log("row detail", row, detail);
let extraParams = null;
if (this.attachListQueryExtra && this.listQueryExtra.length) {
this.listQueryExtra.forEach((item) => {

View File

@ -143,6 +143,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@ -462,17 +463,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;
}
}
@ -480,18 +483,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;
}
@ -510,12 +513,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);
},
/** 打开对话框 */

View File

@ -9,23 +9,45 @@
<!-- <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" @load-sub="handleLoadSub"
<BaseListTable
v-loading="tableLoading"
:table-config="tableConfig.table"
:column-config="tableConfig.column"
:table-data="dataList"
@operate-event="handleOperate"
@load-sub="handleLoadSub"
:refresh-layout-key="refreshLayoutKey" />
<el-pagination class="mt-5 flex justify-end" @size-change="handleSizeChange" @current-change="handlePageChange"
:current-page.sync="page" :page-sizes="[1, 5, 10, 20, 50, 100]" :page-size="size" :total="totalPage"
<el-pagination
class="mt-5 flex justify-end"
@size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page.sync="page"
:page-sizes="[1, 5, 10, 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 ref="edit-dialog" v-if="dialogType === DIALOG_WITH_MENU" :dialog-visible.sync="dialogVisible"
:configs="dialogConfigs" @refreshDataList="handleRefreshDatalist" />
<DialogJustForm ref="add-sub-dialog" :dialog-visible.sync="subdialogVisible" :configs="subdialogConfigs"
<DialogWithMenu
ref="edit-dialog"
v-if="dialogType === DIALOG_WITH_MENU"
:dialog-visible.sync="dialogVisible"
:configs="dialogConfigs"
@refreshDataList="handleRefreshDatalist" />
<DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入原料" filename="bomTemplate.xlsx"
<DialogJustForm
ref="add-sub-dialog"
:dialog-visible.sync="subdialogVisible"
:configs="subdialogConfigs"
@refreshDataList="handleRefreshDatalist" />
<DialogUpload
ref="upload-dialog"
v-if="uploadDialogVisible"
title="导入原料"
filename="bomTemplate.xlsx"
@refresh-list="getList" />
</div>
</template>
@ -159,6 +181,7 @@ export default {
],
},
},
cachedSearchCondition: {}
};
},
inject: ["urls"],
@ -197,9 +220,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.length) {
this.listQueryExtra.map((name) => {
@ -263,7 +286,7 @@ export default {
}
});
})
.catch((err) => { });
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */
@ -302,7 +325,7 @@ export default {
handleRefreshDatalist() {
// location.reload();
this.getList()
this.getList();
},
openUploadDialog() {
@ -320,7 +343,8 @@ export default {
this.openDialog();
break;
case "查询": {
this.getList(payload);
Object.assign(this.cachedSearchCondition, payload)
this.getList(this.cachedSearchCondition);
break;
}
case "导入":
@ -328,23 +352,23 @@ export default {
break;
case "同步":
this.$message({
message: '正在同步...',
type: 'success',
duration: 1000
})
this.$refs['cursor-loading-ref'].style.cursor = 'wait'
message: "正在同步...",
type: "success",
duration: 1000,
});
this.$refs["cursor-loading-ref"].style.cursor = "wait";
return this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
this.$message({
message: res.msg,
type: res.code === 0 ? 'succes' : 'error',
duration: 1500
, onClose: () => {
this.getList()
this.$refs['cursor-loading-ref'].style.cursor = 'unset'
}
})
})
type: res.code === 0 ? "succes" : "error",
duration: 1500,
onClose: () => {
this.getList();
this.$refs["cursor-loading-ref"].style.cursor = "unset";
},
});
});
}
},
@ -353,12 +377,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);
},
/** 打开对话框 */

View File

@ -146,6 +146,7 @@ export default {
tableLoading: false,
refreshLayoutKey: null,
updateCarPayloadKey: 1,
cachedSearchCondition: {}
};
},
inject: ["urls"],
@ -468,14 +469,17 @@ export default {
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;
}
}
@ -483,18 +487,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;
}
@ -513,12 +517,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);
},
/** 打开对话框 */