projects/mesxc-lb #149
@@ -6,19 +6,427 @@
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="SpecialEquipmentCheckConfig"></div>
 | 
			
		||||
	<div class="app-container SpecialEquipmentCheckConfig">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<SearchBar
 | 
			
		||||
			:formConfigs="searchBarFormConfig"
 | 
			
		||||
			ref="search-bar"
 | 
			
		||||
			@select-changed="handleSearchBarChange"
 | 
			
		||||
			@headBtnClick="handleSearchBarBtnClick" />
 | 
			
		||||
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:width="180"
 | 
			
		||||
				: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"
 | 
			
		||||
			@close="cancel"
 | 
			
		||||
			@cancel="cancel"
 | 
			
		||||
			@confirm="handleConfirm">
 | 
			
		||||
			<add ref="add" @refreshDataList="successSubmit" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
		<!-- 添加巡检,查看详情 -->
 | 
			
		||||
		<addOrUpdata
 | 
			
		||||
			v-if="addOrUpdateVisible"
 | 
			
		||||
			ref="addOrUpdate"
 | 
			
		||||
			@refreshDataList="getList" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import addOrUpdata from './add-or-updata.vue';
 | 
			
		||||
import add from './add.vue';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'SpecialEquipmentCheckConfig',
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	components: { addOrUpdata, add },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {};
 | 
			
		||||
		return {
 | 
			
		||||
			addOrUpdateVisible: false,
 | 
			
		||||
			addOrEditTitle: '',
 | 
			
		||||
			searchBarKeys: ['equipmentId', 'name', 'specialType'],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('equipment:check-setting:addInsp')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'add',
 | 
			
		||||
							btnName: '添加',
 | 
			
		||||
							showTip: '添加巡检',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:check-setting:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '修改',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:check-setting:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'detail',
 | 
			
		||||
							btnName: '查看详情',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:check-setting:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'name',
 | 
			
		||||
					label: '配置名',
 | 
			
		||||
					width: 110,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'lineName', label: '产线', showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'equipmentCategory',
 | 
			
		||||
					label: '设备大类',
 | 
			
		||||
					filter: (val) =>
 | 
			
		||||
						val != null ? ['-', '安全', '消防', '特种'][val] : '-',
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'equipmentName', label: '设备', showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'equipmentCode',
 | 
			
		||||
					label: '设备编码',
 | 
			
		||||
					minWidth: 150,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'responsible', label: '负责人' },
 | 
			
		||||
				{ prop: 'remark', label: '描述' },
 | 
			
		||||
				{ prop: 'checkNumber', label: '巡检条数' }, // TODO: 操作 选项,四个,群里询问
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '配置名称',
 | 
			
		||||
					placeholder: '请输入配置名称',
 | 
			
		||||
					param: 'name',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '设备大类',
 | 
			
		||||
					placeholder: '请选择设备大类',
 | 
			
		||||
					param: 'specialType',
 | 
			
		||||
					onchange: true,
 | 
			
		||||
					selectOptions: [
 | 
			
		||||
						{ id: 1, name: '安全设备' },
 | 
			
		||||
						{ id: 2, name: '消防设备' },
 | 
			
		||||
						{ id: 3, name: '特种设备' },
 | 
			
		||||
					],
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '设备名称',
 | 
			
		||||
					placeholder: '请选择设备',
 | 
			
		||||
					param: 'equipmentId',
 | 
			
		||||
					filterable: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('equipment:check-setting:create')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'success',
 | 
			
		||||
				},
 | 
			
		||||
				// {
 | 
			
		||||
				// 	type: this.$auth.hasPermi('equipment:check-setting:export')
 | 
			
		||||
				// 		? 'button'
 | 
			
		||||
				// 		: '',
 | 
			
		||||
				// 	btnName: '导出',
 | 
			
		||||
				// 	name: 'export',
 | 
			
		||||
				// 	color: 'warning',
 | 
			
		||||
				// },
 | 
			
		||||
			],
 | 
			
		||||
			rows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '配置名称',
 | 
			
		||||
						prop: 'name',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '配置名称不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '配置编码',
 | 
			
		||||
						prop: 'code',
 | 
			
		||||
						url: '/base/equipment-check-config/getCode',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '配置编码不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '设备名称',
 | 
			
		||||
						prop: 'equipmentId',
 | 
			
		||||
						url: '/base/core-equipment/listAll',
 | 
			
		||||
						bind: {
 | 
			
		||||
							filterable: true,
 | 
			
		||||
							clearable: true,
 | 
			
		||||
						},
 | 
			
		||||
						rules: [
 | 
			
		||||
							{
 | 
			
		||||
								required: true,
 | 
			
		||||
								message: '设备名称不能为空',
 | 
			
		||||
								trigger: 'change',
 | 
			
		||||
							},
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '设备编码', // TODO: 和设备名称联动估计
 | 
			
		||||
						prop: 'equipmentCode',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			],
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			open: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
				name: null,
 | 
			
		||||
				special: true,
 | 
			
		||||
				specialType: null,
 | 
			
		||||
			},
 | 
			
		||||
			// 表单参数
 | 
			
		||||
			form: {},
 | 
			
		||||
			basePath: '/base/equipment-check-config',
 | 
			
		||||
			mode: null,
 | 
			
		||||
			allSpecialEquipments: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.initSearchBar();
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		handleConfirm() {
 | 
			
		||||
			this.$refs.add.dataFormSubmit();
 | 
			
		||||
		},
 | 
			
		||||
		successSubmit() {
 | 
			
		||||
			this.cancel();
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		initSearchBar() {
 | 
			
		||||
			this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
 | 
			
		||||
				this.allSpecialEquipments = data.filter((item) => item.special);
 | 
			
		||||
				this.setSearchBarEquipmentList(data.filter((item) => item.special));
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 设备大类改变
 | 
			
		||||
		handleSearchBarChange({ param, value }) {
 | 
			
		||||
			if ('specialType' === param) {
 | 
			
		||||
				if (!value) {
 | 
			
		||||
					this.setSearchBarEquipmentList(this.allSpecialEquipments);
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				this.setSearchBarEquipmentList(
 | 
			
		||||
					this.allSpecialEquipments.filter((item) => item.specialType == value)
 | 
			
		||||
				);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		setSearchBarEquipmentList(eqList) {
 | 
			
		||||
			this.$set(
 | 
			
		||||
				this.searchBarFormConfig[2],
 | 
			
		||||
				'selectOptions',
 | 
			
		||||
				eqList.map((item) => ({
 | 
			
		||||
					name: item.name,
 | 
			
		||||
					id: item.id,
 | 
			
		||||
				}))
 | 
			
		||||
			);
 | 
			
		||||
		},
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			this.loading = true;
 | 
			
		||||
			// 执行查询
 | 
			
		||||
			this.recv(this.queryParams).then((response) => {
 | 
			
		||||
				this.list = response.data.list;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
				this.loading = false;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 取消按钮 */
 | 
			
		||||
		cancel() {
 | 
			
		||||
			this.$refs.add.formClear();
 | 
			
		||||
			this.open = false;
 | 
			
		||||
			this.title = '';
 | 
			
		||||
			// this.reset();
 | 
			
		||||
		},
 | 
			
		||||
		/** 表单重置 */
 | 
			
		||||
		reset() {
 | 
			
		||||
			this.form = {
 | 
			
		||||
				id: null,
 | 
			
		||||
				name: null,
 | 
			
		||||
				content: null,
 | 
			
		||||
				program: null,
 | 
			
		||||
				remark: null,
 | 
			
		||||
			};
 | 
			
		||||
			this.resetForm('form');
 | 
			
		||||
		},
 | 
			
		||||
		/** 搜索按钮操作 */
 | 
			
		||||
		handleQuery() {
 | 
			
		||||
			this.queryParams.pageNo = 1;
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 重置按钮操作 */
 | 
			
		||||
		resetQuery() {
 | 
			
		||||
			this.resetForm('queryForm');
 | 
			
		||||
			this.handleQuery();
 | 
			
		||||
		},
 | 
			
		||||
		/** 新增按钮操作 */
 | 
			
		||||
		handleAdd() {
 | 
			
		||||
			// this.reset();
 | 
			
		||||
			this.open = true;
 | 
			
		||||
			this.title = '添加巡检设置';
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.add.init();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 修改按钮操作 */
 | 
			
		||||
		handleUpdate(row) {
 | 
			
		||||
			// this.reset();
 | 
			
		||||
			// const id = row.id;
 | 
			
		||||
			// this.info({ id }).then((response) => {
 | 
			
		||||
			// 	this.form = response.data;
 | 
			
		||||
			// 	this.open = true;
 | 
			
		||||
			// 	this.title = '修改巡检设置';
 | 
			
		||||
			// });
 | 
			
		||||
			this.open = true;
 | 
			
		||||
			this.title = '修改巡检设置';
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.add.init(row.id);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 提交按钮 */
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
				if (!valid) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				// 修改的提交
 | 
			
		||||
				if (this.form.id != null) {
 | 
			
		||||
					this.put(this.form).then((response) => {
 | 
			
		||||
						this.$modal.msgSuccess('修改成功');
 | 
			
		||||
						this.open = false;
 | 
			
		||||
						this.getList();
 | 
			
		||||
					});
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				// 添加的提交
 | 
			
		||||
				this.post(this.form).then((response) => {
 | 
			
		||||
					this.$modal.msgSuccess('新增成功');
 | 
			
		||||
					this.open = false;
 | 
			
		||||
					this.getList();
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					return this.del({ id });
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		// 处理表格按钮
 | 
			
		||||
		handleTableBtnClick({ data, type }) {
 | 
			
		||||
			switch (type) {
 | 
			
		||||
				case 'edit':
 | 
			
		||||
					this.handleUpdate(data);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'delete':
 | 
			
		||||
					this.handleDelete(data);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'detail':
 | 
			
		||||
					this.handleDetail(data);
 | 
			
		||||
					break;
 | 
			
		||||
				case 'add':
 | 
			
		||||
					this.handleAddDetail(data);
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		handleDetail({ id }) {
 | 
			
		||||
			this.addOrUpdateVisible = true;
 | 
			
		||||
			this.addOrEditTitle = '详情';
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.addOrUpdate.init(id, true);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		handleAddDetail({ id }) {
 | 
			
		||||
			this.addOrUpdateVisible = true;
 | 
			
		||||
			this.addOrEditTitle = '添加巡检';
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.addOrUpdate.init(id);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 导出按钮操作 */
 | 
			
		||||
		handleExport() {
 | 
			
		||||
			// 处理查询参数
 | 
			
		||||
			let params = { ...this.queryParams };
 | 
			
		||||
			params.pageNo = undefined;
 | 
			
		||||
			params.pageSize = undefined;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认导出所有巡检设置?')
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.exportLoading = true;
 | 
			
		||||
					return exportEquipmentTypeExcel(params);
 | 
			
		||||
				})
 | 
			
		||||
				.then((response) => {
 | 
			
		||||
					this.$download.excel(response, '巡检设置.xls');
 | 
			
		||||
					this.exportLoading = false;
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	computed: {},
 | 
			
		||||
	methods: {},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,19 +6,325 @@
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="SpecialEquipmentCheckContent"></div>
 | 
			
		||||
	<div class="app-container SpecialEquipmentCheckContent">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<SearchBar
 | 
			
		||||
			:formConfigs="searchBarFormConfig"
 | 
			
		||||
			ref="search-bar"
 | 
			
		||||
			@headBtnClick="handleSearchBarBtnClick" />
 | 
			
		||||
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
		<base-table
 | 
			
		||||
			:table-props="tableProps"
 | 
			
		||||
			:page="queryParams.pageNo"
 | 
			
		||||
			:limit="queryParams.pageSize"
 | 
			
		||||
			:table-data="list"
 | 
			
		||||
			@emitFun="handleEmitFun">
 | 
			
		||||
			<method-btn
 | 
			
		||||
				v-if="tableBtn.length"
 | 
			
		||||
				slot="handleBtn"
 | 
			
		||||
				label="操作"
 | 
			
		||||
				:width="120"
 | 
			
		||||
				: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"
 | 
			
		||||
			@close="cancel"
 | 
			
		||||
			@cancel="cancel"
 | 
			
		||||
			@confirm="submitForm">
 | 
			
		||||
			<DialogForm
 | 
			
		||||
				v-if="open"
 | 
			
		||||
				ref="form"
 | 
			
		||||
				v-model="form"
 | 
			
		||||
				:disabled="mode == 'detail'"
 | 
			
		||||
				:has-files="false"
 | 
			
		||||
				:rows="rows" />
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import { deleteCheck } from '@/api/equipment/base/inspection/settings';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'SpecialEquipmentCheckContent',
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {};
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: ['content'],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				// this.$auth.hasPermi('equipment:check:update')
 | 
			
		||||
				// 	? {
 | 
			
		||||
				// 			type: 'detail',
 | 
			
		||||
				// 			btnName: '详情',
 | 
			
		||||
				// 	  }
 | 
			
		||||
				// 	: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:check:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '修改',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:check:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				{ prop: 'program', label: '巡检项目', showOverflowtooltip: true },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'content',
 | 
			
		||||
					label: '巡检内容',
 | 
			
		||||
					minWidth: 150,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'code', label: '巡检内容编码', showOverflowtooltip: true },
 | 
			
		||||
				{ prop: 'remark', label: '备注', showOverflowtooltip: true },
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					type: 'input',
 | 
			
		||||
					label: '巡检内容',
 | 
			
		||||
					placeholder: '请输入巡检内容',
 | 
			
		||||
					param: 'content',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('equipment:check:create') ? 'button' : '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'success',
 | 
			
		||||
				},
 | 
			
		||||
				// {
 | 
			
		||||
				// 	type: this.$auth.hasPermi('equipment:check:export')
 | 
			
		||||
				// 		? 'button'
 | 
			
		||||
				// 		: '',
 | 
			
		||||
				// 	btnName: '导出',
 | 
			
		||||
				// 	name: 'export',
 | 
			
		||||
				// 	color: 'warning',
 | 
			
		||||
				// },
 | 
			
		||||
			],
 | 
			
		||||
			rows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '巡检内容编号',
 | 
			
		||||
						prop: 'code',
 | 
			
		||||
						url: '/base/equipment-check/getCode',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{
 | 
			
		||||
								required: true,
 | 
			
		||||
								message: '巡检内容编号不能为空',
 | 
			
		||||
								trigger: 'blur',
 | 
			
		||||
							},
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '巡检项目',
 | 
			
		||||
						prop: 'program',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '巡检内容',
 | 
			
		||||
						prop: 'content',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '巡检内容不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '备注',
 | 
			
		||||
						prop: 'remark',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			],
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			open: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				content: null,
 | 
			
		||||
			},
 | 
			
		||||
			// 表单参数
 | 
			
		||||
			form: {
 | 
			
		||||
				code: '',
 | 
			
		||||
				program: '',
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				content: '',
 | 
			
		||||
			},
 | 
			
		||||
			basePath: '/base/equipment-check',
 | 
			
		||||
			mode: null,
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		// this.initSearchBar();
 | 
			
		||||
		this.getList();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		// initSearchBar() {
 | 
			
		||||
		// 	this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
 | 
			
		||||
		// 		this.$set(
 | 
			
		||||
		// 			this.searchBarFormConfig[0],
 | 
			
		||||
		// 			'selectOptions',
 | 
			
		||||
		// 			data.map((item) => ({
 | 
			
		||||
		// 				name: item.name,
 | 
			
		||||
		// 				id: item.id,
 | 
			
		||||
		// 			}))
 | 
			
		||||
		// 		);
 | 
			
		||||
		// 	});
 | 
			
		||||
		// },
 | 
			
		||||
		/** 查询列表 */
 | 
			
		||||
		getList() {
 | 
			
		||||
			this.loading = true;
 | 
			
		||||
			// 执行查询
 | 
			
		||||
			this.recv(this.queryParams).then((response) => {
 | 
			
		||||
				this.list = response.data.list;
 | 
			
		||||
				this.total = response.data.total;
 | 
			
		||||
				this.loading = false;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 取消按钮 */
 | 
			
		||||
		cancel() {
 | 
			
		||||
			this.open = false;
 | 
			
		||||
			this.mode = null;
 | 
			
		||||
			this.reset();
 | 
			
		||||
		},
 | 
			
		||||
		/** 表单重置 */
 | 
			
		||||
		reset() {
 | 
			
		||||
			this.form = {
 | 
			
		||||
				id: null,
 | 
			
		||||
				name: null,
 | 
			
		||||
				content: null,
 | 
			
		||||
				program: null,
 | 
			
		||||
				remark: null,
 | 
			
		||||
			};
 | 
			
		||||
			this.resetForm('form');
 | 
			
		||||
		},
 | 
			
		||||
		/** 搜索按钮操作 */
 | 
			
		||||
		handleQuery() {
 | 
			
		||||
			this.queryParams.pageNo = 1;
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 重置按钮操作 */
 | 
			
		||||
		resetQuery() {
 | 
			
		||||
			this.resetForm('queryForm');
 | 
			
		||||
			this.handleQuery();
 | 
			
		||||
		},
 | 
			
		||||
		/** 新增按钮操作 */
 | 
			
		||||
		handleAdd() {
 | 
			
		||||
			// this.reset();
 | 
			
		||||
			this.open = true;
 | 
			
		||||
			this.title = '添加巡检内容';
 | 
			
		||||
		},
 | 
			
		||||
		/** 修改按钮操作 */
 | 
			
		||||
		handleUpdate(row) {
 | 
			
		||||
			this.reset();
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
			this.info({ 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) {
 | 
			
		||||
					this.put(this.form).then((response) => {
 | 
			
		||||
						this.$modal.msgSuccess('修改成功');
 | 
			
		||||
						this.open = false;
 | 
			
		||||
						this.getList();
 | 
			
		||||
					});
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				// 添加的提交
 | 
			
		||||
				this.post(this.form).then((response) => {
 | 
			
		||||
					this.$modal.msgSuccess('新增成功');
 | 
			
		||||
					this.open = false;
 | 
			
		||||
					this.getList();
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 删除按钮操作 */
 | 
			
		||||
		handleDelete(row) {
 | 
			
		||||
			const id = row.id;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认删除该巡检项目?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					// return this.del({ id });
 | 
			
		||||
					return deleteCheck(id);
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.getList();
 | 
			
		||||
					this.$modal.msgSuccess('删除成功');
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
		handleDetail({ id }) {
 | 
			
		||||
			this.reset();
 | 
			
		||||
			this.mode = 'detail';
 | 
			
		||||
			this.info({ id }).then((response) => {
 | 
			
		||||
				this.form = response.data;
 | 
			
		||||
				this.open = true;
 | 
			
		||||
				this.title = '修改巡检内容';
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 导出按钮操作 */
 | 
			
		||||
		handleExport() {
 | 
			
		||||
			// 处理查询参数
 | 
			
		||||
			let params = { ...this.queryParams };
 | 
			
		||||
			params.pageNo = undefined;
 | 
			
		||||
			params.pageSize = undefined;
 | 
			
		||||
			this.$modal
 | 
			
		||||
				.confirm('是否确认导出所有巡检内容?')
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					this.exportLoading = true;
 | 
			
		||||
					return exportEquipmentTypeExcel(params);
 | 
			
		||||
				})
 | 
			
		||||
				.then((response) => {
 | 
			
		||||
					this.$download.excel(response, '巡检内容.xls');
 | 
			
		||||
					this.exportLoading = false;
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	computed: {},
 | 
			
		||||
	methods: {},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										65
									
								
								src/views/specialEquipment/check/SmallTitle.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/views/specialEquipment/check/SmallTitle.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2023-08-01 15:27:31
 | 
			
		||||
 * @LastEditors: zwq
 | 
			
		||||
 * @LastEditTime: 2023-08-01 16:25:54
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<div :class="[className, { 'p-0': noPadding }]">
 | 
			
		||||
		<slot />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
	props: {
 | 
			
		||||
		size: {
 | 
			
		||||
			// 取值范围:  xl lg md sm
 | 
			
		||||
			type: String,
 | 
			
		||||
			default: 'de',
 | 
			
		||||
			validator: function (val) {
 | 
			
		||||
				return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		noPadding: {
 | 
			
		||||
			type: Boolean,
 | 
			
		||||
			default: false,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	computed: {
 | 
			
		||||
		className: function () {
 | 
			
		||||
			return `${this.size}-title`;
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
 | 
			
		||||
$mgr: 8px;
 | 
			
		||||
@each $size, $height in $pxls {
 | 
			
		||||
	.#{$size}-title {
 | 
			
		||||
		font-size: 18px;
 | 
			
		||||
		line-height: $height;
 | 
			
		||||
		color: #000;
 | 
			
		||||
		font-weight: 500;
 | 
			
		||||
		font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
 | 
			
		||||
 | 
			
		||||
		&::before {
 | 
			
		||||
			content: '';
 | 
			
		||||
			display: inline-block;
 | 
			
		||||
			vertical-align: top;
 | 
			
		||||
			width: 4px;
 | 
			
		||||
			height: $height + 2px;
 | 
			
		||||
			border-radius: 1px;
 | 
			
		||||
			margin-right: $mgr;
 | 
			
		||||
			background-color: #0b58ff;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.p-0 {
 | 
			
		||||
	padding: 0;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										341
									
								
								src/views/specialEquipment/check/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										341
									
								
								src/views/specialEquipment/check/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,341 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2021-11-18 14:16:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2023-12-01 11:02:43
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<el-drawer
 | 
			
		||||
		:visible.sync="visible"
 | 
			
		||||
		:show-close="false"
 | 
			
		||||
		:wrapper-closable="true"
 | 
			
		||||
		class="drawer"
 | 
			
		||||
		size="50%">
 | 
			
		||||
		<small-title slot="title" :no-padding="true">
 | 
			
		||||
			{{ isdetail ? '详情' : '添加巡检' }}
 | 
			
		||||
		</small-title>
 | 
			
		||||
		<div class="content">
 | 
			
		||||
			<div class="visual-part">
 | 
			
		||||
				<el-form
 | 
			
		||||
					:model="dataForm"
 | 
			
		||||
					:rules="dataRule"
 | 
			
		||||
					ref="dataForm"
 | 
			
		||||
					@keyup.enter.native="dataFormSubmit()"
 | 
			
		||||
					label-position="top">
 | 
			
		||||
					<el-row :gutter="20">
 | 
			
		||||
						<el-col :span="8">
 | 
			
		||||
							<el-form-item label="设备大类" prop="equipmentCategory">
 | 
			
		||||
								<span>
 | 
			
		||||
									{{
 | 
			
		||||
										['-', '安全设备', '消防设备', '特种设备'][
 | 
			
		||||
											dataForm.equipmentCategory || 0
 | 
			
		||||
										]
 | 
			
		||||
									}}
 | 
			
		||||
								</span>
 | 
			
		||||
							</el-form-item>
 | 
			
		||||
						</el-col>
 | 
			
		||||
						<el-col :span="8">
 | 
			
		||||
							<el-form-item label="设备名称" prop="equipmentName">
 | 
			
		||||
								{{ dataForm.equipmentName }}
 | 
			
		||||
								<!-- <el-input v-model="dataForm.equipmentName" disabled clearable placeholder="请输入设备名称" /> -->
 | 
			
		||||
							</el-form-item>
 | 
			
		||||
						</el-col>
 | 
			
		||||
						<el-col :span="8">
 | 
			
		||||
							<el-form-item label="设备编码" prop="equipmentCode">
 | 
			
		||||
								{{ dataForm.equipmentCode }}
 | 
			
		||||
								<!-- <el-input
 | 
			
		||||
									v-model="dataForm.equipmentCode"
 | 
			
		||||
									clearable
 | 
			
		||||
									disabled
 | 
			
		||||
									placeholder="请输入设备编码" /> -->
 | 
			
		||||
							</el-form-item>
 | 
			
		||||
						</el-col>
 | 
			
		||||
					</el-row>
 | 
			
		||||
				</el-form>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<el-divider />
 | 
			
		||||
 | 
			
		||||
			<div class="attr-list">
 | 
			
		||||
				<small-title
 | 
			
		||||
					style="margin: 16px 0; padding-left: 8px"
 | 
			
		||||
					:no-padding="true">
 | 
			
		||||
					巡检项目
 | 
			
		||||
				</small-title>
 | 
			
		||||
 | 
			
		||||
				<div v-if="!isdetail" class="action_btn">
 | 
			
		||||
					<template>
 | 
			
		||||
						<span style="display: inline-block">
 | 
			
		||||
							<el-button type="text" @click="addNew()" icon="el-icon-plus">
 | 
			
		||||
								添加
 | 
			
		||||
							</el-button>
 | 
			
		||||
						</span>
 | 
			
		||||
					</template>
 | 
			
		||||
				</div>
 | 
			
		||||
				<base-table
 | 
			
		||||
					:table-props="tableProps"
 | 
			
		||||
					:page="listQuery.pageNo"
 | 
			
		||||
					:limit="listQuery.pageSize"
 | 
			
		||||
					:table-data="checkDetList">
 | 
			
		||||
					<method-btn
 | 
			
		||||
						v-if="!isdetail"
 | 
			
		||||
						slot="handleBtn"
 | 
			
		||||
						:width="120"
 | 
			
		||||
						label="操作"
 | 
			
		||||
						:method-list="tableBtn"
 | 
			
		||||
						@clickBtn="handleClick" />
 | 
			
		||||
				</base-table>
 | 
			
		||||
				<pagination
 | 
			
		||||
					v-show="listQuery.total > 0"
 | 
			
		||||
					:total="listQuery.total"
 | 
			
		||||
					:page.sync="listQuery.pageNo"
 | 
			
		||||
					:limit.sync="listQuery.pageSize"
 | 
			
		||||
					:page-sizes="[5, 10, 15]"
 | 
			
		||||
					@pagination="getList" />
 | 
			
		||||
 | 
			
		||||
				<!-- <div class="drawer-body__footer">
 | 
			
		||||
					<el-button type="primary" @click="goback()">关闭</el-button>
 | 
			
		||||
				</div> -->
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<attr-add
 | 
			
		||||
			v-if="addOrUpdateVisible"
 | 
			
		||||
			ref="addOrUpdate"
 | 
			
		||||
			:config-id="dataForm.id"
 | 
			
		||||
			@refreshDataList="getList" />
 | 
			
		||||
	</el-drawer>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import {
 | 
			
		||||
	getEqCheck,
 | 
			
		||||
	getCheckDetPage,
 | 
			
		||||
	deleteCheckDet,
 | 
			
		||||
} from '@/api/equipment/base/inspection/settings';
 | 
			
		||||
import SmallTitle from './SmallTitle';
 | 
			
		||||
import attrAdd from './attr-add';
 | 
			
		||||
import { DICT_TYPE, getDictDatas } from '@/utils/dict';
 | 
			
		||||
 | 
			
		||||
const tableBtn = [
 | 
			
		||||
	{
 | 
			
		||||
		type: 'edit',
 | 
			
		||||
		btnName: '编辑',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		type: 'delete',
 | 
			
		||||
		btnName: '删除',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'program',
 | 
			
		||||
		label: '巡检项目',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'content',
 | 
			
		||||
		label: '巡检内容',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'code',
 | 
			
		||||
		label: '巡检内容编码',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'description',
 | 
			
		||||
		label: '备注',
 | 
			
		||||
	},
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	components: { SmallTitle, attrAdd },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			tableBtn,
 | 
			
		||||
			tableProps,
 | 
			
		||||
			addOrUpdateVisible: false,
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				infoURL: getEqCheck,
 | 
			
		||||
			},
 | 
			
		||||
			listQuery: {
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				total: 0,
 | 
			
		||||
			},
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				code: undefined,
 | 
			
		||||
				name: '',
 | 
			
		||||
				materialType: undefined,
 | 
			
		||||
				productType: undefined,
 | 
			
		||||
				area: undefined,
 | 
			
		||||
				specifications: undefined,
 | 
			
		||||
				processTime: 0,
 | 
			
		||||
				remark: undefined,
 | 
			
		||||
				unit: undefined,
 | 
			
		||||
			},
 | 
			
		||||
			checkDetList: [],
 | 
			
		||||
			visible: false,
 | 
			
		||||
			isdetail: false,
 | 
			
		||||
			dataRule: {
 | 
			
		||||
				code: [
 | 
			
		||||
					{ required: true, message: '物料编码不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				name: [
 | 
			
		||||
					{ required: true, message: '物料名称不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				materialType: [
 | 
			
		||||
					{ required: true, message: '物料类型不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				productType: [
 | 
			
		||||
					{ required: true, message: '产品类型不能为空', trigger: 'change' },
 | 
			
		||||
				],
 | 
			
		||||
				processTime: [
 | 
			
		||||
					{
 | 
			
		||||
						required: true,
 | 
			
		||||
						message: '产线生产单位用时不能为空',
 | 
			
		||||
						trigger: 'blur',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {},
 | 
			
		||||
	methods: {
 | 
			
		||||
		initData() {
 | 
			
		||||
			this.checkDetList.splice(0);
 | 
			
		||||
			this.listQuery.total = 0;
 | 
			
		||||
		},
 | 
			
		||||
		handleClick(raw) {
 | 
			
		||||
			if (raw.type === 'delete') {
 | 
			
		||||
				this.$confirm(
 | 
			
		||||
					`是否确认删除巡检项目名称为"${raw.data.program}"的数据项?`,
 | 
			
		||||
					'提示',
 | 
			
		||||
					{
 | 
			
		||||
						confirmButtonText: '确定',
 | 
			
		||||
						cancelButtonText: '取消',
 | 
			
		||||
						type: 'warning',
 | 
			
		||||
					}
 | 
			
		||||
				)
 | 
			
		||||
					.then(() => {
 | 
			
		||||
						deleteCheckDet(raw.data.id).then(({ data }) => {
 | 
			
		||||
							this.$message({
 | 
			
		||||
								message: '操作成功',
 | 
			
		||||
								type: 'success',
 | 
			
		||||
								duration: 1500,
 | 
			
		||||
								onClose: () => {
 | 
			
		||||
									this.getList();
 | 
			
		||||
								},
 | 
			
		||||
							});
 | 
			
		||||
						});
 | 
			
		||||
					})
 | 
			
		||||
					.catch(() => {});
 | 
			
		||||
			} else {
 | 
			
		||||
				this.addNew(raw.data.id);
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		getList() {
 | 
			
		||||
			// 获取巡检项目分页
 | 
			
		||||
			getCheckDetPage({
 | 
			
		||||
				...this.listQuery,
 | 
			
		||||
				configId: this.dataForm.id,
 | 
			
		||||
			}).then((response) => {
 | 
			
		||||
				this.checkDetList = response.data.list;
 | 
			
		||||
				this.listQuery.total = response.data.total;
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		init(id, isdetail) {
 | 
			
		||||
			this.initData();
 | 
			
		||||
			this.isdetail = isdetail || false;
 | 
			
		||||
			this.dataForm.id = id || undefined;
 | 
			
		||||
			this.visible = true;
 | 
			
		||||
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs['dataForm'].resetFields();
 | 
			
		||||
 | 
			
		||||
				if (this.dataForm.id) {
 | 
			
		||||
					// 获取设备巡检详情
 | 
			
		||||
					this.urlOptions.infoURL(id).then((response) => {
 | 
			
		||||
						this.dataForm = response.data;
 | 
			
		||||
					});
 | 
			
		||||
					// 获取设备项目列表
 | 
			
		||||
					this.getList();
 | 
			
		||||
				} else {
 | 
			
		||||
					if (this.urlOptions.isGetCode) {
 | 
			
		||||
						this.getCode();
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		goback() {
 | 
			
		||||
			this.$emit('refreshDataList');
 | 
			
		||||
			this.visible = false;
 | 
			
		||||
			// this.initData();
 | 
			
		||||
		},
 | 
			
		||||
		goEdit() {
 | 
			
		||||
			this.isdetail = false;
 | 
			
		||||
		},
 | 
			
		||||
		// 新增 / 修改
 | 
			
		||||
		addNew(id) {
 | 
			
		||||
			this.addOrUpdateVisible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs.addOrUpdate.init(id);
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.drawer >>> .el-drawer {
 | 
			
		||||
	border-radius: 8px 0 0 8px;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .el-form-item__label {
 | 
			
		||||
	padding: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .el-drawer__header {
 | 
			
		||||
	margin: 0;
 | 
			
		||||
	padding: 32px 32px 24px;
 | 
			
		||||
	border-bottom: 1px solid #dcdfe6;
 | 
			
		||||
}
 | 
			
		||||
.drawer >>> .el-drawer__body {
 | 
			
		||||
	flex: 1;
 | 
			
		||||
	height: 1px;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .content {
 | 
			
		||||
	padding: 30px 24px;
 | 
			
		||||
	flex: 1;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
	/* height: 100%; */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .visual-part {
 | 
			
		||||
	/* flex: 1 auto; */
 | 
			
		||||
	padding-right: 10px; /* 调整滚动条样式 */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer >>> .el-form {
 | 
			
		||||
	padding: 0 16px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.drawer-body__footer {
 | 
			
		||||
	display: flex;
 | 
			
		||||
	justify-content: flex-end;
 | 
			
		||||
	padding: 18px;
 | 
			
		||||
}
 | 
			
		||||
.action_btn {
 | 
			
		||||
	float: right;
 | 
			
		||||
	margin: -40px 15px;
 | 
			
		||||
	font-size: 14px;
 | 
			
		||||
}
 | 
			
		||||
.add {
 | 
			
		||||
	color: #0b58ff;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										167
									
								
								src/views/specialEquipment/check/add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								src/views/specialEquipment/check/add.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,167 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2021-11-18 14:16:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @LastEditTime: 2023-11-25 16:23:13
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<el-form
 | 
			
		||||
		:model="dataForm"
 | 
			
		||||
		:rules="dataRule"
 | 
			
		||||
		ref="dataForm"
 | 
			
		||||
		@keyup.enter.native="dataFormSubmit()"
 | 
			
		||||
		label-width="80px">
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="配置名称" prop="name">
 | 
			
		||||
					<el-input v-model="dataForm.name" placeholder="请输入配置名称" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="配置编码" prop="code">
 | 
			
		||||
					<el-input v-model="dataForm.code" placeholder="请输入配置编码" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="设备大类"
 | 
			
		||||
					prop="equipmentCategory"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '请选择设备大类', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.equipmentCategory"
 | 
			
		||||
						:placeholder="`请选择设备大类`"
 | 
			
		||||
						@change="handleEqTypeChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in equipmentTypeOptions"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="设备名称" prop="equipmentId">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.equipmentId"
 | 
			
		||||
						filterable
 | 
			
		||||
						style="width: 100%"
 | 
			
		||||
						placeholder="请选择设备名称"
 | 
			
		||||
						@change="setCode">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="d in equipmentOptions"
 | 
			
		||||
							:key="d.value"
 | 
			
		||||
							:label="d.label"
 | 
			
		||||
							:value="d.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="设备编码" prop="equipmentCode">
 | 
			
		||||
					<el-input
 | 
			
		||||
						v-model="dataForm.equipmentCode"
 | 
			
		||||
						disabled
 | 
			
		||||
						placeholder="请输入设备编码" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicAdd from '../../core/mixins/basic-add';
 | 
			
		||||
import {
 | 
			
		||||
	getEqCheck,
 | 
			
		||||
	getCode,
 | 
			
		||||
	createCheckConfig,
 | 
			
		||||
	updateCheckConfig,
 | 
			
		||||
} from '@/api/equipment/base/inspection/settings';
 | 
			
		||||
import { getEquipmentAll } from '@/api/base/equipment';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicAdd],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				isGetCode: true,
 | 
			
		||||
				codeURL: getCode,
 | 
			
		||||
				createURL: createCheckConfig,
 | 
			
		||||
				updateURL: updateCheckConfig,
 | 
			
		||||
				infoURL: getEqCheck,
 | 
			
		||||
			},
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				code: undefined,
 | 
			
		||||
				name: undefined,
 | 
			
		||||
				equipmentId: undefined,
 | 
			
		||||
				equipmentCode: undefined,
 | 
			
		||||
				equipmentCategory: undefined,
 | 
			
		||||
			},
 | 
			
		||||
			eqList: [],
 | 
			
		||||
			dataRule: {
 | 
			
		||||
				equipmentId: [
 | 
			
		||||
					{ required: true, message: '设备不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				code: [
 | 
			
		||||
					{ required: true, message: '配置编码不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				name: [
 | 
			
		||||
					{ required: true, message: '配置名称不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
			},
 | 
			
		||||
			equipmentOptions: [],
 | 
			
		||||
			equipmentTypeOptions: [
 | 
			
		||||
				{ label: '安全设备', value: 1 },
 | 
			
		||||
				{ label: '消防设备', value: 2 },
 | 
			
		||||
				{ label: '特种设备', value: 3 },
 | 
			
		||||
			],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getDict();
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		async getDict() {
 | 
			
		||||
			// 设备列表
 | 
			
		||||
			const res = await getEquipmentAll();
 | 
			
		||||
			this.eqList = res.data;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.handleEqTypeChange();
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		setCode() {
 | 
			
		||||
			const chooseM = this.eqList.filter((item) => {
 | 
			
		||||
				return item.id === this.dataForm.equipmentId;
 | 
			
		||||
			});
 | 
			
		||||
			this.dataForm.equipmentCode = chooseM[0].code;
 | 
			
		||||
		},
 | 
			
		||||
		// handlers
 | 
			
		||||
		handleEqTypeChange(type) {
 | 
			
		||||
			this.dataForm.equipmentId = null;
 | 
			
		||||
			this.dataForm.equipmentCode = null;
 | 
			
		||||
			if (type) {
 | 
			
		||||
				this.equipmentOptions = this.eqList
 | 
			
		||||
					.filter((item) => item.special)
 | 
			
		||||
					.filter((item) => item.specialType === type)
 | 
			
		||||
					.map((item) => ({ label: item.name, value: item.id }));
 | 
			
		||||
			} else
 | 
			
		||||
				this.equipmentOptions = this.eqList
 | 
			
		||||
					.filter((item) => item.special)
 | 
			
		||||
					.map((item) => ({
 | 
			
		||||
						label: item.name,
 | 
			
		||||
						value: item.id,
 | 
			
		||||
					}));
 | 
			
		||||
			// this.$emit('update', this.form)
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.el-date-editor,
 | 
			
		||||
.el-select {
 | 
			
		||||
	width: 100%;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										145
									
								
								src/views/specialEquipment/check/attr-add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								src/views/specialEquipment/check/attr-add.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,145 @@
 | 
			
		||||
<template>
 | 
			
		||||
	<el-dialog
 | 
			
		||||
		:visible.sync="visible"
 | 
			
		||||
		:width="'30%'"
 | 
			
		||||
		:append-to-body="true"
 | 
			
		||||
		:close-on-click-modal="false"
 | 
			
		||||
		class="dialog">
 | 
			
		||||
		<template #title>
 | 
			
		||||
			<slot name="title">
 | 
			
		||||
				<div class="titleStyle">
 | 
			
		||||
					{{ !dataForm.id ? '新增' : '编辑' }}
 | 
			
		||||
				</div>
 | 
			
		||||
			</slot>
 | 
			
		||||
		</template>
 | 
			
		||||
 | 
			
		||||
		<el-form
 | 
			
		||||
			ref="dataForm"
 | 
			
		||||
			:model="dataForm"
 | 
			
		||||
			:rules="dataRule"
 | 
			
		||||
			label-width="60px"
 | 
			
		||||
			@keyup.enter.native="dataFormSubmit()">
 | 
			
		||||
			<el-form-item label="巡检" prop="checkId">
 | 
			
		||||
				<el-select v-model="dataForm.checkId" filterable placeholder="请选择巡检" style="width: 100%">
 | 
			
		||||
					<el-option v-for="dict in checkList" :key="dict.id" :label="dict.content"
 | 
			
		||||
						:value="dict.id" />
 | 
			
		||||
				</el-select>
 | 
			
		||||
			</el-form-item>
 | 
			
		||||
			<el-form-item label="备注" prop="description">
 | 
			
		||||
				<el-input
 | 
			
		||||
					v-model="dataForm.description"
 | 
			
		||||
					placeholder="请输入备注"
 | 
			
		||||
					clearable />
 | 
			
		||||
			</el-form-item>
 | 
			
		||||
		</el-form>
 | 
			
		||||
 | 
			
		||||
		<el-row style="text-align: right">
 | 
			
		||||
			<el-button @click="visible = false">取消</el-button>
 | 
			
		||||
			<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-dialog>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getCheckDet, createCheckDet, updateCheckDet, getcheckList } from "@/api/equipment/base/inspection/settings";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	props: {
 | 
			
		||||
		configId: {
 | 
			
		||||
			type: String,
 | 
			
		||||
			default: '',
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			visible: false,
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				checkId: undefined,
 | 
			
		||||
				configId: undefined,
 | 
			
		||||
				description: ''
 | 
			
		||||
			},
 | 
			
		||||
			checkList: [],
 | 
			
		||||
			dataRule: {
 | 
			
		||||
				checkId: [{ required: true, message: '巡检不能为空', trigger: 'blur' }],
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getDict()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		async getDict() {
 | 
			
		||||
			const res = await getcheckList()
 | 
			
		||||
			this.checkList = res.data
 | 
			
		||||
		},
 | 
			
		||||
		init(id) {
 | 
			
		||||
			this.dataForm.id = id || '';
 | 
			
		||||
			this.visible = true;
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs['dataForm'].resetFields();
 | 
			
		||||
				if (this.dataForm.id) {
 | 
			
		||||
					getCheckDet(this.dataForm.id).then((res) => {
 | 
			
		||||
						// const { name, value } = res.data;
 | 
			
		||||
						// this.dataForm.name = name;
 | 
			
		||||
						// this.dataForm.value = value;
 | 
			
		||||
						this.dataForm = res.data
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		// 表单提交
 | 
			
		||||
		dataFormSubmit() {
 | 
			
		||||
			this.$refs['dataForm'].validate((valid) => {
 | 
			
		||||
				if (valid) {
 | 
			
		||||
					// 修改的提交
 | 
			
		||||
					if (this.dataForm.id) {
 | 
			
		||||
						updateCheckDet({
 | 
			
		||||
							...this.dataForm,
 | 
			
		||||
							configId: this.configId
 | 
			
		||||
						}).then((response) => {
 | 
			
		||||
							this.$modal.msgSuccess('修改成功');
 | 
			
		||||
							this.visible = false;
 | 
			
		||||
							this.$emit('refreshDataList');
 | 
			
		||||
						});
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
					// 添加的提交
 | 
			
		||||
					createCheckDet({
 | 
			
		||||
						...this.dataForm,
 | 
			
		||||
						configId: this.configId,
 | 
			
		||||
					}).then((response) => {
 | 
			
		||||
						this.$modal.msgSuccess('新增成功');
 | 
			
		||||
						this.visible = false;
 | 
			
		||||
						this.$emit('refreshDataList');
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.dialog >>> .el-dialog__body {
 | 
			
		||||
	padding: 30px 24px;
 | 
			
		||||
}
 | 
			
		||||
.dialog >>> .el-dialog__header {
 | 
			
		||||
	font-size: 16px;
 | 
			
		||||
	color: rgba(0, 0, 0, 0.85);
 | 
			
		||||
	font-weight: 500;
 | 
			
		||||
	padding: 13px 24px;
 | 
			
		||||
	border-bottom: 1px solid #e9e9e9;
 | 
			
		||||
}
 | 
			
		||||
.dialog >>> .el-dialog__header .titleStyle::before {
 | 
			
		||||
	content: '';
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	width: 4px;
 | 
			
		||||
	height: 16px;
 | 
			
		||||
	background-color: #0b58ff;
 | 
			
		||||
	border-radius: 1px;
 | 
			
		||||
	margin-right: 8px;
 | 
			
		||||
	position: relative;
 | 
			
		||||
	top: 2px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
		Reference in New Issue
	
	Block a user