Commit 0ce19e12 authored by chenzj's avatar chenzj

物料主数据页面调整

parent 7771226a
import request from '@/utils/request'
// 查询产品颜色列表
export function listFaceColor(query) {
return request({
url: '/mes/md/faceColor/list',
method: 'get',
params: query
})
}
// 查询产品颜色详细
export function getFaceColor(faceColorId) {
return request({
url: '/mes/md/faceColor/' + faceColorId,
method: 'get'
})
}
// 新增产品颜色
export function addFaceColor(data) {
return request({
url: '/mes/md/faceColor',
method: 'post',
data: data
})
}
// 修改产品颜色
export function updateFaceColor(data) {
return request({
url: '/mes/md/faceColor',
method: 'put',
data: data
})
}
// 删除产品颜色
export function delFaceColor(mdFaceColorIds) {
return request({
url: '/mes/md/faceColor/' + mdFaceColorIds,
method: 'delete'
})
}
<!--产品正反面颜色-->
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8" v-if="optType !='view'">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:faceColor:add']"
>新增</el-button>
<ColorSelect ref="colorSelect" @onSelected="onColorSelected" > </ColorSelect>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:faceColor:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="faceColorList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="排序号" align="center" prop="sortOrder" />
<el-table-column label="颜色编码" align="center" prop="colorCode">
<template slot-scope="scope">
<el-color-picker :value="scope.row.colorCode"></el-color-picker>
</template>
</el-table-column>
<el-table-column label="颜色名称" align="center" prop="colorName" />
<el-table-column label="覆盖率(单位%)" align="center" prop="coverageRate" :show-overflow-tooltip="true" />
<!-- <el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="修改人" align="center" prop="updateBy" />
<el-table-column label="修改时间" align="center" prop="updateTime" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="optType !='view'">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:faceColor:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:faceColor:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品颜色关系对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="排序号" prop="sortOrder">
<el-input v-model="form.sortOrder" type="number" placeholder="请输入排序号" />
</el-form-item>
<el-form-item label="颜色编码" prop="colorCode">
<el-input v-model="form.colorCode" readonly placeholder="请输入颜色" />
</el-form-item>
<el-form-item label="颜色名称" prop="colorName">
<el-input v-model="form.colorName" readonly placeholder="请输入颜色" />
</el-form-item>
<el-form-item label="覆盖率(单位%)" prop="coverageRate">
<el-input v-model="form.coverageRate" type="textarea" placeholder="请输入覆盖率" />
</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>
</template>
<script>
import { listFaceColor, getFaceColor, delFaceColor, addFaceColor, updateFaceColor } from "@/api/mes/md/faceColor";
import ColorSelect from "@/components/colorSelect/index.vue";
//import faceColor from "@/views/mes/md/product/components/faceColor.vue";
export default {
name: "FaceColor",
components: { ColorSelect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品BOM关系表格数据
faceColorList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
colorId: null,
mdFaceColorId: null,
colorName: null,
colorCode: null,
face: 'back',
coverageRate: null,
sortOrder: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
/*quantity: [
{ required: true, message: "物料使用比例不能为空", trigger: "blur" }
]*/
}
};
},
props: {
optType: undefined,
itemId: undefined
},
created() {
this.getList();
},
methods: {
/** 查询产品颜色关系列表 */
getList() {
this.loading = true;
listFaceColor(this.queryParams).then(response => {
this.faceColorList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
itemId: null,
colorId: null,
mdFaceColorId: null,
colorName: null,
colorCode: null,
coverageRate: null,
sortOrder: null,
face: "back",
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.mdFaceColorId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.colorSelect.showFlag = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const mdFaceColorId = row.mdFaceColorId || this.ids
getFaceColor(mdFaceColorId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品颜色";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
updateFaceColor(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const mdFaceColorIds = row.mdFaceColorId || this.ids;
this.$modal.confirm('是否确认删除产品BOM关系编号为"' + mdFaceColorIds + '"的数据项?').then(function() {
return delFaceColor(mdFaceColorIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//物料选择弹出框
onColorSelected(obj){
debugger;
this.form.itemId = this.itemId;
if(obj != undefined && obj != null){
obj.forEach(element => {
//this.form.itemId = element.itemId;
this.form.colorId = element.colorId;
this.form.colorName = element.colorName;
this.form.colorCode = element.colorCode;
this.form.face = 'back';
var retFlag = false;
const idx = this.faceColorList.findIndex(itm => itm.colorId == element.colorId)
if (idx > -1) {
this.$modal.msgError("新增颜色失败,颜色已存在");
return
}
addFaceColor(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
});
}
}
}
};
</script>
<!--客户loss信息-->
<template>
<div class="app-container">
<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="['md:loss:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['md:loss:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['md:loss:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<ClientSelect ref="ClientSelectRef" @onSelected="onClientSelect" />
<el-table
v-loading="loading"
:data="lossList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="分段数量" align="center" prop="segmentCount" />
<el-table-column
label="最大loss数量"
align="center"
prop="maxLossCount"
/>
<el-table-column label="loss比率(单位%)" width="140" align="center" prop="lossRate" />
<el-table-column label="冗余量" align="center" prop="lossRedundance" />
<el-table-column label="备注信息" align="center" prop="remark" />
<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="['md:loss:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['md:loss:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品loss配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="客户名称" prop="customerName">
<el-input
v-model="form.customerName"
placeholder="请选择客户"
disabled
>
<el-button
slot="append"
icon="el-icon-search"
@click="openClientSelect"
></el-button>
</el-input>
</el-form-item>
<el-form-item label="分段数量" prop="segmentCount">
<el-input v-model="form.segmentCount" placeholder="请输入分段数量" />
</el-form-item>
<el-form-item label="最大loss数量" prop="maxLossCount">
<el-input
v-model="form.maxLossCount"
placeholder="请输入最大loss数量"
/>
</el-form-item>
<el-form-item label="loss比率(单位%)" prop="lossRate">
<el-input
v-model="form.lossRate"
placeholder="请输入loss比率(单位%)"
/>
</el-form-item>
<el-form-item label="冗余量" prop="lossRedundance">
<el-input v-model="form.lossRedundance" placeholder="请输入冗余量" />
</el-form-item>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注信息" />
</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>
</template>
<script>
import {
listLoss,
getLoss,
delLoss,
addLoss,
updateLoss,
} from "@/api/mes/md/productLoss";
import ClientSelect from "@/components/clientSelect/single.vue";
export default {
name: "Loss",
components: {
ClientSelect,
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品loss配置表格数据
lossList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
customerId: null,
segmentCount: null,
maxLossCount: null,
lossRate: null,
lossRedundance: null,
remark: null,
},
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
props: {
optType: undefined,
itemId: undefined,
},
created() {
this.getList();
},
methods: {
/** 查询产品loss配置列表 */
getList() {
this.loading = true;
listLoss(this.queryParams).then((response) => {
this.lossList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
productLossId: null,
itemId: null,
customerId: null,
customerName: null,
segmentCount: null,
maxLossCount: null,
lossRate: null,
lossRedundance: null,
remark: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.productLossId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产品loss配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const productLossId = row.productLossId || this.ids;
getLoss(productLossId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改产品loss配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.productLossId != null) {
updateLoss(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.itemId = this.itemId;
addLoss(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
onClientSelect(row) {
if (row != undefined && row != null) {
this.form.customerId = row.clientId;
this.form.customerName = row.clientName;
}
},
openClientSelect() {
this.$refs["ClientSelectRef"].showFlag = true;
},
/** 删除按钮操作 */
handleDelete(row) {
const productLossIds = row.productLossId || this.ids;
this.$modal
.confirm(
'是否确认删除产品loss配置编号为"' + productLossIds + '"的数据项?'
)
.then(function () {
return delLoss(productLossIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"md/loss/export",
{
...this.queryParams,
},
`loss_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<!--产品正反面颜色-->
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8" v-if="optType !='view'">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:faceColor:add']"
>新增</el-button>
<ColorSelect ref="colorSelect" @onSelected="onColorSelected" > </ColorSelect>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:faceColor:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="faceColorList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="排序号" align="center" prop="sortOrder" />
<el-table-column label="颜色编码" align="center" prop="colorCode">
<template slot-scope="scope">
<el-color-picker :value="scope.row.colorCode"></el-color-picker>
</template>
</el-table-column>
<el-table-column label="颜色名称" align="center" prop="colorName" />
<el-table-column label="覆盖率(单位%)" align="center" prop="coverageRate" :show-overflow-tooltip="true" />
<!-- <el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="修改人" align="center" prop="updateBy" />
<el-table-column label="修改时间" align="center" prop="updateTime" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="optType !='view'">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:faceColor:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:faceColor:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品颜色关系对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="排序号" prop="sortOrder">
<el-input v-model="form.sortOrder" type="number" placeholder="请输入排序号" />
</el-form-item>
<el-form-item label="颜色编码" prop="colorCode">
<el-input v-model="form.colorCode" readonly placeholder="请输入颜色" />
</el-form-item>
<el-form-item label="颜色名称" prop="colorName">
<el-input v-model="form.colorName" readonly placeholder="请输入颜色" />
</el-form-item>
<el-form-item label="覆盖率(单位%)" prop="coverageRate">
<el-input v-model="form.coverageRate" type="textarea" placeholder="请输入覆盖率" />
</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>
</template>
<script>
import { listFaceColor, getFaceColor, delFaceColor, addFaceColor, updateFaceColor } from "@/api/mes/md/faceColor";
import ColorSelect from "@/components/colorSelect/index.vue";
//import faceColor from "@/views/mes/md/product/components/faceColor.vue";
export default {
name: "FaceColor",
components: { ColorSelect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品BOM关系表格数据
faceColorList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
colorId: null,
mdFaceColorId: null,
colorName: null,
colorCode: null,
face: 'front',
coverageRate: null,
sortOrder: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
/*quantity: [
{ required: true, message: "物料使用比例不能为空", trigger: "blur" }
]*/
}
};
},
props: {
optType: undefined,
itemId: undefined
},
created() {
this.getList();
},
methods: {
/** 查询产品颜色关系列表 */
getList() {
this.loading = true;
listFaceColor(this.queryParams).then(response => {
this.faceColorList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
itemId: null,
colorId: null,
mdFaceColorId: null,
colorName: null,
colorCode: null,
coverageRate: null,
sortOrder: null,
face: "front",
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.mdFaceColorId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.colorSelect.showFlag = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const mdFaceColorId = row.mdFaceColorId || this.ids
getFaceColor(mdFaceColorId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品颜色";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
updateFaceColor(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const mdFaceColorIds = row.mdFaceColorId || this.ids;
this.$modal.confirm('是否确认删除产品BOM关系编号为"' + mdFaceColorIds + '"的数据项?').then(function() {
return delFaceColor(mdFaceColorIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//物料选择弹出框
onColorSelected(obj){
this.form.itemId = this.itemId;
if(obj != undefined && obj != null){
obj.forEach(element => {
//this.form.itemId = element.itemId;
this.form.colorId = element.colorId;
this.form.colorName = element.colorName;
this.form.colorCode = element.colorCode;
this.form.face = 'front';
var retFlag = false;
const idx = this.faceColorList.findIndex(itm => itm.colorId == element.colorId)
if (idx > -1) {
this.$modal.msgError("新增颜色失败,颜色已存在");
return
}
addFaceColor(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
});
}
}
}
};
</script>
<!--工厂信息-->
<template>
<div class="app-container">
<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="['md:factory:add']"
>新增</el-button
>
<FactorySelect ref="FactorySelectRef" @onSelected="onFactorySelect" />
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['md:factory:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['md:factory:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="factoryList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="产品工厂id" align="center" prop="productFactoryId" />
<el-table-column label="产品id" align="center" prop="itemId" />-->
<!-- <el-table-column
label="工厂id"
align="center"
prop="factoryId"
width="100"
/>-->
<!-- <el-table-column
label="工厂编码"
align="center"
prop="factoryCode"
width="100"
/>-->
<el-table-column
label="工厂名称"
align="center"
prop="factoryName"
width="120"
/>
<!-- <el-table-column
label="创建人"
align="center"
prop="createBy"
width="100"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
/>
<el-table-column
label="修改人"
align="center"
prop="updateBy"
width="120"
/>
<el-table-column
label="修改时间"
align="center"
prop="updateTime"
width="180"
/>-->
<el-table-column label="操作" align="center" width="90">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['md:factory:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {
listFactory,
getFactory,
delFactory,
addFactory,
updateFactory,
} from "@/api/mes/md/productFactory";
import FactorySelect from "@/components/FactorySelect/index.vue";
export default {
name: "Factory",
components: { FactorySelect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品工厂配置表格数据
factoryList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
factoryId: null,
factoryCode: null,
factoryName: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
},
// 表单参数
form: {
factoryName: "",
factoryId: "",
factoryCode: "",
},
// 表单校验
rules: {},
};
},
props: {
optType: undefined,
itemId: {
type: Number | undefined,
default: undefined,
},
},
created() {
this.getList();
},
methods: {
/** 查询产品工厂配置列表 */
getList() {
this.loading = true;
listFactory(this.queryParams).then((response) => {
this.factoryList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
productFactoryId: null,
itemId: null,
factoryId: null,
factoryCode: null,
factoryName: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.productFactoryId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.$refs["FactorySelectRef"].showFlag = true;
},
onFactorySelect(row) {
if (row != null && row != undefined) {
this.form.factoryId = row.factoryId;
this.form.factoryName = row.factoryName;
this.form.itemId = this.itemId
const idx = this.factoryList.findIndex(itm => itm.factoryId == row.factoryId)
if (idx > -1) {
this.$modal.msgError("新增工厂失败,工厂已存在");
return
}
addFactory(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const productFactoryIds = row.productFactoryId || this.ids;
this.$modal
.confirm(
'是否确认删除产品工厂配置编号为"' + productFactoryIds + '"的数据项?'
)
.then(function () {
return delFactory(productFactoryIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"md/factory/export",
{
...this.queryParams,
},
`factory_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8" v-if="optType !='view'">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:mditem:add']"
>新增</el-button>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:mditem:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="bomList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="物料编码" align="center" prop="bomItemCode" />
<el-table-column label="物料名称" align="center" prop="bomItemName" :show-overflow-tooltip="true" />
<el-table-column label="规格" align="center" prop="bomItemSpec" :show-overflow-tooltip="true" />
<el-table-column label="单位" width="60px" align="center" prop="unitOfMeasure" />
<el-table-column label="使用比例" width="90px" align="center" prop="quantity" />
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="optType !='view'">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:mditem:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:mditem:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品BOM关系对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="BOM物料编码" prop="bomItemCode">
<el-input v-model="form.bomItemCode" readonly placeholder="请输入BOM物料编码" />
</el-form-item>
<el-form-item label="BOM物料名称" prop="bomItemName">
<el-input v-model="form.bomItemName" readonly placeholder="请输入BOM物料名称" />
</el-form-item>
<el-form-item label="BOM物料规格" prop="bomItemSpec">
<el-input v-model="form.bomItemSpec" readonly type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="BOM物料单位" prop="unitOfMeasure">
<el-input v-model="form.unitOfMeasure" readonly placeholder="请输入BOM物料单位" />
</el-form-item>
<el-form-item label="物料使用比例" prop="quantity">
<el-input-number :precision="4" :step="0.1" :min="0" v-model="form.quantity" placeholder="请输入物料使用比例" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</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>
</template>
<script>
import { listBom, getBom, delBom, addBom, updateBom } from "@/api/mes/md/bom";
import ItemSelect from "@/components/itemSelect/index.vue";
export default {
name: "Bom",
components: { ItemSelect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品BOM关系表格数据
bomList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
bomItemId: null,
bomItemCode: null,
bomItemName: null,
bomItemSpec: null,
unitOfMeasure: null,
quantity: null,
enableFlag: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
quantity: [
{ required: true, message: "物料使用比例不能为空", trigger: "blur" }
]
}
};
},
props: {
optType: undefined,
itemId: undefined
},
created() {
this.getList();
},
methods: {
/** 查询产品BOM关系列表 */
getList() {
this.loading = true;
listBom(this.queryParams).then(response => {
this.bomList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
bomId: null,
itemId: null,
bomItemId: null,
bomItemCode: null,
bomItemName: null,
bomItemSpec: null,
unitOfMeasure: null,
itemOrProduct: null,
quantity: null,
enableFlag: 'Y',
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.bomId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.itemSelect.showFlag = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const bomId = row.bomId || this.ids
getBom(bomId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品BOM关系";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
updateBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const bomIds = row.bomId || this.ids;
this.$modal.confirm('是否确认删除产品BOM关系编号为"' + bomIds + '"的数据项?').then(function() {
return delBom(bomIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//物料选择弹出框
onItemSelected(obj){
debugger;
this.form.itemId = this.itemId;
if(obj != undefined && obj != null){
obj.forEach(element => {
this.form.bomItemId = element.itemId;
this.form.bomItemCode = element.itemCode;
this.form.bomItemName = element.itemName;
this.form.bomItemSpec = element.specification;
this.form.unitOfMeasure = element.unitOfMeasure;
this.form.itemOrProduct = element.itemOrProduct;
this.form.quantity = 1;
this.form.enableFlag = 'Y';
var retFlag = false;
addBom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
});
}
}
}
};
</script>
<!--排版参数-->
<!--产品外观-->
<template>
<div class="app-container">
<!-- 添加或修改产品外观对话框 -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="模数" prop="modulus">
<el-input v-model="form.modulus" type="number" :precision="2" placeholder="请输入模数" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行数" prop="rowNum">
<el-input v-model="form.rowNum" type="number" :precision="2" placeholder="请输入行数" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="列数" prop="columnNum">
<el-input v-model="form.columnNum" type="number" :precision="2" placeholder="请输入列数" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="搭版数" prop="contactNum">
<el-input v-model="form.contactNum" type="number" :precision="2" placeholder="请输入搭版数" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行双刀位(mm)" prop="rowDoubleBlade">
<el-input v-model="form.rowDoubleBlade" type="number" :precision="2" placeholder="请输入行双刀位(单位mm)" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="列双刀位(mm)" prop="columnDoubleBlade">
<el-input v-model="form.columnDoubleBlade" type="number" :precision="2" placeholder="请输入列双刀位(单位mm)" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="派工倍数" prop="dispatchMultiple">
<el-input v-model="form.dispatchMultiple" type="number" :precision="2" placeholder="请输入派工倍数" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="印张长度(cm)" prop="sheetLength">
<el-input v-model="form.sheetLength" type="number" :precision="2" placeholder="请输入印张长度(单位cm)"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="印张宽度(cm)" prop="sheetWidth">
<el-input v-model="form.sheetWidth" type="number" :precision="2" placeholder="请输入印张宽度(单位cm)" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import {getConf } from "@/api/mes/md/publishedConf";
export default {
name: "Conf",
dicts: ['sys_yes_no','product_shape'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId
},
// 表单参数
form: {
modulus: '',
rowNum: '',
columnNum: '',
contactNum: '',
rowDoubleBlade: '',
columnDoubleBlade: '',
dispatchMultiple: '',
sheetLength: '',
sheetWidth: '',
createBy: '',
createTime: '',
updateBy: '',
updateTime: ''
},
// 表单校验
rules: {
}
};
},
props: {
optType: undefined,
itemId: undefined
},
created() {
this.getPublishedConf();
},
methods: {
//获取产品参数配置表单数据
async getPublishedConfData(){
await this.submitForm()
return this.form
},
//回显参数配置数据
getPublishedConf(){
getConf(this.itemId).then(res=>{
Object.assign(this.form,res.data)
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
itemId: this.itemId,
modulus: null,
rowNum: null,
columnNum: null,
contactNum: null,
rowDoubleBlade: null,
columnDoubleBlade: null,
dispatchMultiple: null,
sheetLength: null,
sheetWidth: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 提交按钮 */
async submitForm() {
return await this.$refs["form"].validate();
},
}
};
</script>
<!--采购信息-->
<template>
<div class="app-container">
<!-- 添加或修改销售单位转换对话框 -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="销售单位" label-width="100px" prop="saleUnit">
<el-input v-model="form.saleUnit" placeholder="请输入销售单位" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销售换算值" label-width="100px" prop="saleConversionValue">
<el-input v-model="form.saleConversionValue" type="number" :precision="2" placeholder="请输入销售换算值" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import { getUnit } from "@/api/mes/md/saleUnit";
export default {
name: "Unit",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 销售单位转换表格数据
unitList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
saleUnit: null,
saleConversionValue: null
},
// 表单参数
form: {
itemId: '',
saleUnit: '',
saleConversionValue: ''
},
// 表单校验
rules: {
itemId: [
{ required: true, message: "产品ID不能为空", trigger: "blur" }
], }
};
},
props: {
optType: undefined,
itemId: {
type: Number | undefined,
default: undefined,
},
},
created() {
this.getSaleUnit();
},
methods: {
//获取基本信息表单数据
async getSaleUnitFormData() {
await this.submitForm();
return this.form;
},
getSaleUnit() {
getUnit(this.itemId).then((res) => {
Object.assign(this.form, res.data);
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
itemId: this.itemId,
saleUnit: null,
saleConversionValue: null
};
this.resetForm("form");
},
/** 提交按钮 */
async submitForm() {
return await this.$refs["form"].validate();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
}
};
</script>
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
<UnitmeasureSelect ref="unitmeasureSelect" @onSelected="onUnitmeasureSelect" > </UnitmeasureSelect>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="销售单位编码" align="center" prop="unitCode" />
<el-table-column label="销售单位名称" align="center" prop="unitName" />
<el-table-column label="销售换算值" align="center" prop="saleConversionValue" />
<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)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改销售单位转换对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="销售单位编码" label-width="100px" prop="unitCode">
<el-input v-model="form.unitCode" readonly placeholder="请输入销售单位" />
</el-form-item>
<el-form-item label="销售单位名称" label-width="100px" prop="unitName">
<el-input v-model="form.unitName" readonly placeholder="请输入销售单位" />
</el-form-item>
<el-form-item label="销售换算值" label-width="100px" prop="saleConversionValue">
<el-input v-model="form.saleConversionValue" placeholder="请输入销售换算值" />
</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>
</template>
<script>
import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/mes/md/unit";
import UnitmeasureSelect from "@/components/unitmeasureSelect/index.vue";
export default {
name: "Unit",
components: {UnitmeasureSelect},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 销售单位转换表格数据
unitList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: this.itemId,
unitId: null,
saleConversionValue: null,
unitCode: null,
unitName: null
},
// 表单参数
form: {},
// 表单校验
rules: {
itemId: [
{ required: true, message: "产品ID不能为空", trigger: "blur" }
], }
};
},
props: {
optType: undefined,
itemId: undefined
},
created() {
this.getList();
},
methods: {
/** 查询销售单位转换列表 */
getList() {
this.loading = true;
listUnit(this.queryParams).then(response => {
this.unitList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
itemId: null,
unitId: null,
saleConversionValue: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null ,
unitCode: null,
unitName: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.unitmeasureSelect.showFlag = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getUnit(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改销售单位转换";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateUnit(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addUnit(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除销售单位转换编号为"' + ids + '"的数据项?').then(function() {
return delUnit(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('md/unit/export', {
...this.queryParams
}, `unit_${new Date().getTime()}.xlsx`)
},
//计量单位选择弹出框
onUnitmeasureSelect(obj){
this.form.itemId = this.itemId;
if(obj != undefined && obj != null){
obj.forEach(element => {
this.form.unitId = element.measureId;
this.form.unitName = element.measureName;
this.form.unitCode = element.measureCode;
const idx = this.unitList.findIndex(itm => itm.unitId == element.measureId)
if (idx > -1) {
this.$modal.msgError("新增单位失败,单位已存在");
return
}
addUnit(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
});
}
}
}
};
</script>
<template>
<div class="app-container">
<el-row v-if="optType != 'view'" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
</el-row>
<div class="header">
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="标题" prop="sopTitle">
<el-input v-model="form.sopTitle" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item label="展示顺序">
<el-input-number :min="1" v-model="form.orderNum"></el-input-number>
</el-form-item>
<el-form-item label="内容说明">
<el-input type="textarea" v-model="form.sopDescription" placeholder="请输入说明信息"></el-input>
</el-form-item>
<!-- <el-form-item label="所属工序" prop="processId">
<el-select v-model="form.processId" placeholder="请选择工序">
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processId"
></el-option>
</el-select>
</el-form-item>-->
<el-form-item label="图片">
<ImageUpload :limit="1" :value="form.sopUrl" :fileSize="5" @onUploaded="handleImgUplaoded" @onRemoved="handleImgRemoved" ></ImageUpload>
</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>
<div class="images">
<div v-for="(item,index) in sopList" :key="index" class="image-middle">
<el-card shadow="hover" :body-style="{pading: '10px'}">
<el-popover>
<img :src="sopList[index].sopUrl" slot="reference" class="image"/>
<el-image class="imagePreview" :src="sopList[index].sopUrl" :preview-src-list="imageList"></el-image>
</el-popover>
<div style="text-align:center;padding-top:12px">
<span>
{{sopList[index].sopTitle}}
</span>
<el-button @click="handleUpdate(sopList[index])" type="primary" icon="el-icon-edit"></el-button>
<el-button @click="handleDelete(sopList[index])" type="danger" icon="el-icon-delete"></el-button>
</div>
</el-card>
</div>
</div>
</div>
</template>
<script>
import { listSop, getSop, delSop, addSop, updateSop } from "@/api/mes/md/sop";
import ImageUpload from "@/components/ImageUpload/index.vue"
import {listAllProcess} from "@/api/mes/pro/process";
export default{
name: "SOPTab",
components: {ImageUpload},
props:{
itemId: null,
optType: null,
},
data(){
return {
title: "新增SOP信息",
loading: true,
open: false,
// 表单参数
form: {},
// 表单校验
rules: {
itemId: [
{ required: true, message: "物料产品ID不能为空", trigger: "blur" }
],
},
// 产品SOP表格数据
sopList: [],
//用于图片预览的清单
imageList: [],
//工序选项
processOptions:[],
queryParams: {
itemId: this.itemId
}
}
},
created(){
this.getList();
this.getProcess();
},
methods: {
//获取当前产品的SOP资料清单
getList(){
listSop(this.queryParams).then(response =>{
debugger;
this.imageList = [];
this.sopList = response.rows;
this.sopList.forEach(row => {
this.imageList.push(row.sopUrl);
});
});
},
//查询工序信息
getProcess(){
listAllProcess().then( response =>{
this.processOptions = response.data;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
sopId: null,
itemId: this.itemId,
orderNum: null,
processId: null,
processCode: null,
processName: null,
sopTitle: null,
sopDescription: null,
sopUrl: null
};
this.resetForm("form");
},
/**
* 新增操作
*/
handleAdd(){
this.reset();
this.open = true;
this.title = "添加产品SOP";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const sopId = row.sopId || this.ids
getSop(sopId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品SOP";
});
},
//图片上传成功
handleImgUplaoded(imgUrl){
console.log(imgUrl);
this.form.sopUrl = imgUrl;
},
//图片移除
handleImgRemoved(imgUrl){
console.log(imgUrl);
this.form.sopUrl = null;
},
//提交
submitForm(){
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.sopId != null) {
updateSop(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSop(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const sopIds = row.sopId || this.ids;
this.$modal.confirm('是否确认删除产品SOP编号为"' + sopIds + '"的数据项?').then(function() {
return delSop(sopIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
}
</script>
<style scoped>
.header {
margin-left: 15px;
font-size: 30px;
font-weight: 600;
}
.images {
display: flex;
margin-top: 20px;
margin-left: 21px;
margin-right: 20px;
flex-wrap: wrap;
}
.image-middle{
margin-right: 15px;
margin-bottom: 15px;
}
.image{
width:110px;
height: 110px;
}
.imagePreview {
width: 600px;
height: 500px;
}
</style>
<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="spec" label-width="7em">
<el-input
v-model="queryParams.spec"
placeholder="请输入产品特性名称"
clearable
@keyup.enter.native="handleQuery"
/>
</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"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="specList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品特性名称" align="center" prop="spec" />
<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)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品特性名称对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产品特性名称" prop="spec" label-width="120px">
<el-input v-model="form.spec" placeholder="请输入产品特性名称" />
</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>
</template>
<script>
import {
listSpec,
getSpec,
delSpec,
addSpec,
updateSpec,
} from "@/api/mes/md/spec";
export default {
name: "Spec",
props: {
itemId: { type: Number, default: "" },
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品特性名称表格数据
specList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: "",
spec: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
spec: [
{
required: true,
message: "产品特性名称不能为空!",
trigger: "blur",
},
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询产品特性名称列表 */
getList() {
this.loading = true;
this.queryParams.itemId = this.itemId;
listSpec(this.queryParams).then((response) => {
this.specList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
itemSpecId: null,
itemId: this.itemId,
spec: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.itemSpecId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产品特性名称";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const itemSpecId = row.itemSpecId || this.ids;
getSpec(itemSpecId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改产品特性名称";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.itemSpecId != null) {
updateSpec(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.itemId = this.itemId;
addSpec(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const itemSpecIds = row.itemSpecId || this.ids;
this.$modal
.confirm("是否确认删除?")
.then(function () {
return delSpec(itemSpecIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"md/spec/export",
{
...this.queryParams,
},
`spec_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="8">
<el-form-item label="工艺路线名称" prop="technologyName">
<el-input v-model="form.technologyName" maxlength="64" v-if="optType == 'view'"/>
<el-input v-model="form.technologyName" placeholder="请输入工艺路线名称" maxlength="64" v-else/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8" v-if="optType !='view'">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:mdtechnology:add']"
>新增</el-button>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:mdtechnology:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="bomList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工序名称" align="center" prop="processName" />
<el-table-column label="工序编码" align="center" prop="processCode" />
<el-table-column label="工时" align="center" prop="workHours" />
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="optType !='view'">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:mditem:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:mditem:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listBom, getBom, delBom, addBom, updateBom } from "@/api/mes/md/bom";
import ItemSelect from "@/components/itemSelect/index.vue";
import Treeselect from "@riophae/vue-treeselect";
export default {
name: "Process",
components: {Treeselect, ItemSelect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品BOM关系表格数据
bomList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
productId: this.productId,
processId:null,
processName: null,
processCode: null,
workHours: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
quantity: [
{ required: true, message: "物料使用比例不能为空", trigger: "blur" }
]
}
};
},
props: {
optType: undefined,
productId: undefined
},
created() {
this.getList();
},
methods: {
/** 查询产品BOM关系列表 */
getList() {
this.loading = true;
listBom(this.queryParams).then(response => {
this.bomList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
productId: this.productId,
processId:null,
processName: null,
processCode: null,
workHours: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.bomId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.itemSelect.showFlag = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const bomId = row.bomId || this.ids
getBom(bomId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品BOM关系";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
updateBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const bomIds = row.bomId || this.ids;
this.$modal.confirm('是否确认删除产品BOM关系编号为"' + bomIds + '"的数据项?').then(function() {
return delBom(bomIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//物料选择弹出框
onItemSelected(obj){
debugger;
this.form.itemId = this.itemId;
if(obj != undefined && obj != null){
obj.forEach(element => {
this.form.bomItemId = element.itemId;
this.form.bomItemCode = element.itemCode;
this.form.bomItemName = element.itemName;
this.form.bomItemSpec = element.specification;
this.form.unitOfMeasure = element.unitOfMeasure;
this.form.itemOrProduct = element.itemOrProduct;
this.form.quantity = 1;
this.form.enableFlag = 'Y';
var retFlag = false;
addBom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.getList();
});
});
}
}
}
};
</script>
......@@ -246,7 +246,7 @@
<el-tab-pane label="基本信息" name="BaseInfo">
<BaseInfo ref="BaseInfo" :optType="optType" :itemId="form.itemId"></BaseInfo>
</el-tab-pane>
<el-tab-pane label="产品特性" name="SpecProperty">
<!-- <el-tab-pane label="产品特性" name="SpecProperty">
<SpecProperty ref="SpecProperty" :optType="optType" :itemId="form.itemId"></SpecProperty>
</el-tab-pane>
<el-tab-pane label="销售单位转换" name="SaleUnit">
......@@ -254,7 +254,7 @@
</el-tab-pane>
<el-tab-pane label="工厂信息" name="Factory">
<Factory ref="Factory" :optType="optType" :itemId="form.itemId"></Factory>
</el-tab-pane>
</el-tab-pane> -->
<!-- <el-tab-pane label="客户信息">
<Customer :optType="optType" :itemId="form.itemId"></Customer>
</el-tab-pane>-->
......@@ -264,7 +264,7 @@
<el-tab-pane label="生产版本" name="ProductionPlan">
<ProductionPlan ref="ProductionPlan" :optType="optType" :itemId="form.itemId"></ProductionPlan>
</el-tab-pane>
<el-tab-pane label="排版参数" name="PublishedConf">
<!-- <el-tab-pane label="排版参数" name="PublishedConf">
<PublishedConf ref="PublishedConf" :optType="optType" :itemId="form.itemId"></PublishedConf>
</el-tab-pane>
<el-tab-pane label="正面颜色" name="FaceColor">
......@@ -299,7 +299,7 @@
</el-tab-pane>
<el-tab-pane label="SOP" name="SOP">
<SOPTab ref="SOP" :itemId="form.itemId" :optType="optType"></SOPTab>
</el-tab-pane>
</el-tab-pane> -->
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType == 'view'">返回</el-button>
......@@ -345,18 +345,8 @@ import {
} from "@/api/mes/md/mdItem";
import BaseInfo from "./components/baseInfo.vue";
import SpecProperty from "./components/specProperty.vue";
import SaleUnit from "./components/saleUnitCon.vue";
import Factory from "./components/factory.vue";
import Customer from "./components/customer.vue";
import Look from "./components/look.vue";
import ProductionPlan from "./components/productionPlan.vue";
import PublishedConf from "./components/publishedConf.vue";
import FaceColor from "./components/faceColor.vue";
import BackFaceColor from "./components/backFaceColor.vue";
import CustomerLoss from "./components/customerLoss.vue";
import ItemBom from "./components/itembom.vue";
import SOPTab from "./components/sop.vue";
import { listAllUnitmeasure } from "@/api/mes/md/unitmeasure";
import { genCode } from "@/api/system/autocode/rule";
import { getToken } from "@/utils/auth";
......@@ -370,18 +360,9 @@ export default {
components: {
Treeselect,
BaseInfo,
SpecProperty,
SaleUnit,
Factory,
Customer,
Look,
ProductionPlan,
PublishedConf,
FaceColor,
BackFaceColor,
CustomerLoss,
ItemBom,
SOPTab,
},
data() {
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment