projects/mes-lb #56

Merged
g7hoo merged 6 commits from projects/mes-lb into projects/mes-test 2023-10-30 10:37:41 +08:00
17 changed files with 452 additions and 286 deletions
Showing only changes of commit d25261b256 - Show all commits

View File

@ -82,7 +82,7 @@
<script> <script>
import { getAccessToken } from '@/utils/auth'; import { getAccessToken } from '@/utils/auth';
import defaultBg from '../../../../../assets/images/default-file-icon.png'; import defaultBg from '../../../../assets/images/default-file-icon.png';
function checkSize(file, message) { function checkSize(file, message) {
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2;
@ -139,56 +139,7 @@ export default {
headers: { Authorization: 'Bearer ' + getAccessToken() }, // headers: { Authorization: 'Bearer ' + getAccessToken() }, //
fileList: [], fileList: [],
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload',
files: [ files: [],
//
// {
// fileName: 'sf.docs',
// fileType: 'asset',
// fileUrl:
// 'https://hbimg.b0.upaiyun.com/cc7475787bd08ed926b68eaf53fa1f2c5473259115e3c-gJdObd_fw658',
// },
// {
// fileName: 'sddf.docs',
// fileType: 'asset',
// fileUrl: 'https://img0.sc115.com/wm/xqx/pic1/1501xofo4ssolji.jpg',
// },
// {
// fileName: 'jjj.docs',
// fileType: 'asset',
// fileUrl:
// 'https://www.mms591.com/www.mms591.com-photo/2013081823/1-130QR34544.jpg',
// },
// {
// fileName: 'asdfasdf.docs',
// fileType: 'asset',
// fileUrl:
// 'https://hbimg.b0.upaiyun.com/8f6bced5f2e38d3a021b2c48d5a98dfb6317e3e12c6a0-QmhJ5v_fw658',
// },
// {
// fileName: 'asdkj.docs',
// fileType: 'asset',
// fileUrl:
// 'https://www.mms591.com/www.mms591.com-photo/2013013021/1-130130212034.jpg',
// },
// {
// fileName: 'lkasjdf.docs',
// fileType: 'asset',
// fileUrl:
// 'https://www.mms591.com/www.mms591.com-photo/2013072122/1-130H1223057.jpg',
// },
// {
// fileName: 'asdf.docs',
// fileType: 'asset',
// fileUrl:
// 'https://img.1ppt.com/uploads/allimg/1212/1-1212101ZH5A2.jpg',
// },
// {
// fileName: 'afdffff.docs',
// fileType: 'asset',
// fileUrl:
// 'https://www.mms591.com/www.mms591.com-photo/2013051721/1-13051H11945.jpg',
// },
],
updateTimer: null, updateTimer: null,
}; };
}, },
@ -414,7 +365,7 @@ export default {
} }
.default-icon { .default-icon {
background: url(../../../../../assets/images/default-file-icon.png) no-repeat; background: url(../../../../assets/images/default-file-icon.png) no-repeat;
background-position: center; background-position: center;
background-size: 64px; background-size: 64px;
} }

View File

@ -6,150 +6,105 @@
--> -->
<template> <template>
<el-form <el-form class="equipment-info-form" ref="form" :model="form" label-width="200px" label-position="top"
class="equipment-info-form"
ref="form"
:model="form"
label-width="200px"
label-position="top"
v-loading="formLoading"> v-loading="formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="设备名称" prop="name" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
label="设备名称" <el-input v-model="form.name" :disabled="disabled" placeholder="请输入设备名称"></el-input>
prop="name"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input
v-model="form.name"
:disabled="disabled"
placeholder="请输入设备名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="设备编码" prop="code" :rules="[]"> <el-form-item label="设备编码" prop="code" :rules="[]">
<el-input <el-input v-model="form.code" :disabled="disabled" placeholder="请输入设备编码"></el-input>
v-model="form.code"
:disabled="disabled"
placeholder="请输入设备编码"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="英文名称" prop="enName" :rules="[]"> <el-form-item label="英文名称" prop="enName" :rules="[]">
<el-input <el-input v-model="form.enName" :disabled="disabled" placeholder="请输入英文名称"></el-input>
v-model="form.enName"
:disabled="disabled"
placeholder="请输入英文名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="缩写" prop="abbr" :rules="[]"> <el-form-item label="缩写" prop="abbr" :rules="[]">
<el-input <el-input v-model="form.abbr" :disabled="disabled" placeholder="请输入名称缩写"></el-input>
v-model="form.abbr"
:disabled="disabled"
placeholder="请输入名称缩写"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="设备类型" prop="equipmentTypeId" :rules="[]"> <el-form-item label="设备类型" prop="equipmentTypeId"
<el-select :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
v-model="form.equipmentTypeId" <el-select v-model="form.equipmentTypeId" :disabled="disabled" filterable placeholder="请选择设备类型">
:disabled="disabled" <el-option v-for="eqType in eqTypeList" :key="eqType.id" :label="eqType.name"
filterable
placeholder="请选择设备类型">
<el-option
v-for="eqType in eqTypeList"
:key="eqType.id"
:label="eqType.name"
:value="eqType.id"></el-option> :value="eqType.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="备注" prop="remark" :rules="[]"> <el-form-item label="预计生产时间(min/天)" prop="workTime" :rules="[
<el-input { required: true, message: '不能为空', trigger: 'blur' },
v-model="form.remark" {
:disabled="disabled" type: 'number',
placeholder="请输入备注"></el-input> message: '请输入正确的数字值',
trigger: 'blur',
transform: (val) => Number(val),
},
]">
<el-input v-model="form.workTime" :disabled="disabled" placeholder="请输入预计生产时间"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="生产日期" prop="productionTime" :rules="[]"> <el-form-item label="生产日期" prop="productionTime" :rules="[]">
<el-date-picker <el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择生产日期"
v-model="form.enterTime"
:disabled="disabled"
type="datetime"
placeholder="请选择生产日期"
value-format="timestamp"></el-date-picker> value-format="timestamp"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="进场日期" prop="enterTime" :rules="[]"> <el-form-item label="进场日期" prop="enterTime" :rules="[]">
<el-date-picker <el-date-picker v-model="form.enterTime" :disabled="disabled" type="datetime" placeholder="请选择进场日期"
v-model="form.enterTime"
:disabled="disabled"
type="datetime"
placeholder="请选择进场日期"
value-format="timestamp"></el-date-picker> value-format="timestamp"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="设备TT值" prop="tvalue" :rules="[
label="设备TT值" { required: true, message: '不能为空', trigger: 'blur' },
prop="tvalue" {
:rules="[ type: 'number',
{ required: true, message: '不能为空', trigger: 'blur' }, message: '请输入正确的数字值',
{ trigger: 'blur',
type: 'number', transform: (val) => Number(val),
message: '请输入正确的数字值', },
trigger: 'blur', ]">
transform: (val) => Number(val), <el-input v-model="form.tvalue" :disabled="disabled" placeholder="请输入设备TT值"></el-input>
},
]">
<el-input
v-model="form.tvalue"
:disabled="disabled"
placeholder="请输入设备TT值"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="产品加工时间(s)" prop="processingTime" :rules="[
label="产品加工时间(s)" { required: true, message: '不能为空', trigger: 'blur' },
prop="processingTime" {
:rules="[ type: 'number',
{ required: true, message: '不能为空', trigger: 'blur' }, message: '请输入正确的数字值',
{ trigger: 'blur',
type: 'number', transform: (val) => Number(val),
message: '请输入正确的数字值', },
trigger: 'blur', ]">
transform: (val) => Number(val), <el-input v-model="form.processingTime" :disabled="disabled" placeholder="请输入产品加工时间"></el-input>
},
]">
<el-input
v-model="form.processingTime"
:disabled="disabled"
placeholder="请输入产品加工时间"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="制造商" prop="manufacturer" :rules="[]"> <el-form-item label="制造商" prop="manufacturer" :rules="[]">
<el-input <el-input v-model="form.manufacturer" :disabled="disabled" placeholder="请输入制造商"></el-input>
v-model="form.manufacturer"
:disabled="disabled"
placeholder="请输入制造商"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="设备规格" prop="spec" :rules="[]"> <el-form-item label="设备规格" prop="spec" :rules="[]">
<el-input <el-input v-model="form.spec" :disabled="disabled" placeholder="请输入设备规格"></el-input>
v-model="form.spec"
:disabled="disabled"
placeholder="请输入设备规格"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -157,14 +112,19 @@
<!-- 功能描述 --> <!-- 功能描述 -->
<el-col> <el-col>
<el-form-item label="功能描述" prop="description" :rules="[]"> <el-form-item label="功能描述" prop="description" :rules="[]">
<el-input <el-input type="textarea" :disabled="disabled" v-model="form.description"
type="textarea"
:disabled="disabled"
v-model="form.description"
placeholder="请填写功能描述"></el-input> placeholder="请填写功能描述"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20">
<!-- 功能描述 -->
<el-col>
<el-form-item label="备注" prop="remark" :rules="[]">
<el-input v-model="form.remark" :disabled="disabled" placeholder="请输入备注"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<!-- 上传资料 --> <!-- 上传资料 -->
<el-col> <el-col>
@ -177,10 +137,7 @@
<!-- 上传图片 --> <!-- 上传图片 -->
<el-col> <el-col>
<el-form-item label="上传图片" prop="pics" :rules="[]"> <el-form-item label="上传图片" prop="pics" :rules="[]">
<AssetsUpload <AssetsUpload :is-pic-mode="true" v-model="form.pics" :disabled="disabled" />
:is-pic-mode="true"
v-model="form.pics"
:disabled="disabled" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -229,6 +186,7 @@ export default {
equipmentTypeId: '', equipmentTypeId: '',
remark: '', remark: '',
productionTime: '', productionTime: '',
workTime: '',
enterTime: '', enterTime: '',
tvalue: '', tvalue: '',
processingTime: '', processingTime: '',
@ -305,16 +263,9 @@ export default {
return response.data; return response.data;
}, },
// //
beforeUpload() {}, beforeUpload() { },
// bind // bind
handleUploadSuccess(response, file, fileList) { handleUploadSuccess(response, file, fileList) {
console.log(
'[dialogForm:handleUploadSuccess]',
response,
file,
fileList,
this.form
);
// //
if ('fileNames' in this.form) this.form.fileNames.push(file.name); if ('fileNames' in this.form) this.form.fileNames.push(file.name);
// //

View File

@ -1,61 +1,29 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBar <SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<method-btn <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加) --> <!-- 对话框(添加) -->
<base-dialog <base-dialog :dialogTitle="title" :dialogVisible="open" @close="cancel" @cancel="cancel" width="60%"
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
width="60%"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm <DialogForm v-if="open" key="index-dialog-form" ref="form" label-position="top" size="small" :dataForm="form"
v-if="open"
key="index-dialog-form"
ref="form"
label-position="top"
size="small"
:dataForm="form"
:rows="computedRows" /> :rows="computedRows" />
</base-dialog> </base-dialog>
<!-- 设备 详情 - 编辑 --> <!-- 设备 详情 - 编辑 -->
<EquipmentDrawer <EquipmentDrawer v-if="editVisible" ref="drawer" :mode="editMode" @update-mode="editMode = $event"
v-if="editVisible" :data-id="form.id" :sections="[
ref="drawer"
:mode="editMode"
@update-mode="editMode = $event"
:data-id="form.id"
:sections="[
{ {
name: '基本信息', name: '基本信息',
key: 'base', key: 'base',
@ -69,36 +37,33 @@
name: '属性列表', name: '属性列表',
key: 'attrs', key: 'attrs',
props: drawerListProps, props: drawerListProps,
url: '/base/equipment-attr/page', url: '/base/core-equipment-attr/page',
urlCreate: '/base/equipment-attr/create', urlCreate: '/base/core-equipment-attr/create',
urlUpdate: '/base/equipment-attr/update', urlUpdate: '/base/core-equipment-attr/update',
urlDelete: '/base/equipment-attr/delete', urlDelete: '/base/core-equipment-attr/delete',
urlDetail: '/base/equipment-attr/get', urlDetail: '/base/core-equipment-attr/get',
queryParams: { queryParams: {
equipmentId: form.id, equipmentId: form.id,
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
}, },
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:equipment-attr:update') this.$auth.hasPermi('base:core-equipment-attr:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '修改', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:equipment-attr:delete') this.$auth.hasPermi('base:core-equipment-attr:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
allowAdd: true, allowAdd: true,
}, },
]" ]" @refreshDataList="getList" @cancel="cancelEdit" @destroy="cancelEdit" />
@refreshDataList="getList"
@cancel="cancelEdit"
@destroy="cancelEdit" />
</div> </div>
</template> </template>
@ -129,23 +94,23 @@ export default {
return { return {
searchBarKeys: ['name', 'code'], searchBarKeys: ['name', 'code'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:equipment:update`) this.$auth.hasPermi(`base:core-equipment:update`)
? { ? {
type: 'detail', type: 'detail',
btnName: '详情', btnName: '详情',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:equipment:update') this.$auth.hasPermi('base:core-equipment:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '修改', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:equipment:delete') this.$auth.hasPermi('base:core-equipment:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
@ -211,14 +176,14 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '', type: this.$auth.hasPermi('base:core-equipment:export') ? 'button' : '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
plain: true, plain: true,
color: 'primary', color: 'primary',
}, },
{ {
type: this.$auth.hasPermi('base:equipment:create') ? 'button' : '', type: this.$auth.hasPermi('base:core-equipment:create') ? 'button' : '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
plain: true, plain: true,
@ -268,17 +233,31 @@ export default {
label: '设备类型', label: '设备类型',
prop: 'equipmentTypeId', prop: 'equipmentTypeId',
url: '/base/core-equipment-type/page?pageNo=1&pageSize=100', url: '/base/core-equipment-type/page?pageNo=1&pageSize=100',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: { bind: {
filterable: true, filterable: true,
}, },
}, },
{
input: true,
label: '预计生产时间(min/天)',
prop: 'workTime',
rules: [
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字值',
trigger: 'blur',
transform: (val) => Number(val),
},
],
},
// { // {
// select: true, // select: true,
// label: '', // label: '',
// prop: 'groupId', // prop: 'groupId',
// url: '/base/equipment-group/page?pageNo=1&pageSize=100', // url: '/base/core-equipment-group/page?pageNo=1&pageSize=100',
// }, // },
{ input: true, label: '备注', prop: 'remark' },
], ],
[ [
{ {
@ -309,7 +288,7 @@ export default {
[ [
{ {
input: true, input: true,
label: '产品加工时间s', label: '产品加工时间(s)',
prop: 'processingTime', prop: 'processingTime',
rules: [ rules: [
{ required: true, message: '不能为空', trigger: 'blur' }, { required: true, message: '不能为空', trigger: 'blur' },
@ -330,7 +309,7 @@ export default {
}, },
{ {
input: true, input: true,
label: '设备规格', label: '规格描述',
prop: 'spec', prop: 'spec',
}, },
], ],
@ -342,6 +321,9 @@ export default {
prop: 'description', prop: 'description',
}, },
], ],
[
{ input: true, label: '备注', prop: 'remark' }
]
// [ // [
// { // {
// assetUpload: true, // assetUpload: true,
@ -453,36 +435,36 @@ export default {
computedRows() { computedRows() {
return this.showUploadComponents return this.showUploadComponents
? [ ? [
...this.rows, ...this.rows,
[ [
{ {
assetUpload: true, assetUpload: true,
key: 'eq-assets', // key: 'eq-assets', //
label: '上传资料', label: '上传资料',
fieldName: 'assets', fieldName: 'assets',
subcomponent: AssetsUpload, subcomponent: AssetsUpload,
prop: 'uploadedAssets', prop: 'uploadedAssets',
default: [], default: [],
bind: { bind: {
'is-pic-mode': false, 'is-pic-mode': false,
},
}, },
], },
[ ],
{ [
assetUpload: true, {
key: 'eq-pics', // assetUpload: true,
label: '上传图片', key: 'eq-pics', //
fieldName: 'images', label: '上传图片',
subcomponent: AssetsUpload, fieldName: 'images',
// prop: '', subcomponent: AssetsUpload,
// default: [], // prop: '',
bind: { // default: [],
'is-pic-mode': true, bind: {
}, 'is-pic-mode': true,
}, },
], },
] ],
]
: this.rows; : this.rows;
}, },
}, },
@ -580,7 +562,7 @@ export default {
this.getList(); this.getList();
this.$modal.msgSuccess('删除成功'); this.$modal.msgSuccess('删除成功');
}) })
.catch(() => {}); .catch(() => { });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -598,7 +580,7 @@ export default {
this.$download.excel(response, '设备.xls'); this.$download.excel(response, '设备.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => {}); .catch(() => { });
}, },
// //
viewDetail(id) { viewDetail(id) {

View File

@ -70,13 +70,13 @@ export default {
return { return {
searchBarKeys: ['name'], searchBarKeys: ['name'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:equipment-type:update') this.$auth.hasPermi('base:core-equipment-type:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '修改', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:equipment-type:delete') this.$auth.hasPermi('base:core-equipment-type:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
@ -112,7 +112,7 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:equipment-type:create') type: this.$auth.hasPermi('base:core-equipment-type:create')
? 'button' ? 'button'
: '', : '',
btnName: '新增', btnName: '新增',
@ -237,25 +237,6 @@ export default {
const id = row.id; const id = row.id;
getEquipmentType(id).then((response) => { getEquipmentType(id).then((response) => {
this.form = response.data; this.form = response.data;
// this.form = {
// code: 'SBLX20230925184444000041',
// name: '131',
// remark: '',
// id: '1706258479729336322',
// files: [
// { fileName: '1.png', fileUrl: '', fileType: 2 },
// { fileName: '1.asdfaslkjfkasdf.png', fileUrl: '', fileType: 2 },
// { fileName: '2.txt', fileUrl: '', fileType: 2 },
// { fileName: '1.rar', fileUrl: '', fileType: 2 },
// { fileName: '1.kkk', fileUrl: '', fileType: 2 },
// { fileName: 'test.file', fileUrl: '', fileType: 2 },
// { fileName: '222', fileUrl: '', fileType: 2 },
// { fileName: 'g', fileUrl: '', fileType: 2 },
// ],
// createTime: 1695638697000,
// parentId: '1701869972319584257',
// };
// debugger;
this.open = true; this.open = true;
this.title = '修改设备类型'; this.title = '修改设备类型';
}); });

View File

@ -0,0 +1,301 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:has-files="true"
:rows="rows" />
</base-dialog>
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import {
createEquipmentType,
updateEquipmentType,
deleteEquipmentType,
getEquipmentType,
getEquipmentTypePage,
exportEquipmentTypeExcel,
} from '@/api/base/equipmentType';
// import { getAccessToken } from '@/utils/auth';
export default {
name: 'EquipmentType',
components: {},
mixins: [basicPageMixin],
data() {
return {
searchBarKeys: ['name'],
tableBtn: [
this.$auth.hasPermi('base:core-equipment-type:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:core-equipment-type:delete')
? {
type: 'delete',
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: '设备类型名称' },
{ prop: 'code', label: '检测类型编码' },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
{
type: 'input',
label: '设备类型',
placeholder: '请输入设备类型名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:core-equipment-type:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:quality-inspection-type: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/core-equipment-type/getCode',
},
],
[
{
select: true,
label: '父类',
prop: 'parentId',
url: '/base/core-equipment-type/page?pageNo=1&pageSize=100',
},
{},
],
[
{
upload: true,
label: '上传资料',
prop: 'files',
},
],
[{ input: true, label: '备注', prop: 'remark' }],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: '',
},
//
form: {},
};
},
watch: {
// form: {
// handler: function (val, oldVal) {
// console.log('[watch:form]', val, oldVal);
// },
// deep: true,
// },
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getEquipmentTypePage(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,
parentId: 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;
getEquipmentType(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) {
updateEquipmentType(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentType(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除设备类型"' + row.name + '"?')
.then(function () {
return deleteEquipmentType(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 exportEquipmentTypeExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备类型.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB