finish 完成上料信息“

This commit is contained in:
lb 2023-02-27 17:00:23 +08:00
parent c012bf7675
commit 31f1f8f3c1
3 changed files with 55 additions and 39 deletions

View File

@ -82,6 +82,7 @@ export default {
//
if (!field.watch && field.fn && typeof field.fn === "function") {
const optionLabel = field.fieldOptionLabel;
//
field.fn().then(({ data: res }) => {
if (res.code === 0 && res.data) {
@ -90,15 +91,15 @@ export default {
this.$set(
field,
"select",
res.data.list.map((item) => ({ label: item.name, value: item.id }))
res.data.list.map((item) => ({ label: optionLabel ? item[optionLabel] : item.name, value: item.id }))
);
}
} else {
this.$message({
message: `${field.label} 数据获取出错: ${res.code} - ${res.msg}`,
type: 'error',
duration: 1500
})
type: "error",
duration: 1500,
});
}
});
}

View File

@ -46,7 +46,7 @@
:disabled="detailMode"
/>
<el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" />
<el-date-picker v-if="col.datetime" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" />
<uploadBtn
v-if="col.upload"
:key="'upload_' + rowIndex + colIndex"
@ -98,6 +98,7 @@
import { pick as __pick } from "@/utils/filters";
import Cookies from "js-cookie";
import uploadBtn from "@/components/uploadBtn";
import moment from "moment";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
@ -321,6 +322,17 @@ export default {
} else {
httpPayload = this.dataForm;
}
/** 针对时间段设置 payload */
if ("startTime" in this.dataForm && "endTime" in this.dataForm) {
const {startTime, endTime} = this.dataForm;
httpPayload = {
...httpPayload,
startTime: startTime ? moment(startTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
endTime: endTime ? moment(endTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss")
}
}
/** 发送 */
return this.$http({
url: this.urls.base,
@ -394,7 +406,8 @@ export default {
}
.el-select,
.el-cascader {
.el-cascader,
.el-date-editor {
width: 100% !important;
}

View File

@ -2,23 +2,23 @@ import TableOperaionComponent from "@/components/noTemplateComponents/operationC
import switchBtn from "@/components/noTemplateComponents/switchBtn";
import QuillRichInput from "@/components/noTemplateComponents/richInput";
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'
import { timeFilter } from "@/utils/filters";
export default function () {
const tableProps = [
{ type: 'index', label: '序号' },
{ type: "index", label: "序号" },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "startTime", label: "上料时间", filter: timeFilter },
{ prop: "endTime", label: "结束上料时间", filter: timeFilter },
{ prop: "material", label: "物料" },
{ prop: "qty", label: "上料数量" },
{ prop: "storeCOde", label: "料仓" },
{ prop: "storeCode", label: "料仓" },
{ prop: "upPos", label: "上料位点" },
// { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'][val] },
// { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent
// { prop: "currentQty", label: "载量" },
// { prop: "currentPos", label: "当前位置" },
{ prop: "description", label: "描述" },
// { prop: "description", label: "描述" },
{ prop: "remark", label: "备注" },
{
prop: "operations",
@ -32,38 +32,39 @@ export default function () {
const headFormFields = [
{
prop: 'materialId',
prop: "materialId",
label: "物料",
// default: { value: "" },
select: [],
// 绑定数据获取函数
fn: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999 } }),
fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }),
bind: {
placeholder: '请选择物料',
filterable: true
}
placeholder: "请选择物料",
filterable: true,
},
},
{
prop: 'storeId',
prop: "storeId",
label: "日料仓",
fieldOptionLabel: 'code', // 把料仓筛选条件的label改为展示code而不是展示name
select: [],
// default: { value: "" },
fn: () => this.$http.get('/pms/materialStorage/page', { params: { page: 1, limit: 999, typeDictValue: '1' } }),
fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "1" } }),
bind: {
placeholder: '请选择日料仓',
filterable: true
}
placeholder: "请选择日料仓",
filterable: true,
},
},
{
timerange: true,
prop: 'timerange', // 应该是个数组,在提交数据时需单独处理
label: '时间段',
prop: "timerange", // 应该是个数组,在提交数据时需单独处理
label: "时间段",
bind: {
placeholder: '选择日期时间',
type: 'datetimerange',
placeholder: "选择日期时间",
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
}
},
},
{
button: {
@ -75,11 +76,11 @@ export default function () {
button: {
type: "primary",
name: "新增",
permission: "pms:materialStorage:save"
permission: "pms:materialStorage:save",
},
bind: {
plain: true,
}
},
},
];
@ -94,20 +95,19 @@ export default function () {
rows: [
[
{
input: true,
datetime: true,
label: "上料时间",
prop: "name",
prop: "startTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入上料时间" },
elparams: { placeholder: "请选择上料时间", type: "datetime" },
},
{
input: true,
datetime: true,
label: "结束上料时间",
prop: "name",
prop: "endTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入结束上料时间" },
}
elparams: { placeholder: "请选择结束上料时间", type: "datetime" },
},
],
[
{
@ -115,7 +115,7 @@ export default function () {
label: "物料",
prop: "materialId",
options: [],
fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }),
fetchData: () => this.$http("/pms/material/page", { params: { page: 1, size: 999 } }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择物料", filterable: true },
},
@ -125,7 +125,10 @@ export default function () {
prop: "qty",
// options: [],
// fetchData: () => this.$http('/pms/material/page', { params: { page: 1, size: 999 } }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{ type: "number", message: "请输入正确的数字", trigger: "blur", transform: (val) => Number(val) },
],
elparams: { placeholder: "请输入上料数量" },
},
],
@ -136,7 +139,7 @@ export default function () {
label: "料仓",
prop: "storeId",
options: [],
fetchData: () => this.$http('/pms/materialStorage/page', { params: { page: 1, size: 999 } }),
fetchData: () => this.$http("/pms/materialStorage/page", { params: { page: 1, size: 999, typeDictValue: '1' } }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择料仓", filterable: true },
},
@ -185,4 +188,3 @@ export default function () {
},
};
}