pms-aomei/src/views/modules/pms/qualityInspectionRecord/config.js
2023-04-03 11:35:14 +08:00

258 lines
8.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
// import StatusComponent from "@/components/noTemplateComponents/statusComponent";
import { timeFilter } from "@/utils/filters";
import { getDictDataList } from "@/utils";
export default function () {
const tableProps = [
{ type: "index", label: "序号" },
{ width: 160, prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "carCode", label: "窑车号" },
{ prop: "orderCode", label: "订单号" },
{ prop: "orderCate", label: "子号" },
{ prop: "scrap", label: "是否报废" },
{ prop: "qty", label: "抽检数量" },
{ prop: "badqty", label: "不合格数量" },
{ prop: 'description', label: '查看详情', subcomponent: TableTextComponent },
{ width: 160, prop: "checkTime", label: "检测时间", filter: timeFilter },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", label: "编辑", icon: "edit-outline", },
{ name: 'delete', label: '删除', icon: 'delete' },
// 只有 injectRow.task 为手动时,才允许编辑
// { name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
// { name: 'delete', icon: 'delete', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
// 只有 injectRow.status 为 waiting 时,才允许编辑
// { name: "edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'status' in injectRow && injectRow.status === 'Waiting' } },
// { name: 'delete', icon: 'delete', emitFull: true, promptField: 'batchNo', enable: injectRow => { return 'status' in injectRow && injectRow.status === 'Waiting' } },
]
},
];
const headFormFields = [
{
prop: "orderId",
label: "订单号",
fieldOptionLabel: 'code',
// fieldOptionValue: 'id',
select: [],
fn: () => this.$http.post("/pms/order/pageView", { page: 1, limit: 999 }),
bind: {
placeholder: "请选择订单号",
filterable: true
},
},
{
prop: "carId",
label: "窑车号",
select: [],
fn: () => this.$http.get("/pms/car/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: ""
},
bind: {
plain: true,
}
},
];
const dialogJustFormConfigs = {
// extra blenderOrderId
// extraIds: {},
form: {
rows: [
[
{
select: true,
label: "窑车号",
prop: "carId",
options: [],
optionLabel: 'code',
optionValue: 'carId',
needCache: true,
fetchData: () => this.$http.post("/pms/carHandle/pageView", { page: 1, limit: 999 }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入窑车号", filterable: true },
injectTo: [
['posCode', 'posCode'], // TODO
['carState', 'stateDictValue']
]
},
{
// select: true,
forceDisabled: true,
label: "当前位置",
// options: getDictDataList(),
prop: "posCode",
},
{
forceDisabledSelect: true,
// select: true,
label: "当前状态",
prop: "carState",
options: [
{ label: '没有数据', value: '0' },
{ label: '正常窑车', value: '1' },
{ label: '判废窑车', value: '2' },
{ label: '摆渡车', value: '3' },
{ label: '空窑车', value: '4' },
],
},
{
select: true,
label: "整车报废",
prop: "scrap",
options: [
{ label: '是', value: 'yes' },
{ label: '否', value: 'no', default: true },
],
// rules: { required: true, message: "必选项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择报废状态" },
},
],
[
{
select: true,
label: "订单号",
prop: "orderId",
options: [],
optionLabel: 'orderCode',
// toggleFetchData: 'carId', // 当 carId 改变的时候,也会 fetchData
hasPrev: 'carId', // 当 carId 改变的时候,也会 fetchData
// 需要保存当前状态
needCache: true,
fetchDataParam: { search: 'carId', get: 'id' }, // 伴随着 toggleFetchData 出现
fetchData: (hisId) => this.$http.get(`/pms/carHandle/${hisId}`),
fetchDataWait: true,
rules: { required: true, message: "必选项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择订单" },
injectTo: [
['orderCate', 'orderCate'], // TODO
['shapeCode', 'shapeCode'],
['orderQty', 'qty'],
]
},
{
forceDisabled: true,
label: "子号",
prop: "orderCate",
elparams: { placeholder: "无" },
},
{
forceDisabled: true,
label: "砖型",
prop: "shapeCode",
elparams: { placeholder: "无" },
},
{
forceDisabled: true,
label: "订单砖数",
prop: "orderQty",
elparams: { placeholder: "无" },
},
],
[
{
input: true,
label: "抽检数量",
prop: "orderQty",
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: "checkPerson",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入检测人" },
},
{
datetime: true,
label: "检测时间",
prop: "checkTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择检测时间", type: 'datetime' },
},
],
[
{
textarea: true,
label: "描述",
prop: "explainText",
elparams: { placeholder: "请输入描述" },
}
]
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", 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/qualityInspectionRecord",
page: "/pms/qualityInspectionRecord/pageView",
pageIsPostApi: true,
// subase: "/pms/equipmentTechParam",
},
};
}