yudao-dev/src/views/devConfig/quality/qualityInspectionBoxBtn/index.vue

341 lines
7.5 KiB
Vue
Raw Normal View History

2023-07-27 15:16:13 +08:00
<template>
2023-08-03 14:04:25 +08:00
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
2023-07-27 15:16:13 +08:00
2023-08-03 14:04:25 +08:00
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
2024-07-19 10:44:17 +08:00
@emitFun="handleEmitFun"
:max-height="tableH">
2023-08-03 14:04:25 +08:00
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
2024-07-19 10:44:17 +08:00
:width="80"
2023-08-03 14:04:25 +08:00
fixed="right"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
2023-07-27 15:16:13 +08:00
2023-08-03 14:04:25 +08:00
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
2023-07-27 15:16:13 +08:00
2023-08-03 14:04:25 +08:00
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
2023-09-18 17:01:44 +08:00
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
2023-08-03 14:04:25 +08:00
</base-dialog>
</div>
2023-07-27 15:16:13 +08:00
</template>
<script>
2023-08-03 14:04:25 +08:00
import {
createQualityInspectionBoxBtn,
updateQualityInspectionBoxBtn,
deleteQualityInspectionBoxBtn,
getQualityInspectionBoxBtn,
getQualityInspectionBoxBtnPage,
exportQualityInspectionBoxBtnExcel,
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
2023-08-03 14:04:25 +08:00
import moment from 'moment';
2023-09-18 17:01:44 +08:00
import DialogForm from './dialogForm.vue';
2024-07-19 10:44:17 +08:00
import tableHeightMixin from '@/mixins/tableHeightMixin';
2023-07-27 15:16:13 +08:00
export default {
2023-08-03 14:04:25 +08:00
name: 'QualityInspectionBoxBtn',
2024-07-19 10:44:17 +08:00
mixins: [basicPageMixin, tableHeightMixin],
2023-09-18 17:01:44 +08:00
components: { DialogForm },
2023-08-03 14:04:25 +08:00
data() {
return {
rows: [
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionId',
2024-07-19 10:44:17 +08:00
rules: [
{ required: true, message: '产线不能为空', trigger: 'blur' },
],
bind: {
filterable: true,
},
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll',
prop: 'sectionId',
2024-07-19 10:44:17 +08:00
rules: [
{ required: true, message: '工段不能为空', trigger: 'blur' },
],
2023-09-18 13:52:36 +08:00
bind: {
filterable: true,
},
},
],
[
{
input: true,
label: '按钮盒识别码',
prop: 'buttonId',
rules: [
{
type: 'number',
2023-09-15 14:49:31 +08:00
message: '请输入整数',
trigger: 'blur',
2023-09-18 13:52:36 +08:00
transform: (val) =>
Number.isInteger(Number(val)) && Number(val),
},
],
},
2023-10-10 15:30:37 +08:00
{ input: true, label: '按钮盒模式', prop: 'model' },
],
[
{
input: true,
label: '按钮值',
prop: 'keyValue',
rules: [
{
type: 'number',
2023-09-18 13:52:36 +08:00
message: '请输入100以内的整数',
trigger: 'blur',
2023-09-18 17:01:44 +08:00
transform: (val) =>
Number(val) <= 100 && Number.isInteger(+val) && Number(val),
},
],
bind: { type: 'number', min: 0, max: 100 },
2024-07-19 10:44:17 +08:00
},
{
select: true,
label: '检测内容',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
],
],
2023-08-03 14:04:25 +08:00
searchBarFormConfig: [
{
type: 'input',
label: '检查内容',
placeholder: '请输入检查内容',
param: 'inspectionDetContent',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-inspection-box-btn:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
],
tableBtn: [
this.$auth.hasPermi('base:quality-inspection-box-btn:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:quality-inspection-box-btn: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'),
},
{
2024-07-19 10:44:17 +08:00
prop: 'productionLineName',
2023-08-03 14:04:25 +08:00
label: '产线',
2024-07-19 10:44:17 +08:00
showOverflowtooltip: true,
2023-08-03 14:04:25 +08:00
},
{
prop: 'sectionName',
label: '工段',
2024-07-19 10:44:17 +08:00
showOverflowtooltip: true,
2023-08-03 14:04:25 +08:00
},
{
prop: 'inspectionDetContent',
label: '检测内容',
2024-07-19 10:44:17 +08:00
showOverflowtooltip: true,
2023-08-03 14:04:25 +08:00
},
{
width: 160,
prop: 'buttonId',
label: '按钮盒识别码',
},
2024-07-19 10:44:17 +08:00
{
width: 90,
prop: 'keyValue',
label: '按钮值',
showOverflowtooltip: true,
},
{
width: 128,
prop: 'model',
label: '按钮盒模式',
showOverflowtooltip: true,
},
2023-08-03 14:04:25 +08:00
],
// 查询参数
queryParams: {
pageNo: 1,
2024-07-19 10:44:17 +08:00
pageSize: 20,
2023-08-03 14:04:25 +08:00
inspectionDetContent: null,
},
// 搜索框需要的 keys, 与上面 queryParams 的除 pageNo, pageSize 之外的 key 一一对应
searchBarKeys: ['inspectionDetContent'],
form: {
2023-09-15 14:30:19 +08:00
id: null,
2023-09-15 14:49:31 +08:00
buttonId: null,
2024-07-19 10:44:17 +08:00
inspectionDetId: null,
productionLineId: null,
2023-09-15 14:30:19 +08:00
sectionId: null,
model: null,
keyValue: null,
2023-08-03 14:04:25 +08:00
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
// 执行查询
getQualityInspectionBoxBtnPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 表单重置 */
reset() {
this.form = {
2023-09-15 14:30:19 +08:00
id: null,
2023-09-15 14:49:31 +08:00
buttonId: null,
2023-09-15 14:30:19 +08:00
inspectionDetContent: null,
productionId: null,
sectionId: null,
model: null,
keyValue: null,
2023-08-03 14:04:25 +08:00
};
this.resetForm('form');
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
2024-07-19 10:44:17 +08:00
this.title = '新增';
2023-08-03 14:04:25 +08:00
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getQualityInspectionBoxBtn(id).then((response) => {
this.form = response.data;
this.open = true;
2024-07-19 10:44:17 +08:00
this.title = '编辑';
2023-08-03 14:04:25 +08:00
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
2024-07-22 16:49:10 +08:00
.delConfirm(row.buttonId)
2023-08-03 14:04:25 +08:00
.then(function () {
return deleteQualityInspectionBoxBtn(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有安灯按钮16键对应数据项?')
.then(() => {
this.exportLoading = true;
return exportQualityInspectionBoxBtnExcel(params);
})
.then((response) => {
this.$download.excel(response, '安灯按钮16键对应.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
2023-07-27 15:16:13 +08:00
};
</script>