<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="lineCode">
|
<el-input
|
v-model="queryParams.lineCode"
|
placeholder="请输入产线编号"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="工位编号" prop="locationCode">
|
<el-input
|
v-model="queryParams.locationCode"
|
placeholder="请输入工位编号"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="操作类型" prop="operationType">
|
<el-select v-model="queryParams.operationType" placeholder="请选择操作类型" clearable>
|
<el-option
|
v-for="dict in dict.type.operation_type"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="参数编码" prop="paramCode">
|
<el-input
|
v-model="queryParams.paramCode"
|
placeholder="请输入参数编码"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item style="float: right">
|
<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>
|
|
<div style="width: 600px">
|
<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="['main:info: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="['main:info: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="['main:info: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="['main:info:export']"
|
>导出</el-button>
|
</el-col>
|
</el-row>
|
</div>
|
|
<el-descriptions class="margin-top" :column="3" :size="size" border>
|
<el-descriptions-item>
|
<template slot="label">
|
<i class="el-icon-user"></i>
|
配方编码
|
</template>
|
{{queryParams.formulaCode}}
|
</el-descriptions-item>
|
<el-descriptions-item>
|
<template slot="label">
|
<i class="el-icon-mobile-phone"></i>
|
配方名称
|
</template>
|
{{showData.formulaName}}
|
</el-descriptions-item>
|
<el-descriptions-item>
|
<template slot="label">
|
<i class="el-icon-location-outline"></i>
|
产品编号
|
</template>
|
{{showData.productCode}}
|
</el-descriptions-item>
|
<el-descriptions-item>
|
<template slot="label">
|
<i class="el-icon-tickets"></i>
|
产品名称
|
</template>
|
{{showData.productName}}
|
</el-descriptions-item>
|
</el-descriptions>
|
<el-table border v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column show-overflow-tooltip label="配方编码" align="center" prop="formulaCode" />
|
<el-table-column show-overflow-tooltip label="产线编号" align="center" prop="lineCode" />
|
<el-table-column show-overflow-tooltip label="工位编号" align="center" prop="locationCode" />
|
<el-table-column show-overflow-tooltip label="产品编号" align="center" prop="productCode" />
|
<el-table-column show-overflow-tooltip label="操作内容" align="center" prop="operationContent" />
|
<el-table-column label="操作类型" align="center" prop="operationType">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.operation_type" :value="scope.row.operationType"/>
|
</template>
|
</el-table-column>
|
<el-table-column show-overflow-tooltip label="排序" align="center" prop="stepSort" />
|
<el-table-column show-overflow-tooltip label="参数编码" align="center" prop="paramCode" />
|
<el-table-column label="图片" align="center" prop="picture" width="100">
|
<template slot-scope="scope">
|
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
|
</template>
|
</el-table-column>
|
<el-table-column show-overflow-tooltip label="备注" align="center" prop="remarks" />
|
|
</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="formulaCode">
|
<el-input v-model="form.formulaCode" placeholder="请输入配方编码" disabled />
|
</el-form-item>
|
<el-form-item label="产品编号" prop="productCode">
|
<el-input v-model="form.productCode" placeholder="请输入产品编号" disabled/>
|
</el-form-item>
|
<el-form-item label="产线编号" prop="lineCode">
|
<el-input v-model="form.lineCode" placeholder="请输入产线编号" />
|
</el-form-item>
|
<el-form-item label="工位编号" prop="locationCode">
|
<el-input v-model="form.locationCode" placeholder="请输入工位编号" />
|
</el-form-item>
|
|
<el-form-item label="操作内容">
|
<editor v-model="form.operationContent" :min-height="192"/>
|
</el-form-item>
|
<el-form-item label="操作类型" prop="operationType">
|
<el-select v-model="form.operationType" placeholder="请选择操作类型">
|
<el-option
|
v-for="dict in dict.type.operation_type"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="排序" prop="stepSort">
|
<el-input v-model="form.stepSort" placeholder="请输入排序" />
|
</el-form-item>
|
<el-form-item label="参数编码" prop="paramCode">
|
<el-input v-model="form.paramCode" placeholder="请输入参数编码" />
|
</el-form-item>
|
<el-form-item label="图片" prop="picture">
|
<image-upload v-model="form.picture"/>
|
</el-form-item>
|
<el-form-item label="备注" prop="remarks">
|
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容"
|
maxlength="30"
|
show-word-limit />
|
</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 {addInfo, delInfo, getInfo, listInfo, updateInfo} from "@/api/main/bs/formulaChildinfo";
|
import { getOne } from '@/api/main/bs/formulaInfo'
|
|
export default {
|
name: "formulaInfoChild",
|
dicts: ['operation_type'],
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 配方配置子信息表格数据
|
infoList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
lineCode: null,
|
locationCode: null,
|
productCode: null,
|
operationType: null,
|
stepSort: null,
|
paramCode: null,
|
formulaCode: null,
|
},
|
showData: {
|
formulaCode: null,
|
productCode: null,
|
productName: null,
|
formulaName: null,
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
lineCode: [
|
{ required: true, message: "产线编号不能为空", trigger: "blur" }
|
],
|
locationCode: [
|
{ required: true, message: "工位编号不能为空", trigger: "blur" }
|
],
|
productCode: [
|
{ required: true, message: "产品编号不能为空", trigger: "blur" }
|
],
|
operationContent: [
|
{ required: true, message: "操作内容不能为空", trigger: "blur" }
|
],
|
operationType: [
|
{ required: true, message: "操作类型不能为空", trigger: "change" }
|
],
|
stepSort: [
|
{ required: true, message: "排序不能为空", trigger: "blur" }
|
],
|
paramCode: [
|
{ required: true, message: "参数编码不能为空", trigger: "blur" }
|
],
|
}
|
};
|
},
|
created() {
|
this.queryParams.formulaCode = this.$route.query.formulaCode
|
this.getOne()
|
console.log('this.queryParams.formulaCode',this.queryParams.formulaCode)
|
this.getList();
|
},
|
methods: {
|
getOne(){
|
getOne({formulaCode: this.queryParams.formulaCode}).then(res => {
|
if (res.code === 200){
|
this.showData.productCode = res.data.productCode
|
this.showData.productName = res.data.productName
|
this.showData.formulaName = res.data.formulaName
|
}
|
})
|
},
|
/** 查询配方配置子信息列表 */
|
getList() {
|
this.loading = true;
|
listInfo(this.queryParams).then(response => {
|
this.infoList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
id: null,
|
lineCode: null,
|
locationCode: null,
|
productCode: null,
|
operationContent: null,
|
operationType: null,
|
stepSort: null,
|
paramCode: null,
|
picture: null,
|
remarks: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
collectData: null,
|
results: null,
|
formulaCode: null,
|
delFlag: 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.reset();
|
this.form.productCode = this.showData.productCode
|
this.form.formulaCode = this.queryParams.formulaCode
|
this.open = true;
|
this.title = "添加配方配置子信息";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const id = row.id || this.ids
|
getInfo(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) {
|
updateInfo(this.form).then(response => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addInfo(this.form).then(response => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const ids = row.id || this.ids;
|
this.$modal.confirm('是否确认删除').then(function() {
|
return delInfo(ids);
|
}).then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
}).catch(() => {});
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('formulaChildInfo/export', {
|
...this.queryParams
|
}, `info_${new Date().getTime()}.xlsx`)
|
}
|
}
|
};
|
</script>
|