add order

This commit is contained in:
lb 2023-03-07 15:29:08 +08:00
parent 8655d9d767
commit 5f5a9f645d
7 changed files with 1130 additions and 25 deletions

View File

@ -39,8 +39,8 @@
<script> <script>
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am'; // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
</script> </script>
<% } %> <% } %>
<!-- 集成测试环境 --> <!-- 集成测试环境 -->

View File

@ -264,7 +264,9 @@ export default {
this.loadingStatus = true; this.loadingStatus = true;
// //
this.$http.get(this.urls.base + `/${this.dataForm.id}`).then(({ data: res }) => { this.$http
.get(this.urls.base + `/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res && res.code === 0) { if (res && res.code === 0) {
this.dataForm = __pick(res.data, Object.keys(this.dataForm)); this.dataForm = __pick(res.data, Object.keys(this.dataForm));
/** 格式化文件上传列表 */ /** 格式化文件上传列表 */
@ -275,21 +277,28 @@ export default {
typeCode: file.typeCode, typeCode: file.typeCode,
url: file.fileUrl, url: file.fileUrl,
})); }));
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 1500,
});
} }
// console.log("[DialogJustForm] init():", this.dataForm); // console.log("[DialogJustForm] init():", this.dataForm);
} }
this.loadingStatus = false; this.loadingStatus = false;
}).catch(err => { })
.catch((err) => {
this.loadingStatus = false; this.loadingStatus = false;
this.$message({ this.$message({
message: `${err}`, message: `${err}`,
type: 'error', type: "error",
duration: 1500 duration: 1500,
}) });
}); });
} else { } else {
// //
this.loadingStatus = false this.loadingStatus = false;
} }
}); });
}, },
@ -347,7 +356,7 @@ export default {
const { updateTime } = this.dataForm; const { updateTime } = this.dataForm;
httpPayload = { httpPayload = {
...httpPayload, ...httpPayload,
updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss") updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
}; };
} }

View File

@ -0,0 +1,133 @@
<!-- 这里单纯的配置表格就好了-->
<template>
<div class="base-list-table w-full">
<el-table
:data="tableData"
v-bind="tableConfig"
ref="base-list-table"
:cell-style="{ padding: 0 }"
:header-cell-style="/** 重写表格样式 **/ {
padding: '8px 0',
}"
row-key="id"
:lazy="true"
:load="loadSubClassFn"
>
<!-- @cell-mouse-enter="(row, col, cell, event) => $emit('cell-mouse-enter', row, col, cell, event)"> -->
<!-- @cell-mouse-leave="(row, col, cell, event) => $emit('cell-mouse-leave', row, col, cell, event)"> -->
<!-- 表格头定义 -->
<template v-for="(head, idx) in columnConfig">
<!-- 索引列 -->
<el-table-column
:key="idx"
v-if="head.type"
:type="head.type"
:label="head.label || head.name || ''"
:header-align="head.align || 'center'"
:align="head.align || 'center'"
:width="head.width || 50"
:index="
head.type === 'index'
? (val) => {
return val + 1 + (page - 1) * size;
}
: null
"
v-bind="head.more"
></el-table-column>
<!-- 普通的表头 -->
<el-table-column
v-else
:key="idx + 'else'"
:label="head.label ? head.label : head.name"
:prop="head.prop || null"
:width="head.width || null"
:min-width="head.minWidth || null"
:fixed="head.fixed || null"
:show-overflow-tooltip="head.showOverflowTooltip || true"
:tooltip-effect="head.tooltipEffect || 'light'"
filter-placement="top"
:align="head.align || null"
v-bind="head.more"
>
<!-- 子组件 -->
<template v-if="head.prop" slot-scope="scope">
<component
v-if="head.subcomponent"
:is="head.subcomponent"
:key="idx + 'sub'"
:inject-data="{ ...scope.row, head }"
@emit-data="handleSubEmitData"
/>
<!-- 直接展示数据或应用过滤器 -->
<span v-else>{{ scope.row[head.prop] | commonFilter(head.filter) }}</span>
</template>
<!-- 多级表头 -->
<template v-if="!head.prop && head.children">
<TableHead v-for="(subhead, subindex) in head.children" :key="'subhead-' + idx + '-subindex-' + subindex" :opt="subhead" />
</template>
</el-table-column>
</template>
</el-table>
</div>
</template>
<script>
import TableHead from "@/components/TableHead.vue";
// 1. /
// 2. '
// 3. more...
export default {
name: "BaseListTable",
components: { TableHead },
filters: {
commonFilter: (source, filterType = (a) => a) => {
return filterType(source);
},
},
props: {
tableConfig: {
type: Object,
default: () => ({}),
},
columnConfig: {
type: Array,
default: () => [],
},
tableData: {
type: Array,
default: () => [],
},
refreshLayoutKey: {
type: Number,
default: 0,
},
},
inject: ["urls"],
data() {
return {
page: 1,
size: 20, // 20
dataList: [],
};
},
watch: {
refreshLayoutKey(val) {
this.$refs["base-list-table"].doLayout();
},
},
methods: {
handleSubEmitData(payload) {
console.log("[component] BaseListTable handleSubEmitData(): ", payload);
this.$emit("operate-event", payload);
},
loadSubClassFn(tree, treeNode, resolve) {
this.$emit("load-sub", { tree, treeNode, resolve });
},
},
};
</script>
<style scoped></style>

View File

@ -0,0 +1,271 @@
<template>
<el-dialog
class="dialog-just-form"
:visible="dialogVisible"
@close="handleClose"
:destroy-on-close="false"
:close-on-click-modal="configs.clickModalToClose ?? true"
>
<!-- title -->
<div slot="title" class="dialog-title">
<h1 class="">
{{ detailMode ? "查看详情" : dataForm.id ? "编辑" : "新增" }}
</h1>
</div>
<!-- form -->
<el-form ref="dataForm" :model="dataForm" v-loading="loadingStatus">
<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-upload
v-if="col.upload"
:key="'upload_' + Math.random()"
:action="col.actionUrl"
:file-list="col.fileList"
:disabled="detailMode || !dataForm.id"
:on-change="handleUploadChange"
v-bind="col.elparams"
:headers="uploadHeaders"
>
<el-button type="primary" size="small">选择文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<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'"
/>
</div>
<!-- add more... -->
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- footer -->
<div slot="footer">
<template v-for="(operate, index) in configs.form.operations">
<el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type" @click="handleBtnClick(operate)">{{
operate.label
}}</el-button>
</template>
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { pick as __pick } from "@/utils/filters";
import Cookies from "js-cookie";
export default {
name: "DialogJustForm",
props: {
configs: {
type: Object,
default: () => ({
clickModalToClose: true,
forms: null,
}),
},
dialogVisible: {
type: Boolean,
default: false,
},
},
inject: ["urls"],
data() {
const dataForm = {};
this.configs.form.rows.forEach((row) => {
row.forEach((col) => {
dataForm[col.prop] = col.default ?? null;
if (col.fetchData)
col.fetchData().then(({ data: res }) => {
if (res.code === 0 && res.data.list) {
this.$set(
col,
"options",
res.data.list.map((i) => ({ label: i.name, value: i.id }))
);
} else {
col.options.splice(0);
}
});
});
});
return {
loadingStatus: false,
dataForm,
detailMode: false,
baseDialogConfig: null,
};
},
computed: {
uploadHeaders() {
return {
token: Cookies.get("token") || "",
};
},
},
methods: {
/** utitilities */
showButton(operate) {
const notDetailMode = !this.detailMode;
const showAlways = operate.showAlways ?? false;
const editMode = operate.showOnEdit && this.dataForm.id;
const addMode = !operate.showOnEdit && !this.dataForm.id;
const permission = operate.permission ? this.$hasPermission(operate.permission) : true;
return notDetailMode && (showAlways || ((editMode || addMode) && permission));
},
resetForm(excludeId = false, immediate = false) {
setTimeout(
() => {
console.log("[Dialog Just Form] clearing form...");
Object.keys(this.dataForm).forEach((key) => {
if (excludeId && key === "id") return;
this.dataForm[key] = null;
});
console.log("[Dialog Just Form] cleared form...", this.dataForm);
this.$refs.dataForm.clearValidate();
this.$emit("dialog-closed"); //
},
immediate ? 0 : 200
);
},
/** init **/
init(parentId, detailMode) {
if (this.$refs.dataForm) {
this.$refs.dataForm.clearValidate();
}
this.detailMode = detailMode ?? false;
this.$nextTick(() => {
this.dataForm.parentId = parentId || null;
});
},
handleComponentModelUpdate(propName, { subject, payload: { data } }) {
this.dataForm[propName] = JSON.stringify(data);
console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]);
},
handleBtnClick(payload) {
console.log("btn click payload: ", payload);
if ("name" in payload) {
switch (payload.name) {
case "cancel":
this.handleClose();
break;
case "reset":
this.resetForm(true, true); // true means exclude id, immediate execution
break;
case "add":
case "update": {
this.$refs.dataForm.validate((passed, result) => {
if (passed) {
//
this.loadingStatus = true;
const method = payload.name === "add" ? "POST" : "PUT";
this.$http({
url: this.urls.base,
method,
data: this.dataForm,
})
.then(({ data: res }) => {
console.log("[add&update] res is: ", res);
this.loadingStatus = false;
if (res.code === 0) {
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
this.$emit("refreshDataList");
this.handleClose();
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 2000,
});
}
})
.catch((errMsg) => {
this.$message.error("参数错误:" + errMsg);
if (this.loadingStatus) this.loadingStatus = false;
});
} else {
//
// this.$message.error(JSON.stringify(result));
this.$message.error("请核查字段信息");
}
});
}
}
}
},
handleClose() {
this.resetForm();
this.$emit("update:dialogVisible", false);
},
},
};
</script>
<style scoped>
.dialog-just-form >>> .el-dialog__body {
/* padding-top: 16px !important;
padding-bottom: 16px !important; */
padding-top: 0 !important;
padding-bottom: 0 !important;
}
.el-select,
.el-cascader {
width: 100% !important;
}
.dialog-just-form >>> .el-dialog__header {
padding: 10px 20px 10px;
/* background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white); */
}
.h0 {
height: 0;
width: 0;
}
</style>

View File

@ -0,0 +1,402 @@
<!--
/**
* 说明表格页加上搜索条件 - <物料管理>模块的定制化版本
*
**/
-->
<template>
<div class="list-view-with-head">
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
<BaseListTable
key="confirmed"
v-loading="tableLoading"
:table-config="null"
:column-config="tableConfigs.ongoingTable"
:table-data="dataList"
@operate-event="handleOperate"
@load-sub="handleLoadSub"
:refresh-layout-key="refreshLayoutKey"
/>
<br>
<hr>
<br>
<BaseListTable
key="ended"
v-loading="tableLoading"
:table-config="null"
:column-config="tableConfigs.finishedTable"
:table-data="dataList"
@operate-event="handleOperate"
@load-sub="handleLoadSub"
:refresh-layout-key="refreshLayoutKey"
/>
<br>
<hr>
<br>
<BaseListTable
key="unconfirmed"
v-loading="tableLoading"
:table-config="null"
:column-config="tableConfigs.pendingTable"
: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"
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"
@refreshDataList="handleRefreshDatalist"
/> -->
</div>
</template>
<script>
import BaseListTable from "./BaseListTable.vue";
import BaseSearchForm from "@/components/BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "./DialogJustForm.vue";
const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm";
const dictList = JSON.parse(localStorage.getItem("dictList"));
export default {
name: "ListViewWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm },
props: {
tableConfigs: {
type: Object,
default: () => ({
ongoingTable: null,
finishedTable: null,
pendingTable: null
})
},
headConfig: {
type: Object,
default: () => ({}),
},
/** 请求page接口的时候有些字段是必填的没有会报500把相关字段名传入这个prop: */
listQueryExtra: {
type: Array,
default: () => ["key"],
},
initDataWhenLoad: { type: Boolean, default: true },
/** dialog configs 或许可以从 tableConfig 计算出来 computed... */
dialogConfigs: {
type: Object,
default: () => ({}),
},
},
computed: {
dialogType() {
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
},
},
data() {
return {
refreshLayoutKey: null,
DIALOG_WITH_MENU,
DIALOG_JUST_FORM,
dialogVisible: false,
topBtnConfig: null,
totalPage: 100,
page: 1,
size: 20, // 20
dataList: [],
tableLoading: false,
subdialogVisible: false,
subdialogConfigs: {
form: {
rows: [
[
{
input: true,
label: "原料名称",
prop: "name",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入原料名称" },
},
{
input: true,
label: "原料编码",
prop: "code",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入原料编码" },
},
{
select: true,
label: "单位",
prop: "unitDictValue",
options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "单位" },
},
],
[
{
select: true,
label: "原料类型",
prop: "typeId",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
options: [],
fetchData: () => this.$http.get("/pms/materialType/page", { params: { page: 1, limit: 999 } }),
elparams: { placeholder: "请输入原料类型" },
// autoDisabled: true, // disabled
},
{
select: true,
label: "原料类别",
prop: "typeDictValue",
options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "原料类别" },
// autoDisabled: true
},
{ input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } },
],
[
{
input: true,
label: "英文名称",
prop: "enName",
elparams: { placeholder: "请输入英文名称" },
},
{
input: true,
label: "缩写",
prop: "enAb",
elparams: { placeholder: "请输入缩写" },
},
{ input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } },
],
[{ input: true, label: "中文描述", prop: "remark", elparams: { placeholder: "备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:material:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:material:save", showOnEdit: true },
// { name: "reset", label: "", type: "warning", showAlways: true },
// { name: 'cancel', label: '', showAlways: true },
],
},
},
};
},
inject: ["urls"],
mounted() {
this.initDataWhenLoad && this.getList();
},
activated() {
this.refreshLayoutKey = this.layoutTable();
},
methods: {
handleLoadSub({ tree, treeNode, resolve }) {
// console.log("tree, treeNOde, resovle is:", tree, treeNode, resolve);
this.$http.get(`${this.urls.tree}?rootId=${tree.id}`).then(({ data: res }) => {
if (res.code === 0 && res.data) {
resolve(
res.data.map((item) => {
if (item.children) item.hasChildren = true;
/** TODO: 合并物料类型 和 类别 */
return item;
})
);
}
});
},
layoutTable() {
return Math.random();
},
/** 获取 列表数据 */
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.length) {
this.listQueryExtra.map((name) => {
params[name] = "";
});
}
this.$http
.get(this.urls.page, {
params: {
...params,
parentId: "0",
},
})
.then(({ data: res }) => {
console.log("[http response] res is: ", res);
// page :
if ("list" in res.data) {
// real env:
this.dataList = res.data.list;
// this.dataList = res.data.records;
this.totalPage = res.data.total;
} else {
this.dataList.splice(0);
this.totalPage = 0;
}
this.tableLoading = false;
// location.reload()
});
},
/** 处理 表格操作 */
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}" 吗?`, "提示", {
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();
}
});
})
.catch((err) => {});
}
case "edit": {
this.openDialog(data); /** data is ==> id */
break;
}
case "view":
case "view-detail-action": {
this.openDialog(data, true);
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
}
});
break;
}
case "add-sub": {
//
const parentId = data;
this.subdialogVisible = true;
this.$nextTick(() => {
this.$refs["add-sub-dialog"].init(parentId);
});
}
}
},
handleRefreshDatalist() {
location.reload();
},
handleBtnClick({ btnName, payload }) {
console.log("[search] form handleBtnClick", btnName, payload);
switch (btnName) {
case "新增":
this.openDialog();
break;
case "查询": {
this.getList(payload);
break;
}
}
},
/** 导航器的操作 */
handleSizeChange(val) {
// val
this.page = 1;
this.size = val;
this.getList();
},
handlePageChange(val) {
// val
this.getList();
},
/** 打开对话框 */
openDialog(row_id, detail_mode) {
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode);
});
},
},
};
</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>

View File

@ -0,0 +1,258 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
import StatusComponent from "@/components/noTemplateComponents/statusComponent";
import { timeFilter, dictFilter } from "@/utils/filters";
export default function () {
const operations = {
'ongoing': ['edit'],
'pending': ['edit', 'delete'],
'finished': ['edit']
}
const genTableProps = (type /** ongoing, pending, finished */) =>
[
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "statusDictValue", label: "订单状态", filter: dictFilter('order_status') }, // 不可编辑
{ prop: "code", label: "订单号" },
{ prop: "cate", label: "子订单号" },
{ prop: "productCode", label: "物料编号" }, // select, filterable
{ prop: "shapeCode", label: "砖型编号" }, // select, filterable
{ prop: "brand", label: "牌号" }, // select, filterable
{ prop: "addon", label: "addon" },
{ prop: "ai", label: "版本号" }, // auto display according to the 配方
{ prop: "shortDesc", label: "物料号销售文本" },
{ prop: "bomCode", label: "配方编码" },
{ prop: "pressCode", label: "压机号" }, // select, filterable
{ prop: "blenderCode", label: "混料机号" }, // select, filterable
{ prop: "kilnCode", label: "隧道窑号" }, // select, filterable
{ prop: "prodqty", label: "订单砖数" },
{ prop: "ktmp", label: "烧成温度" },
{ prop: "tt", label: "烧成时间" },
{ prop: "yieldqty", label: "已生产数量" }, // uneditable
{ prop: "soqty", label: "销售订单数" },
{ prop: "saleNo", label: "销售订单号" },
{ prop: "saleOrderItem", label: "销售订单item号" },
{ prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
{ prop: "specifications", label: "生产订单类型" },
{ prop: "deliveryTime", label: "发货时间" },
{ prop: "customerCode", label: "客户" },
// { prop: "description", label: "详情", subcomponent: TableTextComponent },
{ prop: "pcsKilnCar", label: "托盘码放砖数", },
{ prop: "remark", label: "备注" },
{
prop: "operations",
name: "操作",
fixed: "right",
subcomponent: TableOperaionComponent,
options: operations[type]
},
];
const headFormFields = [
{
label: "原料名称/编码",
prop: "key",
input: true,
default: { value: "" },
bind: { placeholder: "请输入原料名称或编码" },
},
{
button: {
type: "primary",
name: "查询",
},
},
{
button: {
type: "primary",
name: "新增",
permission: "",
},
bind: {
plain: true,
},
},
];
/**
* dialog config 有两个版本一个适用于 DialogWithMenu 组件另一个适用于 DialogJustForm 组件
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
* 此为后者的配置:
*/
const dictList = JSON.parse(localStorage.getItem("dictList"));
const dialogConfigs = {
menu: [
{ name: "原料信息", key: "info" },
{ name: "原料属性信息", key: "attr", onlyEditMode: true },
// { name: "添加子类", key: "add-sub", onlyEditMode: true },
],
form: {
rows: [
[
{
input: true,
label: "原料名称",
prop: "name",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入原料名称" },
},
{
input: true,
label: "原料编码",
prop: "code",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入原料编码" },
},
{
select: true,
label: "单位",
prop: "unitDictValue",
options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "单位" },
},
],
[
// {
// cascader: true,
// label: "父级原料",
// prop: "parentId",
// // TODO: 待解决DialogWithMenu 中设置default只在初始化的时候有效一旦清空过就无效了
// // default: '0',
// // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// options: [{ id: '0', name: '无' }], // 手动注入额外选项,用到的场景不多...
// fetchData: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999, key: '' } }),
// elparams: { placeholder: "请选择父级原料", filterable: true, clearable: true },
// // fetchTreeData: () => {
// // // TODO前提是工厂里总的设备类型数不会超过 999
// // return this.$http.get('/pms/material/tree', {
// // params: { rootId: '0' }
// // })
// // },
// // elparams: { placeholder: "请选择父级原料", 'show-all-levels': false, props: { checkStrictly: true } },
// },
{
select: true,
label: "原料类型",
prop: "typeId",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
options: [],
fetchData: () => this.$http.get('/pms/materialType/page', { params: { page: 1, limit: 999 } }),
elparams: { placeholder: "请输入原料类型" },
// autoDisabled: true, // 有某个条件触发后,自动变成 disabled 状态
},
{
select: true,
label: "原料类别",
prop: "typeDictValue",
options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "原料类别" },
// autoDisabled: true
},
{ input: true, label: "堆积密度(g/cm³)", prop: "density", elparams: { placeholder: "堆积密度" } },
// {
// input: true,
// label: "设备类型",
// prop: "eqTypeId",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入设备类型" },
// },
],
[
{
input: true,
label: "英文名称",
prop: "enName",
elparams: { placeholder: "请输入英文名称" },
},
{
input: true,
label: "缩写",
prop: "enAb",
elparams: { placeholder: "请输入缩写" },
},
{ input: true, label: "原料描述", prop: "description", elparams: { placeholder: "原料描述" } },
],
[{ input: true, label: "中文描述", prop: "remark", elparams: { placeholder: "备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:material:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:material:save", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
table: {
// extraParams: ['stepId'],
extraParams: "materialId",
props: [
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "name", label: "属性名", isEditField: true },
{ prop: "value", label: "属性值", isEditField: true },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", permission: "pms:materialArrt:save" },
{ name: "delete", emitFull: true, permission: "pms:materialArrt:save" },
],
},
],
data: [
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
],
},
subDialog: {
extraParam: "materialId",
forceAttachCode: true,
rows: [
[
{ input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } }
],
[
{ input: true, label: "属性值", prop: "value", elparams: { placeholder: "请输入属性值" } }
],
[
{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } },
]
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:materialArrt:update", showOnEdit: true },
// { name: 'reset', label: '重置', type: 'warning', showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
};
return {
dialogConfigs,
tableConfigs: {
ongoingTable: genTableProps('ongoing'),
pendingTable: genTableProps('pending'),
finishedTable: genTableProps('finished'),
},
headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
},
urls: {
confirmedOrder: '/pms/order/pageCom',
finishedOrder: '/pms/order/pageEnd',
unConfirmedOrder: '/pms/order/pageUnCom',
// base: "/pms/material",
// page: "/pms/material/page",
// tree: "/pms/material/tree",
// subase: "/pms/materialArrt",
// subpage: "/pms/materialArrt/page",
// more...
},
};
}

View File

@ -0,0 +1,32 @@
<template>
<ListViewWithHead :table-configs="tableConfigs" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" />
</template>
<script>
import initConfig from './config';
import ListViewWithHead from './components/ListViewWithHead.vue';
export default {
name: 'OrderView',
components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls
}
},
data() {
const { tableConfigs, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return {
tableConfigs,
headFormConfigs,
allUrls: urls,
dialogConfigs,
};
},
created() {},
mounted() {},
methods: {},
};
</script>
<style scoped></style>