yudao-dev/src/views/quality/base/basicData/qualityInspectionBoxBtn/index.vue

214 lines
5.7 KiB
Vue
Raw Normal View History

2023-07-27 15:16:13 +08:00
<template>
2023-12-13 16:50:55 +08:00
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="buttonClick" />
2023-07-27 15:16:13 +08:00
2023-12-13 16:50:55 +08:00
<!-- 列表 -->
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
2023-07-27 15:16:13 +08:00
2023-12-13 16:50:55 +08:00
<!-- 分页组件 -->
2023-12-15 16:27:30 +08:00
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" /> -->
2023-07-27 15:16:13 +08:00
2023-12-13 16:50:55 +08:00
<!-- 对话框(添加 / 修改) -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" width="50%" @cancel="handleCancel"
@confirm="handleConfirm" :before-close="handleCancel">
<add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update>
</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';
2023-12-13 16:50:55 +08:00
import basicPage from '../../mixins/basic-page';
2023-08-03 14:04:25 +08:00
import moment from 'moment';
2023-12-13 16:50:55 +08:00
import addOrUpdate from './dialogForm.vue';
2023-07-27 15:16:13 +08:00
export default {
2023-08-03 14:04:25 +08:00
name: 'QualityInspectionBoxBtn',
2023-12-13 16:50:55 +08:00
mixins: [basicPage],
components: { addOrUpdate },
2023-08-03 14:04:25 +08:00
data() {
2023-12-13 16:50:55 +08:00
return {
urlOptions: {
getDataListURL: getQualityInspectionBoxBtnPage,
deleteURL: deleteQualityInspectionBoxBtn,
// exportURL: exportFactoryExcel,
},
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,
2023-12-13 16:50:55 +08:00
].filter((v) => v),
tableData: [],
2023-08-03 14:04:25 +08:00
tableProps: [
2023-12-13 16:50:55 +08:00
// {
// prop: 'createTime',
// label: '添加时间',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
2023-08-03 14:04:25 +08:00
{
2023-11-07 19:10:45 +08:00
prop: 'productionLineName',
2024-03-08 16:20:03 +08:00
label: '产线',
width:120,
2023-08-03 14:04:25 +08:00
},
{
prop: 'sectionName',
2024-03-08 16:20:03 +08:00
label: '工段',
width: 120,
2023-08-03 14:04:25 +08:00
},
{
2024-01-18 14:10:49 +08:00
prop: 'inspectionInfoList',
2023-08-03 14:04:25 +08:00
label: '检测内容',
2023-12-13 16:50:55 +08:00
}
2023-08-03 14:04:25 +08:00
],
// 查询参数
2023-12-13 16:50:55 +08:00
listQuery: {
2023-08-03 14:04:25 +08:00
pageNo: 1,
pageSize: 10,
inspectionDetContent: null,
2023-12-13 16:50:55 +08:00
},
addOrUpdateVisible: false,
addOrEditTitle:'',
// 搜索框需要的 keys, 与上面 listQuery 的除 pageNo, pageSize 之外的 key 一一对应
2023-08-03 14:04:25 +08:00
searchBarKeys: ['inspectionDetContent'],
form: {
2023-09-15 14:30:19 +08:00
id: null,
2023-09-15 14:49:31 +08:00
buttonId: null,
2023-12-13 16:50:55 +08:00
inspectionDetContent: [],
2023-11-07 19:10:45 +08:00
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() {
2023-12-13 16:50:55 +08:00
// this.getList();
2023-08-03 14:04:25 +08:00
},
methods: {
2024-01-18 14:10:49 +08:00
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.map((item) => {
// console.log(item);
return {
inspectionInfoList: item.inspectionInfoList.toString(),
productionLineId:item.productionLineId,
productionLineName:item.productionLineName,
sectionId: item.sectionId,
sectionName: item.sectionName
}
})
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
2023-08-03 14:04:25 +08:00
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');
2023-12-13 16:50:55 +08:00
},
2024-01-12 10:00:17 +08:00
deleteHandle(id, name, index, data) {
this.$confirm(`确认要删除产线名为${data.productionLineName}的数据项?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
2023-12-13 16:50:55 +08:00
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.inspectionDetContent = val.inspectionDetContent ? val.inspectionDetContent : undefined;
// this.listQuery.teamId = val.teamId ? val.teamId : undefined;
this.getDataList()
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
2023-12-15 16:27:30 +08:00
// this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
2023-12-13 16:50:55 +08:00
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
2023-08-03 14:04:25 +08:00
},
2023-07-27 15:16:13 +08:00
};
</script>