projects/mesxc-zhp #161
@@ -290,6 +290,10 @@ export default {
 | 
			
		||||
		},
 | 
			
		||||
		handleSearchBarChange({ param, value }) {
 | 
			
		||||
			if ('specialType' === param) {
 | 
			
		||||
				if (!value) {
 | 
			
		||||
					this.setSearchBarEquipmentList(this.allSpecialEquipments);
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				this.setSearchBarEquipmentList(
 | 
			
		||||
					this.allSpecialEquipments.filter((item) => item.specialType == value)
 | 
			
		||||
				);
 | 
			
		||||
@@ -314,7 +318,7 @@ export default {
 | 
			
		||||
			this.http('/base/equipment-maintain-plan/page', 'get', {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 100,
 | 
			
		||||
				special: true
 | 
			
		||||
				special: true,
 | 
			
		||||
			}).then(({ data }) => {
 | 
			
		||||
				this.$set(
 | 
			
		||||
					this.searchBarFormConfig[0],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										463
									
								
								src/views/specialEquipment/maintain/Record--add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										463
									
								
								src/views/specialEquipment/maintain/Record--add.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,463 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: dialogForm.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2023-08-15 10:32:36
 | 
			
		||||
    description: 弹窗的表单组件
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<el-form
 | 
			
		||||
		ref="form"
 | 
			
		||||
		:model="form"
 | 
			
		||||
		:size="size"
 | 
			
		||||
		:label-position="labelPosition"
 | 
			
		||||
		v-loading="formLoading">
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<!-- 设备大类  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="设备大类"
 | 
			
		||||
					prop="equipmentCategory"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '设备大类不能为空', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.equipmentCategory"
 | 
			
		||||
						:placeholder="`请选择设备大类`"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						@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="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="设备名称"
 | 
			
		||||
					prop="equipmentId"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '设备不能为空', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.equipmentId"
 | 
			
		||||
						:placeholder="`请选择设备`"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						@change="handleEqChange">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in equipmentOptions"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 保养单号  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item label="保养单号" prop="maintainOrderNumber">
 | 
			
		||||
					<el-input
 | 
			
		||||
						v-model="form.name"
 | 
			
		||||
						@change="$emit('update', form)"
 | 
			
		||||
						:placeholder="`请输入保养单号`"
 | 
			
		||||
						:disabled="disabled" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 保养人员  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="保养人员"
 | 
			
		||||
					prop="maintainWorker"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '保养人员不能为空', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.maintainWorker"
 | 
			
		||||
						:placeholder="`请选择保养人员`"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						@change="$emit('update', form)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in workerOptions"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 是否计划保养  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="是否计划保养"
 | 
			
		||||
					prop="relatePlan"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{
 | 
			
		||||
							required: true,
 | 
			
		||||
							message: '是否计划保养不能为空',
 | 
			
		||||
							trigger: 'blur',
 | 
			
		||||
						},
 | 
			
		||||
					]">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.relatePlan"
 | 
			
		||||
						:placeholder="`是否计划保养`"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						@change="$emit('update', form)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in [
 | 
			
		||||
								{ label: '是', value: 1 },
 | 
			
		||||
								{ label: '否', value: 2 },
 | 
			
		||||
							]"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 所属计划  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item label="所属计划" prop="maintainPlanId">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="form.maintainPlanId"
 | 
			
		||||
						:placeholder="`请选择所属计划`"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						@change="$emit('update', form)">
 | 
			
		||||
						<el-option
 | 
			
		||||
							v-for="opt in planOptions"
 | 
			
		||||
							:key="opt.value"
 | 
			
		||||
							:label="opt.label"
 | 
			
		||||
							:value="opt.value" />
 | 
			
		||||
					</el-select>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 保养用时  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item label="保养用时(h)" prop="timeUsed">
 | 
			
		||||
					<el-input
 | 
			
		||||
						v-model="form.timeUsed"
 | 
			
		||||
						@change="$emit('update', form)"
 | 
			
		||||
						:placeholder="`请输入保养用时(h)`"
 | 
			
		||||
						:disabled="disabled" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 开始时间  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="开始时间"
 | 
			
		||||
					prop="startTime"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '开始时间不能为空', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-date-picker
 | 
			
		||||
						v-model="form.startTime"
 | 
			
		||||
						type="datetime"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						:placeholder="`请选择开始时间`"
 | 
			
		||||
						value-format="timestamp"
 | 
			
		||||
						format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
						clearable
 | 
			
		||||
						@change="$emit('update', form)" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 结束时间  -->
 | 
			
		||||
			<el-col :span="8">
 | 
			
		||||
				<el-form-item
 | 
			
		||||
					label="结束时间"
 | 
			
		||||
					prop="endTime"
 | 
			
		||||
					:rules="[
 | 
			
		||||
						{ required: true, message: '开始时间不能为空', trigger: 'blur' },
 | 
			
		||||
					]">
 | 
			
		||||
					<el-date-picker
 | 
			
		||||
						v-model="form.endTime"
 | 
			
		||||
						type="datetime"
 | 
			
		||||
						:disabled="disabled"
 | 
			
		||||
						:placeholder="`请选择结束时间`"
 | 
			
		||||
						value-format="timestamp"
 | 
			
		||||
						format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
						clearable
 | 
			
		||||
						@change="$emit('update', form)" />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 上传文件  -->
 | 
			
		||||
			<el-col :span="24">
 | 
			
		||||
				<el-form-item label="上传文件" prop="files">
 | 
			
		||||
					<div
 | 
			
		||||
						class="upload-area"
 | 
			
		||||
						:class="uploadOpen ? '' : 'height-48'"
 | 
			
		||||
						ref="uploadArea">
 | 
			
		||||
						<span class="close-icon" :class="uploadOpen ? 'open' : ''">
 | 
			
		||||
							<el-button
 | 
			
		||||
								type="text"
 | 
			
		||||
								icon="el-icon-arrow-right"
 | 
			
		||||
								@click="handleFilesOpen" />
 | 
			
		||||
						</span>
 | 
			
		||||
						<!-- :file-list="uploadedFileList" -->
 | 
			
		||||
						<el-upload
 | 
			
		||||
							class="upload-in-dialog"
 | 
			
		||||
							:action="uploadUrl"
 | 
			
		||||
							:headers="uploadHeaders"
 | 
			
		||||
							:show-file-list="false"
 | 
			
		||||
							icon="el-icon-upload2"
 | 
			
		||||
							:disabled="disabled"
 | 
			
		||||
							:before-upload="beforeUpload"
 | 
			
		||||
							:on-success="
 | 
			
		||||
								(response, file, fileList) => {
 | 
			
		||||
									handleUploadSuccess(response, file, col.prop);
 | 
			
		||||
								}
 | 
			
		||||
							">
 | 
			
		||||
							<el-button size="mini" :disabled="disabled">
 | 
			
		||||
								<svg-icon
 | 
			
		||||
									icon-class="icon-upload"
 | 
			
		||||
									style="color: inherit"></svg-icon>
 | 
			
		||||
								上传文件
 | 
			
		||||
							</el-button>
 | 
			
		||||
							<div class="el-upload__tip" slot="tip" v-if="false">
 | 
			
		||||
								只能上传jpg/png文件, 大小不超过2MB
 | 
			
		||||
							</div>
 | 
			
		||||
						</el-upload>
 | 
			
		||||
 | 
			
		||||
						<uploadedFile
 | 
			
		||||
							class="file"
 | 
			
		||||
							v-for="file in form.files"
 | 
			
		||||
							:file="file"
 | 
			
		||||
							:key="file.fileUrl"
 | 
			
		||||
							:disabled="disabled"
 | 
			
		||||
							@delete="!disabled && handleDeleteFile(file)" />
 | 
			
		||||
					</div>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
 | 
			
		||||
			<!-- 保养描述  -->
 | 
			
		||||
			<el-col :span="24">
 | 
			
		||||
				<el-form-item label="保养描述" prop="maintenanceDes">
 | 
			
		||||
					<div style="position: relative">
 | 
			
		||||
						<div
 | 
			
		||||
							v-if="1"
 | 
			
		||||
							class="modal"
 | 
			
		||||
							style="
 | 
			
		||||
								position: absolute;
 | 
			
		||||
								top: 0;
 | 
			
		||||
								left: 0;
 | 
			
		||||
								width: 100%;
 | 
			
		||||
								height: 100%;
 | 
			
		||||
								background: rgba(0, 0, 0, 0.3);
 | 
			
		||||
								backdrop-filter: blur(2px);
 | 
			
		||||
							"></div>
 | 
			
		||||
						<Editor
 | 
			
		||||
							style="margin-top: 40px"
 | 
			
		||||
							v-model="form.maintenanceDes"
 | 
			
		||||
							:min-height="192"
 | 
			
		||||
							:disabled="disabled"
 | 
			
		||||
							@change="$emit('update', form)" />
 | 
			
		||||
					</div>
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
		</el-row>
 | 
			
		||||
	</el-form>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getAccessToken } from '@/utils/auth';
 | 
			
		||||
import Editor from '@/components/Editor';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'DialogForm',
 | 
			
		||||
	model: {
 | 
			
		||||
		prop: 'dataForm',
 | 
			
		||||
		event: 'update',
 | 
			
		||||
	},
 | 
			
		||||
	emits: ['update'],
 | 
			
		||||
	components: { Editor },
 | 
			
		||||
	props: {
 | 
			
		||||
		dataForm: {
 | 
			
		||||
			type: Object,
 | 
			
		||||
			default: () => ({}),
 | 
			
		||||
		},
 | 
			
		||||
		disabled: {
 | 
			
		||||
			type: Boolean,
 | 
			
		||||
			default: false,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			allSpeicalEquipments: [],
 | 
			
		||||
			uploadOpen: false,
 | 
			
		||||
			form: {},
 | 
			
		||||
			formLoading: true,
 | 
			
		||||
			dataLoaded: false,
 | 
			
		||||
			equipmentList: [],
 | 
			
		||||
			equipmentOptions: [],
 | 
			
		||||
			equipmentTypeOptions: [
 | 
			
		||||
				{ label: '安全设备', value: 1 },
 | 
			
		||||
				{ label: '消防设备', value: 2 },
 | 
			
		||||
				{ label: '特种设备', value: 3 },
 | 
			
		||||
			],
 | 
			
		||||
			uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
 | 
			
		||||
			uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // 上传有关的headers,url都是固定的
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	watch: {
 | 
			
		||||
		dataForm: {
 | 
			
		||||
			handler(val) {
 | 
			
		||||
				this.form = JSON.parse(JSON.stringify(val));
 | 
			
		||||
				if (this.form.equipmentCategory != null) {
 | 
			
		||||
					setTimeout(() => {
 | 
			
		||||
						this.equipmentOptions = this.equipmentList
 | 
			
		||||
							.filter((item) => item.special)
 | 
			
		||||
							.filter(
 | 
			
		||||
								(item) => item.specialType === this.form.equipmentCategory
 | 
			
		||||
							)
 | 
			
		||||
							.map((item) => ({ label: item.name, value: item.id }));
 | 
			
		||||
					}, 1000);
 | 
			
		||||
				}
 | 
			
		||||
				if (this.hasFiles) {
 | 
			
		||||
					if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
 | 
			
		||||
						this.form.files = this.form.files ?? [];
 | 
			
		||||
					} else if (Array.isArray(this.hasFiles)) {
 | 
			
		||||
						this.hasFiles.forEach((prop) => {
 | 
			
		||||
							this.form[prop] = this.form[prop] ?? [];
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
			deep: true,
 | 
			
		||||
			immediate: true,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.initOptions();
 | 
			
		||||
		this.getEquipmentList();
 | 
			
		||||
		this.getCode('/base/equipment-maintain-plan/getCode');
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		/** 模拟透传 ref  */
 | 
			
		||||
		validate(cb) {
 | 
			
		||||
			return this.$refs.form.validate(cb);
 | 
			
		||||
		},
 | 
			
		||||
		resetFields(args) {
 | 
			
		||||
			return this.$refs.form.resetFields(args);
 | 
			
		||||
		},
 | 
			
		||||
		// getCode
 | 
			
		||||
		async getCode(url) {
 | 
			
		||||
			this.formLoading = true;
 | 
			
		||||
			const response = await this.$axios(url);
 | 
			
		||||
			this.formLoading = false;
 | 
			
		||||
			this.form.code = response.data || '';
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// initialize
 | 
			
		||||
		async initOptions() {
 | 
			
		||||
			this.initEquipment();
 | 
			
		||||
			this.initWorker();
 | 
			
		||||
			this.initPlan();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		async initEquipment() {
 | 
			
		||||
			this.formLoading = true;
 | 
			
		||||
			const response = await this.$axios('/base/core-equipment/listAll');
 | 
			
		||||
			this.equipmentList = response.data || [];
 | 
			
		||||
			const equipmentOptions = (response.data || [])
 | 
			
		||||
				.filter((item) => item.special)
 | 
			
		||||
				.map((item) => ({
 | 
			
		||||
					label: item.name,
 | 
			
		||||
					value: item.id,
 | 
			
		||||
				}));
 | 
			
		||||
			this.equipmentOptions = equipmentOptions;
 | 
			
		||||
			this.allSpeicalEquipments = equipmentOptions;
 | 
			
		||||
			this.formLoading = false;
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		async initWorker() {},
 | 
			
		||||
 | 
			
		||||
		async initPlan() {},
 | 
			
		||||
 | 
			
		||||
		// handlers
 | 
			
		||||
		handleEqTypeChange(type) {
 | 
			
		||||
			this.form.equipmentId = null;
 | 
			
		||||
			if (type) {
 | 
			
		||||
				this.equipmentOptions = this.equipmentList
 | 
			
		||||
					.filter((item) => item.special)
 | 
			
		||||
					.filter((item) => item.specialType === type)
 | 
			
		||||
					.map((item) => ({ label: item.name, value: item.id }));
 | 
			
		||||
			} else
 | 
			
		||||
				this.equipmentOptions = this.equipmentList.map((item) => ({
 | 
			
		||||
					label: item.name,
 | 
			
		||||
					value: item.id,
 | 
			
		||||
				}));
 | 
			
		||||
			// this.$emit('update', this.form)
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		// upload
 | 
			
		||||
		handleFilesOpen() {},
 | 
			
		||||
 | 
			
		||||
		beforeUpload() {},
 | 
			
		||||
 | 
			
		||||
		handleUploadSuccess() {},
 | 
			
		||||
 | 
			
		||||
		handleDeleteFile(file) {},
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.el-date-editor,
 | 
			
		||||
.el-select {
 | 
			
		||||
	width: 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.upload-area {
 | 
			
		||||
	// background: #ccc;
 | 
			
		||||
	// display: grid;
 | 
			
		||||
	// grid-auto-rows: 34px;
 | 
			
		||||
	// grid-template-columns: repeat(6, minmax(32px, max-content));
 | 
			
		||||
	// gap: 8px;
 | 
			
		||||
	// align-items: center;
 | 
			
		||||
	position: relative;
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
	transition: height 0.3s ease-out;
 | 
			
		||||
	margin-top: 40px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.upload-in-dialog {
 | 
			
		||||
	// display: inline-block;
 | 
			
		||||
	margin-right: 24px;
 | 
			
		||||
	// background: #ccc;
 | 
			
		||||
	position: relative;
 | 
			
		||||
	// top: -13px;
 | 
			
		||||
	float: left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.close-icon {
 | 
			
		||||
	// background: #ccc;
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	top: 0;
 | 
			
		||||
	right: 12px;
 | 
			
		||||
	z-index: 100;
 | 
			
		||||
	transition: transform 0.3s ease-out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.close-icon.open {
 | 
			
		||||
	transform: rotateZ(90deg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.dialog__upload_component__close {
 | 
			
		||||
	color: #ccc;
 | 
			
		||||
}
 | 
			
		||||
.dialog__upload_component__close:hover {
 | 
			
		||||
	/* color: #777; */
 | 
			
		||||
	color: red;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.height-48 {
 | 
			
		||||
	height: 35px !important;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -6,19 +6,642 @@
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="SpecialEquipmentMaintainRecord"></div>
 | 
			
		||||
	<div class="app-container SpecialEquipmentMaintainRecord">
 | 
			
		||||
		<!-- 搜索工作栏 -->
 | 
			
		||||
		<SearchBar
 | 
			
		||||
			:formConfigs="searchBarFormConfig"
 | 
			
		||||
			ref="search-bar"
 | 
			
		||||
			:is-fold="true"
 | 
			
		||||
			@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="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"
 | 
			
		||||
			width="60%"
 | 
			
		||||
			@close="cancel"
 | 
			
		||||
			@cancel="cancel"
 | 
			
		||||
			@confirm="submitForm">
 | 
			
		||||
			<DialogForm
 | 
			
		||||
				v-if="open"
 | 
			
		||||
				ref="form"
 | 
			
		||||
				v-model="form"
 | 
			
		||||
				:disabled="mode == 'detail'" />
 | 
			
		||||
			<el-row v-if="mode === 'detail'" slot="footer" type="flex" justify="end">
 | 
			
		||||
				<el-col :span="12">
 | 
			
		||||
					<el-button size="small" class="btnTextStyle" @click="cancel">
 | 
			
		||||
						关闭
 | 
			
		||||
					</el-button>
 | 
			
		||||
				</el-col>
 | 
			
		||||
			</el-row>
 | 
			
		||||
		</base-dialog>
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment';
 | 
			
		||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
			
		||||
import Editor from '@/components/Editor';
 | 
			
		||||
import DialogForm from './Record--add.vue';
 | 
			
		||||
import {
 | 
			
		||||
	deleteEqMaintainLog,
 | 
			
		||||
	exportMaintainLogExcel,
 | 
			
		||||
} from '@/api/equipment/base/maintain/record';
 | 
			
		||||
 | 
			
		||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'SpecialEquipmentMaintainRecord',
 | 
			
		||||
	components: {},
 | 
			
		||||
	props: {},
 | 
			
		||||
	components: { DialogForm },
 | 
			
		||||
	mixins: [basicPageMixin],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {};
 | 
			
		||||
		return {
 | 
			
		||||
			searchBarKeys: [
 | 
			
		||||
				'maintainPlanId',
 | 
			
		||||
				'startTime',
 | 
			
		||||
				'relatePlan',
 | 
			
		||||
				'equipmentId',
 | 
			
		||||
				'specialType',
 | 
			
		||||
			],
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi('equipment:maintain-record:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'detail',
 | 
			
		||||
							btnName: '详情',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:maintain-record:update')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '修改',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
				this.$auth.hasPermi('equipment:maintain-record:delete')
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'delete',
 | 
			
		||||
							btnName: '删除',
 | 
			
		||||
					  }
 | 
			
		||||
					: undefined,
 | 
			
		||||
			].filter((v) => v),
 | 
			
		||||
			tableProps: [
 | 
			
		||||
				// {
 | 
			
		||||
				// 	prop: 'createTime',
 | 
			
		||||
				// 	label: '添加时间',
 | 
			
		||||
				// 	fixed: true,
 | 
			
		||||
				// 	width: 150,
 | 
			
		||||
				// 	filter: timeFilter,
 | 
			
		||||
				// },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'maintainOrderNumber',
 | 
			
		||||
					label: '设备保养单号',
 | 
			
		||||
					width: 110,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'startTime',
 | 
			
		||||
					label: '开始时间',
 | 
			
		||||
					filter: timeFilter,
 | 
			
		||||
					minWidth: 150,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'endTime',
 | 
			
		||||
					label: '结束时间',
 | 
			
		||||
					filter: timeFilter,
 | 
			
		||||
					minWidth: 150,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'equipmentCategory',
 | 
			
		||||
					label: '设备大类',
 | 
			
		||||
					minWidth: 100,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
					filter: (val) =>
 | 
			
		||||
						val != null ? ['-', '安全设备', '消防设备', '特种设备'][val] : '-',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'equipmentName',
 | 
			
		||||
					label: '设备名称',
 | 
			
		||||
					minWidth: 100,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'maintainWorker',
 | 
			
		||||
					label: '保养人员',
 | 
			
		||||
					minWidth: 100,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'relatePlan',
 | 
			
		||||
					label: '是否计划保养',
 | 
			
		||||
					width: 120,
 | 
			
		||||
					filter: (v) => (v != null ? ['', '是', '否'][v] : ''),
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'planName',
 | 
			
		||||
					label: '保养计划名称',
 | 
			
		||||
					minWidth: 120,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'maintainDuration',
 | 
			
		||||
					label: '计划保养用时(h)',
 | 
			
		||||
					minWidth: 130,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
				{ prop: 'timeUsed', label: '实际保养用时(h)', minWidth: 130 },
 | 
			
		||||
				{
 | 
			
		||||
					prop: 'remark',
 | 
			
		||||
					label: '备注',
 | 
			
		||||
					minWidth: 100,
 | 
			
		||||
					showOverflowtooltip: true,
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			searchBarFormConfig: [
 | 
			
		||||
				{
 | 
			
		||||
					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',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '计划名称',
 | 
			
		||||
					placeholder: '请选择计划名称',
 | 
			
		||||
					param: 'maintainPlanId',
 | 
			
		||||
				},
 | 
			
		||||
				// 开始结束时间
 | 
			
		||||
				{
 | 
			
		||||
					type: 'datePicker',
 | 
			
		||||
					label: '保养开始时间',
 | 
			
		||||
					dateType: 'daterange', // datetimerange
 | 
			
		||||
					format: 'yyyy-MM-dd',
 | 
			
		||||
					valueFormat: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
					rangeSeparator: '-',
 | 
			
		||||
					startPlaceholder: '开始日期',
 | 
			
		||||
					endPlaceholder: '结束日期',
 | 
			
		||||
					defaultTime: ['00:00:00', '23:59:59'],
 | 
			
		||||
					param: 'startTime',
 | 
			
		||||
					// width: 350,
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'select',
 | 
			
		||||
					label: '是否计划保养',
 | 
			
		||||
					selectOptions: [
 | 
			
		||||
						{ name: '是', id: 1 },
 | 
			
		||||
						{ name: '否', id: 2 },
 | 
			
		||||
					],
 | 
			
		||||
					param: 'relatePlan',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'button',
 | 
			
		||||
					btnName: '查询',
 | 
			
		||||
					name: 'search',
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: 'separate',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('equipment:maintain-record:export')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '导出',
 | 
			
		||||
					name: 'export',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'primary',
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					type: this.$auth.hasPermi('equipment:maintain-record:create')
 | 
			
		||||
						? 'button'
 | 
			
		||||
						: '',
 | 
			
		||||
					btnName: '新增',
 | 
			
		||||
					name: 'add',
 | 
			
		||||
					plain: true,
 | 
			
		||||
					color: 'success',
 | 
			
		||||
				},
 | 
			
		||||
			],
 | 
			
		||||
			rows: [
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '设备大类',
 | 
			
		||||
						prop: 'specialType',
 | 
			
		||||
						options: [
 | 
			
		||||
							{ label: '安全设备', value: 1 },
 | 
			
		||||
							{ label: '消防设备', value: 2 },
 | 
			
		||||
							{ label: '特种设备', value: 3 },
 | 
			
		||||
						],
 | 
			
		||||
						bind: {
 | 
			
		||||
							filterable: true,
 | 
			
		||||
							clearable: true,
 | 
			
		||||
						},
 | 
			
		||||
						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: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '保养人员',
 | 
			
		||||
						prop: 'maintainWorker',
 | 
			
		||||
						url: '/base/core-worker/listAll',
 | 
			
		||||
						valueKey: 'name',
 | 
			
		||||
						bind: {
 | 
			
		||||
							filterable: true,
 | 
			
		||||
							clearable: true,
 | 
			
		||||
							multiple: true,
 | 
			
		||||
						},
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '保养人员不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '保养单号',
 | 
			
		||||
						prop: 'maintainOrderNumber',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					// {
 | 
			
		||||
					// 	switch: true,
 | 
			
		||||
					// 	label: '是否计划保养',
 | 
			
		||||
					// 	prop: 'relatePlan',
 | 
			
		||||
					// 	bind: {
 | 
			
		||||
					// 		'active-value': 1,
 | 
			
		||||
					// 		'inactive-value': 2,
 | 
			
		||||
					// 	},
 | 
			
		||||
					// 	rules: [{ required: true, message: '是否计划保养不能为空', trigger: 'blur' }],
 | 
			
		||||
					// },
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						options: [
 | 
			
		||||
							{ label: '是', value: 1 },
 | 
			
		||||
							{ label: '否', value: 2 },
 | 
			
		||||
						],
 | 
			
		||||
						label: '是否计划保养',
 | 
			
		||||
						prop: 'relatePlan',
 | 
			
		||||
						bind: {
 | 
			
		||||
							clearable: true,
 | 
			
		||||
							filterable: true,
 | 
			
		||||
						},
 | 
			
		||||
						rules: [
 | 
			
		||||
							{
 | 
			
		||||
								required: true,
 | 
			
		||||
								message: '是否计划保养不能为空',
 | 
			
		||||
								trigger: 'blur',
 | 
			
		||||
							},
 | 
			
		||||
						],
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						select: true,
 | 
			
		||||
						label: '所属计划',
 | 
			
		||||
						prop: 'maintainPlanId',
 | 
			
		||||
						url: '/base/equipment-maintain-plan/page',
 | 
			
		||||
						bind: {
 | 
			
		||||
							filterable: true,
 | 
			
		||||
							clearable: true,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						input: true,
 | 
			
		||||
						label: '保养用时',
 | 
			
		||||
						prop: 'timeUsed',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						datetime: true,
 | 
			
		||||
						label: '开始时间',
 | 
			
		||||
						prop: 'startTime',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '开始时间不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
						bind: {
 | 
			
		||||
							format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
							'value-format': 'timestamp',
 | 
			
		||||
							// 'value-format': 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
							clearable: true,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						datetime: true,
 | 
			
		||||
						label: '结束时间',
 | 
			
		||||
						prop: 'endTime',
 | 
			
		||||
						rules: [
 | 
			
		||||
							{ required: true, message: '结束时间不能为空', trigger: 'blur' },
 | 
			
		||||
						],
 | 
			
		||||
						bind: {
 | 
			
		||||
							format: 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
							'value-format': 'timestamp',
 | 
			
		||||
							// 'value-format': 'yyyy-MM-dd HH:mm:ss',
 | 
			
		||||
							clearable: true,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					{},
 | 
			
		||||
				],
 | 
			
		||||
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						upload: true,
 | 
			
		||||
						label: '上传资料',
 | 
			
		||||
						prop: 'files',
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[
 | 
			
		||||
					{
 | 
			
		||||
						label: '保养描述',
 | 
			
		||||
						prop: 'maintenanceDes',
 | 
			
		||||
						subcomponent: Editor,
 | 
			
		||||
						bind: {
 | 
			
		||||
							'min-height': 192,
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				],
 | 
			
		||||
				[{ input: true, label: '备注', prop: 'remark' }],
 | 
			
		||||
			],
 | 
			
		||||
			// 是否显示弹出层
 | 
			
		||||
			open: false,
 | 
			
		||||
			// 查询参数
 | 
			
		||||
			queryParams: {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 10,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				relatePlan: null,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
				special: true,
 | 
			
		||||
				specialType: null,
 | 
			
		||||
			},
 | 
			
		||||
			// 表单参数
 | 
			
		||||
			form: {},
 | 
			
		||||
			basePath: '/base/equipment-maintain-log',
 | 
			
		||||
			mode: null,
 | 
			
		||||
			allSpecialEquipments: [],
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		this.initSearchBar();
 | 
			
		||||
		if (this.$route.query) {
 | 
			
		||||
			this.queryParams.equipmentId =
 | 
			
		||||
				this.$route.query?.equipmentId ?? undefined;
 | 
			
		||||
			this.queryParams.maintainPlanId =
 | 
			
		||||
				this.$route.query?.maintainPlanId ?? undefined;
 | 
			
		||||
			this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined;
 | 
			
		||||
			this.queryParams.startTime = this.$route.query?.createTime ?? undefined;
 | 
			
		||||
			this.searchBarFormConfig[1].defaultSelect =
 | 
			
		||||
				this.$route.query.equipmentId ?? undefined;
 | 
			
		||||
			this.searchBarFormConfig[2].defaultSelect =
 | 
			
		||||
				this.$route.query.maintainPlanId ?? undefined;
 | 
			
		||||
			this.searchBarFormConfig[3].defaultSelect =
 | 
			
		||||
				this.$route.query?.createTime ?? undefined;
 | 
			
		||||
			this.searchBarFormConfig[4].defaultSelect =
 | 
			
		||||
				Number(this.$route.query.relatePlan) ?? undefined;
 | 
			
		||||
		}
 | 
			
		||||
		this.getList();
 | 
			
		||||
		if (this.$route.query.addRecord) {
 | 
			
		||||
			this.handleAdd();
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		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[1],
 | 
			
		||||
				'selectOptions',
 | 
			
		||||
				eqList.map((item) => ({
 | 
			
		||||
					name: item.name,
 | 
			
		||||
					id: item.id,
 | 
			
		||||
				}))
 | 
			
		||||
			);
 | 
			
		||||
		},
 | 
			
		||||
		initSearchBar() {
 | 
			
		||||
			this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
 | 
			
		||||
				this.allSpecialEquipments = data.filter((item) => item.special);
 | 
			
		||||
				this.setSearchBarEquipmentList(data.filter((item) => item.special));
 | 
			
		||||
			});
 | 
			
		||||
			this.http('/base/equipment-maintain-plan/page', 'get', {
 | 
			
		||||
				pageNo: 1,
 | 
			
		||||
				pageSize: 100,
 | 
			
		||||
				special: true,
 | 
			
		||||
			}).then(({ data }) => {
 | 
			
		||||
				this.$set(
 | 
			
		||||
					this.searchBarFormConfig[2],
 | 
			
		||||
					'selectOptions',
 | 
			
		||||
					(data?.list || []).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,
 | 
			
		||||
				relatePlan: null,
 | 
			
		||||
				maintainPlanId: null,
 | 
			
		||||
				equipmentId: null,
 | 
			
		||||
				maintainWorker: null,
 | 
			
		||||
				maintainOrderNumber: null,
 | 
			
		||||
				startTime: null,
 | 
			
		||||
				endTime: null,
 | 
			
		||||
				timeUsed: null,
 | 
			
		||||
				remark: null,
 | 
			
		||||
				maintenanceDes: null,
 | 
			
		||||
				files: [
 | 
			
		||||
					// {
 | 
			
		||||
					// 	fileName: '',
 | 
			
		||||
					// 	fileType: '',
 | 
			
		||||
					// 	fileUrl: '',
 | 
			
		||||
					// },
 | 
			
		||||
				],
 | 
			
		||||
			};
 | 
			
		||||
			this.resetForm('form');
 | 
			
		||||
		},
 | 
			
		||||
		/** 搜索按钮操作 */
 | 
			
		||||
		handleQuery() {
 | 
			
		||||
			this.queryParams.pageNo = 1;
 | 
			
		||||
			this.getList();
 | 
			
		||||
		},
 | 
			
		||||
		/** 重置按钮操作 */
 | 
			
		||||
		resetQuery() {
 | 
			
		||||
			this.resetForm('queryForm');
 | 
			
		||||
			this.handleQuery();
 | 
			
		||||
		},
 | 
			
		||||
		/** 新增按钮操作 */
 | 
			
		||||
		handleAdd() {
 | 
			
		||||
			this.reset();
 | 
			
		||||
			if (this.$route.query.addRecord) {
 | 
			
		||||
				// 赋值
 | 
			
		||||
				const tempRow = this.$route.query.row;
 | 
			
		||||
				this.form.equipmentId = tempRow.equipmentId;
 | 
			
		||||
				this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2;
 | 
			
		||||
				this.form.startTime = tempRow.nextMaintainTime;
 | 
			
		||||
				this.form.maintainPlanId = tempRow.id;
 | 
			
		||||
			}
 | 
			
		||||
			if (this.$route.query.isAdd) {
 | 
			
		||||
				// 赋值
 | 
			
		||||
				this.form.equipmentId = this.$route.query.equipmentId;
 | 
			
		||||
				this.form.maintainPlanId = this.$route.query.maintainPlanId;
 | 
			
		||||
			}
 | 
			
		||||
			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.form.maintainWorker = this.form.maintainWorker.split(',');
 | 
			
		||||
				this.title = '修改保养记录';
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		/** 提交按钮 */
 | 
			
		||||
		submitForm() {
 | 
			
		||||
			this.$refs['form'].validate((valid) => {
 | 
			
		||||
				if (!valid) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				this.form.maintainWorker = this.form.maintainWorker.join(',');
 | 
			
		||||
				// 修改的提交
 | 
			
		||||
				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.equipmentName + '"的数据项?')
 | 
			
		||||
				.then(function () {
 | 
			
		||||
					return deleteEqMaintainLog(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 exportMaintainLogExcel(params);
 | 
			
		||||
				})
 | 
			
		||||
				.then((response) => {
 | 
			
		||||
					this.$download.excel(response, '设备保养记录.xls');
 | 
			
		||||
					this.exportLoading = false;
 | 
			
		||||
				})
 | 
			
		||||
				.catch(() => {});
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	computed: {},
 | 
			
		||||
	methods: {},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user