test #47
@ -1,279 +1,518 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<SearchBar
|
||||||
|
:formConfigs="searchBarFormConfig"
|
||||||
|
ref="search-bar"
|
||||||
|
@headBtnClick="handleSearchBarBtnClick" />
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 列表 -->
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<base-table
|
||||||
<el-form-item label="编码" prop="code">
|
:table-props="tableProps"
|
||||||
<el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery"/>
|
:page="queryParams.pageNo"
|
||||||
</el-form-item>
|
:limit="queryParams.pageSize"
|
||||||
<el-form-item label="设备名称" prop="name">
|
:table-data="list"
|
||||||
<el-input v-model="queryParams.name" placeholder="请输入设备名称" clearable @keyup.enter.native="handleQuery"/>
|
@emitFun="handleEmitFun">
|
||||||
</el-form-item>
|
<method-btn
|
||||||
<el-form-item label="创建时间" prop="createTime">
|
v-if="tableBtn.length"
|
||||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
slot="handleBtn"
|
||||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
label="操作"
|
||||||
</el-form-item>
|
:method-list="tableBtn"
|
||||||
<el-form-item>
|
@clickBtn="handleTableBtnClick" />
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
</base-table>
|
||||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<!-- 操作工具栏 -->
|
<!-- 分页组件 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<pagination
|
||||||
<el-col :span="1.5">
|
v-show="total > 0"
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
:total="total"
|
||||||
v-hasPermi="['base:equipment:create']">新增</el-button>
|
:page.sync="queryParams.pageNo"
|
||||||
</el-col>
|
:limit.sync="queryParams.pageSize"
|
||||||
<el-col :span="1.5">
|
@pagination="getList" />
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
|
||||||
v-hasPermi="['base:equipment:export']">导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 对话框(添加 / 修改) -->
|
||||||
<el-table v-loading="loading" :data="list">
|
<base-dialog
|
||||||
<el-table-column label="id" align="center" prop="id" />
|
:dialogTitle="title"
|
||||||
<el-table-column label="编码" align="center" prop="code" />
|
:dialogVisible="open"
|
||||||
<el-table-column label="设备名称" align="center" prop="name" />
|
@close="cancel"
|
||||||
<el-table-column label="英文名称" align="center" prop="enName" />
|
@cancel="cancel"
|
||||||
<el-table-column label="缩写" align="center" prop="abbr" />
|
@confirm="submitForm">
|
||||||
<el-table-column label="设备类型,关联设备类型表" align="center" prop="equipmentTypeId" />
|
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
|
||||||
<el-table-column label="分组id (关联 base_equipment_GROUP)" align="center" prop="groupId" />
|
</base-dialog>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template v-slot="scope">
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['base:equipment:update']">修改</el-button>
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['base:equipment:delete']">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页组件 -->
|
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"/>
|
|
||||||
|
|
||||||
<!-- 对话框(添加 / 修改) -->
|
<!-- 对话框(添加 / 修改) -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
<el-dialog
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
:title="title"
|
||||||
<el-form-item label="编码" prop="code">
|
:visible.sync="open"
|
||||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
width="500px"
|
||||||
</el-form-item>
|
v-dialogDrag
|
||||||
<el-form-item label="设备名称" prop="name">
|
append-to-body>
|
||||||
<el-input v-model="form.name" placeholder="请输入设备名称" />
|
<el-form ref="form" :model="form" label-width="80px">
|
||||||
</el-form-item>
|
<el-form-item label="编码" prop="code">
|
||||||
<el-form-item label="英文名称" prop="enName">
|
<el-input v-model="form.code" placeholder="请输入编码" />
|
||||||
<el-input v-model="form.enName" placeholder="请输入英文名称" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="设备名称" prop="name">
|
||||||
<el-form-item label="缩写" prop="abbr">
|
<el-input v-model="form.name" placeholder="请输入设备名称" />
|
||||||
<el-input v-model="form.abbr" placeholder="请输入缩写" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="英文名称" prop="enName">
|
||||||
<el-form-item label="进厂日期" prop="enterTime">
|
<el-input v-model="form.enName" placeholder="请输入英文名称" />
|
||||||
<el-date-picker clearable v-model="form.enterTime" type="date" value-format="timestamp" placeholder="选择进厂日期" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="缩写" prop="abbr">
|
||||||
<el-form-item label="生产日期" prop="productionTime">
|
<el-input v-model="form.abbr" placeholder="请输入缩写" />
|
||||||
<el-date-picker clearable v-model="form.productionTime" type="date" value-format="timestamp" placeholder="选择生产日期" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="进厂日期" prop="enterTime">
|
||||||
<el-form-item label="设备类型,关联设备类型表" prop="equipmentTypeId">
|
<el-date-picker
|
||||||
<el-select v-model="form.equipmentTypeId" placeholder="请选择设备类型,关联设备类型表">
|
clearable
|
||||||
<el-option label="请选择字典生成" value="" />
|
v-model="form.enterTime"
|
||||||
</el-select>
|
type="date"
|
||||||
</el-form-item>
|
value-format="timestamp"
|
||||||
<el-form-item label="分组id (关联 base_equipment_GROUP)" prop="groupId">
|
placeholder="选择进厂日期" />
|
||||||
<el-select v-model="form.groupId" placeholder="请选择分组id (关联 base_equipment_GROUP)">
|
</el-form-item>
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-form-item label="生产日期" prop="productionTime">
|
||||||
</el-select>
|
<el-date-picker
|
||||||
</el-form-item>
|
clearable
|
||||||
<el-form-item label="每小时生产数量" prop="tvalue">
|
v-model="form.productionTime"
|
||||||
<el-input v-model="form.tvalue" placeholder="请输入每小时生产数量" />
|
type="date"
|
||||||
</el-form-item>
|
value-format="timestamp"
|
||||||
<el-form-item label="单件加工时间 s/件" prop="processingTime">
|
placeholder="选择生产日期" />
|
||||||
<el-input v-model="form.processingTime" placeholder="请输入单件加工时间 s/件" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="设备类型,关联设备类型表" prop="equipmentTypeId">
|
||||||
<el-form-item label="制造商" prop="manufacturer">
|
<el-select
|
||||||
<el-input v-model="form.manufacturer" placeholder="请输入制造商" />
|
v-model="form.equipmentTypeId"
|
||||||
</el-form-item>
|
placeholder="请选择设备类型,关联设备类型表">
|
||||||
<el-form-item label="规格" prop="spec">
|
<el-option label="请选择字典生成" value="" />
|
||||||
<el-input v-model="form.spec" placeholder="请输入规格" />
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="功能描述">
|
<el-form-item
|
||||||
<editor v-model="form.description" :min-height="192"/>
|
label="分组id (关联 base_equipment_GROUP)"
|
||||||
</el-form-item>
|
prop="groupId">
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-select
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
v-model="form.groupId"
|
||||||
</el-form-item>
|
placeholder="请选择分组id (关联 base_equipment_GROUP)">
|
||||||
</el-form>
|
<el-option label="请选择字典生成" value="" />
|
||||||
<div slot="footer" class="dialog-footer">
|
</el-select>
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
</el-form-item>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-form-item label="每小时生产数量" prop="tvalue">
|
||||||
</div>
|
<el-input v-model="form.tvalue" placeholder="请输入每小时生产数量" />
|
||||||
</el-dialog>
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="单件加工时间 s/件" prop="processingTime">
|
||||||
|
<el-input
|
||||||
|
v-model="form.processingTime"
|
||||||
|
placeholder="请输入单件加工时间 s/件" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="制造商" prop="manufacturer">
|
||||||
|
<el-input v-model="form.manufacturer" placeholder="请输入制造商" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格" prop="spec">
|
||||||
|
<el-input v-model="form.spec" placeholder="请输入规格" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="功能描述">
|
||||||
|
<editor v-model="form.description" :min-height="192" />
|
||||||
|
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createEquipment, updateEquipment, deleteEquipment, getEquipment, getEquipmentPage, exportEquipmentExcel } from "@/api/base/equipment";
|
import moment from 'moment';
|
||||||
|
import basicPageMixin from '../mixin/basicPageMixin';
|
||||||
|
import { getAccessToken } from '@/utils/auth';
|
||||||
|
|
||||||
|
import {
|
||||||
|
createEquipment,
|
||||||
|
updateEquipment,
|
||||||
|
deleteEquipment,
|
||||||
|
getEquipment,
|
||||||
|
getEquipmentPage,
|
||||||
|
exportEquipmentExcel,
|
||||||
|
} from '@/api/base/equipment';
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Equipment",
|
name: 'Equipment',
|
||||||
components: {
|
components: {
|
||||||
Editor
|
Editor,
|
||||||
},
|
},
|
||||||
data() {
|
mixins: [basicPageMixin],
|
||||||
return {
|
data() {
|
||||||
// 遮罩层
|
return {
|
||||||
loading: true,
|
searchBarKeys: ['name', 'code'],
|
||||||
// 导出遮罩层
|
tableBtn: [
|
||||||
exportLoading: false,
|
this.$auth.hasPermi('base:equipment:update')
|
||||||
// 显示搜索条件
|
? {
|
||||||
showSearch: true,
|
type: 'edit',
|
||||||
// 总条数
|
btnName: '修改',
|
||||||
total: 0,
|
}
|
||||||
// 设备列表
|
: undefined,
|
||||||
list: [],
|
this.$auth.hasPermi('base:equipment:delete')
|
||||||
// 弹出层标题
|
? {
|
||||||
title: "",
|
type: 'delete',
|
||||||
// 是否显示弹出层
|
btnName: '删除',
|
||||||
open: false,
|
}
|
||||||
// 查询参数
|
: undefined,
|
||||||
queryParams: {
|
].filter((v) => v),
|
||||||
pageNo: 1,
|
tableProps: [
|
||||||
pageSize: 10,
|
{
|
||||||
code: null,
|
prop: 'createTime',
|
||||||
name: null,
|
label: '添加时间',
|
||||||
createTime: [],
|
fixed: true,
|
||||||
},
|
width: 180,
|
||||||
// 表单参数
|
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||||
form: {},
|
},
|
||||||
// 表单校验
|
{ prop: 'name', label: '设备名称', align: 'center' },
|
||||||
rules: {
|
{ prop: 'code', label: '检测编码', align: 'center' },
|
||||||
code: [{ required: true, message: "编码不能为空", trigger: "blur" }],
|
{ prop: 'equipmentType', label: '设备类型', align: 'center' },
|
||||||
name: [{ required: true, message: "设备名称不能为空", trigger: "blur" }],
|
{ prop: 'equipmentGroup', label: '设备分组', align: 'center' },
|
||||||
groupId: [{ required: true, message: "分组id (关联 base_equipment_GROUP)不能为空", trigger: "change" }],
|
{ prop: 'enName', label: '英文名称', align: 'center' },
|
||||||
}
|
{ prop: 'abbr', label: '缩写', align: 'center' },
|
||||||
};
|
{
|
||||||
},
|
action: 'show-detail',
|
||||||
created() {
|
label: '详情',
|
||||||
this.getList();
|
align: 'center',
|
||||||
},
|
subcomponent: {
|
||||||
methods: {
|
props: ['injectData'],
|
||||||
/** 查询列表 */
|
render: function (h) {
|
||||||
getList() {
|
const _this = this;
|
||||||
this.loading = true;
|
return h(
|
||||||
// 执行查询
|
'el-button',
|
||||||
getEquipmentPage(this.queryParams).then(response => {
|
{
|
||||||
this.list = response.data.list;
|
props: { type: 'text', size: 'mini' },
|
||||||
this.total = response.data.total;
|
on: {
|
||||||
this.loading = false;
|
click: function () {
|
||||||
});
|
console.log('inejctdata', _this.injectData);
|
||||||
},
|
_this.$emit('emitData', {
|
||||||
/** 取消按钮 */
|
action: _this.injectData.action,
|
||||||
cancel() {
|
value: _this.injectData.id,
|
||||||
this.open = false;
|
});
|
||||||
this.reset();
|
},
|
||||||
},
|
},
|
||||||
/** 表单重置 */
|
},
|
||||||
reset() {
|
'查看详情'
|
||||||
this.form = {
|
);
|
||||||
id: undefined,
|
},
|
||||||
code: undefined,
|
},
|
||||||
name: undefined,
|
},
|
||||||
enName: undefined,
|
],
|
||||||
abbr: undefined,
|
searchBarFormConfig: [
|
||||||
enterTime: undefined,
|
{
|
||||||
productionTime: undefined,
|
type: 'input',
|
||||||
equipmentTypeId: undefined,
|
label: '名称',
|
||||||
groupId: undefined,
|
placeholder: '请输入设备名称',
|
||||||
tvalue: undefined,
|
param: 'name',
|
||||||
processingTime: undefined,
|
},
|
||||||
manufacturer: undefined,
|
{
|
||||||
spec: undefined,
|
type: 'input',
|
||||||
description: undefined,
|
label: '编码',
|
||||||
remark: undefined,
|
placeholder: '请输入设备编码',
|
||||||
};
|
param: 'codes',
|
||||||
this.resetForm("form");
|
},
|
||||||
},
|
{
|
||||||
/** 搜索按钮操作 */
|
type: 'button',
|
||||||
handleQuery() {
|
btnName: '查询',
|
||||||
this.queryParams.pageNo = 1;
|
name: 'search',
|
||||||
this.getList();
|
color: 'primary',
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
{
|
||||||
resetQuery() {
|
type: 'separate',
|
||||||
this.resetForm("queryForm");
|
},
|
||||||
this.handleQuery();
|
{
|
||||||
},
|
type: this.$auth.hasPermi('base:equipment:create') ? 'button' : '',
|
||||||
/** 新增按钮操作 */
|
btnName: '新增',
|
||||||
handleAdd() {
|
name: 'add',
|
||||||
this.reset();
|
plain: true,
|
||||||
this.open = true;
|
color: 'success',
|
||||||
this.title = "添加设备";
|
},
|
||||||
},
|
{
|
||||||
/** 修改按钮操作 */
|
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '',
|
||||||
handleUpdate(row) {
|
btnName: '导出',
|
||||||
this.reset();
|
name: 'export',
|
||||||
const id = row.id;
|
color: 'warning',
|
||||||
getEquipment(id).then(response => {
|
},
|
||||||
this.form = response.data;
|
],
|
||||||
this.open = true;
|
rows: [
|
||||||
this.title = "修改设备";
|
[
|
||||||
});
|
{
|
||||||
},
|
input: true,
|
||||||
/** 提交按钮 */
|
label: '设备名称',
|
||||||
submitForm() {
|
prop: 'name',
|
||||||
this.$refs["form"].validate(valid => {
|
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
if (!valid) {
|
// bind: {
|
||||||
return;
|
// disabled: true, // some condition, like detail mode...
|
||||||
}
|
// }
|
||||||
// 修改的提交
|
},
|
||||||
if (this.form.id != null) {
|
{
|
||||||
updateEquipment(this.form).then(response => {
|
input: true,
|
||||||
this.$modal.msgSuccess("修改成功");
|
label: '设备编码',
|
||||||
this.open = false;
|
prop: 'code',
|
||||||
this.getList();
|
url: '/base/equipment/getCode',
|
||||||
});
|
},
|
||||||
return;
|
],
|
||||||
}
|
[
|
||||||
// 添加的提交
|
{
|
||||||
createEquipment(this.form).then(response => {
|
input: true,
|
||||||
this.$modal.msgSuccess("新增成功");
|
label: '英文名称',
|
||||||
this.open = false;
|
prop: 'enName',
|
||||||
this.getList();
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
});
|
// bind: {
|
||||||
});
|
// disabled: true, // some condition, like detail mode...
|
||||||
},
|
// }
|
||||||
/** 删除按钮操作 */
|
},
|
||||||
handleDelete(row) {
|
{
|
||||||
const id = row.id;
|
input: true,
|
||||||
this.$modal.confirm('是否确认删除设备编号为"' + id + '"的数据项?').then(function() {
|
label: '缩写',
|
||||||
return deleteEquipment(id);
|
prop: 'abbr',
|
||||||
}).then(() => {
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
this.getList();
|
// bind: {
|
||||||
this.$modal.msgSuccess("删除成功");
|
// disabled: true, // some condition, like detail mode...
|
||||||
}).catch(() => {});
|
// }
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
],
|
||||||
handleExport() {
|
[
|
||||||
// 处理查询参数
|
{
|
||||||
let params = {...this.queryParams};
|
select: true,
|
||||||
params.pageNo = undefined;
|
label: '设备类型',
|
||||||
params.pageSize = undefined;
|
prop: 'equipmentTypeId',
|
||||||
this.$modal.confirm('是否确认导出所有设备数据项?').then(() => {
|
url: '/base/equipment-type/page?pageNo=1&pageSize=100',
|
||||||
this.exportLoading = true;
|
},
|
||||||
return exportEquipmentExcel(params);
|
{
|
||||||
}).then(response => {
|
select: true,
|
||||||
this.$download.excel(response, '设备.xls');
|
label: '设备分组',
|
||||||
this.exportLoading = false;
|
prop: 'groupId',
|
||||||
}).catch(() => {});
|
url: '/base/equipment-group/page?pageNo=1&pageSize=100',
|
||||||
}
|
},
|
||||||
}
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '生产日期',
|
||||||
|
prop: 'productionTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '进厂日期',
|
||||||
|
prop: 'enterTime',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '设备TT值',
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
type: 'number',
|
||||||
|
message: '请输入正确的数字值',
|
||||||
|
trigger: 'blur',
|
||||||
|
transform: (val) => Number(val),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
prop: 'tvalue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '单件产品加工时间',
|
||||||
|
prop: 'processingTime',
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
type: 'number',
|
||||||
|
message: '请输入正确的数字值',
|
||||||
|
trigger: 'blur',
|
||||||
|
transform: (val) => Number(val),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '制造商',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
prop: 'manufacturer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: '设备规格',
|
||||||
|
prop: 'spec',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
textarea: true,
|
||||||
|
label: '功能描述',
|
||||||
|
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||||
|
prop: 'description',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
upload: true,
|
||||||
|
label: '上传资料',
|
||||||
|
prop: 'uploadFiles',
|
||||||
|
url: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // 请求地址
|
||||||
|
bind: {
|
||||||
|
headers: { Authorization: 'Bearer ' + getAccessToken() },
|
||||||
|
'show-file-list': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
diy: true,
|
||||||
|
label: '设备资料',
|
||||||
|
prop: 'fileNames',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[{ input: true, label: '备注', prop: 'remark' }],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
diy: true,
|
||||||
|
label: '设备图片',
|
||||||
|
prop: 'fileUrls',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: null,
|
||||||
|
name: null,
|
||||||
|
createTime: [],
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getEquipmentPage(this.queryParams).then((response) => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
enName: undefined,
|
||||||
|
abbr: undefined,
|
||||||
|
enterTime: undefined,
|
||||||
|
productionTime: undefined,
|
||||||
|
equipmentTypeId: undefined,
|
||||||
|
groupId: undefined,
|
||||||
|
tvalue: undefined,
|
||||||
|
processingTime: undefined,
|
||||||
|
manufacturer: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
description: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm('form');
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm('queryForm');
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = '添加设备';
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getEquipment(id).then((response) => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = '修改设备';
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateEquipment(this.form).then((response) => {
|
||||||
|
this.$modal.msgSuccess('修改成功');
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createEquipment(this.form).then((response) => {
|
||||||
|
this.$modal.msgSuccess('新增成功');
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认删除设备编号为"' + id + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
|
return deleteEquipment(id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess('删除成功');
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = { ...this.queryParams };
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认导出所有设备数据项?')
|
||||||
|
.then(() => {
|
||||||
|
this.exportLoading = true;
|
||||||
|
return exportEquipmentExcel(params);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.$download.excel(response, '设备.xls');
|
||||||
|
this.exportLoading = false;
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -85,8 +85,14 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEmitFun(val) {
|
handleEmitFun({ action, value }) {
|
||||||
console.log('emit unf', val);
|
console.log('[Emit Fun]', action, value);
|
||||||
|
switch (action) {
|
||||||
|
// 查看详情
|
||||||
|
case 'show-detail':
|
||||||
|
this.$modal.msgSuccess('查看详情')
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
getList() {},
|
getList() {},
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<method-btn
|
<method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun"></base-table>
|
@emitFun="handleEmitFun"></base-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"></base-table>
|
:table-data="list"></base-table>
|
||||||
<!-- @emit-fun="handleEmitFun"> -->
|
<!-- @emitFun="handleEmitFun"> -->
|
||||||
<!-- <method-btn
|
<!-- <method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emit-fun="handleEmitFun">
|
@emitFun="handleEmitFun">
|
||||||
<!-- <method-btn
|
<!-- <method-btn
|
||||||
v-if="tableBtn.length"
|
v-if="tableBtn.length"
|
||||||
slot="handleBtn"
|
slot="handleBtn"
|
||||||
|
Loading…
Reference in New Issue
Block a user