2024-3-1 基础信息BOM+产品+工厂 展示优化

master
A0010407 9 months ago
parent 3972b80908
commit 69c61233e8

@ -138,7 +138,7 @@
/>
<el-table-column
label="产品名称"
align="center"
align="left"
prop="productDescZh"
width="350"
/>
@ -150,7 +150,7 @@
/>
<el-table-column
label="组件名称"
align="center"
align="left"
prop="componentDescZh"
width="350"
/>
@ -419,7 +419,7 @@ export default {
component: null,
productCode: null,
bomHierarchy: null,
handle:null,
handle: null,
factoryCode: null,
productionVersion: null,
bomCode: null,
@ -581,32 +581,32 @@ export default {
},
load(tree, treeNode, resolve) {
console.log("treeNode:",treeNode);
console.log("tree:",tree);
console.log("resolve:",resolve);
console.log("treeNode:", treeNode);
console.log("tree:", tree);
console.log("resolve:", resolve);
this.queryParams.pageNum = null;
this.queryParams.pageSize = null;
if(tree.bomHierarchy == " " || tree.bomHierarchy == null){
if (tree.bomHierarchy == " " || tree.bomHierarchy == null) {
this.queryParams.bomHierarchy = "1";
this.queryParams.cumc = tree.cumc;
this.queryParams.component = tree.component;
this.queryParams.bomCode = tree.bomCode;
}else if(tree.bomHierarchy == "1"){
} else if (tree.bomHierarchy == "1") {
this.queryParams.bomHierarchy = "2";
this.queryParams.component = tree.component;
this.queryParams.bomCode = tree.bomCode;
}else if(tree.bomHierarchy == "2"){
} else if (tree.bomHierarchy == "2") {
this.queryParams.bomHierarchy = "3";
this.queryParams.component = tree.component;
this.queryParams.bomCode = tree.bomCode;
}else if(tree.bomHierarchy == "3"){
} else if (tree.bomHierarchy == "3") {
this.queryParams.bomHierarchy = "4";
this.queryParams.component = tree.component;
this.queryParams.bomCode = tree.bomCode;
}
listBom(this.queryParams).then(response => {
resolve(response.rows)
})
listBom(this.queryParams).then((response) => {
resolve(response.rows);
});
this.queryParams.bomCode = null;
},
},

@ -1,126 +1,171 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="组织名称" prop="factoryName">
<el-input
v-model="queryParams.factoryName"
placeholder="请输入组织名称"
clearable
@keyup.enter.native="handleQuery"
/>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="组织名称" prop="factoryName">
<el-input
v-model="queryParams.factoryName"
placeholder="请输入组织名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="组织编码" prop="factoryCode">
<el-input
v-model="queryParams.factoryCode"
placeholder="请输入组织编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-form-item label="组织编码" prop="factoryCode">
<el-input
v-model="queryParams.factoryCode"
placeholder="请输入组织编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择启用状态"
@change="$forceUpdate()"
clearable
style="width:205px"
@keyup.enter.native="handleQuery">
<el-option v-for="item in options" :key="item.status" :label="item.label" :value="item.status"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
style="width: 205px"
@keyup.enter.native="handleQuery"
>
<el-option
v-for="item in options"
:key="item.status"
:label="item.label"
:value="item.status"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['wms:factory:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['wms:factory:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="factoryList"
row-key="factoryId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="组织名称" align="center" prop="factoryName" width="350"/>
<el-table-column label="组织编码" align="center" prop="factoryCode" />
<el-table-column prop="ftype" label="工厂建模类型" width="100" align="center">
<el-table
v-if="refreshTable"
v-loading="loading"
:data="factoryList"
row-key="factoryId"
:default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column
label="组织名称"
align="left"
prop="factoryName"
width="350"
/>
<el-table-column label="组织编码" align="center" prop="factoryCode" />
<el-table-column
prop="ftype"
label="工厂建模类型"
width="100"
align="center"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.f_type"
:value="scope.row.ftype"
/>
<dict-tag :options="dict.type.f_type" :value="scope.row.ftype" />
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column prop="status" label="是否启用" align="center" >
<template slot-scope="scope">
{{ scope.row.status == 1 ? "启用" : "停用" }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['wms:factory:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['wms:factory:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wms:factory:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column prop="status" label="是否启用" align="center">
<template slot-scope="scope">
{{ scope.row.status == 1 ? "启用" : "停用" }}
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['wms:factory:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['wms:factory:add']"
>新增</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wms:factory:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改工厂模型对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="父组织名" prop="parentId" style="width:350px">
<treeselect v-model="form.parentId" :options="factoryOptions" :normalizer="normalizer" placeholder="请选择父组织id" />
</el-form-item>
<el-form-item label="组织名称" prop="factoryName" style="width:350px">
<el-input v-model="form.factoryName" placeholder="请输入组织名称" />
</el-form-item>
<el-form-item label="组织编码" prop="factoryCode" style="width:350px">
<el-input v-model="form.factoryCode" placeholder="请输入组织编码" />
</el-form-item>
<!-- 添加或修改工厂模型对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="父组织名" prop="parentId" style="width: 350px">
<treeselect
v-model="form.parentId"
:options="factoryOptions"
:normalizer="normalizer"
placeholder="请选择父组织id"
/>
</el-form-item>
<el-form-item label="组织名称" prop="factoryName" style="width: 350px">
<el-input v-model="form.factoryName" placeholder="请输入组织名称" />
</el-form-item>
<el-form-item label="组织编码" prop="factoryCode" style="width: 350px">
<el-input v-model="form.factoryCode" placeholder="请输入组织编码" />
</el-form-item>
<el-form-item label="工厂建模分类" prop="ftype">
<el-select
v-model="form.ftype"
@ -130,228 +175,254 @@
>
<el-option
v-for="dict in dict.type.f_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="负责人" prop="leader" style="width:350px">
<el-input v-model="form.leader" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="联系电话" prop="phone" style="width:350px">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="邮箱" prop="email" style="width:350px">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>
<el-form-item label="是否启用" prop="status" >
<el-select v-model="form.status" placeholder="请选择是否启用" @change="$forceUpdate()" clearable style="width:230px">
<el-option v-for="item in options" :key="item.status" :label="item.label" :value="item.status"></el-option>
<el-form-item label="负责人" prop="leader" style="width: 350px">
<el-input v-model="form.leader" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="联系电话" prop="phone" style="width: 350px">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="邮箱" prop="email" style="width: 350px">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>
<el-form-item label="是否启用" prop="status">
<el-select
v-model="form.status"
placeholder="请选择是否启用"
@change="$forceUpdate()"
clearable
style="width: 230px"
>
<el-option
v-for="item in options"
:key="item.status"
:label="item.label"
:value="item.status"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFactory, getFactory, delFactory, addFactory, updateFactory } from "@/api/wms/factory";
import {
listFactory,
getFactory,
delFactory,
addFactory,
updateFactory,
} from "@/api/wms/factory";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Factory",
dicts: [
"f_type",
],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
factoryList: [],
//
factoryOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
parentId: null,
ancestors: null,
factoryName: null,
orderNum: null,
leader: null,
phone: null,
email: null,
status: null,
},
options: [{
status: "1",
label: '启用'
}, {
status: "0",
label: '停用'
}],
//
form: {},
//
rules: {
factoryCode: [
{ required: true, message: "组织编码不能为空", trigger: "blur" }
],
factoryName: [
{ required: true, message: "组织名称不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "组织状态不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询工厂模型列表 */
getList() {
this.loading = true;
listFactory(this.queryParams).then(response => {
this.factoryList = this.handleTree(response.data, "factoryId", "parentId");
this.loading = false;
});
},
/** 转换工厂模型数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.factoryId,
label: node.factoryName,
children: node.children
};
},
/** 查询工厂模型下拉树结构 */
getTreeselect() {
listFactory().then(response => {
this.factoryOptions = [];
const data = { factoryId: 0, factoryName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "factoryId", "parentId");
this.factoryOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
factoryId: null,
parentId: null,
ancestors: null,
factoryName: null,
orderNum: null,
leader: null,
phone: null,
email: null,
status: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.factoryId) {
this.form.parentId = row.factoryId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加工厂模型";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.factoryId;
}
getFactory(row.factoryId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工厂模型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.factoryId != null) {
updateFactory(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFactory(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除工厂模型编号为"' + row.factoryId + '"的数据项?').then(function() {
return delFactory(row.factoryId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
name: "Factory",
dicts: ["f_type"],
components: {
Treeselect,
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
factoryList: [],
//
factoryOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
parentId: null,
ancestors: null,
factoryName: null,
orderNum: null,
leader: null,
phone: null,
email: null,
status: null,
},
options: [
{
status: "1",
label: "启用",
},
{
status: "0",
label: "停用",
},
],
//
form: {},
//
rules: {
factoryCode: [
{ required: true, message: "组织编码不能为空", trigger: "blur" },
],
factoryName: [
{ required: true, message: "组织名称不能为空", trigger: "blur" },
],
status: [
{ required: true, message: "组织状态不能为空", trigger: "blur" },
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询工厂模型列表 */
getList() {
this.loading = true;
listFactory(this.queryParams).then((response) => {
this.factoryList = this.handleTree(
response.data,
"factoryId",
"parentId"
);
this.loading = false;
});
},
/** 转换工厂模型数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.factoryId,
label: node.factoryName,
children: node.children,
};
},
/** 查询工厂模型下拉树结构 */
getTreeselect() {
listFactory().then((response) => {
this.factoryOptions = [];
const data = { factoryId: 0, factoryName: "顶级节点", children: [] };
data.children = this.handleTree(response.data, "factoryId", "parentId");
this.factoryOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
factoryId: null,
parentId: null,
ancestors: null,
factoryName: null,
orderNum: null,
leader: null,
phone: null,
email: null,
status: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.factoryId) {
this.form.parentId = row.factoryId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加工厂模型";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.factoryId;
}
getFactory(row.factoryId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改工厂模型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.factoryId != null) {
updateFactory(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFactory(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除工厂模型编号为"' + row.factoryId + '"的数据项?')
.then(function () {
return delFactory(row.factoryId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save