优化页面字段

This commit is contained in:
BianLzhaoMin 2024-07-16 10:46:02 +08:00
parent 54077911c4
commit d35f8799ae
2 changed files with 418 additions and 288 deletions

View File

@ -1,19 +1,38 @@
<template> <template>
<div class="app-container" id="safeTools"> <div class="app-container" id="safeTools">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="80px"
>
<el-form-item label="供应商名称" prop="dictName"> <el-form-item label="供应商名称" prop="dictName">
<el-input <el-input
v-model="queryParams.dictName" v-model="queryParams.dictName"
placeholder="请输入供应商名称" placeholder="请输入供应商名称"
clearable maxlength="50" clearable
maxlength="50"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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-item>
</el-form> </el-form>
@ -25,7 +44,8 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
@ -56,7 +76,8 @@
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -65,50 +86,116 @@
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
@click="handleRefreshCache" @click="handleRefreshCache"
>刷新缓存</el-button> >刷新缓存</el-button
>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="typeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(queryParams.pageNum, queryParams.pageSize)"> <el-table-column
label="序号"
align="center"
width="80"
type="index"
:index="
indexContinuation(queryParams.pageNum, queryParams.pageSize)
"
>
<!-- <template scope="scope"> <!-- <template scope="scope">
<span>{{ (queryParams.pageNum - 1) * 10 + scope.$index + 1 }}</span> <span>{{ (queryParams.pageNum - 1) * 10 + scope.$index + 1 }}</span>
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column label="工器具类型" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column
<el-table-column label="规格型号" align="center" prop="dictName" :show-overflow-tooltip="true" /> label="工器具类型"
<el-table-column label="设备编号" align="center" prop="dictName" :show-overflow-tooltip="true" /> align="center"
<el-table-column label="设备状态" align="center" prop="dictName" :show-overflow-tooltip="true" /> prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="设备编号"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="设备状态"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column label="固定资产编号" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column
<el-table-column label="设备原编号" align="center" prop="dictName" :show-overflow-tooltip="true" /> label="固定资产编号"
<el-table-column label="购置批次" align="center" prop="dictName" :show-overflow-tooltip="true" /> align="center"
<el-table-column label="绑定标签" align="center" prop="dictName" :show-overflow-tooltip="true" /> prop="dictName"
<el-table-column label="所在仓库" align="center" prop="dictName" :show-overflow-tooltip="true" /> :show-overflow-tooltip="true"
/>
<el-table-column
label=""
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="购置批次"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="绑定标签"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="所在仓库"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>编辑</el-button> >编辑</el-button
>
<el-button <el-button
size="mini" size="mini"
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -116,10 +203,24 @@
/> />
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> :title="title"
:visible.sync="open"
width="600px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="120px"
>
<el-form-item label="单位类型名称" prop="dictName"> <el-form-item label="单位类型名称" prop="dictName">
<el-input v-model="form.dictName" placeholder="请输入单位类型名称" maxlength="50"/> <el-input
v-model="form.dictName"
placeholder="请输入单位类型名称"
maxlength="50"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="字典类型" prop="dictType">--> <!-- <el-form-item label="字典类型" prop="dictType">-->
<!-- <el-input v-model="form.dictType" placeholder="请输入字典类型" />--> <!-- <el-input v-model="form.dictType" placeholder="请输入字典类型" />-->
@ -146,10 +247,17 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; import {
listType,
getType,
delType,
addType,
updateType,
refreshCache,
} from '@/api/system/dict/type'
export default { export default {
name: "SafeTools", name: 'SafeTools',
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
data() { data() {
return { return {
@ -168,7 +276,7 @@ export default {
// //
typeList: [], typeList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -179,39 +287,48 @@ export default {
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined,
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
dictName: [ dictName: [
{ required: true, message: "字典名称不能为空", trigger: "blur" } {
required: true,
message: '字典名称不能为空',
trigger: 'blur',
},
], ],
dictType: [ dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" } {
] required: true,
message: '字典类型不能为空',
trigger: 'blur',
},
],
},
} }
};
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true; this.loading = true
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(
this.typeList = response.rows; (response) => {
this.total = response.total; this.typeList = response.rows
this.loading = false; this.total = response.total
} this.loading = false
); },
)
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -219,89 +336,97 @@ export default {
dictId: undefined, dictId: undefined,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: "0", status: '0',
remark: undefined remark: undefined,
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
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 = '添加字典类型'
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId) this.ids = selection.map((item) => item.dictId)
this.single = selection.length!=1 this.single = selection.length != 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
const dictId = row.dictId || this.ids const dictId = row.dictId || this.ids
getType(dictId).then(response => { getType(dictId).then((response) => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改字典类型"; this.title = '修改字典类型'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId != undefined) {
updateType(this.form).then(response => { updateType(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addType(this.form).then(response => { addType(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids
this.$modal.confirm('是否确认删除所选择的数据项?').then(function() { this.$modal
return delType(dictIds); .confirm('是否确认删除所选择的数据项?')
}).then(() => { .then(function () {
this.getList(); return delType(dictIds)
this.$modal.msgSuccess("删除成功"); })
}).catch(() => {}); .then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/dict/type/export', { this.download(
...this.queryParams 'system/dict/type/export',
}, `type_${new Date().getTime()}.xlsx`) {
...this.queryParams,
},
`type_${new Date().getTime()}.xlsx`,
)
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess('刷新成功')
this.$store.dispatch('dict/cleanDict'); this.$store.dispatch('dict/cleanDict')
}); })
} },
} },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini { ::v-deep.el-table .fixed-width .el-button--mini {

View File

@ -220,10 +220,15 @@
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
label="IOT设备" label="IOT设备"
align="center" align="center"
prop="ownHouseName" prop="ownHouseName"
/> -->
<el-table-column
label="所在仓库"
align="center"
prop="ownHouseName"
/> />
<!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">--> <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->