add 窑炉等待室和检测平台“
This commit is contained in:
parent
05297626a0
commit
d84a2d7dbf
@ -64,7 +64,7 @@ export default function () {
|
||||
// },
|
||||
];
|
||||
|
||||
const dialogJustFormConfigs = {}
|
||||
const dialogJustFormConfigs = null;
|
||||
|
||||
const carPayloadDialogConfigs = {
|
||||
carPayloadDialog: true,
|
||||
|
@ -1,28 +0,0 @@
|
||||
<template>
|
||||
<div v-if="showCarPayload" class="car-payload-dialog">
|
||||
<div class="backdrop"></div>
|
||||
<div class="card">
|
||||
<!-- table -->
|
||||
<!-- pagination -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CarPayloadView",
|
||||
props: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.car-payload-dialog {
|
||||
position: fixed;
|
||||
}
|
||||
</style>
|
@ -56,10 +56,7 @@ export default function () {
|
||||
// },
|
||||
];
|
||||
|
||||
const dialogJustFormConfigs = {
|
||||
|
||||
};
|
||||
|
||||
const dialogJustFormConfigs = null;
|
||||
|
||||
const carPayloadDialogConfigs = {
|
||||
carPayloadDialog: true,
|
||||
|
@ -0,0 +1,540 @@
|
||||
<!-- 表格页加上搜索条件 -->
|
||||
<template>
|
||||
<div class="list-view-with-head">
|
||||
<!-- <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"
|
||||
/>
|
||||
|
||||
<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"
|
||||
key="edit-dialog"
|
||||
v-if="!!dialogConfigs"
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
<DialogJustForm
|
||||
ref="car-payload-add-dialog"
|
||||
key="car-payload-add-dialog"
|
||||
v-if="!!carPayloadAddConfigs"
|
||||
:dialog-visible.sync="carPayloadAddVisible"
|
||||
:configs="carPayloadAddConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
<DialogCarPayload
|
||||
ref="car-payload-dialog"
|
||||
key="car-payload-dialog"
|
||||
v-if="!!carPayloadDialogConfigs"
|
||||
:dialog-visible.sync="carPayloadDialogVisible"
|
||||
:configs="carPayloadDialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import BaseSearchForm from "@/components/BaseSearchForm.vue";
|
||||
import DialogWithMenu from "@/components/DialogWithMenu.vue";
|
||||
import DialogJustForm from "@/components/DialogJustForm.vue";
|
||||
import DialogCarPayload from "@/components/DialogCarPayload.vue";
|
||||
import moment from "moment";
|
||||
|
||||
const DIALOG_WITH_MENU = "DialogWithMenu";
|
||||
const DIALOG_JUST_FORM = "DialogJustForm";
|
||||
const DIALOG_CARPAYLOAD = "DialogCarPayload";
|
||||
|
||||
export default {
|
||||
name: "ListViewWithHead",
|
||||
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload },
|
||||
props: {
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
/** 列配置, 即 props **/ column: [],
|
||||
/** 表格整体配置 */ table: undefined,
|
||||
}),
|
||||
},
|
||||
headConfig: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
/** 请求page接口的时候有些字段是必填的,没有会报500,把相关字段名传入这个prop: */
|
||||
listQueryExtra: {
|
||||
type: Array,
|
||||
default: () => ["key"],
|
||||
},
|
||||
attachListQueryExtra: {
|
||||
// 新增时,附带 listQueryExtra 里的哪些键和对应值
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
initDataWhenLoad: { type: Boolean, default: true },
|
||||
/** dialog configs 或许可以从 tableConfig 计算出来 computed... */
|
||||
dialogConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
carPayloadDialogConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
carPayloadAddConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
triggerUpdate: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
dialogType() {
|
||||
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
|
||||
},
|
||||
},
|
||||
activated() {
|
||||
console.log("list view with ehad activated..........", this.triggerUpdate);
|
||||
this.refreshLayoutKey = this.layoutTable();
|
||||
},
|
||||
watch: {
|
||||
triggerUpdate(val, oldVal) {
|
||||
if (val && val !== oldVal) {
|
||||
// get list
|
||||
this.page = 1;
|
||||
this.size = 20;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
DIALOG_WITH_MENU,
|
||||
DIALOG_JUST_FORM,
|
||||
DIALOG_CARPAYLOAD,
|
||||
dialogVisible: false,
|
||||
carPayloadDialogVisible: false,
|
||||
carPayloadAddVisible: false,
|
||||
topBtnConfig: null,
|
||||
totalPage: 100,
|
||||
page: 1,
|
||||
size: 20, // 默认20
|
||||
dataList: [],
|
||||
tableLoading: false,
|
||||
refreshLayoutKey: null,
|
||||
};
|
||||
},
|
||||
inject: ["urls"],
|
||||
mounted() {
|
||||
this.initDataWhenLoad && this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 获取 列表数据 */
|
||||
getList(queryParams) {
|
||||
this.tableLoading = true;
|
||||
|
||||
const params = queryParams
|
||||
? { ...queryParams, page: this.page, limit: this.size }
|
||||
: {
|
||||
page: this.page,
|
||||
limit: this.size,
|
||||
};
|
||||
|
||||
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.map((nameOrObj) => {
|
||||
if (typeof nameOrObj === "string") params[nameOrObj] = "";
|
||||
else if (typeof nameOrObj === "object") {
|
||||
Object.keys(nameOrObj).forEach((key) => {
|
||||
params[key] = nameOrObj[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$http[this.urls.pageIsPostApi ? "post" : "get"](
|
||||
this.urls.page,
|
||||
this.urls.pageIsPostApi
|
||||
? {
|
||||
...params,
|
||||
}
|
||||
: {
|
||||
params,
|
||||
}
|
||||
)
|
||||
.then(({ data: res }) => {
|
||||
console.log("[http response] res is: ", res);
|
||||
|
||||
if (res.code === 0) {
|
||||
// page 场景:
|
||||
if ("list" in res.data) {
|
||||
this.dataList = res.data.list;
|
||||
this.totalPage = res.data.total;
|
||||
} else if (Array.isArray(res.data)) {
|
||||
this.dataList = res.data
|
||||
this.totalPage = null;
|
||||
} else {
|
||||
this.dataList.splice(0);
|
||||
this.totalPage = 0;
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
this.tableLoading = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message({
|
||||
message: `${err}`,
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
this.tableLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
layoutTable() {
|
||||
return Math.random();
|
||||
},
|
||||
|
||||
/** 处理 表格操作 */
|
||||
handleOperate({ type, data }) {
|
||||
console.log("payload", type, data);
|
||||
// 编辑、删除、跳转路由、打开弹窗(动态component)都可以在配置里加上 url
|
||||
// payload: { type: string, data: string | number | object }
|
||||
switch (type) {
|
||||
case "delete": {
|
||||
// 确认是否删除
|
||||
return this.$confirm(`确定要删除记录 "${data.name ?? data.id}" 吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
// this.$http.delete(this.urls.base + `/${data}`).then((res) => {
|
||||
this.$http({
|
||||
url: this.urls.base,
|
||||
method: "DELETE",
|
||||
data: [`${data.id}`],
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("删除成功!");
|
||||
this.page = 1;
|
||||
this.size = 10;
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
case "edit": {
|
||||
this.openDialog(data); /** data is ==> id */
|
||||
break;
|
||||
}
|
||||
case "view":
|
||||
case "view-detail-action": {
|
||||
this.openDialog(data, true);
|
||||
break;
|
||||
}
|
||||
// case "view-blender-batch-details": {
|
||||
// this.$router.push({
|
||||
// name: "pms-blenderBatchDetails",
|
||||
// query: {
|
||||
// batchId: data,
|
||||
// },
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// case "status": {
|
||||
// console.log("status", data);
|
||||
// // TODO: 类似于这种字符串,可以统一集中到一个文件里
|
||||
// const { id, code } = data;
|
||||
// const queryCondition = { id, code };
|
||||
// if ("enabled" in data) queryCondition.enabled = data["enabled"];
|
||||
// if ("status" in data) queryCondition.status = data["status"];
|
||||
// // 更改状态,更改状态需要 id 和 code 然后是 状态 enabled
|
||||
// this.$http.put(this.urls.base, queryCondition).then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// // do nothing
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// case "view-attachment": {
|
||||
// this.openDialog(data, false, { key: "attachment" });
|
||||
// break;
|
||||
// }
|
||||
// case "view-recipe": {
|
||||
// this.openDialog(data, true, { key: "attr" });
|
||||
// break;
|
||||
// }
|
||||
// case "to-bom-detail": {
|
||||
// // console.log('to-bom-detail', data.name)
|
||||
// // 查看配方详情
|
||||
// return this.$router.push({
|
||||
// name: "pms-bomDetails",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "copy": {
|
||||
// return this.$http
|
||||
// .post(this.urls.copyUrl, data, {
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// })
|
||||
// .then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "复制成功!",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// this.getList();
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
// .catch((errMsg) => {
|
||||
// this.$message({
|
||||
// message: errMsg,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// case "change-category": {
|
||||
// return this.$http.put(this.urls.base, data).then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "修改成功",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// onClose: () => {
|
||||
// this.getList();
|
||||
// },
|
||||
// });
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// case "preview": {
|
||||
// console.log("[PREVIEW] data", data);
|
||||
// // report preview
|
||||
// return this.$router.push({
|
||||
// name: "pms-reportPreview",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "design": {
|
||||
// console.log("[DESIGN] data", data);
|
||||
// // report design
|
||||
// return this.$router.push({
|
||||
// name: "pms-reportDesign",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "detach": {
|
||||
// return this.$http
|
||||
// .post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
|
||||
// .then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "下发成功",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// onClose: () => {
|
||||
// this.getList();
|
||||
// },
|
||||
// });
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
case "to-car-history": {
|
||||
return this.$router.push({
|
||||
name: "pms-carHistory",
|
||||
query: {
|
||||
code: data.code,
|
||||
},
|
||||
});
|
||||
}
|
||||
case "to-car-payload": {
|
||||
// open dialog instead of redirect to a new page
|
||||
this.openCarPayloadDialog(data);
|
||||
break;
|
||||
}
|
||||
case "edit-payload": {
|
||||
this.openCarPayloadAddDialog(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openCarPayloadDialog(id) {
|
||||
this.carPayloadDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["car-payload-dialog"].init(id);
|
||||
});
|
||||
},
|
||||
|
||||
openCarPayloadAddDialog(id) {
|
||||
this.carPayloadAddVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["car-payload-add-dialog"].init(null, null, null, { hisId: id });
|
||||
});
|
||||
},
|
||||
|
||||
handleBtnClick({ btnName, payload }) {
|
||||
console.log("[search] form handleBtnClick", btnName, payload);
|
||||
switch (btnName) {
|
||||
case "新增":
|
||||
this.openDialog();
|
||||
break;
|
||||
|
||||
case "手动添加": {
|
||||
this.openDialog();
|
||||
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");
|
||||
}
|
||||
delete params.timerange;
|
||||
}
|
||||
}
|
||||
|
||||
/** 处理 listQueryExtra 里的数据 */
|
||||
this.listQueryExtra?.map((cond) => {
|
||||
if (typeof cond === "string") {
|
||||
if (!!payload[cond]) {
|
||||
params[cond] = payload[cond];
|
||||
} else {
|
||||
params[cond] = "";
|
||||
}
|
||||
} else if (typeof cond === "object") {
|
||||
Object.keys(cond).forEach((key) => {
|
||||
params[key] = cond[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("查询", params);
|
||||
this.getList(params);
|
||||
break;
|
||||
}
|
||||
|
||||
case "同步":
|
||||
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/** 导航器的操作 */
|
||||
handleSizeChange(val) {
|
||||
// val 是新值
|
||||
this.page = 1;
|
||||
this.size = val;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
// val 是新值
|
||||
this.getList();
|
||||
},
|
||||
|
||||
/** 打开对话框 */
|
||||
openDialog(row_id, detail_mode, tag_info) {
|
||||
this.dialogVisible = true;
|
||||
let extraParams = null;
|
||||
if (this.attachListQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.forEach((item) => {
|
||||
let found = item[this.attachListQueryExtra];
|
||||
if (found !== null && found !== undefined) extraParams = item;
|
||||
});
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
console.log(`[edit-dialog] extraParams: ${extraParams}`);
|
||||
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.list-view-with-head {
|
||||
background: white;
|
||||
/* height: 100%; */
|
||||
min-height: inherit;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 0 1.125px 0.125px rgba(0, 0, 0, 0.125);
|
||||
}
|
||||
</style>
|
253
src/views/modules/pms/detectionPlatform/config.js
Normal file
253
src/views/modules/pms/detectionPlatform/config.js
Normal file
@ -0,0 +1,253 @@
|
||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||
|
||||
import request from "@/utils/request";
|
||||
import { timeFilter } from '@/utils/filters'
|
||||
import { getDictDataList } from '@/utils'
|
||||
|
||||
export default function () {
|
||||
const tableProps = [
|
||||
{ type: 'index', label: '序号' },
|
||||
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||
{ prop: "code", label: "窑车号" },
|
||||
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
|
||||
{ prop: "orderCode", label: "订单号" },
|
||||
{ prop: "posCode", label: "位置" },
|
||||
{ prop: "startTime", label: "开始时间", filter: timeFilter },
|
||||
{ prop: "endTime", label: "结束时间", filter: timeFilter },
|
||||
{
|
||||
prop: "operations",
|
||||
name: "操作",
|
||||
fixed: "right",
|
||||
width: 90,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: "to-car-payload", label: "装载详情", icon: 'document' },
|
||||
{ name: "edit-payload", label: "输入载砖详情", icon: 'edit' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const headFormFields = [
|
||||
// {
|
||||
// prop: 'code',
|
||||
// label: "窑车号",
|
||||
// input: true,
|
||||
// default: { value: "" },
|
||||
// bind: {
|
||||
// placeholder: '请输入窑车号'
|
||||
// }
|
||||
// },
|
||||
{
|
||||
timerange: true,
|
||||
prop: "timerange",
|
||||
label: "时间段",
|
||||
bind: {
|
||||
placeholder: "选择日期时间",
|
||||
type: "datetimerange",
|
||||
"start-placeholder": "开始时间",
|
||||
"end-placeholder": "结束时间",
|
||||
},
|
||||
},
|
||||
{
|
||||
button: {
|
||||
type: "primary",
|
||||
name: "查询",
|
||||
},
|
||||
},
|
||||
{
|
||||
button: {
|
||||
type: "primary",
|
||||
name: "手动添加",
|
||||
permission: ""
|
||||
},
|
||||
bind: {
|
||||
plain: true,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
const dialogJustFormConfigs = {
|
||||
clickModalToClose: true,
|
||||
form: {
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
prop: "carId",
|
||||
label: "窑车号",
|
||||
options: [],
|
||||
fetchData: () => this.$http.get('/pms/car/page', { params: { limit: 999, page: 1, code: '' } }),
|
||||
optionLabel: 'code',
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { filterable: true, placeholder: "请选择窑车" },
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
label: "位置",
|
||||
prop: "pos",
|
||||
options: [],
|
||||
fetchData: () => this.$http.post('/pms/carHandle/listPos', { limit: 999, page: 1, pos: [5, 6] }),
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择窑车位置" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
datetime: true,
|
||||
label: "开始时间",
|
||||
prop: "startTime",
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择开始时间" },
|
||||
},
|
||||
{
|
||||
datetime: true,
|
||||
label: "结束时间",
|
||||
prop: "endTime",
|
||||
default: null,
|
||||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择结束时间" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: "窑车状态",
|
||||
prop: "stateDictValue",
|
||||
options: getDictDataList('car_state').map(_ => ({ label: _.dictLabel, value: _.dictValue })),
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择窑车状态" },
|
||||
},
|
||||
{}
|
||||
],
|
||||
],
|
||||
operations: [
|
||||
{ name: "add-pos-manually", label: "保存", type: "primary", permission: "", showOnEdit: false },
|
||||
// { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
|
||||
// { name: "reset", label: "重置", type: "warning", showAlways: true },
|
||||
// { name: 'cancel', label: '取消', showAlways: true },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const carPayloadAddConfigs = {
|
||||
clickModalToClose: true,
|
||||
form: {
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
prop: "orderId",
|
||||
label: "订单号",
|
||||
options: [],
|
||||
fetchData: () => this.$http.post('/pms/order/pageCom', { limit: 999, page: 1, code: '', type: 1 }),
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { filterable: true, placeholder: "请选择订单" },
|
||||
},
|
||||
// {
|
||||
// input: true,
|
||||
// label: "窑车载量",
|
||||
// prop: "qty",
|
||||
// rules: [
|
||||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// { type: 'number', message: "请输入大于0的整数", trigger: "blur", transform: val => Number(val) > 0 && Number.isInteger(Number(val)) && Number(val) },
|
||||
// ],
|
||||
// elparams: { placeholder: "请输入窑车载量" },
|
||||
// },
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: "合格砖数",
|
||||
prop: "goodqty",
|
||||
rules: [
|
||||
{ required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
{ type: 'number', message: "请输入大于0的整数", trigger: "blur", transform: val => Number(val) > 0 && Number.isInteger(Number(val)) && Number(val) },
|
||||
],
|
||||
// rules: [
|
||||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||||
// ],
|
||||
elparams: { placeholder: "请输入合格砖数" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: "废砖数",
|
||||
prop: "badqty",
|
||||
rules: [
|
||||
{ required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
{ type: 'number', message: "请输入大于0的整数", trigger: "blur", transform: val => Number(val) > 0 && Number.isInteger(Number(val)) && Number(val) },
|
||||
],
|
||||
// rules: [
|
||||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||||
// ],
|
||||
elparams: { placeholder: "请输入废砖数" },
|
||||
},
|
||||
],
|
||||
// [
|
||||
// {
|
||||
// input: true,
|
||||
// label: "备注",
|
||||
// prop: "remark",
|
||||
// elparams: { placeholder: "请输入备注" },
|
||||
// }
|
||||
// ],
|
||||
],
|
||||
operations: [
|
||||
{ name: "add-car-payload", label: "保存", type: "primary", permission: "", showOnEdit: false },
|
||||
// { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
|
||||
// { name: "reset", label: "重置", type: "warning", showAlways: true },
|
||||
// { name: 'cancel', label: '取消', showAlways: true },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const carPayloadDialogConfigs = {
|
||||
carPayloadDialog: true,
|
||||
clickModalToClose: true,
|
||||
tableConfig: {
|
||||
table: null,
|
||||
column: [
|
||||
// 窑车的 装载详情
|
||||
// tableProps
|
||||
{ type: "index", label: "序号" },
|
||||
{ prop: "orderCode", label: "订单号" },
|
||||
{ prop: "bomCode", label: "配方号" },
|
||||
{ prop: "shapeCode", label: "砖型编码" },
|
||||
{ width: 160, prop: "qty", label: "订单对应数量" },
|
||||
{ prop: "goodqty", label: "合格数量" },
|
||||
{ prop: "badqty", label: "废砖数量" },
|
||||
{ prop: "startTime", label: "开始时间" },
|
||||
{ prop: "endTime", label: "结束时间" },
|
||||
// { prop: "remark", label: "备注" },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
carPayloadAddConfigs,
|
||||
carPayloadDialogConfigs,
|
||||
dialogConfigs: dialogJustFormConfigs,
|
||||
tableConfig: {
|
||||
table: null, // 此处可省略,el-table 上的配置项
|
||||
column: tableProps, // el-column-item 上的配置项
|
||||
},
|
||||
headFormConfigs: {
|
||||
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
|
||||
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
||||
},
|
||||
urls: {
|
||||
base: "/pms/carHandle",
|
||||
page: "/pms/carHandle/pageHis",
|
||||
pageIsPostApi: true,
|
||||
posFormUrl: "/pms/trans/inputCurrent",
|
||||
payloadFormUrl: '/pms/trans/inputDetail', // 载砖详情 url
|
||||
// subase: '/pms/blenderStepParam',
|
||||
// subpage: '/pms/blenderStepParam/page',
|
||||
// more...
|
||||
},
|
||||
};
|
||||
}
|
45
src/views/modules/pms/detectionPlatform/index.vue
Normal file
45
src/views/modules/pms/detectionPlatform/index.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<ListViewWithHead
|
||||
:table-config="tableConfig"
|
||||
:head-config="headFormConfigs"
|
||||
:dialog-configs="dialogConfigs"
|
||||
:car-payload-dialog-configs="carPayloadDialogConfigs"
|
||||
:car-payload-add-configs="carPayloadAddConfigs"
|
||||
:listQueryExtra="[{ pos: [5, 6] }]"
|
||||
:trigger-update="triggerUpdateKey"
|
||||
key="DetectionPlatform"
|
||||
/>
|
||||
<!-- attach-list-query-data="code" -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import initConfig from "./config";
|
||||
import ListViewWithHead from "./components/ListViewWithHead.vue";
|
||||
|
||||
export default {
|
||||
name: "DetectionPlatformView",
|
||||
components: { ListViewWithHead },
|
||||
provide() {
|
||||
return {
|
||||
urls: this.allUrls,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const { tableConfig, headFormConfigs, carPayloadAddConfigs, carPayloadDialogConfigs, urls, dialogConfigs } = initConfig.call(this);
|
||||
return {
|
||||
carPayloadAddConfigs,
|
||||
carPayloadDialogConfigs,
|
||||
tableConfig,
|
||||
headFormConfigs,
|
||||
allUrls: urls,
|
||||
dialogConfigs,
|
||||
triggerUpdateKey: "",
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
this.triggerUpdateKey = Math.random().toString();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -0,0 +1,540 @@
|
||||
<!-- 表格页加上搜索条件 -->
|
||||
<template>
|
||||
<div class="list-view-with-head">
|
||||
<!-- <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"
|
||||
/>
|
||||
|
||||
<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"
|
||||
key="edit-dialog"
|
||||
v-if="!!dialogConfigs"
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
<DialogJustForm
|
||||
ref="car-payload-add-dialog"
|
||||
key="car-payload-add-dialog"
|
||||
v-if="!!carPayloadAddConfigs"
|
||||
:dialog-visible.sync="carPayloadAddVisible"
|
||||
:configs="carPayloadAddConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
<DialogCarPayload
|
||||
ref="car-payload-dialog"
|
||||
key="car-payload-dialog"
|
||||
v-if="!!carPayloadDialogConfigs"
|
||||
:dialog-visible.sync="carPayloadDialogVisible"
|
||||
:configs="carPayloadDialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import BaseSearchForm from "@/components/BaseSearchForm.vue";
|
||||
import DialogWithMenu from "@/components/DialogWithMenu.vue";
|
||||
import DialogJustForm from "@/components/DialogJustForm.vue";
|
||||
import DialogCarPayload from "@/components/DialogCarPayload.vue";
|
||||
import moment from "moment";
|
||||
|
||||
const DIALOG_WITH_MENU = "DialogWithMenu";
|
||||
const DIALOG_JUST_FORM = "DialogJustForm";
|
||||
const DIALOG_CARPAYLOAD = "DialogCarPayload";
|
||||
|
||||
export default {
|
||||
name: "ListViewWithHead",
|
||||
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload },
|
||||
props: {
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
/** 列配置, 即 props **/ column: [],
|
||||
/** 表格整体配置 */ table: undefined,
|
||||
}),
|
||||
},
|
||||
headConfig: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
/** 请求page接口的时候有些字段是必填的,没有会报500,把相关字段名传入这个prop: */
|
||||
listQueryExtra: {
|
||||
type: Array,
|
||||
default: () => ["key"],
|
||||
},
|
||||
attachListQueryExtra: {
|
||||
// 新增时,附带 listQueryExtra 里的哪些键和对应值
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
initDataWhenLoad: { type: Boolean, default: true },
|
||||
/** dialog configs 或许可以从 tableConfig 计算出来 computed... */
|
||||
dialogConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
carPayloadDialogConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
carPayloadAddConfigs: {
|
||||
type: Object,
|
||||
default: () => null,
|
||||
},
|
||||
triggerUpdate: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
dialogType() {
|
||||
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
|
||||
},
|
||||
},
|
||||
activated() {
|
||||
console.log("list view with ehad activated..........", this.triggerUpdate);
|
||||
this.refreshLayoutKey = this.layoutTable();
|
||||
},
|
||||
watch: {
|
||||
triggerUpdate(val, oldVal) {
|
||||
if (val && val !== oldVal) {
|
||||
// get list
|
||||
this.page = 1;
|
||||
this.size = 20;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
DIALOG_WITH_MENU,
|
||||
DIALOG_JUST_FORM,
|
||||
DIALOG_CARPAYLOAD,
|
||||
dialogVisible: false,
|
||||
carPayloadDialogVisible: false,
|
||||
carPayloadAddVisible: false,
|
||||
topBtnConfig: null,
|
||||
totalPage: 100,
|
||||
page: 1,
|
||||
size: 20, // 默认20
|
||||
dataList: [],
|
||||
tableLoading: false,
|
||||
refreshLayoutKey: null,
|
||||
};
|
||||
},
|
||||
inject: ["urls"],
|
||||
mounted() {
|
||||
this.initDataWhenLoad && this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 获取 列表数据 */
|
||||
getList(queryParams) {
|
||||
this.tableLoading = true;
|
||||
|
||||
const params = queryParams
|
||||
? { ...queryParams, page: this.page, limit: this.size }
|
||||
: {
|
||||
page: this.page,
|
||||
limit: this.size,
|
||||
};
|
||||
|
||||
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.map((nameOrObj) => {
|
||||
if (typeof nameOrObj === "string") params[nameOrObj] = "";
|
||||
else if (typeof nameOrObj === "object") {
|
||||
Object.keys(nameOrObj).forEach((key) => {
|
||||
params[key] = nameOrObj[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$http[this.urls.pageIsPostApi ? "post" : "get"](
|
||||
this.urls.page,
|
||||
this.urls.pageIsPostApi
|
||||
? {
|
||||
...params,
|
||||
}
|
||||
: {
|
||||
params,
|
||||
}
|
||||
)
|
||||
.then(({ data: res }) => {
|
||||
console.log("[http response] res is: ", res);
|
||||
|
||||
if (res.code === 0) {
|
||||
// page 场景:
|
||||
if ("list" in res.data) {
|
||||
this.dataList = res.data.list;
|
||||
this.totalPage = res.data.total;
|
||||
} else if (Array.isArray(res.data)) {
|
||||
this.dataList = res.data
|
||||
this.totalPage = null;
|
||||
} else {
|
||||
this.dataList.splice(0);
|
||||
this.totalPage = 0;
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
this.tableLoading = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message({
|
||||
message: `${err}`,
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
this.tableLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
layoutTable() {
|
||||
return Math.random();
|
||||
},
|
||||
|
||||
/** 处理 表格操作 */
|
||||
handleOperate({ type, data }) {
|
||||
console.log("payload", type, data);
|
||||
// 编辑、删除、跳转路由、打开弹窗(动态component)都可以在配置里加上 url
|
||||
// payload: { type: string, data: string | number | object }
|
||||
switch (type) {
|
||||
case "delete": {
|
||||
// 确认是否删除
|
||||
return this.$confirm(`确定要删除记录 "${data.name ?? data.id}" 吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
// this.$http.delete(this.urls.base + `/${data}`).then((res) => {
|
||||
this.$http({
|
||||
url: this.urls.base,
|
||||
method: "DELETE",
|
||||
data: [`${data.id}`],
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("删除成功!");
|
||||
this.page = 1;
|
||||
this.size = 10;
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
case "edit": {
|
||||
this.openDialog(data); /** data is ==> id */
|
||||
break;
|
||||
}
|
||||
case "view":
|
||||
case "view-detail-action": {
|
||||
this.openDialog(data, true);
|
||||
break;
|
||||
}
|
||||
// case "view-blender-batch-details": {
|
||||
// this.$router.push({
|
||||
// name: "pms-blenderBatchDetails",
|
||||
// query: {
|
||||
// batchId: data,
|
||||
// },
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// case "status": {
|
||||
// console.log("status", data);
|
||||
// // TODO: 类似于这种字符串,可以统一集中到一个文件里
|
||||
// const { id, code } = data;
|
||||
// const queryCondition = { id, code };
|
||||
// if ("enabled" in data) queryCondition.enabled = data["enabled"];
|
||||
// if ("status" in data) queryCondition.status = data["status"];
|
||||
// // 更改状态,更改状态需要 id 和 code 然后是 状态 enabled
|
||||
// this.$http.put(this.urls.base, queryCondition).then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// // do nothing
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// case "view-attachment": {
|
||||
// this.openDialog(data, false, { key: "attachment" });
|
||||
// break;
|
||||
// }
|
||||
// case "view-recipe": {
|
||||
// this.openDialog(data, true, { key: "attr" });
|
||||
// break;
|
||||
// }
|
||||
// case "to-bom-detail": {
|
||||
// // console.log('to-bom-detail', data.name)
|
||||
// // 查看配方详情
|
||||
// return this.$router.push({
|
||||
// name: "pms-bomDetails",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "copy": {
|
||||
// return this.$http
|
||||
// .post(this.urls.copyUrl, data, {
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// },
|
||||
// })
|
||||
// .then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "复制成功!",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// this.getList();
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
// .catch((errMsg) => {
|
||||
// this.$message({
|
||||
// message: errMsg,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// case "change-category": {
|
||||
// return this.$http.put(this.urls.base, data).then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "修改成功",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// onClose: () => {
|
||||
// this.getList();
|
||||
// },
|
||||
// });
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// case "preview": {
|
||||
// console.log("[PREVIEW] data", data);
|
||||
// // report preview
|
||||
// return this.$router.push({
|
||||
// name: "pms-reportPreview",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "design": {
|
||||
// console.log("[DESIGN] data", data);
|
||||
// // report design
|
||||
// return this.$router.push({
|
||||
// name: "pms-reportDesign",
|
||||
// query: {
|
||||
// name: data.name,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// case "detach": {
|
||||
// return this.$http
|
||||
// .post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
|
||||
// .then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: "下发成功",
|
||||
// type: "success",
|
||||
// duration: 1500,
|
||||
// onClose: () => {
|
||||
// this.getList();
|
||||
// },
|
||||
// });
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: `${res.code}: ${res.msg}`,
|
||||
// type: "error",
|
||||
// duration: 1500,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
case "to-car-history": {
|
||||
return this.$router.push({
|
||||
name: "pms-carHistory",
|
||||
query: {
|
||||
code: data.code,
|
||||
},
|
||||
});
|
||||
}
|
||||
case "to-car-payload": {
|
||||
// open dialog instead of redirect to a new page
|
||||
this.openCarPayloadDialog(data);
|
||||
break;
|
||||
}
|
||||
case "edit-payload": {
|
||||
this.openCarPayloadAddDialog(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openCarPayloadDialog(id) {
|
||||
this.carPayloadDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["car-payload-dialog"].init(id);
|
||||
});
|
||||
},
|
||||
|
||||
openCarPayloadAddDialog(id) {
|
||||
this.carPayloadAddVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["car-payload-add-dialog"].init(null, null, null, { hisId: id });
|
||||
});
|
||||
},
|
||||
|
||||
handleBtnClick({ btnName, payload }) {
|
||||
console.log("[search] form handleBtnClick", btnName, payload);
|
||||
switch (btnName) {
|
||||
case "新增":
|
||||
this.openDialog();
|
||||
break;
|
||||
|
||||
case "手动添加": {
|
||||
this.openDialog();
|
||||
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");
|
||||
}
|
||||
delete params.timerange;
|
||||
}
|
||||
}
|
||||
|
||||
/** 处理 listQueryExtra 里的数据 */
|
||||
this.listQueryExtra?.map((cond) => {
|
||||
if (typeof cond === "string") {
|
||||
if (!!payload[cond]) {
|
||||
params[cond] = payload[cond];
|
||||
} else {
|
||||
params[cond] = "";
|
||||
}
|
||||
} else if (typeof cond === "object") {
|
||||
Object.keys(cond).forEach((key) => {
|
||||
params[key] = cond[key];
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("查询", params);
|
||||
this.getList(params);
|
||||
break;
|
||||
}
|
||||
|
||||
case "同步":
|
||||
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/** 导航器的操作 */
|
||||
handleSizeChange(val) {
|
||||
// val 是新值
|
||||
this.page = 1;
|
||||
this.size = val;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
// val 是新值
|
||||
this.getList();
|
||||
},
|
||||
|
||||
/** 打开对话框 */
|
||||
openDialog(row_id, detail_mode, tag_info) {
|
||||
this.dialogVisible = true;
|
||||
let extraParams = null;
|
||||
if (this.attachListQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.forEach((item) => {
|
||||
let found = item[this.attachListQueryExtra];
|
||||
if (found !== null && found !== undefined) extraParams = item;
|
||||
});
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
console.log(`[edit-dialog] extraParams: ${extraParams}`);
|
||||
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.list-view-with-head {
|
||||
background: white;
|
||||
/* height: 100%; */
|
||||
min-height: inherit;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 0 1.125px 0.125px rgba(0, 0, 0, 0.125);
|
||||
}
|
||||
</style>
|
244
src/views/modules/pms/kilnWaitingRoom/config.js
Normal file
244
src/views/modules/pms/kilnWaitingRoom/config.js
Normal file
@ -0,0 +1,244 @@
|
||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||
|
||||
import request from "@/utils/request";
|
||||
import { timeFilter } from '@/utils/filters'
|
||||
import { getDictDataList } from '@/utils'
|
||||
|
||||
export default function () {
|
||||
const tableProps = [
|
||||
{ type: 'index', label: '序号' },
|
||||
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||
{ prop: "code", label: "窑车号" },
|
||||
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
|
||||
{ prop: "orderCode", label: "订单号" },
|
||||
{ prop: "posCode", label: "位置" },
|
||||
{ prop: "startTime", label: "开始时间", filter: timeFilter },
|
||||
{ prop: "endTime", label: "结束时间", filter: timeFilter },
|
||||
{
|
||||
prop: "operations",
|
||||
name: "操作",
|
||||
fixed: "right",
|
||||
width: 90,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: "to-car-payload", label: "装载详情", icon: 'document' },
|
||||
// { name: "edit-payload", label: "输入载砖详情", icon: 'edit' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const headFormFields = [
|
||||
// {
|
||||
// prop: 'code',
|
||||
// label: "窑车号",
|
||||
// input: true,
|
||||
// default: { value: "" },
|
||||
// bind: {
|
||||
// placeholder: '请输入窑车号'
|
||||
// }
|
||||
// },
|
||||
{
|
||||
timerange: true,
|
||||
prop: "timerange",
|
||||
label: "时间段",
|
||||
bind: {
|
||||
placeholder: "选择日期时间",
|
||||
type: "datetimerange",
|
||||
"start-placeholder": "开始时间",
|
||||
"end-placeholder": "结束时间",
|
||||
},
|
||||
},
|
||||
{
|
||||
button: {
|
||||
type: "primary",
|
||||
name: "查询",
|
||||
},
|
||||
},
|
||||
{
|
||||
button: {
|
||||
type: "primary",
|
||||
name: "手动添加",
|
||||
permission: ""
|
||||
},
|
||||
bind: {
|
||||
plain: true,
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
const dialogJustFormConfigs = {
|
||||
clickModalToClose: true,
|
||||
form: {
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
prop: "carId",
|
||||
label: "窑车号",
|
||||
options: [],
|
||||
fetchData: () => this.$http.get('/pms/car/page', { params: { limit: 999, page: 1, code: '' } }),
|
||||
optionLabel: 'code',
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { filterable: true, placeholder: "请选择窑车" },
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
label: "位置",
|
||||
prop: "pos",
|
||||
options: [],
|
||||
fetchData: () => this.$http.post('/pms/carHandle/listPos', { limit: 999, page: 1, pos: [2] }),
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择窑车位置" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
datetime: true,
|
||||
label: "开始时间",
|
||||
prop: "startTime",
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择开始时间" },
|
||||
},
|
||||
{
|
||||
datetime: true,
|
||||
label: "结束时间",
|
||||
prop: "endTime",
|
||||
default: null,
|
||||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择结束时间" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: "窑车状态",
|
||||
prop: "stateDictValue",
|
||||
options: getDictDataList('car_state').map(_ => ({ label: _.dictLabel, value: _.dictValue })),
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请选择窑车状态" },
|
||||
},
|
||||
{}
|
||||
],
|
||||
],
|
||||
operations: [
|
||||
{ name: "add-pos-manually", label: "保存", type: "primary", permission: "", showOnEdit: false },
|
||||
// { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
|
||||
// { name: "reset", label: "重置", type: "warning", showAlways: true },
|
||||
// { name: 'cancel', label: '取消', showAlways: true },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const carPayloadAddConfigs = null
|
||||
// const carPayloadAddConfigs = {
|
||||
// clickModalToClose: true,
|
||||
// form: {
|
||||
// rows: [
|
||||
// [
|
||||
// {
|
||||
// select: true,
|
||||
// prop: "orderId",
|
||||
// label: "订单号",
|
||||
// options: [],
|
||||
// fetchData: () => this.$http.post('/pms/order/pageCom', { limit: 999, page: 1, code: '', type: 1 }),
|
||||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// elparams: { filterable: true, placeholder: "请选择订单" },
|
||||
// },
|
||||
// {
|
||||
// input: true,
|
||||
// label: "窑车载量",
|
||||
// prop: "qty",
|
||||
// rules: [
|
||||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// { type: 'number', message: "请输入大于0的整数", trigger: "blur", transform: val => Number(val) > 0 && Number.isInteger(Number(val)) && Number(val) },
|
||||
// ],
|
||||
// elparams: { placeholder: "请输入窑车载量" },
|
||||
// },
|
||||
// ],
|
||||
// // [
|
||||
// // {
|
||||
// // input: true,
|
||||
// // label: "合格砖数",
|
||||
// // prop: "goodqty",
|
||||
// // rules: [
|
||||
// // { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// // { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||||
// // ],
|
||||
// // elparams: { placeholder: "请输入合格砖数" },
|
||||
// // },
|
||||
// // {
|
||||
// // input: true,
|
||||
// // label: "废砖数",
|
||||
// // prop: "badqty",
|
||||
// // rules: [
|
||||
// // { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
// // { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||||
// // ],
|
||||
// // elparams: { placeholder: "请输入废砖数" },
|
||||
// // },
|
||||
// // ],
|
||||
// // [
|
||||
// // {
|
||||
// // input: true,
|
||||
// // label: "备注",
|
||||
// // prop: "remark",
|
||||
// // elparams: { placeholder: "请输入备注" },
|
||||
// // }
|
||||
// // ],
|
||||
// ],
|
||||
// operations: [
|
||||
// { name: "add-car-payload", label: "保存", type: "primary", permission: "", showOnEdit: false },
|
||||
// // { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
|
||||
// // { name: "reset", label: "重置", type: "warning", showAlways: true },
|
||||
// // { name: 'cancel', label: '取消', showAlways: true },
|
||||
// ],
|
||||
// },
|
||||
// };
|
||||
|
||||
const carPayloadDialogConfigs = {
|
||||
carPayloadDialog: true,
|
||||
clickModalToClose: true,
|
||||
tableConfig: {
|
||||
table: null,
|
||||
column: [
|
||||
// 窑车的 装载详情
|
||||
// tableProps
|
||||
{ type: "index", label: "序号" },
|
||||
{ prop: "orderCode", label: "订单号" },
|
||||
{ prop: "bomCode", label: "配方号" },
|
||||
{ prop: "shapeCode", label: "砖型编码" },
|
||||
{ width: 160, prop: "qty", label: "订单对应数量" },
|
||||
{ prop: "goodqty", label: "合格数量" },
|
||||
{ prop: "badqty", label: "废砖数量" },
|
||||
{ prop: "startTime", label: "开始时间" },
|
||||
{ prop: "endTime", label: "结束时间" },
|
||||
// { prop: "remark", label: "备注" },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
carPayloadAddConfigs,
|
||||
carPayloadDialogConfigs,
|
||||
dialogConfigs: dialogJustFormConfigs,
|
||||
tableConfig: {
|
||||
table: null, // 此处可省略,el-table 上的配置项
|
||||
column: tableProps, // el-column-item 上的配置项
|
||||
},
|
||||
headFormConfigs: {
|
||||
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
|
||||
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
||||
},
|
||||
urls: {
|
||||
base: "/pms/carHandle",
|
||||
page: "/pms/carHandle/pageHis",
|
||||
pageIsPostApi: true,
|
||||
posFormUrl: "/pms/trans/inputCurrent",
|
||||
payloadFormUrl: '/pms/trans/inputDetail', // 载砖详情 url
|
||||
// subase: '/pms/blenderStepParam',
|
||||
// subpage: '/pms/blenderStepParam/page',
|
||||
// more...
|
||||
},
|
||||
};
|
||||
}
|
45
src/views/modules/pms/kilnWaitingRoom/index.vue
Normal file
45
src/views/modules/pms/kilnWaitingRoom/index.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<ListViewWithHead
|
||||
:table-config="tableConfig"
|
||||
:head-config="headFormConfigs"
|
||||
:dialog-configs="dialogConfigs"
|
||||
:car-payload-dialog-configs="carPayloadDialogConfigs"
|
||||
:car-payload-add-configs="carPayloadAddConfigs"
|
||||
:listQueryExtra="[{ pos: [2] }]"
|
||||
:trigger-update="triggerUpdateKey"
|
||||
key="kilnWatingRoom"
|
||||
/>
|
||||
<!-- attach-list-query-data="code" -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import initConfig from "./config";
|
||||
import ListViewWithHead from "./components/ListViewWithHead.vue";
|
||||
|
||||
export default {
|
||||
name: "kilnWaitingRoomView",
|
||||
components: { ListViewWithHead },
|
||||
provide() {
|
||||
return {
|
||||
urls: this.allUrls,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const { tableConfig, headFormConfigs,carPayloadAddConfigs, carPayloadDialogConfigs, urls, dialogConfigs } = initConfig.call(this);
|
||||
return {
|
||||
carPayloadAddConfigs,
|
||||
carPayloadDialogConfigs,
|
||||
tableConfig,
|
||||
headFormConfigs,
|
||||
allUrls: urls,
|
||||
dialogConfigs,
|
||||
triggerUpdateKey: "",
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
this.triggerUpdateKey = Math.random().toString();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
Loading…
Reference in New Issue
Block a user