271 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			271 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
| 	<div class="app-container">
 | |
| 		<!-- 搜索工作栏 -->
 | |
| 		<SearchBar
 | |
| 			:formConfigs="searchBarFormConfig"
 | |
| 			ref="search-bar"
 | |
| 			@headBtnClick="handleSearchBarBtnClick" />
 | |
| 
 | |
| 		<!-- 列表 -->
 | |
| 		<base-table
 | |
| 			:table-props="tableProps"
 | |
| 			:page="queryParams.pageNo"
 | |
| 			:limit="queryParams.pageSize"
 | |
| 			:table-data="list"
 | |
| 			@emitFun="handleEmitFun"
 | |
| 			:max-height="tableH">
 | |
| 			<method-btn
 | |
| 				v-if="tableBtn.length"
 | |
| 				slot="handleBtn"
 | |
| 				label="操作"
 | |
| 				:width="80"
 | |
| 				fixed="right"
 | |
| 				:method-list="tableBtn"
 | |
| 				@clickBtn="handleTableBtnClick" />
 | |
| 		</base-table>
 | |
| 
 | |
| 		<!-- 分页组件 -->
 | |
| 		<pagination
 | |
| 			v-show="total > 0"
 | |
| 			:total="total"
 | |
| 			:page.sync="queryParams.pageNo"
 | |
| 			:limit.sync="queryParams.pageSize"
 | |
| 			@pagination="getList" />
 | |
| 
 | |
| 		<!-- 对话框(添加 / 修改) -->
 | |
| 		<base-dialog
 | |
| 			:dialogTitle="title"
 | |
| 			:dialogVisible="open"
 | |
| 			width="50%"
 | |
| 			@close="cancel"
 | |
| 			@cancel="cancel"
 | |
| 			@confirm="submitForm">
 | |
| 			<DialogForm v-if="open" ref="form" v-model="form"/>
 | |
| 		</base-dialog>
 | |
| 	</div>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| import {
 | |
| 	createQualityInspectionBoxBtn,
 | |
| 	updateQualityInspectionBoxBtn,
 | |
| 	deleteQualityInspectionBoxBtn,
 | |
| 	getQualityInspectionBoxBtn,
 | |
| 	getQualityInspectionBoxBtnPage,
 | |
| 	exportQualityInspectionBoxBtnExcel,
 | |
| } from '@/api/base/qualityInspectionBoxBtn';
 | |
| import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | |
| import moment from 'moment';
 | |
| import DialogForm from './dialogForm.vue';
 | |
| import tableHeightMixin from '@/mixins/tableHeightMixin';
 | |
| 
 | |
| export default {
 | |
| 	name: 'QualityInspectionBoxBtn',
 | |
| 	mixins: [basicPageMixin, tableHeightMixin],
 | |
| 	components: { DialogForm },
 | |
| 	data() {
 | |
| 		return {
 | |
| 			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'),
 | |
| 				},
 | |
| 				{
 | |
| 					prop: 'productionLineName',
 | |
| 					label: '产线',
 | |
| 					showOverflowtooltip: true,
 | |
| 				},
 | |
| 				{
 | |
| 					prop: 'sectionName',
 | |
| 					label: '工段',
 | |
| 					showOverflowtooltip: true,
 | |
| 				},
 | |
| 				{
 | |
| 					prop: 'inspectionDetContent',
 | |
| 					label: '检测内容',
 | |
| 					showOverflowtooltip: true,
 | |
| 				},
 | |
| 				{
 | |
| 					width: 160,
 | |
| 					prop: 'buttonId',
 | |
| 					label: '按钮盒识别码',
 | |
| 				},
 | |
| 				{
 | |
| 					width: 90,
 | |
| 					prop: 'keyValue',
 | |
| 					label: '按钮值',
 | |
| 					showOverflowtooltip: true,
 | |
| 				},
 | |
| 				{
 | |
| 					width: 128,
 | |
| 					prop: 'model',
 | |
| 					label: '按钮盒模式',
 | |
| 					showOverflowtooltip: true,
 | |
| 				},
 | |
| 			],
 | |
| 			// 查询参数
 | |
| 			queryParams: {
 | |
| 				pageNo: 1,
 | |
| 				pageSize: 20,
 | |
| 				inspectionDetContent: null,
 | |
| 			},
 | |
| 			// 搜索框需要的 keys, 与上面 queryParams 的除 pageNo, pageSize 之外的 key 一一对应
 | |
| 			searchBarKeys: ['inspectionDetContent'],
 | |
| 			form: {
 | |
| 				id: null,
 | |
| 				buttonId: null,
 | |
| 				inspectionDetId: null,
 | |
| 				inspectionDetContent: null,
 | |
| 				productionLineId: null,
 | |
| 				sectionId: null,
 | |
| 				model: null,
 | |
| 				keyValue: null,
 | |
| 			},
 | |
| 		};
 | |
| 	},
 | |
| 	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 = {
 | |
| 				id: null,
 | |
| 				buttonId: null,
 | |
| 				inspectionDetId: null,
 | |
| 				inspectionDetContent: null,
 | |
| 				productionLineId: null,
 | |
| 				sectionId: null,
 | |
| 				model: null,
 | |
| 				keyValue: null,
 | |
| 			},
 | |
| 			this.resetForm('form');
 | |
| 		},
 | |
| 		/** 新增按钮操作 */
 | |
| 		handleAdd() {
 | |
| 			this.reset();
 | |
| 			this.open = true;
 | |
| 			this.title = '新增';
 | |
| 		},
 | |
| 		/** 修改按钮操作 */
 | |
| 		handleUpdate(row) {
 | |
| 			this.reset();
 | |
| 			const id = row.id;
 | |
| 			getQualityInspectionBoxBtn(id).then((response) => {
 | |
| 				this.form = response.data;
 | |
| 				this.open = true;
 | |
| 				this.title = '编辑';
 | |
| 			});
 | |
| 		},
 | |
| 		/** 提交按钮 */
 | |
| 		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
 | |
| 				.delConfirm(row.buttonId)
 | |
| 				.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(() => {});
 | |
| 		},
 | |
| 	},
 | |
| };
 | |
| </script>
 |