update 查询条件没应用上的问题
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
/** 打开对话框 */
|
||||
|
||||
Reference in New Issue
Block a user