2023-08-18 15:39:34 +08:00
|
|
|
import DialogForm from '@/components/DialogForm/index.vue';
|
2023-08-03 13:37:24 +08:00
|
|
|
|
2023-08-02 11:27:33 +08:00
|
|
|
export default {
|
2023-08-03 13:37:24 +08:00
|
|
|
components: { DialogForm },
|
2023-08-02 11:27:33 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
// 遮罩层
|
|
|
|
loading: true,
|
|
|
|
// 导出遮罩层
|
|
|
|
exportLoading: false,
|
|
|
|
// 显示搜索条件
|
|
|
|
showSearch: true,
|
|
|
|
// 总条数
|
|
|
|
total: 0,
|
|
|
|
// 质量检测信息基础列表
|
|
|
|
list: [],
|
|
|
|
// 弹出层标题
|
|
|
|
title: '',
|
|
|
|
// 是否显示弹出层
|
|
|
|
open: false,
|
|
|
|
// 列表数据
|
|
|
|
tableData: [],
|
2023-08-03 11:19:06 +08:00
|
|
|
// 弹窗的表单
|
|
|
|
// form: {}, // 占位
|
|
|
|
// 搜索框需要的 keys
|
|
|
|
// searchBarKeys: [], // 占位
|
|
|
|
// tableProps: [], // 占位
|
|
|
|
// tableBtn: [], // 占位
|
|
|
|
// searchBarFormConfig: [], // 占位
|
|
|
|
// // 弹窗表单配置
|
|
|
|
// dialogFormConfig: [], // 占位
|
2023-08-02 11:27:33 +08:00
|
|
|
};
|
|
|
|
},
|
2023-08-03 11:19:06 +08:00
|
|
|
mounted() {},
|
2023-08-02 11:27:33 +08:00
|
|
|
methods: {
|
2023-08-04 11:08:21 +08:00
|
|
|
// 过滤后端传回的详情数据
|
|
|
|
filterData(data, keys) {
|
|
|
|
const obj = {};
|
|
|
|
keys.forEach((key) => {
|
|
|
|
if (/time/i.test(key)) {
|
|
|
|
obj[key] = new Date(data[key]);
|
|
|
|
} else {
|
|
|
|
obj[key] = data[key];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return obj;
|
|
|
|
},
|
2023-08-02 11:27:33 +08:00
|
|
|
// 处理搜索条件
|
|
|
|
handleSearchBarBtnClick() {},
|
2023-08-03 11:19:06 +08:00
|
|
|
// 处理表格按钮
|
2023-08-02 11:27:33 +08:00
|
|
|
handleTableBtnClick({ data, type }) {
|
|
|
|
switch (type) {
|
|
|
|
case 'edit':
|
|
|
|
this.handleUpdate(data);
|
|
|
|
break;
|
|
|
|
case 'delete':
|
|
|
|
this.handleDelete(data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 处理搜索栏按钮
|
|
|
|
handleSearchBarBtnClick(btn) {
|
2023-08-03 11:19:06 +08:00
|
|
|
// const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代
|
2023-08-02 11:27:33 +08:00
|
|
|
switch (btn.btnName) {
|
|
|
|
case 'search':
|
2023-08-03 11:19:06 +08:00
|
|
|
this.searchBarKeys.forEach((key) => {
|
2023-08-02 11:27:33 +08:00
|
|
|
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() {},
|
2023-08-03 11:19:06 +08:00
|
|
|
/** 搜索按钮操作 */
|
|
|
|
handleQuery() {
|
|
|
|
this.queryParams.pageNo = 1;
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
resetQuery() {
|
|
|
|
this.resetForm('queryForm');
|
|
|
|
this.handleQuery();
|
|
|
|
},
|
2023-08-03 13:37:24 +08:00
|
|
|
/** 取消按钮 */
|
|
|
|
cancel() {
|
|
|
|
this.open = false;
|
|
|
|
this.reset();
|
|
|
|
},
|
2023-08-02 11:27:33 +08:00
|
|
|
},
|
|
|
|
};
|