update 破碎

This commit is contained in:
lb 2023-02-28 15:38:35 +08:00
parent b1adcec01c
commit f093cf413c
4 changed files with 238 additions and 6 deletions

View File

@ -12,7 +12,7 @@
>
<el-input v-if="opt.input" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
<el-select v-if="opt.select" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small">
<el-option v-for="item in opt.select" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in opt.select" :key="item.value + Math.random().toString()" :label="item.label" :value="item.value" />
</el-select>
<el-date-picker v-if="opt.timerange" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
<el-upload
@ -83,6 +83,7 @@ export default {
//
if (!field.watch && field.fn && typeof field.fn === "function") {
const optionLabel = field.fieldOptionLabel;
const optionValue = field.fieldOptionValue;
//
field.fn().then(({ data: res }) => {
if (res.code === 0 && res.data) {
@ -91,7 +92,10 @@ export default {
this.$set(
field,
"select",
res.data.list.map((item) => ({ label: optionLabel ? item[optionLabel] : item.name, value: item.id }))
res.data.list.map((item) => ({
label: optionLabel ? item[optionLabel] : item.name,
value: optionValue ? item[optionValue] : item.id,
}))
);
}
} else {

View File

@ -137,7 +137,7 @@ export default {
this.$set(
col,
"options",
res.data.list.map((i) => ({ label: i.name, value: i.id }))
res.data.list.map((i) => ({ label: i.name, value: col.optionValue ? i[col.optionValue] : i.id }))
);
// col.options = res.data.list;
} else {
@ -329,8 +329,17 @@ export default {
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")
endTime: endTime ? moment(endTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
};
}
/** 针对时间段设置 payload */
if ("updateTime" in this.dataForm) {
const { updateTime } = this.dataForm;
httpPayload = {
...httpPayload,
updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss")
};
}
/** 发送 */

View File

@ -0,0 +1,187 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import switchBtn from "@/components/noTemplateComponents/switchBtn";
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'
export default function () {
const tableProps = [
{ type: 'index', label: '序号' },
// { prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "updateTime", label: "上料时间", filter: timeFilter },
{ prop: "material", label: "原料" },
{ prop: "qty", label: "上料量" },
{ prop: "siloCode1", label: "上料料仓1" },
{ prop: "siloCode2", label: "上料料仓2" },
{ prop: "siloCode3", label: "上料料仓3" },
{ prop: "statusDictValue", label: "破碎作业", filter: val => ['正常停止', '废除'][val] ?? '-' },
{ prop: "description", label: "描述" },
{ prop: "remark", label: "备注" },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: ["edit", { name: "delete", emitFull: true, permission: "pms:brokeLog:delete" }],
},
];
const headFormFields = [
{
prop: 'material',
label: "按原料搜索",
// input: true,
select: [],
fieldOptionValue: 'name', // 把料仓筛选条件的label改为展示code而不是展示name
default: { value: "" },
fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }),
bind: {
placeholder: '请输入原料名',
filterable: true
}
},
{
prop: 'silo',
label: "按料仓搜索",
fieldOptionLabel: 'code', // 把料仓筛选条件的label改为展示code而不是展示name
select: [],
fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999 } }),
bind: {
placeholder: '请选择料仓',
filterable: true,
}
},
{
timerange: true,
prop: 'timerange',
label: "时间段",
bind: {
placeholder: '请选择上料时间段',
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
}
},
{
button: {
type: "primary",
name: "查询",
},
},
{
button: {
type: "primary",
name: "新增",
permission: "pms:brokeLog:save"
},
bind: {
plain: true,
}
},
];
/**
* dialog config 有两个版本一个适用于 DialogWithMenu 组件另一个适用于 DialogJustForm 组件
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
* 此为后者的配置:
*/
const dialogJustFormConfigs = {
form: {
rows: [
[
{
// input: true,
select: true,
options: [],
label: "原料",
prop: "material",
optionValue: 'code',
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入原料名称" },
elparams: { placeholder: "请选择原料" },
fetchData: () => this.$http.get("/pms/material/page", { params: { limit: 999, page: 1 } }),
// rules: { required: true, message: "必填项不能为空", trigger: "change" },
},
{
input: true,
label: "上料量",
prop: "qty",
rules: [{ required: true, message: "必填项不能为空", trigger: "blur" }, { type: 'number', message: '请输入正确的数字类型', trigger: 'blur', transform: val => Number(val) }],
elparams: { placeholder: "请输入上料量" },
},
{
datetime: true,
label: "上料时间",
prop: "updateTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择上料时间", type: 'datetime' },
},
],
[
{
prop: 'silo1',
label: '上料料仓1',
select: true,
options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999 } }),
elparams: { placeholder: "请选择上料料仓1" }
},
{
prop: 'silo2',
label: '上料料仓2',
select: true,
options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999 } }),
elparams: { placeholder: "请选择上料料仓2" }
},
{
prop: 'silo3',
label: '上料料仓3',
select: true,
options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999 } }),
elparams: { placeholder: "请选择上料料仓3" }
},
],
[
{ select: true, label: "破碎作业", prop: "statusDictValue", options: [{ label: '正常停止', value: 0 }, { label: '废除', value: '1' }], elparams: { placeholder: "破碎作业", filterable: true } },
{},
{}
],
[
{ input: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } },
],
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:brokeLog:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:brokeLog:update", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
};
// 备注:弹窗弹出的时间和网速有关......
return {
dialogConfigs: dialogJustFormConfigs,
tableConfig: {
table: null, // 此处可省略el-table 上的配置项
column: tableProps, // el-column-item 上的配置项
},
headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
},
urls: {
base: "/pms/brokeLog",
page: "/pms/brokeLog/page",
// subase: '/pms/blenderStepParam',
// subpage: '/pms/blenderStepParam/page',
// more...
},
};
}

View File

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