This commit is contained in:
lb 2023-02-20 11:25:32 +08:00
parent 20806b355d
commit 7d0c66ad73
6 changed files with 287 additions and 4 deletions

View File

@ -38,8 +38,9 @@
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
// 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.21:8080/pms-am'; // xv
</script>
<% } %>
<!-- 集成测试环境 -->

View File

@ -14,8 +14,9 @@
</div>
<div class="dialog-body__inner relative">
<!-- v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu) && $hasPermission()" -->
<el-button
v-if="dataForm.id && !detailMode && /属性/.test(activeMenu)"
v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu)"
plain
type="primary"
size="small"

View File

@ -83,6 +83,19 @@ export default {
row.forEach((col) => {
dataForm[col.prop] = col.default ?? "";
console.log("[small dialog]==========>", col.prop, dataForm[col.prop]);
if (typeof col.fetchData === "function")
col.fetchData().then(({ data: res }) => {
if (res.code === 0) {
this.$set(
col,
"options",
res.data.list.map((item) => ({ label: item.name, value: item.id }))
);
} else {
this.$set(col, "options", []);
}
});
});
});

View File

@ -101,7 +101,7 @@ export default {
size: 20, // 20
dataList: [],
tableLoading: false,
refreshLayoutKey: null
refreshLayoutKey: null,
};
},
inject: ["urls"],
@ -213,6 +213,12 @@ export default {
this.$http.put(this.urls.base, queryCondition).then(({ data: res }) => {
if (res.code === 0) {
// do nothing
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: 'error',
duration: 1500
})
}
});
break;
@ -230,7 +236,16 @@ export default {
this.openDialog();
break;
case "查询": {
this.getList(payload);
const params = {};
this.listQueryExtra?.map(cond => {
if (!!payload[cond]) {
params[cond] = payload[cond]
} else {
params[cond] = ''
}
});
console.log("查询", params);
this.getList(params);
break;
}
}

View File

@ -0,0 +1,221 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
import { timeFilter, dictFilter } from "@/utils/filters";
import switchBtn from "@/components/noTemplateComponents/switchBtn";
export default function () {
const tableProps = [
{ type: "index", label: "序号" },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "name", label: "牌号" },
{ prop: "code", label: "配方编码" },
{ prop: "externalCode", label: "版本号" },
// { prop: "specifications", label: "程序号" },
// { prop: "unitDictValue", label: "砖型", filter: dictFilter("unit") },
// { prop: "unitDictValue", label: "物料号", filter: dictFilter("unit") },
{ prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent
{ prop: "sumqty", label: "配方总重量" },
{ prop: "sync", label: "同步状态" },
{ prop: "remark", label: "备注" },
{ prop: "description", label: "详情", subcomponent: TableTextComponent, buttonContent: "查看配方详情", actionName: 'view-recipe' },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: ["edit", { name: "delete", emitFull: true, permission: "pms:bom:delete" }],
},
];
const headFormFields = [
{
label: "关键字",
prop: "key",
input: true,
default: { value: "" },
bind: { placeholder: "请输入关键字" },
},
{
button: {
type: "primary",
name: "查询",
},
},
{
button: {
type: "plain",
name: "新增",
permission: "pms:bom:save",
},
},
];
const dictList = JSON.parse(localStorage.getItem("dictList") || {});
const dialogConfigs = {
menu: [
{ name: "配方", key: "info" },
{ name: "配方详情", key: "attr", onlyEditMode: true },
// {
// name: "附件",
// key: "attachment",
// onlyEditMode: true,
// actionUrl: window.SITE_CONFIG["apiURL"] + "/pms/attachment/uploadFileFormData?typeCode=ProductAttachment",
// },
],
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: "请输入物料编码" },
},
// { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } },
// {
// select: true,
// label: "产品类型",
// prop: "typeDictValue",
// options: "product_type" in dictList ? dictList["product_type"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// elparams: { placeholder: "选择一个产品类型" },
// },
],
[
// { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } },
// {
// select: true,
// label: "单位",
// prop: "unitDictValue",
// options: "unit" in dictList ? dictList["unit"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
// elparams: { placeholder: "选择单位" },
// },
{
input: true,
label: "版本号",
prop: "externalCode",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入版本号" },
},
{
input: true,
label: "同步状态",
prop: "sync",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入同步状态" },
},
],
[{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:bom:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:bom:update", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
table: {
// extraParams: ['stepId'],
extraParams: "bomId",
props: [
{ type: "index", label: "序号" },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "material", label: "物料", isEditField: true },
{ prop: "qty", label: "配方物料重量", isEditField: true },
{ prop: "sumqty", label: "配方总重量", isEditField: true },
{ prop: "percent", label: "配比", isEditField: true },
{ prop: "remark", label: "备注", isEditField: true },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", permission: "pms:bomMaterial:update" },
{ name: "delete", emitFull: true, permission: "pms:bomMaterial:delete" },
],
},
],
data: [
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
],
},
subDialog: {
extraParam: "bomId",
forceAttachCode: true, // 产品属性新增必填 code 字段......
rows: [
[
{
select: true,
label: "物料",
prop: "materialId",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择物料", filterable: true },
options: [],
// fetchData: () => this.$http.get('/pms/material/page', { params: { limit: 999, page: 1 } })
fetchData: () => new Promise((resolve) => {
setTimeout(() => {
resolve({
data: {
code: 0,
data: {
total: 0,
list:
[
{ id: 10001, name: 'mock物料1' },
{ id: 10002, name: 'mock物料2' },
{ id: 10003, name: 'mock物料3' },
{ id: 10004, name: 'mock物料4' },
{ id: 10005, name: 'mock物料5' },
]
}
}
})
}, 800)
})
},
{
input: true,
label: "物料重量",
prop: "qty",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入物料重量" },
},
],
[{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "添加备注" } }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:bomMaterial:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:bomMaterial:update", showOnEdit: true },
],
},
};
return {
dialogConfigs,
tableConfig: {
table: null, // 此处可省略el-table 上的配置项
column: tableProps, // el-column-item 上的配置项
},
headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
},
urls: {
base: "/pms/bom",
page: "/pms/bom/page",
subase: "/pms/bomMaterial",
subpage: "/pms/bomMaterial/page",
},
};
}

View File

@ -0,0 +1,32 @@
<template>
<ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" :listQueryExtra="['key', 'externalCode']" />
</template>
<script>
import initConfig from './config';
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue';
export default {
name: 'BlenderView',
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>