lb #9

Merged
g7hoo merged 18 commits from lb into test 2023-08-03 15:15:37 +08:00
2 changed files with 147 additions and 117 deletions
Showing only changes of commit 77688fed77 - Show all commits

View File

@ -1,109 +1,26 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <SearchBar
:model="queryParams" :formConfigs="searchBarFormConfig"
ref="queryForm" ref="search-bar"
size="small" @headBtnClick="handleSearchBarBtnClick" />
:inline="true"
v-show="showSearch"
label-width="68px">
<el-form-item label="检测内容" prop="content">
<el-input
v-model="queryParams.content"
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:quality-inspection-det: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:quality-inspection-det: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="检测类型id" align="center" prop="typeId" /> :page="queryParams.pageNo"
<el-table-column label="检测内容" align="center" prop="content" /> :limit="queryParams.pageSize"
<el-table-column label="检测编码" align="center" prop="code" /> :table-data="list"
<el-table-column label="备注" align="center" prop="remark" /> @emit-fun="handleEmitFun">
<el-table-column <method-btn
label="创建时间" v-if="tableBtn.length"
align="center" slot="handleBtn"
prop="createTime"
width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作" label="操作"
align="center" :method-list="tableBtn"
class-name="small-padding fixed-width"> @clickBtn="handleTableBtnClick" />
<template v-slot="scope"> </base-table>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:quality-inspection-det:update']">
修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:quality-inspection-det:delete']">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination
v-show="total > 0" v-show="total > 0"
@ -113,13 +30,12 @@
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog <base-dialog
:title="title" :dialogTitle="title"
:visible.sync="open" :dialogVisible="open"
width="500px" @cancel="cancel"
v-dialogDrag @confirm="submitForm">
append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="检测类型id" prop="typeId"> <el-form-item label="检测类型id" prop="typeId">
<el-select v-model="form.typeId" placeholder="请选择检测类型id"> <el-select v-model="form.typeId" placeholder="请选择检测类型id">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
@ -135,11 +51,8 @@
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> </base-dialog>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -158,6 +71,82 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
searchBarFormConfig: [
{
type: 'input',
label: '检测内容',
placeholder: '请输入检测内容',
param: 'content',
},
{
type: 'datePicker',
label: '创建时间',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'createTime',
width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-inspection-det:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
tableBtn: [
this.$auth.hasPermi('base:quality-inspection-det:update') ? {
type: 'edit',
btnName: '修改',
} : undefined,
this.$auth.hasPermi('base:quality-inspection-det:delete') ? {
type: 'delete',
btnName: '删除',
} : undefined,
].filter(v=>v),
tableData: [],
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'typeId', label: '检测类型ID', align: 'center' },
{ prop: 'content', label: '检测类型内容', align: 'center' },
{ prop: 'code', label: '检测编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' },
],
// //
loading: true, loading: true,
// //
@ -196,6 +185,47 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
/** base table related */
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
}
},
/** search bar related */
handleSearchBarBtnClick(btn) {
const keys = ['name', 'createTime']; // timeVal
switch (btn.btnName) {
case 'search':
keys.forEach((key) => {
if (key == 'timeVal') {
this.queryParams['startTime'] = btn.timeVal[0];
this.queryParams['endTime'] = btn.timeVal[1];
return;
}
this.queryParams[key] = btn[key] || null;
});
this.handleQuery();
break;
case 'add':
this.handleAdd();
break;
case 'export':
this.handleExport();
break;
case 'reset':
this.$refs['search-bar'].resetForm();
this.resetQuery();
break;
}
},
handleEmitFun(val) {
console.log('emit unf', val);
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;

View File

@ -69,15 +69,15 @@ export default {
data() { data() {
return { return {
tableBtn: [ tableBtn: [
{ this.$auth.hasPermi('base:quality-inspection-type:update') ? {
type: 'edit', type: 'edit',
btnName: '修改', btnName: '修改',
}, } : undefined,
{ this.$auth.hasPermi('base:quality-inspection-type:delete') ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
}, } : undefined,
], ].filter(v=>v),
tableData: [], tableData: [],
tableProps: [ tableProps: [
{ {