实现工厂建模

This commit is contained in:
ddmt 2024-11-18 20:52:44 +08:00
parent 3f6228e1c9
commit fc3954970f
7 changed files with 1122 additions and 28 deletions

View File

@ -50,6 +50,7 @@
"jsencrypt": "3.0.0-rc.1",
"nprogress": "0.2.0",
"quill": "1.3.7",
"sass": "^1.32.0",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
@ -71,7 +72,6 @@
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
"sass": "3.32.0",
"sass-loader": "10.1.0",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询能效检测点列表
export function listCheckpoint(query) {
return request({
url: '/footprint/checkpoint/list',
method: 'get',
params: query
})
}
// 查询能效检测点详细
export function getCheckpoint(id) {
return request({
url: '/footprint/checkpoint/' + id,
method: 'get'
})
}
// 新增能效检测点
export function addCheckpoint(data) {
return request({
url: '/footprint/checkpoint',
method: 'post',
data: data
})
}
// 修改能效检测点
export function updateCheckpoint(data) {
return request({
url: '/footprint/checkpoint',
method: 'put',
data: data
})
}
// 删除能效检测点
export function delCheckpoint(id) {
return request({
url: '/footprint/checkpoint/' + id,
method: 'delete'
})
}
// 导出能效检测点
export function exportCheckpoint(query) {
return request({
url: '/footprint/checkpoint/export',
method: 'get',
params: query
})
}

53
src/api/mes/model.js Normal file
View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询工厂建模列表
export function listModel(query) {
return request({
url: '/mes/model/list',
method: 'get',
params: query
})
}
// 查询工厂建模详细
export function getModel(id) {
return request({
url: '/mes/model/' + id,
method: 'get'
})
}
// 新增工厂建模
export function addModel(data) {
return request({
url: '/mes/model',
method: 'post',
data: data
})
}
// 修改工厂建模
export function updateModel(data) {
return request({
url: '/mes/model',
method: 'put',
data: data
})
}
// 删除工厂建模
export function delModel(id) {
return request({
url: '/mes/model/' + id,
method: 'delete'
})
}
// 导出工厂建模
export function exportModel(query) {
return request({
url: '/mes/model/export',
method: 'get',
params: query
})
}

53
src/api/mes/project.js Normal file
View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询项目维护列表
export function listProject(query) {
return request({
url: '/mes/project/list',
method: 'get',
params: query
})
}
// 查询项目维护详细
export function getProject(id) {
return request({
url: '/mes/project/' + id,
method: 'get'
})
}
// 新增项目维护
export function addProject(data) {
return request({
url: '/mes/project',
method: 'post',
data: data
})
}
// 修改项目维护
export function updateProject(data) {
return request({
url: '/mes/project',
method: 'put',
data: data
})
}
// 删除项目维护
export function delProject(id) {
return request({
url: '/mes/project/' + id,
method: 'delete'
})
}
// 导出项目维护
export function exportProject(query) {
return request({
url: '/mes/project/export',
method: 'get',
params: query
})
}

View File

@ -1,22 +1,364 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入项目名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="负责人" prop="leader">
<el-input
v-model="queryParams.leader"
placeholder="请输入负责人"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始日期" prop="startDate">
<el-date-picker clearable size="small"
v-model="queryParams.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="endDate">
<el-date-picker clearable size="small"
v-model="queryParams.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="项目状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择项目状态" clearable filterable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</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="['mes:project: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="['mes:project: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="['mes:project: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="['mes:project:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="项目名" align="center" prop="name" />
<el-table-column label="负责人" align="center" prop="leader" />
<el-table-column label="开始日期" align="center" prop="startDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="结束日期" align="center" prop="endDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="项目介绍" align="center" prop="description">
<template slot-scope="scope">
<div v-html='scope.row.description'></div>
</template>
</el-table-column>
<el-table-column label="项目状态" align="center" prop="status" :formatter="statusFormat" />
<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="['mes:project:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:project: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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名" prop="name">
<el-input v-model="form.name" placeholder="请输入项目名" />
</el-form-item>
<el-form-item label="负责人" prop="leader">
<el-input v-model="form.leader" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="开始日期" prop="startDate">
<el-date-picker clearable size="small"
v-model="form.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="endDate">
<el-date-picker clearable size="small"
v-model="form.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="项目介绍">
<imageUpload v-model="form.description"/>
</el-form-item>
<el-form-item label="项目状态" prop="status">
<el-select v-model="form.status" placeholder="请选择项目状态" clearable filterable>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></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>
</template>
<script>
import { listProject, getProject, delProject, addProject, updateProject, exportProject } from "@/api/mes/project";
import ImageUpload from '@/components/ImageUpload';
export default {
name: "ProjectInfo",
name: "Project",
components: {
ImageUpload,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
projectList: [],
//
title: "",
//
open: false,
//
statusOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
leader: null,
startDate: null,
endDate: null,
description: null,
status: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("project_status").then(response => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询项目维护列表 */
getList() {
this.loading = true;
listProject(this.queryParams).then(response => {
this.projectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
leader: null,
startDate: null,
endDate: null,
description: null,
status: 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.open = true;
this.title = "添加项目维护";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getProject(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) {
updateProject(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProject(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除项目维护编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delProject(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有项目维护数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportProject(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@ -1,23 +1,328 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="站点名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入站点名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="站点地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入站点地址"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态 0未过载 1已过载" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态 0未过载 1已过载" clearable filterable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</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="['footprint:checkpoint: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="['footprint:checkpoint: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="['footprint:checkpoint: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="['footprint:checkpoint:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="checkpointList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="站点名称" align="center" prop="name" />
<el-table-column label="站点地址" align="center" prop="address" />
<el-table-column label="实时功率" align="center" prop="rtPower" />
<el-table-column label="实时电压" align="center" prop="rtVoltage" />
<el-table-column label="状态 0未过载 1已过载" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="上报时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</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="['footprint:checkpoint:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['footprint:checkpoint: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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="站点名称" prop="name">
<el-input v-model="form.name" placeholder="请输入站点名称" />
</el-form-item>
<el-form-item label="站点地址" prop="address">
<el-input v-model="form.address" placeholder="请输入站点地址" />
</el-form-item>
<el-form-item label="实时功率" prop="rtPower">
<el-input v-model="form.rtPower" placeholder="请输入实时功率" />
</el-form-item>
<el-form-item label="实时电压" prop="rtVoltage">
<el-input v-model="form.rtVoltage" placeholder="请输入实时电压" />
</el-form-item>
<el-form-item label="状态 0未过载 1已过载" prop="status">
<el-select v-model="form.status" placeholder="请选择状态 0未过载 1已过载" clearable filterable>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</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 { listCheckpoint, getCheckpoint, delCheckpoint, addCheckpoint, updateCheckpoint, exportCheckpoint } from "@/api/footprint/checkpoint";
export default {
name: "Checkpoint",
components: {
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
checkpointList: [],
//
title: "",
//
open: false,
// 0 1
statusOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
address: null,
status: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("overload_status").then(response => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询能效检测点列表 */
getList() {
this.loading = true;
listCheckpoint(this.queryParams).then(response => {
this.checkpointList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 0 1
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
address: null,
rtPower: null,
rtVoltage: null,
status: null,
remark: null,
createBy: null,
createTime: 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.open = true;
this.title = "添加能效检测点";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCheckpoint(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) {
updateCheckpoint(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCheckpoint(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除能效检测点编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delCheckpoint(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有能效检测点数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportCheckpoint(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@ -1,25 +1,313 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="产品名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="产品名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="生产线名称" prop="productLineName">
<el-input
v-model="queryParams.productLineName"
placeholder="请输入生产线名称"
clearable
size="small"
@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"
v-hasPermi="['mes:model: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="['mes:model: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="['mes:model: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="['mes:model:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="modelList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="产品名称" align="center" prop="materialName" />
<el-table-column label="生产线名称" align="center" prop="productLineName" />
<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="['mes:model:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:model: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="800px" append-to-body>
<el-form ref="form" :model="form" :inline="true" :rules="rules" label-width="100px">
<el-form-item label="生产线名称" prop="productLineName">
<el-input v-model="form.productLineName" placeholder="请输入生产线名称" />
</el-form-item>
<el-form-item label="产品" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入产品名称" disabled>
<template slot="append">
<el-button @click="factoryModel_open=true">选择</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="产品型号" prop="productModel">
<el-input v-model="form.productModel" placeholder="请输入生产线名称" disabled />
</el-form-item>
<el-form-item label="产品规格" prop="productSpecification">
<el-input v-model="form.productSpecification" placeholder="请输入生产线名称" disabled/>
</el-form-item>
<el-form-item label="描述" prop="remark">
<!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> -->
<Editor :height=127 v-model="form.remark" />
</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>
<factoryModel :open.sync="factoryModel_open" @onCancel="factoryModel_open=false" @onSelected="handleMaterialSelected" />
</div>
</template>
<script>
import { listModel, getModel, delModel, addModel, updateModel, exportModel } from "@/api/mes/model";
import Editor from "@/components/Editor/index"
import factoryModel from "@/components/Material/MaterialSelect";
export default {
name: "FactoryModel",
name: "Model",
components: {
Editor,
factoryModel
},
data() {
return {
factoryModel_open: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
modelList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
materialName: null,
productLineName: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
},
watch: {
this.getList();
},
methods: {
handleMaterialSelected(list){
this.form.materialId = list[0].id;
this.form.materialName = list[0].name;
this.form.productModel = list[0].model;
this.form.productSpecification = list[0].specification;
this.factoryModel_open=false;
console.log("handleMaterialSelected", list[0],this.form);
console.log(this.modelList);
},
/** 查询工厂建模列表 */
getList() {
this.loading = true;
listModel(this.queryParams).then(response => {
this.modelList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
materialName: null,
productLineName: null,
remark: null,
productSpecification: null,
productModel: 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.open = true;
this.title = "添加工厂建模";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getModel(id).then(response => {
this.form = response.data;
this.form.materialName = this.form.mesFactoryModelDetailList.name;
this.form.productModel = this.form.mesFactoryModelDetailList.model;
this.form.productSpecification = this.form.mesFactoryModelDetailList.specification;
this.open = true;
this.title = "修改工厂建模";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateModel(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addModel(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除工厂建模编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delModel(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有工厂建模数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportModel(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>