test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
10 changed files with 521 additions and 276 deletions
Showing only changes of commit a312117ea3 - Show all commits

View File

@ -1,68 +1,52 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <SearchBar
<el-form-item label="编码" prop="code"> :formConfigs="searchBarFormConfig"
<el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery"/> ref="search-bar"
</el-form-item> @headBtnClick="handleSearchBarBtnClick" />
<el-form-item label="设备名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入设备名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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="['base:equipment:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<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-table
<el-table-column label="id" align="center" prop="id" /> :table-props="tableProps"
<el-table-column label="编码" align="center" prop="code" /> :page="queryParams.pageNo"
<el-table-column label="设备名称" align="center" prop="name" /> :limit="queryParams.pageSize"
<el-table-column label="英文名称" align="center" prop="enName" /> :table-data="list"
<el-table-column label="缩写" align="center" prop="abbr" /> @emitFun="handleEmitFun">
<el-table-column label="设备类型,关联设备类型表" align="center" prop="equipmentTypeId" /> <method-btn
<el-table-column label="分组id (关联 base_equipment_GROUP" align="center" prop="groupId" /> v-if="tableBtn.length"
<el-table-column label="备注" align="center" prop="remark" /> slot="handleBtn"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> label="操作"
<template v-slot="scope"> :method-list="tableBtn"
<span>{{ parseTime(scope.row.createTime) }}</span> @clickBtn="handleTableBtnClick" />
</template> </base-table>
</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
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> <base-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> :dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
</base-dialog>
<!-- 对话框(添加 / 修改) -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
v-dialogDrag
append-to-body>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="编码" prop="code"> <el-form-item label="编码" prop="code">
<el-input v-model="form.code" placeholder="请输入编码" /> <el-input v-model="form.code" placeholder="请输入编码" />
</el-form-item> </el-form-item>
@ -76,18 +60,34 @@
<el-input v-model="form.abbr" placeholder="请输入缩写" /> <el-input v-model="form.abbr" placeholder="请输入缩写" />
</el-form-item> </el-form-item>
<el-form-item label="进厂日期" prop="enterTime"> <el-form-item label="进厂日期" prop="enterTime">
<el-date-picker clearable v-model="form.enterTime" type="date" value-format="timestamp" 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="productionTime"> <el-form-item label="生产日期" prop="productionTime">
<el-date-picker clearable v-model="form.productionTime" type="date" value-format="timestamp" 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="equipmentTypeId"> <el-form-item label="设备类型,关联设备类型表" prop="equipmentTypeId">
<el-select v-model="form.equipmentTypeId" placeholder="请选择设备类型,关联设备类型表"> <el-select
v-model="form.equipmentTypeId"
placeholder="请选择设备类型,关联设备类型表">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="分组id (关联 base_equipment_GROUP" prop="groupId"> <el-form-item
<el-select v-model="form.groupId" placeholder="请选择分组id (关联 base_equipment_GROUP"> label="分组id (关联 base_equipment_GROUP"
prop="groupId">
<el-select
v-model="form.groupId"
placeholder="请选择分组id (关联 base_equipment_GROUP">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -95,7 +95,9 @@
<el-input v-model="form.tvalue" placeholder="请输入每小时生产数量" /> <el-input v-model="form.tvalue" placeholder="请输入每小时生产数量" />
</el-form-item> </el-form-item>
<el-form-item label="单件加工时间 s/件" prop="processingTime"> <el-form-item label="单件加工时间 s/件" prop="processingTime">
<el-input v-model="form.processingTime" placeholder="请输入单件加工时间 s/件" /> <el-input
v-model="form.processingTime"
placeholder="请输入单件加工时间 s/件" />
</el-form-item> </el-form-item>
<el-form-item label="制造商" prop="manufacturer"> <el-form-item label="制造商" prop="manufacturer">
<el-input v-model="form.manufacturer" placeholder="请输入制造商" /> <el-input v-model="form.manufacturer" placeholder="请输入制造商" />
@ -119,28 +121,263 @@
</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,
}, },
mixins: [basicPageMixin],
data() { data() {
return { return {
// searchBarKeys: ['name', 'code'],
loading: true, tableBtn: [
// this.$auth.hasPermi('base:equipment:update')
exportLoading: false, ? {
// type: 'edit',
showSearch: true, btnName: '修改',
// }
total: 0, : undefined,
// this.$auth.hasPermi('base:equipment:delete')
list: [], ? {
// type: 'delete',
title: "", btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '设备名称', align: 'center' },
{ prop: 'code', label: '检测编码', align: 'center' },
{ prop: 'equipmentType', label: '设备类型', align: 'center' },
{ prop: 'equipmentGroup', label: '设备分组', align: 'center' },
{ prop: 'enName', label: '英文名称', align: 'center' },
{ prop: 'abbr', label: '缩写', align: 'center' },
{
action: 'show-detail',
label: '详情',
align: 'center',
subcomponent: {
props: ['injectData'],
render: function (h) {
const _this = this;
return h(
'el-button',
{
props: { type: 'text', size: 'mini' },
on: {
click: function () {
console.log('inejctdata', _this.injectData);
_this.$emit('emitData', {
action: _this.injectData.action,
value: _this.injectData.id,
});
},
},
},
'查看详情'
);
},
},
},
],
searchBarFormConfig: [
{
type: 'input',
label: '名称',
placeholder: '请输入设备名称',
param: 'name',
},
{
type: 'input',
label: '编码',
placeholder: '请输入设备编码',
param: 'codes',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:equipment:create') ? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
rows: [
[
{
input: true,
label: '设备名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '设备编码',
prop: 'code',
url: '/base/equipment/getCode',
},
],
[
{
input: true,
label: '英文名称',
prop: 'enName',
// rules: [{ required: true, message: '', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '缩写',
prop: 'abbr',
// rules: [{ required: true, message: '', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
],
[
{
select: true,
label: '设备类型',
prop: 'equipmentTypeId',
url: '/base/equipment-type/page?pageNo=1&pageSize=100',
},
{
select: true,
label: '设备分组',
prop: 'groupId',
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, open: false,
// //
@ -153,12 +390,6 @@ export default {
}, },
// //
form: {}, form: {},
//
rules: {
code: [{ required: true, message: "编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "设备名称不能为空", trigger: "blur" }],
groupId: [{ required: true, message: "分组id (关联 base_equipment_GROUP不能为空", trigger: "change" }],
}
}; };
}, },
created() { created() {
@ -169,7 +400,7 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// //
getEquipmentPage(this.queryParams).then(response => { getEquipmentPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
@ -199,7 +430,7 @@ export default {
description: undefined, description: undefined,
remark: undefined, remark: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
@ -208,43 +439,43 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm');
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加设备"; this.title = '添加设备';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; const id = row.id;
getEquipment(id).then(response => { getEquipment(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改设备"; this.title = '修改设备';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
// //
if (this.form.id != null) { if (this.form.id != null) {
updateEquipment(this.form).then(response => { updateEquipment(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; return;
} }
// //
createEquipment(this.form).then(response => { createEquipment(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -253,12 +484,16 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除设备编号为"' + id + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除设备编号为"' + id + '"的数据项?')
.then(function () {
return deleteEquipment(id); return deleteEquipment(id);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -266,14 +501,18 @@ export default {
let params = { ...this.queryParams }; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有设备数据项?').then(() => { this.$modal
.confirm('是否确认导出所有设备数据项?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportEquipmentExcel(params); return exportEquipmentExcel(params);
}).then(response => { })
.then((response) => {
this.$download.excel(response, '设备.xls'); this.$download.excel(response, '设备.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
} .catch(() => {});
} },
},
}; };
</script> </script>

View File

@ -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"

View File

@ -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() {},

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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"

View File

@ -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"