|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<el-container class="is-vertical">
|
|
<el-container class="is-vertical">
|
|
|
- <sc-page-header v-if="!hidePageHeader" @add="table_add"></sc-page-header>
|
|
|
|
|
|
|
+ <sc-page-header v-if="!selectable" @add="table_add"></sc-page-header>
|
|
|
|
|
|
|
|
<scTable ref="xGridTable" :apiObj="$API.basic.material" :formConfig="formConfig" :paramsColums="paramsColums" :toolbarConfig="toolbarConfig" :columns="columns" v-bind="options">
|
|
<scTable ref="xGridTable" :apiObj="$API.basic.material" :formConfig="formConfig" :paramsColums="paramsColums" :toolbarConfig="toolbarConfig" :columns="columns" v-bind="options">
|
|
|
<template #action="{ row }">
|
|
<template #action="{ row }">
|
|
@@ -34,10 +34,10 @@ import { mapFormItemInput, mapFormItemSelect } from "@/components/scTable/helper
|
|
|
import materialDetail from "./detail";
|
|
import materialDetail from "./detail";
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
- options: { type: Object, default: () => {} },
|
|
|
|
|
- hidePageHeader: { type: Boolean, default: false },
|
|
|
|
|
- hideHandler: { type: Boolean, default: false },
|
|
|
|
|
- hideCheckbox: { type: Boolean, default: false }
|
|
|
|
|
|
|
+ selectable: { type: Boolean, default: false },
|
|
|
|
|
+ multiple: { type: Boolean, default: false },
|
|
|
|
|
+ paramsColums: { type: Array, default: () => [] },
|
|
|
|
|
+ options: { type: Object, default: () => ({}) }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const toolbarConfig = reactive({
|
|
const toolbarConfig = reactive({
|
|
@@ -54,13 +54,16 @@ const selectConfig = reactive({
|
|
|
|
|
|
|
|
const formConfig = reactive({
|
|
const formConfig = reactive({
|
|
|
data: {},
|
|
data: {},
|
|
|
- items: [
|
|
|
|
|
|
|
+ items: computed(() => props.selectable ? [
|
|
|
|
|
+ mapFormItemInput("nameLike", "物料名称"),
|
|
|
|
|
+ mapFormItemInput("codeLike", "物料编码")
|
|
|
|
|
+ ]: [
|
|
|
mapFormItemInput("nameLike", "物料名称"),
|
|
mapFormItemInput("nameLike", "物料名称"),
|
|
|
mapFormItemInput("codeLike", "物料编码"),
|
|
mapFormItemInput("codeLike", "物料编码"),
|
|
|
mapFormItemSelect("materialType", "物料类型", selectConfig),
|
|
mapFormItemSelect("materialType", "物料类型", selectConfig),
|
|
|
mapFormItemSelect("status", "物料状态", { ...selectConfig, options: objectToArray(statusDic) }),
|
|
mapFormItemSelect("status", "物料状态", { ...selectConfig, options: objectToArray(statusDic) }),
|
|
|
mapFormItemSelect("needType", "需求类型", { ...selectConfig, options: objectToArray(materialDic.needType) })
|
|
mapFormItemSelect("needType", "需求类型", { ...selectConfig, options: objectToArray(materialDic.needType) })
|
|
|
- ]
|
|
|
|
|
|
|
+ ])
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const paramsColums = reactive([
|
|
const paramsColums = reactive([
|
|
@@ -70,15 +73,24 @@ const paramsColums = reactive([
|
|
|
{ column: "materialType" },
|
|
{ column: "materialType" },
|
|
|
{ column: "materialTypeIn" },
|
|
{ column: "materialTypeIn" },
|
|
|
{ column: "status" },
|
|
{ column: "status" },
|
|
|
- { column: "needType" }
|
|
|
|
|
|
|
+ { column: "needType" },
|
|
|
|
|
+ ...props.paramsColums
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
-const columns = reactive([
|
|
|
|
|
- { visible: props.hideHandler, type: props.hideCheckbox && "radio" || "checkbox", fixed: "left", width: 40 },
|
|
|
|
|
- { visible: !props.hideHandler, type: "seq", fixed: "left", width: 60 },
|
|
|
|
|
|
|
+const columns = computed(() => props.selectable ? [
|
|
|
|
|
+ { type: props.multiple && "checkbox" || "radio", fixed: "left", width: 40 },
|
|
|
|
|
+ { type: "html", field: "name", title: "物料名称", fixed: "left", minWidth: 150, sortable: true },
|
|
|
|
|
+ { type: "html", field: "code", title: "物料编码", fixed: "left", minWidth: 150, sortable: true },
|
|
|
|
|
+ { type: "html", field: "materialType", title: "物料类型", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.type, cellValue, cellValue) },
|
|
|
|
|
+ { type: "html", field: "needType", title: "物料来源", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.needType, cellValue, cellValue) },
|
|
|
|
|
+ { type: "html", field: "specification", title: "规格型号", minWidth: 120, sortable: true },
|
|
|
|
|
+ { type: "html", field: "unit", title: "单位", minWidth: 100, sortable: true },
|
|
|
|
|
+ { visible: false, type: "html", field: "price", title: "标准售价", minWidth: 100, sortable: true }
|
|
|
|
|
+]: [
|
|
|
|
|
+ { type: "seq", fixed: "left", width: 60 },
|
|
|
{ type: "html", field: "name", title: "物料名称", fixed: "left", minWidth: 150, sortable: true },
|
|
{ type: "html", field: "name", title: "物料名称", fixed: "left", minWidth: 150, sortable: true },
|
|
|
{ type: "html", field: "code", title: "物料编码", fixed: "left", minWidth: 150, sortable: true },
|
|
{ type: "html", field: "code", title: "物料编码", fixed: "left", minWidth: 150, sortable: true },
|
|
|
- { visible: !props.hideHandler, field: "status", title: "物料状态", minWidth: 100, editRender: { name: "$cell-tag", options: statusDic } },
|
|
|
|
|
|
|
+ { field: "status", title: "物料状态", minWidth: 100, editRender: { name: "$cell-tag", options: statusDic } },
|
|
|
{ type: "html", field: "materialType", title: "物料类型", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.type, cellValue, cellValue) },
|
|
{ type: "html", field: "materialType", title: "物料类型", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.type, cellValue, cellValue) },
|
|
|
{ type: "html", field: "needType", title: "物料来源", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.needType, cellValue, cellValue) },
|
|
{ type: "html", field: "needType", title: "物料来源", minWidth: 120, sortable: true, formatter: ({ cellValue }) => XEUtils.get(materialDic.needType, cellValue, cellValue) },
|
|
|
{ type: "html", field: "specification", title: "规格型号", minWidth: 120, sortable: true },
|
|
{ type: "html", field: "specification", title: "规格型号", minWidth: 120, sortable: true },
|
|
@@ -86,15 +98,12 @@ const columns = reactive([
|
|
|
{ visible: false, type: "html", field: "price", title: "标准售价", minWidth: 100, sortable: true },
|
|
{ visible: false, type: "html", field: "price", title: "标准售价", minWidth: 100, sortable: true },
|
|
|
{ type: "html", field: "createTime", title: "创建日期", minWidth: 120, sortable: true, formatter: ({ cellValue }) => TOOL.dateFormat(cellValue, "YYYY-MM-DD") || cellValue },
|
|
{ type: "html", field: "createTime", title: "创建日期", minWidth: 120, sortable: true, formatter: ({ cellValue }) => TOOL.dateFormat(cellValue, "YYYY-MM-DD") || cellValue },
|
|
|
{ visible: false, type: "html", field: "remark", title: "备注", minWidth: 300, sortable: true },
|
|
{ visible: false, type: "html", field: "remark", title: "备注", minWidth: 300, sortable: true },
|
|
|
- { visible: !props.hideHandler, title: "操作", fixed: "right", width: 220, slots: { default: "action" } }
|
|
|
|
|
|
|
+ { title: "操作", fixed: "right", width: 220, slots: { default: "action" } }
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
// 显示隐藏 筛选表单
|
|
// 显示隐藏 筛选表单
|
|
|
const xGridTable = ref();
|
|
const xGridTable = ref();
|
|
|
-const refreshTable = (mode = "add") => {
|
|
|
|
|
- xGridTable.value.reloadColumn(columns);
|
|
|
|
|
- xGridTable.value.searchData(mode);
|
|
|
|
|
-}
|
|
|
|
|
|
|
+const refreshTable = (mode = "add") => xGridTable.value.searchData(mode);
|
|
|
|
|
|
|
|
const materialRef = ref();
|
|
const materialRef = ref();
|
|
|
const dialog = ref(false);
|
|
const dialog = ref(false);
|