From efad6058c9c9ee6ba754dc9cc61c8d744cd199b8 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期一, 06 一月 2025 10:30:31 +0800 Subject: [PATCH] 完成设备模块搬迁 --- src/components/equipment/check-record.vue | 424 + src/components/do/a6-device/state.vue | 641 ++ src/components/equipment/inspection-form.vue | 276 src/components/do/a6-device/resource-reservation.vue | 504 + src/components/equipment/using-external-instruments.vue | 198 src/components/equipment/equipment-check.vue | 333 + src/components/do/a6-device/record.vue | 472 + src/components/do/a6-device/device-overview.vue | 408 + src/components/do/a6-device/borrow.vue | 632 ++ src/components/equipment/equipment-scrap.vue | 193 src/components/equipment/equipment-acceptance.vue | 377 + src/components/equipment/scrapApplicationForm.vue | 199 src/components/equipment/acceptance-form.vue | 210 src/components/view/a6-device.vue | 324 src/util/auth.js | 17 src/components/equipment/accident-form.vue | 236 src/components/do/a6-device/check.vue | 677 ++ src/components/equipment/addYearPlanDia.vue | 231 src/components/equipment/failure-form.vue | 198 src/components/equipment/inspection-of-equipment.vue | 202 static/js/menu.js | 86 src/components/do/a6-device/fault.vue | 687 ++ src/components/do/a6-device/management.vue | 1041 +++ src/components/equipment/equipment-calibration-plan.vue | 602 ++ node_modules.zip | 0 src/components/do/a6-device/maintenance.vue | 494 + src/assets/api/controller.js | 128 src/components/do/a6-device/operation-overview.vue | 259 src/components/equipment/applicationForm.vue | 239 src/components/equipment/addVerificationYearPlanDia.vue | 248 src/components/equipment/equipment-accident.vue | 194 src/components/equipment/equipment-verification-plan.vue | 682 ++ src/main.js | 8 src/components/equipment/equipment-maintenance-plan.vue | 425 + src/components/equipment/equipment-failure.vue | 193 package.json | 1 src/components/do/a6-device/files.vue | 1478 +++- src/components/do/a6-device/operation-instruction.vue | 562 + src/components/equipment/quantity-value-traceability-plan.vue | 434 + src/components/do/a6-device/check-and-accept.vue | 1013 +++ src/components/do/a6-device/calibration.vue | 948 ++ src/components/do/a6-device/acquisition-config.vue | 792 ++ 42 files changed, 15,963 insertions(+), 1,303 deletions(-) diff --git a/node_modules.zip b/node_modules.zip new file mode 100644 index 0000000..550a786 --- /dev/null +++ b/node_modules.zip Binary files differ diff --git a/package.json b/package.json index adfde49..d25ffa0 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "bootstart": "0.0.0", "bootstrap": "^5.0.1", "core-js": "^3.37.1", + "dom-to-image": "^2.6.0", "dragula": "^3.7.3", "echarts": "^5.4.2", "element-ui": "^2.15.6", diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index 6372293..82b3f7f 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -75,6 +75,16 @@ personCommunicationAbility, procurementSuppliesContents, procurementSuppliesStore, + deviceAcceptance, + deviceAccidentReport, + deviceExaminePlan, + deviceCalibrationPlan, + deviceExternalApply, + deviceBreakdownMaintenance, + deviceMaintenancePlan, + deviceScrapped, + deviceInspectionRecord, + deviceTraceabilityManagement, } } @@ -1003,3 +1013,121 @@ exportExcel: '/procurementSuppliesStore/exportExcel', // 鑰楁潗鍏ュ簱瀵煎嚭 updateStore: '/procurementSuppliesStore/updateStore', // 鑰楁潗鍏ュ簱淇敼 } + +// 璁惧楠屾敹锛堣澶囷級 +const deviceAcceptance = { + addDeviceAcceptance: '/deviceAcceptance/addDeviceAcceptance', // 鏂板璁惧楠屾敹 + updateDeviceAcceptance: '/deviceAcceptance/updateDeviceAcceptance', // 缂栬緫璁惧楠屾敹 + delDeviceAcceptance: '/deviceAcceptance/delDeviceAcceptance', // 鍒犻櫎璁惧楠屾敹 + delDeviceAcceptanceFileList: '/deviceAcceptance/delDeviceAcceptanceFileList', // 璁惧楠屾敹闄勪欢鍒犻櫎 + getDeviceAcceptance: '/deviceAcceptance/getDeviceAcceptance', // 鏌ヨ璁惧楠屾敹 + getDeviceAcceptanceFileList: '/deviceAcceptance/getDeviceAcceptanceFileList', // 璁惧楠屾敹闄勪欢鍒楄〃 + pageDeviceAcceptance: '/deviceAcceptance/pageDeviceAcceptance', // 璁惧楠屾敹鍒楄〃 + uploadDeviceAcceptanceFile: '/deviceAcceptance/uploadDeviceAcceptanceFile', // 璁惧楠屾敹闄勪欢鏂板 + exportDeviceAcceptance: '/deviceAcceptance/exportDeviceAcceptance', // 瀵煎嚭 +} + +// 璁惧浜嬫晠 +const deviceAccidentReport = { + addDeviceAccidentReport: '/deviceAccidentReport/addDeviceAccidentReport', // 鏂板璁惧浜嬫晠鎶ュ憡 + delDeviceAccidentReport: '/deviceAccidentReport/delDeviceAccidentReport', // 鍒犻櫎璁惧浜嬫晠鎶ュ憡 + getDeviceAccidentReport: '/deviceAccidentReport/getDeviceAccidentReport', // 鏌ヨ璁惧浜嬫晠鎶ュ憡 + pageDeviceAccidentReport: '/deviceAccidentReport/pageDeviceAccidentReport', // 璁惧浜嬫晠鎶ュ憡鍒楄〃 + exportDeviceAccidentReport: '/deviceAccidentReport/exportDeviceAccidentReport', // 瀵煎嚭 +} + +// 璁惧鏍告煡璁″垝 +const deviceExaminePlan = { + addDeviceExaminePlanDetail: '/deviceExaminePlan/addDeviceExaminePlanDetail', // 鏂板璁惧鏍告煡璁″垝璇︽儏 + addExamineRecord: '/deviceExaminePlan/addExamineRecord', // 鏂板鏍告煡璁板綍 + addExamineRecordContrast: '/deviceExaminePlan/addExamineRecordContrast', // 鏂板鏍告煡瀵规瘮璁板綍 + delDeviceExaminePlanDetail: '/deviceExaminePlan/delDeviceExaminePlanDetail', // 鍒犻櫎璁惧鏍告煡璁″垝璇︽儏 + delQualitySupervise: '/deviceExaminePlan/delQualitySupervise', // 璁惧鏍告煡璁″垝鍒犻櫎 + exportDeviceExaminePlanDetail: '/deviceExaminePlan/exportDeviceExaminePlanDetail', // 瀵煎嚭璁惧鏍告煡璁″垝 + getExamineRecord: '/deviceExaminePlan/getExamineRecord', // 鏌ヨ鏍告煡璁板綍 + getExamineRecordContrast: '/deviceExaminePlan/getExamineRecordContrast', // 鏌ヨ鏍告煡瀵规瘮璁板綍 + importDeviceExaminePlan: '/deviceExaminePlan/importDeviceExaminePlan', // 瀵煎叆璁惧鏍告煡璁″垝 + pageDeviceExaminePlan: '/deviceExaminePlan/pageDeviceExaminePlan', // 璁惧鏍告煡璁″垝鍒楄〃 + pageDeviceExaminePlanDetail: '/deviceExaminePlan/pageDeviceExaminePlanDetail', // 璁惧鏍告煡璁″垝璇︽儏鍒楄〃 + ratifyDeviceExaminePlan: '/deviceExaminePlan/ratifyDeviceExaminePlan', // 璁惧鏍告煡璁″垝鎵瑰噯 + reviewExamineRecord: '/deviceExaminePlan/reviewExamineRecord', // 澶嶆牳鏍告煡璁板綍 + reviewExamineRecordContrast: '/deviceExaminePlan/reviewExamineRecordContrast', // 瀹℃牳鏍告煡瀵规瘮璁板綍 + updateDeviceExaminePlanDetail: '/deviceExaminePlan/updateDeviceExaminePlanDetail', // 淇敼璁惧鏍告煡璁″垝璇︽儏 + exportReviewExamineRecordDetail: '/deviceExaminePlan/exportReviewExamineRecordDetail', // 鏍告煡璁板綍瀵煎嚭 + exportReviewExamineRecordContrast: '/deviceExaminePlan/exportReviewExamineRecordContrast', // 鏍告煡瀵规瘮瀵煎嚭 + addDeviceExaminePlan: '/deviceExaminePlan/addDeviceExaminePlan', // 娣诲姞璁惧鏍告煡璁″垝 +} + +// 璁惧鏍″噯璁″垝 +const deviceCalibrationPlan = { + pageDeviceCalibrationPlan: '/deviceCalibrationPlan/pageDeviceCalibrationPlan', // 璁惧鏍″噯璁″垝鍒楄〃鏌ヨ + importDeviceCalibrationPlan: '/deviceCalibrationPlan/importDeviceCalibrationPlan', // 瀵煎叆璁惧鏍″噯璁� + ratifyDeviceCalibrationPlan: '/deviceCalibrationPlan/ratifyDeviceCalibrationPlan', // 璁惧鏍″噯璁″垝鎵瑰噯 + exportDeviceCalibrationPlanDetail: '/deviceCalibrationPlan/exportDeviceCalibrationPlanDetail', // 璁惧鏍″噯璁″垝瀵煎嚭 + delQualitySupervise: '/deviceCalibrationPlan/delQualitySupervise', // 璁惧鏍″噯璁″垝鍒犻櫎 + pageDeviceCalibrationPlanDetail: '/deviceCalibrationPlan/pageDeviceCalibrationPlanDetail', // 璁惧鏍″噯璁″垝璇︽儏鍒楄〃 + addDeviceCalibrationPlanDetail: '/deviceCalibrationPlan/addDeviceCalibrationPlanDetail', // 鏂板璁惧鏍″噯璁″垝璇︽儏 + updateDeviceCalibrationPlanDetail: '/deviceCalibrationPlan/updateDeviceCalibrationPlanDetail', // 淇敼璁惧鏍″噯璁″垝璇︽儏 + delDeviceCalibrationPlanDetail: '/deviceCalibrationPlan/delDeviceCalibrationPlanDetail', // 璁惧鏍″噯璁″垝璇︽儏鍒犻櫎 + addDeviceCalibrationPlan: '/deviceCalibrationPlan/addDeviceCalibrationPlan', // 鏂板璁惧鏍″噯璁″垝 +} + +// 鍊熺敤澶栭儴浠櫒 +const deviceExternalApply = { + addDeviceExternalApply: '/deviceExternalApply/addDeviceExternalApply', // 鏂板鍒╃敤澶栭儴璁惧鐢宠 + delDeviceExternalApply: '/deviceExternalApply/delDeviceExternalApply', // 鍒犻櫎鍒╃敤澶栭儴璁惧鐢宠 + getDeviceExternalApply: '/deviceExternalApply/getDeviceExternalApply', // 鏌ヨ鍒╃敤澶栭儴璁惧鐢宠 + pageDeviceExternalApply: '/deviceExternalApply/pageDeviceExternalApply', // 鍒╃敤澶栭儴璁惧鐢宠鍒楄〃 + exportDeviceExternalApply: '/deviceExternalApply/exportDeviceExternalApply', // 瀵煎嚭 +} + +// 璁惧鏁呴殰涓庣淮淇� +const deviceBreakdownMaintenance = { + addDeviceBreakdownMaintenance: '/deviceBreakdownMaintenance/addDeviceBreakdownMaintenance', // 鏂板璁惧鏁呴殰缁翠慨 + delDeviceBreakdownMaintenance: '/deviceBreakdownMaintenance/delDeviceBreakdownMaintenance', // 鍒犻櫎璁惧鏁呴殰缁翠慨 + getDeviceBreakdownMaintenance: '/deviceBreakdownMaintenance/getDeviceBreakdownMaintenance', // 鏌ヨ璁惧鏁呴殰缁翠慨 + pageDeviceBreakdownMaintenance: '/deviceBreakdownMaintenance/pageDeviceBreakdownMaintenance', // 璁惧鏁呴殰缁翠慨鍒楄〃 + exportDeviceBreakdownMaintenance: '/deviceBreakdownMaintenance/exportDeviceBreakdownMaintenance', // 瀵煎嚭 +} + +// 璁惧淇濆吇 +const deviceMaintenancePlan = { + addMaintenancePlan: '/deviceMaintenancePlan/addMaintenancePlan', // 鏂板璁惧淇濆吇璁″垝 + deleteMaintenancePlan: '/deviceMaintenancePlan/deleteMaintenancePlan', // 鍒犻櫎璁惧淇濆吇璁″垝 + exportDeviceMaintenancePlan: '/deviceMaintenancePlan/exportDeviceMaintenancePlan', // 瀵煎嚭璁惧淇濆吇璁″垝 + getMaintenancePlanDetail: '/deviceMaintenancePlan/getMaintenancePlanDetail', // 鏌ヨ璁惧淇濆吇璁″垝璇︽儏 + reviewMaintenancePlanStatus: '/deviceMaintenancePlan/reviewMaintenancePlanStatus', // 淇濆吇璁″垝瀹℃牳鐘舵�佷慨鏀� + selectDeviceMaintenancePlanByPage: '/deviceMaintenancePlan/selectDeviceMaintenancePlanByPage', // 鍒嗛〉鏌ヨ璁惧淇濆吇璁″垝 + updateMaintenancePlan: '/deviceMaintenancePlan/updateMaintenancePlan', // 淇敼璁惧淇濆吇璁″垝 +} + +// 璁惧鎶ュ簾 +const deviceScrapped = { + addDeviceScrapped: '/deviceScrapped/addDeviceScrapped', // 鏂板璁惧鎶ュ簾鐢宠 + delDeviceScrapped: '/deviceScrapped/delDeviceScrapped', // 鍒犻櫎璁惧鎶ュ簾鐢宠 + getDeviceScrapped: '/deviceScrapped/getDeviceScrapped', // 鏌ヨ璁惧鎶ュ簾鐢宠 + pageDeviceScrapped: '/deviceScrapped/pageDeviceScrapped', // 璁惧鎶ュ簾鐢宠鍒楄〃 + exportDeviceScrapped: '/deviceScrapped/exportDeviceScrapped', // 瀵煎嚭 +} + +// 璁惧鐐规 +const deviceInspectionRecord = { + addDeviceInspectionRecord: '/deviceInspectionRecord/addDeviceInspectionRecord', // 鏂板璁惧鐐规璁板綍 + deleteDeviceInspectionRecord: '/deviceInspectionRecord/deleteDeviceInspectionRecord', // 鍒犻櫎璁惧鐐规璁板綍 + exportDeviceInspectionRecord: '/deviceInspectionRecord/exportDeviceInspectionRecord', // 瀵煎嚭璁惧鐐规璁板綍 + getDeviceInspectionRecordByPage: '/deviceInspectionRecord/getDeviceInspectionRecordByPage', // 鍒嗛〉鏌ヨ璁惧鐐规璁板綍 + updateDeviceInspectionRecord: '/deviceInspectionRecord/updateDeviceInspectionRecord', // 淇敼璁惧鐐规璁板綍 + reviewDeviceInspectionRecord: '/deviceInspectionRecord/reviewDeviceInspectionRecord', // 澶嶆牳璁惧鐐规璁板綍 + getDeviceInspectionRecord: '/deviceInspectionRecord/getDeviceInspectionRecord', // 璁惧鐐规璁板綍璇︽儏 +} + +// 璁惧閲忓�兼函婧愯鍒� +const deviceTraceabilityManagement = { + addTraceabilityManagement: '/deviceTraceabilityManagement/addTraceabilityManagement', // 鏂板閲忓�兼函婧愯鍒� + deleteTraceabilityManagement: '/deviceTraceabilityManagement/deleteTraceabilityManagement', // 鍒犻櫎閲忓�兼函婧愯鍒� + exportDeviceTraceabilityManagement: '/deviceTraceabilityManagement/exportDeviceTraceabilityManagement', // 瀵煎嚭閲忓�兼函婧愯鍒� + getTraceabilityManagementDetail: '/deviceTraceabilityManagement/getTraceabilityManagementDetail', // 鏌ヨ閲忓�兼函婧愯鍒掕鎯� + reviewTraceabilityManagementStatus: '/deviceTraceabilityManagement/reviewTraceabilityManagementStatus', // 閲忓�兼函婧愯鍒掑鏍哥姸鎬佷慨鏀� + selectDeviceTraceabilityManagementByPage: '/deviceTraceabilityManagement/selectDeviceTraceabilityManagementByPage', // 鍒嗛〉鏌ヨ閲忓�兼函婧愯鍒� + updateTraceabilityManagement: '/deviceTraceabilityManagement/updateTraceabilityManagement', // 淇敼閲忓�兼函婧愯鍒� +} diff --git a/src/components/do/a6-device/acquisition-config.vue b/src/components/do/a6-device/acquisition-config.vue new file mode 100644 index 0000000..dbe1ba7 --- /dev/null +++ b/src/components/do/a6-device/acquisition-config.vue @@ -0,0 +1,792 @@ +<template> + <div class="data-acquisition-config"> + <div> + <el-row class="title"> + <el-col :span="6" style="padding-left: 20px;text-align: left;">鏁伴噰閰嶇疆</el-col> + <el-col :span="18" style="text-align: right;"> + <el-button size="medium" type="primary" @click="fileConfiguration">鏂囦欢閰嶇疆</el-button> + <el-button size="medium" @click="$parent.closeDataVue()"> + <span style="color: #3A7BFA;">杩斿洖</span> + </el-button> + </el-col> + </el-row> + </div> + <div class="table"> + <el-table :data="tableList.slice( + (page.current - 1) * page.size, + page.current * page.size + ) + " border tooltip-effect="dark" style="width: 74%;" height="100%" :span-method="spanMethod"> + <el-table-column type="index" label="搴忓彿" align="center" width="65"></el-table-column> + <el-table-column prop="deviceName" align="center" min-width="100" label="璁惧鍚嶇О"></el-table-column> + <el-table-column prop="fileType" align="center" label="鏂囦欢鍚庣紑"></el-table-column> + <el-table-column prop="collectUrl" align="center" min-width="100" show-overflow-tooltip + label="閲囬泦鍦板潃"></el-table-column> + <el-table-column prop="storageUrl" align="center" min-width="100" show-overflow-tooltip + label="瀛樺偍鍦板潃"></el-table-column> + <el-table-column prop="ip" align="center" label="IP鍦板潃" min-width="100"></el-table-column> + <el-table-column prop="sample" align="center" label="妫�楠屽璞�" show-overflow-tooltip + min-width="150"></el-table-column> + <el-table-column prop="inspectionItemClass" align="center" label="妫�楠岄」鍒嗙被" min-width="120"></el-table-column> + <el-table-column prop="inspectionItem" align="center" label="妫�楠岄」" min-width="100"></el-table-column> + <el-table-column prop="inspectionItemSubclass" align="center" label="妫�楠屽瓙椤�" min-width="100"></el-table-column> + <el-table-column prop="referx" align="center" label="鍙傜収X" min-width="100"></el-table-column> + <el-table-column prop="x" align="center" label="X"></el-table-column> + <el-table-column prop="refery" align="center" label="鍙傜収Y" min-width="100"></el-table-column> + <el-table-column prop="y" align="center" label="Y"></el-table-column> + <el-table-column prop="anotherName" align="center" label="鍒悕" min-width="100"></el-table-column> + <el-table-column prop="matchingName" align="center" label="鍖归厤鍚嶇О" min-width="100"></el-table-column> + <el-table-column prop="formula" align="center" label="鍏紡"></el-table-column> + <el-table-column prop="section" fixed="right" label="鎿嶄綔" width="120"> + <template slot-scope="scope"> + <el-button type="text" @click="dataConfig(scope.row)">鏁伴噰閰嶇疆</el-button> + </template> + </el-table-column> + </el-table> + </div> + <div class="page" v-if="tableList.length > 0"> + <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page="page.current" + :page-sizes="[10, 20, 30, 50, 100]" :page-size="page.size" layout="total, sizes, prev, pager, next, jumper" + :total="tableList.length"> + </el-pagination> + </div> + <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible3" width="920px" :before-close="closeForm"> + <el-form :model="configForm" label-position="top" size="small" ref="configForm" label-width="100px" + class="demo-ruleForm"> + <el-table :data="domains" style="width: 100%" height="300"> + <el-table-column label="搴忓彿" type="index" width="80"> + <template v-slot="scope"> + {{ getIndexWithAlphabet(scope.$index) }} + </template> + </el-table-column> + <el-table-column prop="referx" label="鍙傜収X" min-width="140"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.referx"></el-input> + </template> + </el-table-column> + <el-table-column prop="x" label="X" min-width="100"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.x"></el-input> + </template> + </el-table-column> + <el-table-column prop="refery" label="鍙傜収Y" min-width="140"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.refery"></el-input> + </template> + </el-table-column> + <el-table-column prop="y" label="Y" min-width="100"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.y"></el-input> + </template> + </el-table-column> + <el-table-column prop="anotherName" label="鍒悕" min-width="140"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.anotherName"></el-input> + </template> + </el-table-column> + <el-table-column prop="matchingName" label="鍖归厤鍚嶇О" min-width="140"> + <template v-slot="scope"> + <el-input style="width: 100%" v-model="scope.row.matchingName"></el-input> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" width="150"> + <template v-slot="scope"> + <el-button @click.prevent="removeDomain(scope.row)" size="small" type="text">鍒犻櫎</el-button> + <el-button @click="addDomain" size="small" type="text">鏂板</el-button> + </template> + </el-table-column> + </el-table> + <div class="fomItem2"> + <el-form-item class="fomItemInput1"> + <template v-slot="label"> + 鍏紡锛� + <el-tooltip v-for="(formula, key) in formulas" class="itemFomItem" effect="dark" :content="formula.content" :key="key" + placement="top"> + <label>{{ formula.label }}()</label> + </el-tooltip> + <el-input type="textarea" autosi:autosize="{ minRows: 2, maxRows: 4}" ze placeholder="璇疯緭鍏ュ唴瀹�" + v-model="configForm.formula" @change="evalResult"> + </el-input> + </template> + </el-form-item> + </div> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="closeForm">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm3" :loading="upLoad3">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible4" width="400px"> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"> + <span style="color:red;margin-right: 4px;">*</span>IP锛� + </div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.ip"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"> + <span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛� + </div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.collectUrl"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label">鍌ㄥ瓨鍦板潃锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.storageUrl"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"> + <span style="color:red;margin-right: 4px;">*</span>鏂囦欢鍚庣紑锛� + </div> + <el-select v-model="configForm.fileType" size="small" placeholder="璇烽�夋嫨" style="width: 100%;"> + <el-option v-for="item in fileTypeOptions" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label">濮旀墭瀛楁锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.entrustCode"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label">鏍峰搧瀛楁锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.sampleCode"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.dbFileName"></el-input> + </div> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="dialogVisible4 = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm4" :loading="upLoad4">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "dataAcquisitionConfig", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + props: { + deviceId: { + type: Number, + default: () => [] + } + }, + mounted() { + this.init(); + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + formulas: [ + { + label: "MAX", + content: "姹傚弬鏁版渶澶у�硷紝鍙傛暟涓暟鏈�灏戜袱涓紝濡傦細MAX(A1,B2)" + }, + { + label: "MIN", + content: "姹傚弬鏁版渶灏忓�硷紝鍙傛暟涓暟鏈�灏戜袱涓紝濡傦細MIN(A1,B2)" + }, + { + label: "SUM", + content: "姹傚拰锛屽弬鏁颁釜鏁版渶灏戜袱涓紝濡傦細SUM(A1,B2)" + }, + { + label: "ABS", + content: "姹傜粷瀵瑰�硷紝鍙傛暟涓暟鏈�灏戜竴涓紝濡傦細ABS(A1)" + }, + { + label: "AVERAGE", + content: "姹傚钩鍧囧�硷紝鍙傛暟涓暟鏈�灏戜袱涓釜锛屽锛欰VERAGE(A1,B2)" + }, + { + label: "MEDIAN", + content: "姹備腑鍊硷紝鍙傛暟涓暟鏈�灏戜袱涓釜锛屽锛歁EDIAN(A1,B2)" + }, + ], + dialogVisible4: false, + tableList: [], + page: { + current: 1, + size: 20 + }, + dialogVisible3: false, + configForm: { + formula: "", + collectUrl: "", + storageUrl: "", + entrustCode: "", + sampleCode: "", + dbFileName: "", + fiberOpticRibbon: "" + }, + domains: [ + { + referx: "", + refery: "", + x: "", + y: "", + anotherName: "", + matchingName: "" + } + ], + upLoad3: false, + upLoad4: false, + fileTypeOptions: [ + { label: "csv", value: ".csv" }, + { label: "db", value: ".db" }, + { label: "mdb", value: ".mdb" }, + { label: "word", value: ".docx" }, + { label: "excel", value: ".xlsx" }, + { label: "txt", value: ".txt" }, + { label: "png", value: ".png" } + ], + spanList: [], + specialSpanList: [], + spanConfig: { + special: { + main: "inspectionItemSubclass", + rows: [ + { + name: "deviceName", + index: 1 + }, + { + name: "fileType", + index: 2 + }, + { + name: "collectUrl", + index: 3 + }, + { + name: "storageUrl", + index: 4 + }, + { + name: "ip", + index: 5 + }, + { + name: "inspectionItem", + index: 6 + }, + { + name: "inspectionItemSubclass", + index: 7 + }, + { + name: "formula", + index: 13 + }, + { + name: "section", + index: 14 + } + ] + } + }, + deleteList: [] + }; + }, + // 鏂规硶闆嗗悎 + methods: { + getIndexWithAlphabet(index) { + const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + const letterIndex = index % 26; + return alphabet.charAt(letterIndex) + (index + 1); + }, + rowspan(spanArr, position, spanName) { + this.tableList.forEach((item, index) => { + if (index === 0) { + spanArr.push(1); + position = 0; + } else { + if ( + this.tableList[index][spanName] === + this.tableList[index - 1][spanName] + ) { + spanArr[position] += 1; + spanArr.push(0); + } else { + spanArr.push(1); + position = index; + } + } + }); + }, + spanMethod({ row, column, rowIndex, columnIndex }) { + // 涓�鑸殑鍚堝苟琛� + if ( + this.spanConfig != undefined && + this.spanConfig.rows && + this.spanConfig.rows.length > 0 + ) { + let i = null; + let obj = this.spanConfig.rows.find((item, index) => { + i = index; + return item.index == columnIndex; + }); + if (obj) { + const _row = this.spanList[i].arr[rowIndex]; + const _col = _row > 0 ? 1 : 0; + return { + rowspan: _row, + colspan: _col + }; + } + } + // 鐗规畩鐨勫悎骞惰 + if ( + this.spanConfig != undefined && + this.spanConfig.special && + this.spanConfig.special.main && + this.spanConfig.special.rows && + this.spanConfig.special.rows.length > 0 + ) { + let i = null; + let obj = this.spanConfig.special.rows.find((item, index) => { + i = index; + return item.index == columnIndex; + }); + if (obj) { + const _row = this.specialSpanList[i].arr[rowIndex]; + const _col = _row > 0 ? 1 : 0; + return { + rowspan: _row, + colspan: _col + }; + } + } + }, + fileConfiguration() { + this.dialogVisible4 = true; + if (this.tableList[0]) { + this.$set(this.configForm, "fileType", this.tableList[0].fileType); + this.$set(this.configForm, "collectUrl", this.tableList[0].collectUrl); + this.$set(this.configForm, "storageUrl", this.tableList[0].storageUrl); + this.$set(this.configForm, "ip", this.tableList[0].ip); + this.$set( + this.configForm, + "entrustCode", + this.tableList[0].entrustCode + ); + this.$set( + this.configForm, + "sampleCode", + this.tableList[0].sampleCode + ); + this.$set( + this.configForm, + "dbFileName", + this.tableList[0].dbFileName + ); + this.$set( + this.configForm, + "fiberOpticRibbon", + this.tableList[0].fiberOpticRibbon + ) + } + }, + init() { + this.$axios + .get( + this.$api.deviceScope.queryDataAcquisitionConfiguration + + "?deviceId=" + + this.deviceId + + "&isDevice=" + + false + ) + .then(res => { + this.tableList = res.data; + this.tableList.forEach(i => { + let isIncludes = false + if (i.formula && i.formula != "") { + this.formulas.forEach(j => { + if (i.formula.includes(j.label)) { + isIncludes = true + } + }) + } + if (!isIncludes && i.formula) { + i.formula = i.formula.slice(1, -1) + } + i.sample = i.sample + .replace(/"/g, "") + .replace(/],/g, "锛�") + .replace(/\[/g, "") + .replace(/]/g, ""); + }); + if (this.tableList[0]) { + this.$set(this.configForm, "fileType", this.tableList[0].fileType); + this.$set( + this.configForm, + "collectUrl", + this.tableList[0].collectUrl + ); + this.$set( + this.configForm, + "storageUrl", + this.tableList[0].storageUrl + ); + this.$set(this.configForm, "ip", this.tableList[0].ip); + this.$set( + this.configForm, + "entrustCode", + this.tableList[0].entrustCode + ); + this.$set( + this.configForm, + "sampleCode", + this.tableList[0].sampleCode + ); + this.$set( + this.configForm, + "dbFileName", + this.tableList[0].dbFileName + ); + this.$set( + this.configForm, + "fiberOpticRibbon", + this.tableList[0].fiberOpticRibbon + ) + } + // 涓�鑸殑鍚堝苟琛� + if ( + this.spanConfig != undefined && + this.spanConfig.rows && + this.spanConfig.rows.length > 0 + ) { + this.spanList = []; + this.spanConfig.rows.forEach((item, index) => { + this.spanList.push({ + arr: [], + position: 0 + }); + this.rowspan( + this.spanList[index].arr, + this.spanList[index].position, + item.name + ); + }); + } + // 鐗规畩鐨勫悎骞惰 + if ( + this.spanConfig != undefined && + this.spanConfig.special && + this.spanConfig.special.main && + this.spanConfig.special.rows && + this.spanConfig.special.rows.length > 0 + ) { + this.specialSpanList = []; + this.spanConfig.special.rows.forEach((item, index) => { + this.specialSpanList.push({ + arr: [], + position: 0 + }); + this.rowspan( + this.specialSpanList[index].arr, + this.specialSpanList[index].position, + this.spanConfig.special.main + ); + }); + } + }); + }, + submitForm4() { + const obj = Object.assign({ + deviceId: this.deviceId, + fileType: this.configForm.fileType, + collectUrl: this.configForm.collectUrl, + storageUrl: this.configForm.storageUrl, + ip: this.configForm.ip, + isDevice: true, + entrustCode: this.configForm.entrustCode, + sampleCode: this.configForm.sampleCode, + dbFileName: this.configForm.dbFileName, + fiberOpticRibbon: this.configForm.fiberOpticRibbon + }); + this.upLoad4 = true; + this.$axios + .post( + this.$api.deviceScope.saveDataAcquisitionConfiguration + + "?deviceId=" + + this.deviceId, + obj, + { + headers: { + "Content-Type": "application/json" + } + } + ) + .then(res => { + if (res.code == 200) { + // this.tableList = res.data; + this.dialogVisible4 = false; + this.init(); + this.$message.success("鎿嶄綔鎴愬姛"); + } + this.upLoad4 = false; + }) + .catch(err => { + this.upLoad4 = false; + }); + }, + dataConfig(row) { + this.configForm = { + deviceId: row.deviceId, + inspectionItem: row.inspectionItem.trim(), + inspectionItemSubclass: row.inspectionItemSubclass, + structureItemParameterId: row.structureItemParameterId, + inspectionItemClass: row.inspectionItemClass, + }; + this.dialogVisible3 = true; + this.$axios + .get( + this.$api.deviceScope.queryDataAcquisitionConfiguration + + "?deviceId=" + + this.deviceId + + "&inspectionItem=" + + row.inspectionItem.trim() + + "&isDevice=" + + true + + "&inspectionItemSubclass=" + + row.inspectionItemSubclass.trim() + + "&inspectionItemClass=" + + row.inspectionItemClass.trim() + + + "&structureItemParameterId=" + + row.structureItemParameterId + ) + .then(res => { + const data = res.data; + if (data[0]) { + this.domains.splice(0, 1); + let formula = data[0].formula + let isIncludes = false + if (formula && formula != "") { + for (let key in this.formulas) { + if (formula.includes(this.formulas[key].label)) { + isIncludes = true + } + } + } + if (!isIncludes && formula) { + let formulaValue = formula.slice(1, -1) + this.$set(this.configForm, "formula", formulaValue); + } else { + this.$set(this.configForm, "formula", data[0].formula); + } + data.forEach(i => { + this.domains.push({ + referx: i.referx, + refery: i.refery, + x: i.x, + y: i.y, + anotherName: i.anotherName, + matchingName: i.matchingName, + id: i.id + }); + }); + } + }); + }, + submitForm3() { + this.$refs.configForm.validate(valid => { + // 琛ㄥ崟鏍¢獙 + if (valid) { + this.domains.forEach(item => { + const isEmpty = Object.values(item).every(val => val === ""); + if (isEmpty) { + this.$message.error("璇峰~鍐欏弬鐓ф暟鎹�"); + } + }); + this.domains.forEach((i, index) => { + let isIncludes = false + if (this.configForm.formula && this.configForm.formula !== "") { + for (let formula in this.formulas) { + if (this.configForm.formula.includes(this.formulas[formula].label)) { + isIncludes = true + } + } + } + if (isIncludes === false && this.configForm.formula !== "" && this.configForm.formula !== undefined) { + i.formula = "(" + this.configForm.formula + ")"; + } else { + i.formula = this.configForm.formula; + } + i.deviceId = this.deviceId; + i.inspectionItem = this.configForm.inspectionItem; + i.inspectionItemSubclass = this.configForm.inspectionItemSubclass; + i.structureItemParameterId = this.configForm.structureItemParameterId; + i.inspectionItemClass = this.configForm.inspectionItemClass; + i.serialNumber = this.getIndexWithAlphabet(index) + }); + this.$axios + .post( + this.$api.deviceScope.saveDataAcquisitionConfiguration + + "?deviceId=" + + this.deviceId, + { dataConfigList: this.domains, isDevice: false }, + { + headers: { + "Content-Type": "application/json" + } + } + ) + .then(res => { + this.dialogVisible3 = false; + this.domains = [ + { + referx: "", + refery: "", + x: "", + y: "", + id: "" + } + ]; + if (this.deleteList.length > 0) { + this.$axios + .delete( + this.$api.deviceScope.deleteDataAcquisitionConfiguration + + "?ids=" + + this.deleteList.join() + ) + .then(res => { + if (res.code == 200) { + this.init(); + } + }); + } + this.init(); + this.$message.success("娣诲姞鎴愬姛"); + }); + } else { + return false; + } + }); + }, + removeDomain(item) { + // 鍒犻櫎鍏紡formItem + const index = this.domains.indexOf(item); + if (index !== -1 && this.domains.length > 1) { + if (item.id) { + this.deleteList.push(item.id); + this.domains.splice(index, 1); + } else { + this.domains.splice(index, 1); + } + } else { + this.$message.error("涓嶅厑璁稿垹闄ゆ渶鍚庝竴鏉℃暟鎹紒"); + } + }, + addDomain() { + // 娣诲姞鍏紡formItem + this.domains.push({ + referx: "", + refery: "", + x: "", + y: "", + id: "" + }); + }, + evalResult(val) { + this.configForm.formula = val; + // 鏍规嵁鍏紡璁$畻鍑虹粨鏋� + }, + sizeChange(val) { + this.page.size = val; + }, + currentChange(val) { + this.page.current = val; + }, + closeForm() { + this.deleteList = []; + this.domains = [ + { + referx: "", + refery: "", + x: "", + y: "", + id: "" + } + ]; + this.dialogVisible3 = false; + this.$refs.configForm.resetFields(); + } + } +}; +</script> + +<style scoped> +.itemFomItem { + margin-left: 20px; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + + font-size: 14px; + text-align: right; +} + +.data-acquisition-config { + width: 100%; + height: 100%; + overflow-y: hidden; + overflow-x: hidden; + .title { + height: 60px; + line-height: 60px; + } +} + +.page { + width: 100%; + height: 30px; + text-align: right; + margin-top: 10px; +} + +.table { + margin-top: 10px; + background-color: #fff; + width: calc(100vw - 1em); + height: calc(100vh - 18em); +} + +.fomItem1 { + display: flex; + height: 74px; +} + +.fomItem2 { + display: flex; + width: 100%; +} + +.fomItemInput { + width: 180px; + margin-right: 6px; +} + +.fomItemInput1 { + width: 100%; + margin-right: 6px; +} + +>>>.el-form-item__label { + padding-bottom: 0 !important; +} +</style> diff --git a/src/components/do/a6-device/borrow.vue b/src/components/do/a6-device/borrow.vue index cfcc90b..c2ad921 100644 --- a/src/components/do/a6-device/borrow.vue +++ b/src/components/do/a6-device/borrow.vue @@ -1,13 +1,641 @@ +<!-- 璁惧鍊熺敤 --> <template> - <div>璁惧鍊熺敤</div> + <div> + <div class="search"> + <div class="search_thing"> + <div class="search_label">娴佺▼缂栧彿锛�</div> + <div ><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.processNumber" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns"> + <el-button size="small" type="primary" @click="add">鏂板</el-button> + <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">瀵煎嚭</el-button> + </div> + </div> + <div class="tables" style="margin-top: 10px;"> + <ValueTable ref="ValueTable" :url="$api.deviceBorrow.deviceBorrowPage" + :delUrl="$api.deviceBorrow.deleteDeviceBorrow" + :componentData="componentData" :key="upIndex"/> + </div> + <el-dialog title="浠櫒璁惧棰�(鍊�)鐢ㄧ櫥璁�" top="5vh" :visible.sync="dialogVisible" width="60%"> + <el-steps :active="currentStep" finish-status="success" align-center> + <el-step style="cursor:pointer" v-for="(v, i) in steps" :title="v" :key="i" + @click.native="choiceStep(i)"></el-step> + </el-steps> + <el-form ref="form" :model="form" :rules="rules" label-width="130px"> + <div v-show="currentStepClick === 0"> + <el-card style="margin-top: 1em; height: 51vh; overflow-y: scroll;"> + <!-- 鏂板璁惧浜嬭褰曞崱鐗� --> + <el-row> + <el-col :span="12"> + <el-form-item label="缂栧彿锛�" prop="processNumber"> + <el-input v-model="form.processNumber" size="small" :disabled="currentStep>0"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О锛�"> + <el-input v-model="form.deviceName" size="small" disabled></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绠$悊缂栧彿锛�" prop="unifyNumber"> + <el-input v-model="form.unifyNumber" size="small" :disabled="currentStep>0"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍊熺敤浜猴細" prop="recipientUser"> + <el-select v-model="form.recipientUser" filterable placeholder="璇烽�夋嫨" clearable + size="small" style="width: 100%;" :disabled="currentStep>0"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍊熺敤浜鸿仈绯绘柟寮忥細" prop="borrowerContactInformation" label-width="150px"> + <el-input v-model="form.borrowerContactInformation" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍊熺敤鏃ユ湡锛�" prop="recipientTime"> + <el-date-picker + v-model="form.recipientTime" + type="date" + placeholder="閫夋嫨鏃ユ湡" size="small" format="yyyy-MM-dd" style="width: 100%" value-format="yyyy-MM-dd" :disabled="currentStep>0"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍊熺敤鏃剁姸鎬侊細" + > + <el-radio-group v-model="form.recipientState" :disabled="currentStep !== 0"> + <el-radio :label="0">鍚堟牸</el-radio> + <el-radio :label="1">缁翠慨</el-radio> + <el-radio :label="2">鍋滅敤</el-radio> + <el-radio :label="3">鎶ュ簾</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐩稿叧闄勪欢锛�" prop="fileName"> + <el-input v-model="form.fileName" disabled size="small" + :style="`width: ${currentStep == 0 ? '88%' : '100%'};`"> + <el-button slot="append" v-if="currentStep === 0" icon="el-icon-delete-solid" + @click="deleteFile"></el-button> + </el-input> + <el-upload ref="upload" style="float: right;" :action="action" :show-file-list="false" + :on-success="onSuccess" :disabled="currentStep !== 0"> + <el-button style="position: relative;top: -4px" class="uploadFile" slot="trigger" size="small" + type="primary" v-if="currentStep === 0">闄勪欢涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬬幆鑺傝矗浠讳汉锛�" prop="nextUser"> + <el-select v-model="form.nextUser" filterable placeholder="璇烽�夋嫨" clearable + size="small" style="width: 100%;" :disabled="currentStep !== 0"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.submitOperationUser }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.submitOperationTime }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 1"> + <el-card style="margin-top: 1em; height: 51vh; overflow-y: scroll;"> + <el-row> + <el-col :span="12"> + <el-form-item label="褰掕繕浜猴細" prop="rebackUser" :rules="[{ required: currentStep === 1, message: '璇疯緭鍏ュ綊杩樹汉', trigger: 'change' }]"> + <!-- <el-input v-model="form.rebackUser" size="small" :disabled="currentStep !== 1"></el-input> --> + <el-select v-model="form.rebackUser" filterable placeholder="璇烽�夋嫨" clearable + size="small" style="width: 50%;" :disabled="currentStep !== 1"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="褰掕繕鏃ユ湡锛�" prop="rebackTime" :rules="[{ required: currentStep === 1, message: '璇烽�夋嫨褰掕繕鏃ユ湡', trigger: 'change' }]"> + <el-date-picker + v-model="form.rebackTime" + :disabled="currentStep !== 1" + type="date" + placeholder="閫夋嫨鏃ユ湡" size="small" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎺ユ敹鐘跺喌锛�" + > + <el-radio-group v-model="form.receiveState" :disabled="currentStep !== 1"> + <el-radio :label="0">鍚堟牸</el-radio> + <el-radio :label="1">缁翠慨</el-radio> + <el-radio :label="2">鍋滅敤</el-radio> + <el-radio :label="3">鎶ュ簾</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧璐熻矗浜猴細" prop="deviceUser" :rules="[{ required: currentStep === 1, message: '璇烽�夋嫨璁惧璐熻矗浜�', trigger: 'change' }]"> + <!-- <el-input v-model="form.deviceUser" size="small" :disabled="currentStep !== 1"></el-input> --> + <el-select v-model="form.deviceUser" filterable placeholder="璇烽�夋嫨" clearable + size="small" style="width: 50%;" :disabled="currentStep !== 1"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞锛�"> + <el-input type="textarea" v-model="form.note" :disabled="currentStep !== 1" + size="small"></el-input> + </el-form-item> + </el-col> + + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.receiveOperationUser }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.receiveOperationTime }} + </el-col> + </el-row> + </div> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="submitForm('3reject')" v-if="currentStep !== 0 && currentStep !== 2">椹冲洖</el-button> + <el-button @click="submitForm('2save')" v-if="currentStep === 0">淇濆瓨</el-button> + <el-button type="primary" v-if="currentStep !== 2" @click="submitForm('1submit')">{{ currentStep === 0 ? '鎻愪氦' : + '閫氳繃' + }}</el-button> + </span> + </el-dialog> + <el-dialog title="娴佺▼璺熻釜" top="5vh" :visible.sync="dialogVisible0" width="60%"> + <el-table + :data="deviceLogs" + style="width: 100%"> + <el-table-column + type="index" + width="50"> + </el-table-column> + <el-table-column + prop="operator" + label="鎿嶄綔浜�" + width="180"> + </el-table-column> + <el-table-column + prop="operationTime" + label="鎿嶄綔鏃ユ湡" + width="180"> + </el-table-column> + <el-table-column + prop="operationType" + label="鎻愪氦绫诲瀷"> + </el-table-column> + <el-table-column + prop="operationContent" + label="鎿嶄綔鍐呭"> + </el-table-column> + </el-table> + </el-dialog> + </div> </template> <script> +import ValueTable from '../../tool/value-table.vue' +import { dateFormat } from '../../../util/date' export default { - + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + components: { + ValueTable + }, + data() { + return { + dialogVisible: false, + dialogVisible0:false, + //琛ㄥご鏄剧ず + componentData:{ + entity: { + processNumber: null, + deviceId:null, + orderBy: { + field: 'id', + order: 'asc' + } + }, + isIndex: true, + showSelect: false, + select: false, + do: [ + { + id: 'show', + font: '鏌ョ湅', + type: 'text', + method: 'lookDetail' + }, + { + id: 'delete', + font: '鍒犻櫎', + type: 'text', + method: 'doDiy' + }, + { + id: '111', + font: '娴佺▼璺熻釜', + type: 'text', + method: 'handleLookList' + }], + init:false, + tagField: { + recipientState:{ + select: [{ + value: 0, + type: 'success', + label: '鍚堟牸' + }, { + value: 1, + type: 'warning', + label: '缁翠慨' + }, { + value: 2, + type: 'info', + label: '鍋滅敤' + }, { + value: 3, + type: 'danger', + label: '鎶ュ簾' + }] + } + }, + selectField: {}, + requiredAdd: [], + requiredUp: [], + }, + upIndex:0, + entityCopy:null, + currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳 + currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖� + steps: ['鍊熷嚭', '鍊熺敤'], + responsibleOptions: [], // 涓嬬幆鑺傝礋璐d汉list + form:{ + processNumber:null, + deviceName:null, + unifyNumber:null, + recipientUser:null, + recipientTime:null, + nextUser:null, + rebackUser:null, + rebackTime:null, + receiveState:null, + deviceUser:null, + fileName:null, + }, + rules:{ + processNumber: [{ required: true, message: '璇疯緭鍏ョ紪鍙�', trigger: 'blur' }], + deviceName: [{ required: true, message: '璇疯緭鍏ヨ澶囧悕绉�', trigger: 'blur' }], + unifyNumber: [{ required: true, message: '璇疯緭鍏ョ鐞嗙紪鍙�', trigger: 'blur' }], + recipientUser: [{ required: true, message: '璇疯緭鍏ュ�熺敤浜�', trigger: 'blur' }], + borrowerContactInformation: [{ required: true, message: '璇疯緭鍏ュ�熺敤浜鸿仈绯绘柟寮�', trigger: 'blur' }], + recipientTime: [{ required: true, message: '璇烽�夋嫨鍊熺敤鏃ユ湡', trigger: 'change' }], + nextUser: [{ required: true, message: '璇烽�夋嫨涓嬬幆鑺傝礋璐d汉', trigger: 'change' }], + }, + deviceLogs:[], + outLoading:false + } + }, + watch:{ + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.componentData.entity.deviceId = this.clickNodeVal.value + this.entityCopy = this.HaveJson(this.componentData.entity) + this.refreshTable() + } + }, + dialogVisible(newVal) { + if (!newVal) { + this.form = {} + this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳 + this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖� + this.$refs['form'].clearValidate() + } + } + }, + computed: { + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, + mounted() { + this.componentData.entity.deviceId = this.clickNodeVal.value + this.entityCopy = this.HaveJson(this.componentData.entity) + // console.log(333,this.clickNodeVal) + this.getUserList() + this.refreshTable() + }, + methods: { + refreshTable(e) { + this.$refs['ValueTable'].selectList(e) + }, + refresh() { + this.componentData.entity = this.HaveJson(this.entityCopy) + this.refreshTable() + // this.upIndex++ + }, + choiceStep(index) { + this.currentStepClick = index + }, + //鎻愪氦琛ㄥ崟 + async submitForm(saveState) { + this.$refs.form.validate((valid) => { + if (valid === true || saveState !== '1submit') { + // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂� + let user = JSON.parse(localStorage.getItem('user')) + const dateTime = dateFormat(new Date()) + // 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡 + switch (this.currentStep) { + case 0: + this.form.submitOperationUser = user.name + this.form.submitOperationTime = dateTime + break + case 1: + this.form.receiveOperationUser = user.name + this.form.receiveOperationTime = dateTime + break + default: + break + } + // 鑾峰彇褰撳墠鐜妭璐熻矗浜� + switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) { + case 0: + this.form.nowUser = this.form.nextUser + break + default: + break + } + let currentStepAction; + // 璁剧疆璇ユ搷浣滃垽鏂槸鍚︿负鎻愪氦锛屼繚瀛橈紝椹冲洖锛岄�氳繃 + switch (saveState) { + // 鎻愪氦锛岄�氳繃 + case '1submit': + currentStepAction = this.currentStep + 1 + break + // 淇濆瓨 + case '2save': + currentStepAction = this.currentStep + break + // 椹冲洖 + case '3reject': + currentStepAction = this.currentStep - 1 + break + default: + break + } + // 鑾峰彇褰撳墠鐘舵�� + this.form.nowState = currentStepAction === 2 ? '鍏抽棴' : this.steps[currentStepAction] + this.form.deviceId = this.clickNodeVal.value + delete this.form.deviceLogs + this.$axios.post(this.$api.deviceBorrow.saveDeviceBorrow, this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs:true + }).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.dialogVisible = false + this.refreshTable() + } + }) + } else { + let step = this.steps[this.currentStep] + this.$message.warning(step + ' 娴佺▼涓湁蹇呭~椤规湭濉紒'); + } + }); + }, + deleteFile() { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.fileName).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛锛�') + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + onSuccess(response, file, fileList) { + if (response.code == 200) { + // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 + this.form.fileName = file.name + this.form.url= response.data + } else { + this.$message.error(response.message) + } + }, + // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� + getUserList() { + this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + if (res.code == 200) { + this.responsibleOptions = res.data + } + }) + }, + // 鏌ョ湅璇︽儏 + lookDetail(row){ + this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow+'?id='+row.id).then(res => { + if (res.code == 200) { + this.form = res.data + this.form.deviceName = this.clickNodeVal.label + this.form.deviceId = this.clickNodeVal.value + this.deviceLogs = res.data.deviceLogs + let i = this.steps.findIndex(item => item == row.nowState) + if(i==-1){ + this.currentStep = 2 + this.currentStepClick = 0 + }else{ + this.currentStep = i + this.currentStepClick = i + } + console.log(this.currentStepClick) + this.dialogVisible = true + } + }) + }, + // 鏂板 + add(){ + this.dialogVisible = true + this.form = { + processNumber:null, + deviceName:null, + unifyNumber:null, + recipientUser:null, + recipientTime:null, + nextUser:null, + rebackUser:null, + rebackTime:null, + receiveState:null, + deviceUser:null, + fileName:null, + } + this.form.deviceName = this.clickNodeVal.label + this.form.deviceId = this.clickNodeVal.value + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.post(this.$api.deviceBorrow.deviceBorrowExport,{deviceId:this.clickNodeVal.value},{responseType: 'blob'}).then(res => { + this.outLoading = false + const blob = new Blob([res], { + type: 'application/force-download' + }) + const filename = decodeURI(this.clickNodeVal.label+'璁惧鍊熷嚭缁熻'+'.xlsx') + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click(); + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click(); + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + handleLookList(row){ + this.$axios.get(this.$api.deviceBorrow.getDeviceBorrow+'?id='+row.id).then(res => { + if (res.code == 200) { + this.deviceLogs = res.data.deviceLogs + this.dialogVisible0 = true + } + }) + } + }, } </script> <style scoped> +h4 { + font-weight: 400; + font-size: 16px; + display: flex; + justify-content: space-between; + margin: 10px 0; +} +h4 .line { + display: inline-block; + width: 3px; + height: 16px; + background: #3A7BFA; + margin-right: 4px; +} + +.tables { + width: 100%; + height: calc(100vh - 15em); +} + +.search { + background-color: #fff; + display: flex; + align-items: center; + position: relative; + margin-top: 10px; +} + +.search_thing { + display: flex; + align-items: center; + height: 40px; +} + +.search_label { + width: 70px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 120px); +} + +.btns { + position: absolute; + right: 0px; + top: 50%; + transform: translate(0, -50%); +} + +.btns_thing { + position: absolute; + right: 230px; + top: 50%; + transform: translate(0, -50%); +} + +.form .search_label { + width: 120px; +} +.el-radio{ + margin-right: 10px; +} +.el-radio-group{ + width: 100%; + display: flex; + margin-top: 12px; +} </style> diff --git a/src/components/do/a6-device/calibration.vue b/src/components/do/a6-device/calibration.vue index f7b4d46..b1aa45b 100644 --- a/src/components/do/a6-device/calibration.vue +++ b/src/components/do/a6-device/calibration.vue @@ -1,259 +1,698 @@ +<!-- 璁惧鏍″噯 --> <template> <div> - <div class="search"> - <div class="search_thing"> - <el-button size="small" type="primary" @click="dialogVisible0=true">鏍″噯椤圭洰缁存姢</el-button> - </div> - <div class="btns"> - <el-button size="small" type="primary">娣诲姞鏍″噯璁板綍</el-button> - <el-button size="small" type="primary">瀵煎嚭</el-button> - </div> + <div class="btnS"> + <el-button size="small" type="primary" @click="calibrationMaintenance()">鏍″噯椤圭洰缁存姢</el-button> + <el-button size="small" type="primary" @click="add('add')">娣诲姞鏍″噯璁板綍</el-button> + <el-button size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button> </div> - <div class="tables" style="margin-top: 16px;"> - <ValueTable ref="ValueTable" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> + <div class="tables" style="margin-top: 10px;"> + <el-table :data="tableData" height="calc(100vh - 20em)"> + <el-table-column label="搴忓彿" type="index" width="120"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="璁板綍缂栧彿" min-width="150" prop="processNumber"></el-table-column> + <el-table-column label="鏍″噯鏈烘瀯" min-width="150" prop="unitOfMeasure" + show-overflow-tooltip></el-table-column> + <el-table-column label="鏍″噯缁撹" min-width="150" prop="status"> + <template v-slot="scope"> + {{ scope.row.status === '0yes' ? '鍚堟牸' : scope.row.status === '1no' ? '涓嶅悎鏍�' : '鍏朵粬' }} + </template> + </el-table-column> + <el-table-column label="鏍″噯璇佷功缂栧彿" min-width="150" prop="certificateSerialNumber"></el-table-column> + <el-table-column label="璇存槑" min-width="150" prop="remark" show-overflow-tooltip></el-table-column> + <el-table-column label="鏍″噯鏃ユ湡" min-width="150" prop="calibrationDate"></el-table-column> + <el-table-column label="涓嬫鏍″噯鏃ユ湡" min-width="150" prop="nextCalibrationDate"></el-table-column> + <el-table-column label="纭鏃ユ湡" min-width="150" prop="confirmDate"></el-table-column> + <el-table-column label="鐧昏浜�" min-width="150" prop="createUser"></el-table-column> + <el-table-column label="鐧昏鏃ユ湡" min-width="150" prop="createTime"></el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" min-width="180" align="center"> + <template #default="{ row }"> + <el-button size="small" type="text" @click="handleAttachmentClick(row)">涓嬭浇闄勪欢</el-button> + <el-button size="small" type="text" @click="handleViewClick('view', row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" style="margin-right: 5%;" + @size-change="handleSizeChange" @current-change="handleCurrentChange"> + </el-pagination> </div> - <el-dialog - title="鏍″噯椤圭洰缁存姢" - :visible.sync="dialogVisible0" - width="60%" - style="max-height: 80vh;margin-top: 10vh;" - :close-on-click-modal="false" - :close-on-press-escape="false"> + <!-- 鏍″噯椤圭洰缁存姢 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible0" title="鏍″噯椤圭洰缁存姢" + top="5vh" width="70%"> <h4> - <div style="display: flex; - align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟缁存姢</span></div> - <el-button type="primary" size="small" @click="addCalibrate">娣� 鍔�</el-button> + <span style="display: flex;align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟缁存姢</span></span> + <el-button :loading="addCalibrateLoading" size="small" type="primary" @click="addCalibrate">娣� 鍔�</el-button> </h4> - <div class="search"> - <div class="search_thing"> - <div class="search_label">璁¢噺鍙傛暟锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">閲忕▼鑼冨洿锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label" style="width: 100px;">鏈�澶у厑璁歌宸細</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">鍒ゅ畾鏍囧噯锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> + <div> + <el-form ref="form0" :model="form0" :rules="form0Rules" + label-position="right" label-width="120px"> + <el-row> + <el-col :span="12"> + <el-form-item label="璁¢噺鍙傛暟:" prop="measurementParameter"> + <el-input v-model="form0.measurementParameter" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閲忕▼鑼冨洿:" prop="rangeOfMeasurement"> + <el-input v-model="form0.rangeOfMeasurement" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈�澶у厑璁歌宸�:" prop="maxPermissibleError"> + <el-input v-model="form0.maxPermissibleError" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍒ゅ畾鏍囧噯:" prop="judgmentCriteria"> + <el-input v-model="form0.judgmentCriteria" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> </div> <h4> - <div style="display: flex; - align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟</span></div> + <span style="display: flex;align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟</span></span> </h4> - <ValueTable ref="ValueTable0" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData0" :key="upIndex0"/> + <!-- 璁惧鏍″噯鍙傛暟琛ㄦ牸 --> + <el-table ref="calibrateTable" v-loading="calibrateParamsLoading" :data="calibrateParams" + max-height="450" + stripe style="width: 100%"> + <el-table-column label="缂栧彿" type="index" width="80"></el-table-column> + <el-table-column label="璁¢噺鍙傛暟" prop="measurementParameter"></el-table-column> + <el-table-column label="閲忕▼鑼冨洿" prop="rangeOfMeasurement"></el-table-column> + <el-table-column label="鏈�澶у厑璁歌宸�" prop="maxPermissibleError"></el-table-column> + <el-table-column label="鍒ゅ畾鏍囧噯" prop="judgmentCriteria"></el-table-column> + <el-table-column label="鍒涘缓浜�" prop="createdBy"></el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" prop="creationTime"></el-table-column> + <el-table-column fixed="right" label="鎿嶄綔"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleDelete(scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-dialog> + + <!-- 娣诲姞鏍″噯璁板綍 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible1" title="娣诲姞鏍″噯璁板綍" + top="5vh" + width="80%" @close="resetCalibrationRecord"> + <div style="height: 70vh;overflow-y: auto;overflow-x: hidden;"> + <h4> + <div style="display: flex;align-items: center;"> + <span class="line"></span> + <span>娣诲姞璁惧鏍″噯璁板綍</span> + </div> + </h4> + <el-form ref="calibrationRecord" :model="calibrationRecord" + :rules="formRules" label-position="right" label-width="120px"> + <el-row> + <el-col :span="6"> + <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:" prop="unitOfMeasure"> + <el-input v-model="calibrationRecord.unitOfMeasure" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏍″噯鏃ユ湡:" prop="calibrationDate"> + <el-date-picker v-model="calibrationRecord.calibrationDate" :disabled="operationType === 'view'" + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 90%" type="date" + value-format="yyyy-MM-dd" @change="getNextCalibrationDate"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="涓嬫鏍″噯鏃ユ湡:" label-width="140px"> + <el-date-picker v-model="calibrationRecord.nextCalibrationDate" disabled + format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 90%" + type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="璁$畻鍣ㄥ叿:" prop="calculatingApparatus"> + <el-input v-model="calibrationRecord.calculatingApparatus" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="璁$畻鏍囧噯閲忕▼:" prop="standardRange"> + <el-input v-model="calibrationRecord.standardRange" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="璁¢噺鏍囧噯涓嶇‘瀹氬害:" label-width="140px" prop="calibrationStandardUncertainty"> + <el-input v-model="calibrationRecord.calibrationStandardUncertainty" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鎵�渚濇嵁鏂囦欢:" prop="byDocument"> + <el-input v-model="calibrationRecord.byDocument" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="璇佷功缂栧彿:" prop="certificateSerialNumber"> + <el-input v-model="calibrationRecord.certificateSerialNumber" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="鐘舵��:" label-width="140px" prop="status" required> + <el-radio-group v-model="calibrationRecord.status" :disabled="operationType === 'view'"> + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="纭鏃ユ湡:"> + <el-date-picker v-model="calibrationRecord.confirmDate" :disabled="operationType === 'view'" + format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 100%" + type="datetime" value-format="yyyy-MM-dd HH:mm:ss"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="17"> + <el-form-item label="闄勪欢锛�" prop="fileName"> + <el-input v-model="calibrationRecord.fileName" :style="`width: ${operationType === 'add' ? '85%' : '100%'};}`" disabled + size="small"> + <el-button v-if="operationType === 'add'" slot="append" icon="el-icon-delete-solid" + @click="deleteFile"></el-button> + </el-input> + <el-upload v-if="operationType === 'add'" ref="upload" :action="action" + :before-upload="beforeUpload" + :headers="headers" + :limit="1" :on-error="onError" :on-success="handleSuccessUp" + :show-file-list="false" + style="float: right;"> + <el-button :loading="upLoading" size="small" style="position: relative; top: -4px;" + type="primary">闄勪欢涓婁紶 + </el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞:"> + <el-input v-model="calibrationRecord.remark" :disabled="operationType === 'view'" :rows="3" size="small" style="width: 96%" + type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <h4> + <span style="display: flex;align-items: center;"> + <span class="line"></span><span>鏍″噯鏉$洰纭缁撴灉</span> + </span> + </h4> + <el-table ref="calibrateTable" :data="calibrateParams" border> + <el-table-column label="缂栧彿" type="index" width="60"></el-table-column> + <el-table-column label="璁¢噺鍙傛暟" prop="measurementParameter"></el-table-column> + <el-table-column label="閲忕▼鑼冨洿" prop="rangeOfMeasurement"></el-table-column> + <el-table-column label="鏈�澶у厑璁歌宸�" prop="maxPermissibleError"></el-table-column> + <el-table-column label="鍒ゅ畾鏍囧噯" prop="judgmentCriteria"></el-table-column> + <el-table-column label="鏄惁鏍″噯" prop="isCalibration"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鏄惁鏍″噯 + </template> + <template slot-scope="scope"> + <el-radio-group v-model="scope.row.isCalibration" :disabled="operationType === 'view'"> + <el-radio label="0yes">鏄�</el-radio> + <el-radio label="1no">鍚�</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍒ゅ畾缁撴灉" min-width="140" prop="result"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鍒ゅ畾缁撴灉 + </template> + <template slot-scope="scope"> + <el-radio-group v-model="scope.row.result" :disabled="operationType === 'view'" @input="checkRadio()"> + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍗曢」缁撴灉璇存槑" prop="singleResultStatement"> + <template slot-scope="scope"> + <el-input v-model="scope.row.singleResultStatement" :disabled="operationType === 'view'" + size="small"></el-input> + </template> + </el-table-column> + </el-table> + <!-- 鎿嶄綔鏃ュ織 --> + <!-- <h4>--> + <!-- <div style="display: flex;--> + <!-- align-items: center;">--> + <!-- <span class="line"></span><span>鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織</span>--> + <!-- </div>--> + <!-- </h4>--> + <!-- <el-table :data="tableDataOperate" style="width: 100%">--> + <!-- <el-table-column type="index" label="搴忓彿" width="100"></el-table-column>--> + <!-- <el-table-column prop="operator" label="鎿嶄綔浜�" width="120"></el-table-column>--> + <!-- <el-table-column prop="operationTime" label="鎿嶄綔鏃堕棿" width="180"></el-table-column>--> + <!-- <el-table-column prop="operationType" label="鎿嶄綔绫诲瀷" width="120"></el-table-column>--> + <!-- <el-table-column prop="operationContent" label="鎿嶄綔鍐呭"></el-table-column>--> + <!-- </el-table>--> + </div> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible0 = false">鍙� 娑�</el-button> - <el-button type="primary" @click="dialogVisible0 = false">纭� 瀹�</el-button> + <el-button v-if="operationType === 'add'" @click="dialogVisible1 = false">鍙� 娑�</el-button> + <el-button v-if="operationType === 'add'" :loading="addRecordLoading" type="primary" + @click="addRecord">纭� 瀹�</el-button> </span> </el-dialog> </div> </template> <script> -import ValueTable from '../../tool/value-table.vue' +import file from '../../../util/file'; +import fileDownload from "../../../util/file"; + export default { - components: { - ValueTable - }, - data(){ - return { - componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'handleLook', - font: '鏌ョ湅璇︽儏', - type: 'text', - method: 'handleLook' - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex:0, - componentData0: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - isPage:false, - do: [{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy', - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex0:0, - dialogVisible0:false, - form0:{ - value:'' + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; } } }, - methods:{ - addCalibrate(){ - if(!this.form0.value){ - this.$message.error('璇疯緭鍏ヨ閲忓弬鏁�') - return + data() { + return { + value: "", + calibrateParams: [], + calibrateParamsLoading: false, + addCalibrateLoading: false, + calibrationRecord: { + unitOfMeasure: '', // 璁¢噺鍗曚綅 + calibrationDate: null, // 鏍″噯鏃ユ湡 + nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 + calculatingApparatus: '', // 璁$畻鍣ㄥ叿 + confirmDate: null, // 纭鏃ユ湡 + standardRange: '', // 璁$畻鏍囧噯閲忕▼ + calibrationStandardUncertainty: '', // 璁¢噺鏍囧噯涓嶇‘瀹氬害 + byDocument: '', // 渚濇嵁鏂囦欢 + certificateSerialNumber: '', // 璇佷功缂栧彿 + status: '', // 鐘舵�� + remark: '', // 澶囨敞 + systemFileName: '', // + fileName: '', // + }, + formRules: { + unitOfMeasure: [{required: true, message: '璇疯緭鍏ユ牎鍑嗘湇鍔℃満鏋�', trigger: 'blur'}], + calibrationDate: [{required: true, message: '璇烽�夋嫨鏍″噯鏃ユ湡', trigger: 'change'}], + calculatingApparatus: [{required: true, message: '璇疯緭鍏ヨ绠楀櫒鍏�', trigger: 'blur'}], + standardRange: [{required: true, message: '璇疯緭鍏ヨ绠楁爣鍑嗛噺绋�', trigger: 'blur'}], + calibrationStandardUncertainty: [{required: true, message: '璇疯緭鍏ヨ閲忔爣鍑嗕笉纭畾搴�', trigger: 'blur'}], + byDocument: [{required: true, message: '璇疯緭鍏ユ墍渚濇嵁鏂囦欢', trigger: 'blur'}], + status: [{required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change'}], + }, + tableData: [], + dialogVisible0: false, + dialogVisible1: false, + form0: { + measurementParameter: '', // 璁¢噺鍙傛暟 + rangeOfMeasurement: '', + maxPermissibleError: '', + judgmentCriteria: '', + createdBy: '', + action: '', + deviceId: null + }, + form0Rules: { + measurementParameter: [ + {required: true, message: '璇疯緭鍏ヨ閲忓弬鏁�', trigger: 'blur'} + ], + rangeOfMeasurement: [ + {required: true, message: '璇疯緭鍏ラ噺绋嬭寖鍥�', trigger: 'blur'} + ], + maxPermissibleError: [ + {required: true, message: '璇疯緭鍏ユ渶澶у厑璁歌宸�', trigger: 'blur'} + ], + judgmentCriteria: [ + {required: true, message: '璇疯緭鍏ュ垽瀹氭爣鍑�', trigger: 'blur'} + ], + }, + addRecordLoading: false, + tableDataOperate: [], // 鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織 + upLoading: false, + operationType: '', + search: { + size: 20, + current: 1, + total: 0 + }, + } + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') } - // 淇濆瓨 - // 鏇存柊鍒楄〃 + }, + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, + mounted() { + //鑾峰彇鎿嶄綔璁板綍淇℃伅 + this.getOperateMsg(); + this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + }, + methods: { + //鐘舵�佸垽瀹� + checkRadio(){ + let resultList = this.calibrateParams.map(ele=>ele.result) + if(resultList && resultList.filter(ele=>ele=='1no').length>0){ + this.calibrationRecord.status = '1no' + }else if(resultList && resultList.filter(ele=>ele=='2other').length==resultList.length){ + this.calibrationRecord.status = '2other' + }else if(resultList && resultList.filter(ele=>ele=='0yes').length==resultList.length){ + this.calibrationRecord.status = '0yes' + } + }, + getNextCalibrationDate(val) { + let oneYearLaterDate = new Date(val) + oneYearLaterDate.setFullYear(oneYearLaterDate.getFullYear() + 1); + oneYearLaterDate.setDate(oneYearLaterDate.getDate() - 1); + // let obj = oneYearLaterDate.toISOString().split('T')[0]; + this.calibrationRecord.nextCalibrationDate = oneYearLaterDate + }, + handleSizeChange(val) { + this.search.size = val + this.getTableList(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val + this.getTableList(this.clickNodeVal.value); + }, + getTableList(deviceId) { + this.$axios.get(this.$api.deviceCheck.deviceMetricRecordPage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&type=calibrate").then(res => { + this.tableData = res.data.records + this.search.total = res.data.total + }) + }, + getOperateMsg() { + this.$axios.get(this.$api.deviceOperate.list + "/" + this.clickNodeVal.value).then(res => { + this.tableDataOperate = res.data + }) + }, + // 娣诲姞鏍告煡璁板綍 + add(type) { + this.operationType = type + this.dialogVisible1 = true + this.getXmsg() + }, + // 鏌ョ湅璇︽儏 + handleViewClick(type, row) { + this.$axios.get(this.$api.deviceCheck.showDeviceMetricsCopy + "?id=" + row.id + "&type=calibrate").then(res => { + this.calibrateParams = res.data + }) + this.calibrationRecord = {...row} + this.operationType = type + this.dialogVisible1 = true + }, + // 琛ㄦ牸鍒犻櫎鎿嶄綔 + handleDeleteClick(row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetricRecord + "?id=" + row.id).then(res => { + this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + this.$message.success('鍒犻櫎鎴愬姛锛�') + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }) + }, + handleAttachmentClick(row) { + let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName) + if (state) { + let url = this.javaApi + '/img/' + row.systemFileName; + fileDownload.downloadIamge(url, row.systemFileName) + } else { + const url = this.javaApi+'/word/'+ row.systemFileName + const link = document.createElement('a'); + link.href = url; + link.download = row.systemFileName; + link.click(); + this.$message.success('涓嬭浇鎴愬姛') + } + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.deviceMetricRecordExport + '?deviceId=' + this.clickNodeVal.value + "&type=calibrate", { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], {type: 'application/octet-stream'}); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鏍″噯.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鏍″噯.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + deleteFile() { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎鏂囦欢, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.calibrationRecord.systemFileName).then(res => { + this.calibrationRecord.fileName = '' + this.$refs.upload.clearFiles() + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛锛�') + } + }) + }).catch((err) => { + console.log('err----', err) + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 鏍″噯椤圭洰缁存姢 + calibrationMaintenance() { + this.dialogVisible0 = true + this.getXmsg(); + }, + // 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅 + async getXmsg() { + this.calibrateParamsLoading = true + try { + await this.$axios.get(this.$api.deviceCheck.selectDeviceMetric + "?deviceId=" + this.clickNodeVal.value + "&type=calibrate").then(res => { + if (res.code == 200) { + this.calibrateParams = res.data + } + this.calibrateParamsLoading = false + }) + } catch (e) { + console.log('getXmsg---', e) + this.calibrateParamsLoading = false + } + }, + // 鏍″噯椤圭洰缁存姢-鍒犻櫎璁惧鏍″噯鍙傛暟 + handleDelete(row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetrics + '?id=' + row.id).then(res => { + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛!'); + this.getXmsg(); + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�'); + }) + }, + addCalibrate() { + this.$refs['form0'].validate((valid) => { + if (valid) { + // 淇濆瓨 + this.calibrateParamsLoading = true + this.addCalibrateLoading = true + this.form0.deviceId = this.clickNodeVal.value; + const user = JSON.parse(localStorage.getItem('user')) + this.form0.createdBy = user.name; + this.form0.type = 'calibrate' + this.$axios.post(this.$api.deviceCheck.saveOrUpdateDeviceMetric, this.form0, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('淇濆瓨鎴愬姛') + this.$refs['form0'].resetFields() + this.getXmsg() // 鍒锋柊璁惧鏍″噯鍙傛暟琛ㄦ牸 + } + this.calibrateParamsLoading = false + this.addCalibrateLoading = false + }) + } else { + this.addCalibrateLoading = false + this.$message.warning('鏈夊繀濉」鏈~'); + } + }) + }, + addRecord() { + this.$refs['calibrationRecord'].validate((valid) => { + if (valid) { + try { + if (this.calibrateParams.some(m => m.isCalibration === undefined)) { + this.$message.error('璇烽�夋嫨鏄惁鏍″噯') + return + } + if (!this.calibrateParams.every(m => m.result !== undefined)) { + this.$message.error('璇烽�夋嫨鍒ゅ畾缁撴灉') + return + } + this.addRecordLoading = true + this.calibrationRecord.deviceId = this.clickNodeVal.value; + let user = JSON.parse(localStorage.getItem('user')) + this.calibrationRecord.createUser = user.name + this.calibrationRecord.type = 'calibrate' + this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams + this.$axios.post(this.$api.deviceCheck.addOrUpdateDeviceMetricRecord, this.calibrationRecord, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('娣诲姞鎴愬姛') + this.dialogVisible1 = false + this.getTableList(this.clickNodeVal.value) + } + this.addRecordLoading = false + }) + } catch (e) { + console.log('addRecord---', e) + this.addRecordLoading = false + } + } else { + this.$message.warning('鏈夊繀濉」鏈~'); + } + }) + }, + resetCalibrationRecord() { + this.$refs.calibrationRecord.resetFields() + }, + // 涓婁紶闄勪欢 + handleSuccessUp(response, file) { + if (response.code == 200) { + // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 + this.calibrationRecord.fileName = file.name + this.calibrationRecord.systemFileName = response.data + this.upLoading = false; + } else { + this.upLoading = false; + this.$message.error(response.message) + } + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + this.upLoading = true; + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + // end + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getTableList(newVal.value); + } + }, + dialogVisible1(newVal) { + if (newVal === false) { + this.calibrateParams = [] + this.calibrationRecord = { + unitOfMeasure: '', // 璁¢噺鍗曚綅 + calibrationDate: null, // 鏍″噯鏃ユ湡 + nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 + calculatingApparatus: '', // 璁$畻鍣ㄥ叿 + standardRange: '', // 璁$畻鏍囧噯閲忕▼ + calibrationStandardUncertainty: '', // 璁¢噺鏍囧噯涓嶇‘瀹氬害 + byDocument: '', // 渚濇嵁鏂囦欢 + certificateSerialNumber: '', // 璇佷功缂栧彿 + status: '', // 鐘舵�� + remark: '', // 澶囨敞 + } + } } } } -</script> +function downloadImage(url) { + const link = document.createElement('a'); + link.href = url; + link.target="_blank" + link.download = 'attachment.jpg'; // 鏂囦欢鍚� + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); +} + +</script> <style scoped> -.tables{ - width: calc(100vw - 390px); +.tables { + width: 100%; height: calc(100vh - 230px); } + .search { background-color: #fff; height: 40px; @@ -272,29 +711,68 @@ width: 70px; font-size: 14px; text-align: right; + margin-right: 10px; } .search_input { width: calc(100% - 110px); } -.btns{ - position: absolute; - right: 40px; - top: 50%; - transform: translate(0,-50%); + +.btnS { + text-align: right; + margin-top: 10px; } -h4{ + +h4 { font-weight: 400; font-size: 16px; display: flex; justify-content: space-between; margin: 10px 0; } -h4 .line{ + +h4 .line { display: inline-block; width: 3px; height: 16px; background: #3A7BFA; margin-right: 4px; } + +.check { + background-color: #fff; + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.check_thing { + flex: 0 0 calc(20% - 10px); + margin-bottom: 20px; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.check_label { + font-size: 14px; + margin-bottom: 5px; +} + +.check_data .check_input { + width: 100%; +} + +.el-table { + font-size: 14px; + color: #333; +} + +.el-table thead { + background-color: #f5f5f5; +} </style> + + + + diff --git a/src/components/do/a6-device/check-and-accept.vue b/src/components/do/a6-device/check-and-accept.vue index 2fc1fd5..d8f5350 100644 --- a/src/components/do/a6-device/check-and-accept.vue +++ b/src/components/do/a6-device/check-and-accept.vue @@ -1,147 +1,900 @@ +<!-- 璁惧楠屾敹 --> <template> <div> <div class="search"> <div class="search_thing"> - <div class="search_label">鍏抽敭瀛楋細</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value" @keyup.enter.native="refreshTable()"></el-input></div> + <div class="search_label">娴佺▼缂栧彿锛�</div> + <div class="search_input"><el-input v-model="search.processNumber" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="getDeviceAList(clickNodeVal.value)"></el-input></div> + <el-button size="small" style="margin-left: 10px" @click="resetSearch">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="getDeviceAList(clickNodeVal.value)">鏌� 璇�</el-button> </div> - <div class="search_thing" style="padding-left: 30px;"> - <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> - </div> - <div class="btns"> - <el-button size="small" type="primary">鏂板缓</el-button> - <el-button size="small" type="primary">瀵煎嚭</el-button> + <div class="search_thing"> + <el-button size="small" type="primary" @click="dialogVisible = true">娣诲姞楠屾敹</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵煎嚭</el-button> </div> </div> - <div class="tables" style="margin-top: 16px;"> - <ValueTable ref="ValueTable" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> + <div class="tables"> + <el-table ref="table" :data="tableDataAlist" height="100%"> + <el-table-column label="搴忓彿" type="index" width="60"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="娴佺▼缂栧彿" min-width="150" prop="processNumber" show-overflow-tooltip/> + <el-table-column label="璁惧鍚嶇О" min-width="140" prop="deviceName" show-overflow-tooltip/> + <el-table-column label="绠$悊缂栧彿" min-width="140" prop="managementNumber" show-overflow-tooltip/> + <el-table-column label="搴忓垪鍙�" min-width="80" prop="serialNumber" /> + <el-table-column label="鎻愪氦鑰�" min-width="100" prop="submitUser" /> + <el-table-column label="鎻愪氦鏃ユ湡" min-width="150" prop="createTime" /> + <el-table-column label="褰撳墠鐘舵��" min-width="140" prop="currentState" /> + <el-table-column label="褰撳墠璐熻矗浜�" min-width="120" prop="currentResponsible" /> + <el-table-column fixed="right" label="鎿嶄綔" min-width="180"> + <template #default="{ row }"> + <el-button size="small" type="text" @click="handleAttachmentClick(row)">闄勪欢</el-button> + <el-button size="small" type="text" @click="handleViewClick(row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDownOne(row)">瀵煎嚭</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> </div> + <!-- 娣诲姞璁惧鏁呴殰璁板綍 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧楠屾敹璁板綍" + width="60%" @open="openRecordAcceptance"> + <el-steps :active="currentStep" finish-status="success"> + <el-step v-for="(v, i) in steps" :key="i" :title="v" style="cursor:pointer" + @click.native="choiceStep(i)"></el-step> + </el-steps> + <el-form ref="form" :model="form" :rules="rules" label-width="130px"> + <div v-show="currentStepClick === 0"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <!-- 鏂板璁惧浜嬭褰曞崱鐗� --> + <el-row> + <el-col :span="24"> + <el-form-item label="娴佺▼缂栧彿锛�" prop="processNumber"> + <el-input v-model="form.processNumber" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О锛�"> + <el-input v-model="form.deviceName" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐢熶骇鍘傚锛�"> + <el-input v-model="form.manufacturer" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍨嬪彿锛�"> + <el-input v-model="form.specificationModel" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绠$悊缂栧彿锛�"> + <el-input v-model="form.managementNumber" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ュ簭鍒楀彿', trigger: 'blur' }]" label="搴忓垪鍙凤細" + prop="serialNumber"> + <el-input v-model="form.serialNumber" :disabled="currentStep !== 0" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ヨ澶囩被鍒�', trigger: 'change' }]" label="璁惧绫诲埆锛�" + prop="deviceClass"> + <el-radio-group v-model="form.deviceClass" :disabled="currentStep !== 0"> + <el-radio label="0precision">绮惧瘑鍨嬭澶�</el-radio> + <el-radio label="1conventional">甯歌璁惧</el-radio><br /> + <el-radio label="2auxiliary_class">杈呭姪绫昏澶�</el-radio> + <el-radio label="4environmental">鐜绫昏澶�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ュ紑绠卞墠妫�鏌ュ鍖呰鏈夋棤鐮存崯', trigger: 'blur' }]" label="寮�绠卞墠妫�鏌ュ鍖呰鏈夋棤鐮存崯锛�" label-width="220px" + prop="checkOuterPackaging"> + <el-input v-model="form.checkOuterPackaging" :disabled="currentStep !== 0" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐩稿叧闄勪欢锛�" prop="fileName"> + <el-input v-model="form.fileName" :style="`width: ${currentStep == 0 ? '88%' : '100%'};`" disabled + size="small"> + <el-button v-if="currentStep === 0" slot="append" icon="el-icon-delete-solid" + @click="deleteFile"></el-button> + </el-input> + <el-upload ref="upload" :action="action" :on-success="onSuccess" :show-file-list="false" + style="float: right;"> + <el-button v-if="currentStep === 0" slot="trigger" class="uploadFile" size="small" + style="position: relative;top: -4px" type="primary">闄勪欢涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇烽�夋嫨涓嬬幆鑺傝矗浠讳汉', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="submitNextPesponsible"> + <el-select v-model="form.submitNextPesponsible" :disabled="currentStep !== 0" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 50%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ヨ澶囧紑绠遍獙鏀剁粨璁�', trigger: 'change' }]" label="璁惧寮�绠遍獙鏀剁粨璁猴細" label-width="150px" + prop="unpackingAcceptanceConclusion"> + <el-radio-group v-model="form.unpackingAcceptanceConclusion" :disabled="currentStep !== 0"> + <el-radio :label="'0qualified'">鍚堟牸</el-radio> + <el-radio :label="'1unqualified'">涓嶅悎鏍硷紝缂哄皯澶囦欢渚涘簲鍟嗚ˉ鍙�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <div style="margin-bottom: 20px; width: 100%;"> + <label>澶囦欢纭锛�</label> + <el-button v-if="currentStep === 0" size="small" style="float: right;" + type="primary" @click="addTableRow('sparePartsConfirmationList')">澧炲姞琛�</el-button> + </div> + <el-table :data="form.sparePartsConfirmationList" border stripe style="width: 100%; min-height: 30vh"> + <el-table-column label="搴忓彿" prop="搴忓彿" type="index" width="80" /> + <el-table-column label="鍚嶇О" min-width="120" prop="name"> + <template v-slot="scope"> + <el-input v-if="currentStep === 0" v-model="scope.row.name" size="small"></el-input> + <label v-else>{{ scope.row.name }}</label> + </template> + </el-table-column> + <el-table-column label="鏁伴噺" min-width="120" prop="number"> + <template v-slot="scope"> + <el-input v-if="currentStep === 0" v-model="scope.row.number" size="small"></el-input> + <label v-else>{{ scope.row.number }}</label> + </template> + </el-table-column> + <el-table-column label="澶囨敞" min-width="120" prop="note"> + <template v-slot="scope"> + <el-input v-if="currentStep === 0" v-model="scope.row.note" size="small"></el-input> + <label v-else>{{ scope.row.note }}</label> + </template> + </el-table-column> + <el-table-column v-if="currentStep === 0" fixed="right" label="鎿嶄綔" width="90"> + <template slot-scope="scope"> + <el-button icon="el-icon-delete" type="text" + @click="deleteRow(scope.$index, scope.row, 'sparePartsConfirmationList')">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-col> + <el-col :span="24"> + <div style="margin: 20px 0; width: 100%;"> + <label>鏂囦欢绫荤‘璁わ細</label> + <el-button v-if="currentStep === 0" size="small" style="float: right;" + type="primary" @click="addTableRow('fileClassConfirmationList')">澧炲姞琛�</el-button> + </div> + <el-table :data="form.fileClassConfirmationList" border stripe style="width: 100%; min-height: 30vh"> + <el-table-column label="搴忓彿" prop="搴忓彿" type="index" width="80" /> + <el-table-column label="搴旀湁鍐屾暟" min-width="120" prop="expectedCopies"> + <template v-slot="scope"> + <el-input v-if="currentStep === 0" v-model="scope.row.expectedCopies" size="small"></el-input> + <label v-else>{{ scope.row.expectedCopies }}</label> + </template> + </el-table-column> + <el-table-column label="瀹為檯鏀跺埌鍐屾暟" min-width="120" prop="actualCopies"> + <template v-slot="scope"> + <el-input v-if="currentStep === 0" v-model="scope.row.actualCopies" size="small"></el-input> + <label v-else>{{ scope.row.actualCopies }}</label> + </template> + </el-table-column> + <el-table-column v-if="currentStep === 0" fixed="right" label="鎿嶄綔" width="90"> + <template v-slot="scope"> + <el-button icon="el-icon-delete" type="text" + @click="deleteRow(scope.$index, scope.row, 'fileClassConfirmationList')">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-col> + <el-col :span="24" style="margin-top: 10px;"> + <el-form-item label="澶囨敞锛�" label-width="90px"> + <el-input v-model="form.submitRemarks" :disabled="currentStep !== 0" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.submitOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.submitDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 1"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="澶嶆牳鎰忚锛�" prop="accidentDescription"> + <el-input v-model="form.unpackingReviewOpinion" :disabled="currentStep !== 1" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 1, message: '璇疯緭鍏ヤ笅鐜妭璐d换浜�', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="unpackingNextPesponsible"> + <el-select v-model="form.unpackingNextPesponsible" :disabled="currentStep !== 1" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 50%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.unpackingOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.unpackingDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 2"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 2, message: '璇疯緭鍏ュ畨瑁呬綅缃�', trigger: 'blur' }]" label="瀹夎浣嶇疆锛�" + prop="installLocation"> + <el-input v-model="form.installLocation" :disabled="currentStep !== 2" clearable placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞锛�"> + <el-input v-model="form.installRemarks" :disabled="currentStep !== 2" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 2, message: '璇疯緭鍏ヤ笅鐜妭璐d换浜�', trigger: 'blur' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="installNextPesponsible"> + <el-select v-model="form.installNextPesponsible" :disabled="currentStep !== 2" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 50%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <div style="margin-bottom: 20px; width: 100%;"> + <label>瀹夎楠屾敹璁板綍</label> + <el-button v-if="currentStep === 2" size="small" style="float: right;" + type="primary" @click="addTableRow('installationAcceptanceRecordList')">澧炲姞琛�</el-button> + </div> + <el-table :data="form.installationAcceptanceRecordList" border stripe + style="width: 100%; min-height: 30vh"> + <el-table-column label="搴忓彿" prop="搴忓彿" type="index" width="80" /> + <el-table-column label="椤圭洰" min-width="120" prop="installationProject"> + <template v-slot="scope"> + <el-input v-if="currentStep === 2" v-model="scope.row.installationProject" + size="small"></el-input> + <label v-else>{{ scope.row.installationProject }}</label> + </template> + </el-table-column> + <el-table-column label="瀹夎鎯呭喌" min-width="120" prop="installationSituation"> + <template v-slot="scope"> + <el-input v-if="currentStep === 2" v-model="scope.row.installationSituation" + size="small"></el-input> + <label v-else>{{ scope.row.installationSituation }}</label> + </template> + </el-table-column> + <el-table-column label="瀹夎瀹屾垚" min-width="120" prop="installationCompleted"> + <template v-slot="scope"> + <el-select v-if="currentStep === 2" v-model="scope.row.installationCompleted" placeholder="璇烽�夋嫨"> + <el-option label="鏄�" value="0yes"></el-option> + <el-option label="鍚�" value="1no"></el-option> + </el-select> + <label v-else>{{ scope.row.installationCompleted === '0yes' ? '鏄�' : + scope.row.installationCompleted === '1no' ? '鍚�' : '' }}</label> + </template> + </el-table-column> + <el-table-column v-if="currentStep === 2" fixed="right" label="鎿嶄綔" width="90"> + <template slot-scope="scope"> + <el-button icon="el-icon-delete" type="text" + @click="deleteRow(scope.$index, scope.row, 'installationAcceptanceRecordList')">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.installOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.installDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 3"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 3, message: '璇疯緭鍏ュ鍚堟剰瑙�', trigger: 'blur' }]" label="澶嶅悎鎰忚锛�" + prop="installationAcceptanceCompoundOpinion"> + <el-input v-model="form.installationAcceptanceCompoundOpinion" :disabled="currentStep !== 3" + size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 3, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="installationAcceptanceNextPesponsible"> + <el-select v-model="form.installationAcceptanceNextPesponsible" :disabled="currentStep !== 3" clearable + filterable placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 50%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.installationAcceptanceOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.installationAcceptanceDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 4"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <div style="margin-bottom: 20px; width: 100%;"> + <label>楠屾敹鏍告煡璁板綍锛�</label> + <el-button v-if="currentStep === 4" size="small" style="float: right;" + type="primary" @click="addTableRow('acceptanceCheckRecordList')">澧炲姞琛�</el-button> + </div> + <el-table :data="form.acceptanceCheckRecordList" border style="width: 100%; min-height: 30vh"> + <el-table-column label="搴忓彿" prop="sequence" width="80"> + </el-table-column> + <el-table-column label="浠櫒妯″潡" min-width="120" prop="instrumentModule"> + <template v-slot="scope"> + <el-input v-if="currentStep === 4" v-model="scope.row.instrumentModule" size="small"></el-input> + <label v-else>{{ scope.row.instrumentModule }}</label> + </template> + </el-table-column> + <el-table-column label="鏍告煡鍙傛暟" min-width="120" prop="verificationParameter"> + <template v-slot="scope"> + <el-input v-if="currentStep === 4" v-model="scope.row.verificationParameter" size="small"></el-input> + <label v-else>{{ scope.row.verificationParameter }}</label> + </template> + </el-table-column> + <el-table-column label="鍙帴鏀堕檺" min-width="120" prop="acceptableLimit"> + <template v-slot="scope"> + <el-input v-if="currentStep === 4" v-model="scope.row.acceptableLimit" size="small"></el-input> + <label v-else>{{ scope.row.acceptableLimit }}</label> + </template> + </el-table-column> + <el-table-column label="鏍告煡缁撴灉" min-width="120" prop="verificationResult"> + <template v-slot="scope"> + <el-input v-if="currentStep === 4" v-model="scope.row.verificationResult" size="small"></el-input> + <label v-else>{{ scope.row.verificationResult }}</label> + </template> + </el-table-column> + <el-table-column label="鏍告煡缁撹" min-width="120" prop="verificationConclusion"> + <template v-slot="scope"> + <el-select v-if="currentStep === 4" v-model="scope.row.verificationConclusion" placeholder="璇烽�夋嫨"> + <el-option label="绗﹀悎" value="0accordWith"></el-option> + <el-option label="涓嶇鍚�" value="1inconformity"></el-option> + </el-select> + <label v-else>{{ scope.row.verificationConclusion }}</label> + </template> + </el-table-column> + <el-table-column v-if="currentStep === 4" fixed="right" label="鎿嶄綔" width="90"> + <template slot-scope="scope"> + <el-button size="small" type="text" + @click="deleteRow(scope.$index, scope.row, 'acceptanceCheckRecordList')">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-form-item :rules="[{ required: currentStep === 4, message: '璇疯緭鍏ヨ澶囧紑绠遍獙鏀剁粨璁�', trigger: 'change' }]" label="璁惧寮�绠遍獙鏀剁粨璁猴細" + label-width="150px" prop="acceptanceCheckUnpackingConclusion"> + <el-radio-group v-model="form.acceptanceCheckUnpackingConclusion" :disabled="currentStep !== 4"> + <el-radio :label="'0qualified'">鍚堟牸</el-radio> + <el-radio :label="'1unqualified'">涓嶅悎鏍硷紝缂哄皯澶囦欢渚涘簲鍟嗚ˉ鍙�</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item :rules="[{ required: currentStep === 4, message: '璇疯緭鍏ヤ笅鐜妭璐d换浜�', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="acceptanceCheckNextPesponsible"> + <el-select v-model="form.acceptanceCheckNextPesponsible" :disabled="currentStep !== 4" clearable + filterable placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 50%;"> + <el-option v-for="item in responsibleOptions" :key="item.value" :label="item.label" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.acceptanceCheckOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.acceptanceCheckDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 5"> + <el-card style="margin-top: 1em; height: 56vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 5, message: '璇疯緭鍏ュ鏍告剰瑙�', trigger: 'blur' }]" label="瀹℃牳鎰忚锛�" + prop="acceptanceAuditAuditOpinion"> + <el-input v-model="form.acceptanceAuditAuditOpinion" :disabled="currentStep !== 5" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.acceptanceAuditOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.acceptanceAuditDate }} + </el-col> + </el-row> + </div> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button v-if="currentStep !== 0 && currentStep !== 6" @click="submitForm('3reject')">椹冲洖</el-button> + <el-button v-if="currentStep === 0" @click="submitForm('2save')">淇濆瓨</el-button> + <el-button v-if="currentStep !== 6" type="primary" @click="submitForm('1submit')">{{ currentStep === 0 ? '鎻愪氦' : + '閫氳繃' + }}</el-button> + </span> + </el-dialog> </div> + <!-- 鏌ュ崟缂栬緫妗� --> </template> <script> -import ValueTable from '../../tool/value-table.vue' +import { dateFormat } from '../../../util/date' +import file from '../../../util/file'; + export default { - components: { - ValueTable - }, - data(){ - return { - value:'', - componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'getFile', - font: '闄勪欢', - type: 'text', - method: 'getFile' - }, { - id: 'handleLook', - font: '鏌ョ湅', - type: 'text', - method: 'handleLook' - },{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy', - disabFun: (row, index) => { - return row.state === '宸插鏍�' || row.state === '宸叉壒鍑�' - } - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex:0, + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } } }, - methods:{ - refreshTable(){} + data() { + return { + //浜嬫晠璁惧淇℃伅 + tableDataAlist: [], // 鏇存敼鍙橀噺鍚嶇О + dialogVisible: false, + rules: { + quantity: [{ required: true, message: '璇疯緭鍏ユ暟閲�', trigger: 'blur' }], + }, + currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳 + currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖� + steps: ['鎻愪氦', '寮�绠遍獙鏀跺鏍�', '瀹夎楠屾敹妫�鏌�', '瀹夎楠屾敹澶嶆牳', '楠屾敹鏍告煡', '楠屾敹鏍告煡瀹℃牳'], + form: { + sparePartsConfirmationList: [], // 澶囦欢纭List + fileClassConfirmationList: [], // 鏂囦欢纭List + installationAcceptanceRecordList: [], // 瀹夎楠屾敹璁板綍 + acceptanceCheckRecordList: [], // 楠屾敹鏍告煡璁板綍 + fileName: '', // 鏂囦欢鍚嶇О + systemFileName: '', // 绯荤粺鏂囦欢鍚嶇О + }, + outLoading: false, + responsibleOptions: [], // 涓嬬幆鑺傝礋璐d汉list + isUpdate: false, + search: { + size: 20, + current: 1, + total: 0, + processNumber: '', + }, + } + }, + computed: { + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, + mounted() { + // 鑾峰彇璁惧浜嬫晠淇℃伅 + this.getDeviceAList(this.clickNodeVal.value); + window.excelClosed = this.closed + }, + methods: { + handleSizeChange(val) { + this.search.size = val + this.getPersonnelTraining(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val + this.getPersonnelTraining(this.clickNodeVal.value); + }, + deleteFile() { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.systemFileName).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛锛�') + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + onSuccess(response, file, fileList) { + if (response.code == 200) { + // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 + this.form.fileName = file.name + this.form.systemFileName = response.data + } else { + this.$message.error(response.message) + } + }, + addTableRow(value) { + switch (value) { + // 澶囦欢纭 + case 'sparePartsConfirmationList': + const obj = Object.assign({ + name: '', + number: null, + note: '' + }) + this.form.sparePartsConfirmationList.push(obj) + break + // 鏂囦欢纭List + case 'fileClassConfirmationList': + const obj1 = Object.assign({ + expectedCopies: '', + actualCopies: '', + }) + this.form.fileClassConfirmationList.push(obj1) + break + // 瀹夎楠屾敹璁板綍 + case 'installationAcceptanceRecordList': + const obj2 = Object.assign({ + installationProject: '', + installationSituation: '', + installationCompleted: '' + }) + this.form.installationAcceptanceRecordList.push(obj2) + break + // 楠屾敹鏍告煡璁板綍 + case 'acceptanceCheckRecordList': + const obj3 = Object.assign({ + instrumentModule: '', + verificationParameter: '', + acceptableLimit: '', + verificationResult: '', + verificationConclusion: '' + }) + this.form.acceptanceCheckRecordList.push(obj3) + default: + break + } + }, + deleteRow(index, row, type) { + switch (type) { + // 澶囦欢纭 + case 'sparePartsConfirmationList': + if (row.sparePartsId) { + this.$axios.delete(this.$api.deviceCheck.deleteIncidentReportAll + '?sparePartsId=' + row.sparePartsId).then(res => { }); + } + this.form.sparePartsConfirmationList.splice(index, 1) + this.$message.success('鍒犻櫎鎴愬姛锛�') + break + // 鏂囦欢纭List + case 'fileClassConfirmationList': + if (row.fileId) { + this.$axios.delete(this.$api.deviceCheck.deleteIncidentReportAll + '?fileId=' + row.fileId).then(res => { }); + } + this.form.fileClassConfirmationList.splice(index, 1) + this.$message.success('鍒犻櫎鎴愬姛锛�') + break + // 瀹夎楠屾敹璁板綍 + case 'installationAcceptanceRecordList': + if (row.installId) { + this.$axios.delete(this.$api.deviceCheck.deleteIncidentReportAll + '?installId=' + row.installId).then(res => { }); + } + this.form.installationAcceptanceRecordList.splice(index, 1) + this.$message.success('鍒犻櫎鎴愬姛锛�') + break + // 楠屾敹鏍告煡璁板綍 + case 'acceptanceCheckRecordList': + if (row.acceptanceCheckId) { + this.$axios.delete(this.$api.deviceCheck.deleteIncidentReportAll + '?acceptanceCheckId=' + row.acceptanceCheckId).then(res => { }); + } + this.form.acceptanceCheckRecordList.splice(index, 1) + this.$message.success('鍒犻櫎鎴愬姛锛�') + default: + break + } + }, + choiceStep(index) { + this.currentStepClick = index + }, + openRecordAcceptance() { + // 鑾峰彇璁惧鍩虹淇℃伅 + this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => { + this.form.deviceName = res.data.deviceName + this.form.manufacturer = res.data.manufacturer + this.form.specificationModel = res.data.specificationModel + this.form.managementNumber = res.data.managementNumber + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + }); + // 鑾峰彇璐熻矗浜轰俊鎭� + this.getUserList() + }, + //鎻愪氦琛ㄥ崟 + async submitForm(saveState) { + this.$refs.form.validate((valid) => { + if (valid === true || saveState !== '1submit') { + // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂� + let user = JSON.parse(localStorage.getItem('user')) + const dateTime = dateFormat(new Date()) + // 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡 + switch (this.currentStep) { + case 0: + this.form.submitOperatingPersonnel = user.name + this.form.submitDate = dateTime + break + case 1: + this.form.unpackingOperatingPersonnel = user.name + this.form.unpackingDate = dateTime + break + case 2: + this.form.installOperatingPersonnel = user.name + this.form.installDate = dateTime + break + case 3: + this.form.installationAcceptanceOperatingPersonnel = user.name + this.form.installationAcceptanceDate = dateTime + break + case 4: + this.form.acceptanceCheckOperatingPersonnel = user.name + this.form.acceptanceCheckDate = dateTime + break + case 5: + this.form.acceptanceAuditOperatingPersonnel = user.name + this.form.acceptanceAuditDate = dateTime + break + default: + break + } + // 鑾峰彇褰撳墠鐜妭璐熻矗浜� + switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) { + case 0: + this.form.currentResponsible = this.form.submitNextPesponsible + break + case 1: + this.form.currentResponsible = this.form.unpackingNextPesponsible + break + case 2: + this.form.currentResponsible = this.form.installNextPesponsible + break + case 3: + this.form.currentResponsible = this.form.installationAcceptanceNextPesponsible + break + case 4: + this.form.currentResponsible = this.form.acceptanceCheckNextPesponsible + break + default: + break + } + let currentStepAction; + // 璁剧疆璇ユ搷浣滃垽鏂槸鍚︿负鎻愪氦锛屼繚瀛橈紝椹冲洖锛岄�氳繃 + switch (saveState) { + // 鎻愪氦锛岄�氳繃 + case '1submit': + currentStepAction = this.currentStep + 1 + break + // 淇濆瓨 + case '2save': + currentStepAction = this.currentStep + break + // 椹冲洖 + case '3reject': + currentStepAction = this.currentStep - 1 + break + default: + break + } + // 鑾峰彇褰撳墠鐘舵�� + this.form.currentState = currentStepAction === 6 ? '鍏抽棴' : this.steps[currentStepAction] + this.form.deviceId = this.clickNodeVal.value + this.$axios.post(this.$api.deviceCheck.saveIncidentReportData, this.form, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.getDeviceAList(this.clickNodeVal.value); + this.dialogVisible = false + } + }) + } else { + let step = this.steps[this.currentStep] + this.$message.warning(step + ' 娴佺▼涓湁蹇呭~椤规湭濉紒'); + } + }); + }, + // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� + getUserList() { + this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + if (res.code == 200) { + this.responsibleOptions = res.data + } + }) + }, + resetSearch() { + this.search = { + size: 20, + current: 1, + total: 0, + processNumber: '', + } + this.getDeviceAList(this.clickNodeVal.value); + }, + // 鑾峰彇璁惧浜嬫晠淇℃伅(鏍规嵁浠巚uex涓幏鍙栧埌鐨勮澶囧悕绉癷d杩涜鏁版嵁鏌ヨ) + getDeviceAList(deviceId) { + this.$axios.get(this.$api.deviceCheck.incidentReportPage + "?deviceId=" + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&processNumber=" + this.search.processNumber).then(res => { + if (res.code == 200) { + this.tableDataAlist = res.data.records + this.search.total = res.data.total + } + }) + }, + //table 浜嬩欢澶勭悊寮�濮嬪 + handleAttachmentClick(row) { + // 妯℃嫙涓嬭浇闄勪欢 + const imageUrl = this.javaApi+'/img/'+row.systemFileName; // 鍥剧墖 URL + // downloadImage(imageUrl); + file.downloadIamge(imageUrl,row.fileName) + }, + handleViewClick(row) { + this.$axios.get(this.$api.deviceCheck.getShowIncidentReport + "?id=" + row.id).then(res => { + this.form = { ...res.data } + // 濡傛灉绱㈠紩涓�6琛ㄧず鍏ㄩ儴閫氳繃 + this.currentStep = this.steps.indexOf(this.form.currentState) === -1 ? 6 : this.steps.indexOf(this.form.currentState) + this.currentStepClick = this.currentStep === 6 ? 0 : this.currentStep + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + }) + this.dialogVisible = true + }, + // 瀵煎嚭 + handleDownOne(row) { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.acceptanceCertificateExport + '?deviceId=' + row.deviceId + '&processNumber=' + row.processNumber, { + responseType: "blob" + }).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res], { type: 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧楠屾敹.doc'; + link.click(); + }) + }, + // 鍒犻櫎 + handleDeleteClick(row) { + this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteIncidentReport + '?id=' + row.id).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getDeviceAList(this.clickNodeVal.value); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.incidentReportExport + '?deviceId=' + this.clickNodeVal.value, { + responseType: "blob" + }).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res], { type: 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧楠屾敹.xlsx'; + link.click(); + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getDeviceAList(newVal.value); + } + }, + dialogVisible(newVal) { + if (!newVal) { + this.form = { + sparePartsConfirmationList: [], // 澶囦欢纭List + fileClassConfirmationList: [], // 鏂囦欢纭List + installationAcceptanceRecordList: [], // 瀹夎楠屾敹璁板綍 + acceptanceCheckRecordList: [], // 楠屾敹鏍告煡璁板綍 + fileName: '', // 鏂囦欢鍚嶇О + systemFileName: '', // 绯荤粺鏂囦欢鍚嶇О + } + this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳 + this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖� + this.$refs['form'].clearValidate() + } + } } +} +function downloadImage(url) { + const link = document.createElement('a'); + link.href = url; + link.download = 'attachment.jpg'; // 鏂囦欢鍚� + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } </script> <style scoped> -.tables{ - width: calc(100vw - 390px); - height: calc(100vh - 230px); +>>>.el-radio { + color: #606266; + font-weight: 500; + cursor: pointer; + margin-right: 0px; + width: 10em; } + +.tables { + width: 100%; + height: calc(100vh - 17em); +} + .search { background-color: #fff; height: 40px; display: flex; align-items: center; - position: relative; + justify-content: space-between; } .search_thing { @@ -151,18 +904,28 @@ } .search_label { - width: 70px; font-size: 14px; - text-align: right; + width: 110px; } .search_input { width: calc(100% - 120px); } -.btns{ - position: absolute; - right: 40px; - top: 50%; - transform: translate(0,-50%); + +.search_thing { + display: flex; + margin: 10px 0; +} + +.line { + width: 20px; + height: 1px; + background-color: #ccc; + display: inline-block; + margin-right: 10px; +} + +.form .search_label { + width: 120px; } </style> diff --git a/src/components/do/a6-device/check.vue b/src/components/do/a6-device/check.vue index 8f3c0ed..8b76b3d 100644 --- a/src/components/do/a6-device/check.vue +++ b/src/components/do/a6-device/check.vue @@ -1,13 +1,686 @@ +<!-- 璁惧鏍告煡 --> <template> - <div>璁惧鏍告煡</div> + <div> + <div class="btns"> + <el-button size="small" type="primary" @click="calibrationMaintenance()">鏍告煡椤圭洰缁存姢</el-button> + <el-button size="small" type="primary" @click="add('add')">娣诲姞鏍告煡璁板綍</el-button> + <el-button size="small" type="primary">瀵煎嚭Excel</el-button> + </div> + <div class="tables" style="margin-top: 16px;"> + <el-table :data="tableData" height="calc(100vh - 20em)"> + <el-table-column label="搴忓彿" type="index" width="120"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="璁板綍缂栧彿" min-width="150" prop="processNumber"></el-table-column> + <el-table-column label="鏍告煡鏈烘瀯" min-width="150" prop="calibrationInstitution" + show-overflow-tooltip></el-table-column> + <el-table-column label="鏍告煡缁撹" min-width="150" prop="status"> + <template v-slot="scope"> + {{ scope.row.status === '0yes' ? '鍚堟牸' : scope.row.status === '1no' ? '涓嶅悎鏍�' : '鍏朵粬' }} + </template> + </el-table-column> + <el-table-column label="鏍告煡璇佷功缂栧彿" min-width="150" prop="certificateSerialNumber"></el-table-column> + <el-table-column label="璇存槑" min-width="150" prop="remark" show-overflow-tooltip></el-table-column> + <el-table-column label="鏍告煡鏃ユ湡" min-width="150" prop="calibrationDate"></el-table-column> + <el-table-column label="涓嬫鏍告煡鏃ユ湡" min-width="150" prop="nextCalibrationDate"></el-table-column> + <el-table-column label="鐧昏浜�" min-width="150" prop="createUser"></el-table-column> + <el-table-column label="鐧昏鏃ユ湡" min-width="150" prop="createTime"></el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" min-width="150"> + <template #default="{ row }"> + <el-button size="small" type="text" @click="handleAttachmentClick(row)">闄勪欢</el-button> + <el-button size="small" type="text" @click="handleViewClick('view', row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" style="margin-right: 5%;" + @size-change="handleSizeChange" @current-change="handleCurrentChange"> + </el-pagination> + </div> + + <!-- 鏍″噯椤圭洰缁存姢 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible0" title="鏍告煡椤圭洰缁存姢" + top="5vh" width="70%"> + <h4> + <span style="display: flex;align-items: center;"><span class="line"></span><span>璁惧鏍告煡鍙傛暟缁存姢</span></span> + <el-button :loading="addCalibrateLoading" size="small" type="primary" @click="addCalibrate">娣� 鍔�</el-button> + </h4> + <div> + <el-form ref="form0" :model="form0" :rules="form0Rules" + label-position="right" label-width="120px"> + <el-row> + <el-col :span="12"> + <el-form-item label="鏍告煡鍙傛暟:" prop="measurementParameter"> + <el-input v-model="form0.measurementParameter" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍告煡鑼冨洿:" prop="rangeOfMeasurement"> + <el-input v-model="form0.rangeOfMeasurement" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈�澶у厑璁歌宸�:" prop="maxPermissibleError"> + <el-input v-model="form0.maxPermissibleError" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍒ゅ畾鏍囧噯:" prop="judgmentCriteria"> + <el-input v-model="form0.judgmentCriteria" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <h4> + <span style="display: flex;align-items: center;"><span class="line"></span><span>璁惧鏍告煡鍙傛暟</span></span> + </h4> + <!-- 璁惧鏍″噯鍙傛暟琛ㄦ牸 --> + <el-table ref="calibrateTable" v-loading="calibrateParamsLoading" :data="calibrateParams" + max-height="450" + stripe style="width: 100%"> + <el-table-column label="缂栧彿" type="index" width="80"></el-table-column> + <el-table-column label="鏍告煡鍙傛暟" prop="measurementParameter"></el-table-column> + <el-table-column label="鏍告煡鑼冨洿" prop="rangeOfMeasurement"></el-table-column> + <el-table-column label="鏈�澶у厑璁歌宸�" prop="maxPermissibleError"></el-table-column> + <el-table-column label="鍒ゅ畾鏍囧噯" prop="judgmentCriteria"></el-table-column> + <el-table-column label="鍒涘缓浜�" prop="createdBy"></el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" prop="creationTime"></el-table-column> + <el-table-column fixed="right" label="鎿嶄綔"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleDelete(scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-dialog> + + <!-- 娣诲姞鏍告煡璁板綍 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible1" title="娣诲姞鏍告煡璁板綍" + top="5vh" + width="80%" @close="resetcalibrationRecord"> + <div class="dialog-content"> + <h4> + <span style="display: flex;align-items: center;"> + <span class="line"></span> + <span>娣诲姞璁惧鏍告煡璁板綍</span> + </span> + </h4> + <el-form ref="calibrationRecord" :model="calibrationRecord" :rules="formRules" + label-position="right" label-width="120px"> + <el-row> + <el-col :span="6"> + <el-form-item label="鏍告煡浜�:" prop="unitOfMeasure"> + <el-input v-model="calibrationRecord.unitOfMeasure" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏍告煡鏃ユ湡:" prop="calibrationDate"> + <el-date-picker v-model="calibrationRecord.calibrationDate" :disabled="operationType === 'view'" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 90%" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="涓嬫鏍告煡鏃ユ湡:" label-width="140px" prop="nextCalibrationDate"> + <el-date-picker v-model="calibrationRecord.nextCalibrationDate" :disabled="operationType === 'view'" :picker-options="{ disabledDate: this.disabledDate }" + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" style="width: 90%" type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鏍告煡鍣ㄥ叿:" prop="calculatingApparatus"> + <el-input v-model="calibrationRecord.calculatingApparatus" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏍告煡鏍囧噯閲忕▼:" prop="standardRange"> + <el-input v-model="calibrationRecord.standardRange" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="鏍告煡鏍囧噯涓嶇‘瀹氬害:" label-width="140px" prop="calibrationStandardUncertainty"> + <el-input v-model="calibrationRecord.calibrationStandardUncertainty" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鏍告煡鎸囧涔�:" prop="byDocument"> + <el-input v-model="calibrationRecord.byDocument" :disabled="operationType === 'view'" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="妫�鏌ユ姤鍛婄紪鍙�:" prop="certificateSerialNumber"> + <el-input v-model="calibrationRecord.certificateSerialNumber" :disabled="operationType === 'view'" size="small" + style="width: 90%"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏍告煡鎬荤粨璁�:" label-width="140px" prop="status"> + <el-radio-group v-model="calibrationRecord.status" :disabled="operationType === 'view'"> + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="23"> + <el-form-item label="闄勪欢锛�" prop="fileName"> + <el-input v-model="calibrationRecord.fileName" :style="`width: ${operationType === 'add' ? '90%' : '100%'};}`" disabled + size="small"> + <el-button v-if="operationType === 'add'" slot="append" icon="el-icon-delete-solid" + @click="deleteFile"></el-button> + </el-input> + <el-upload v-if="operationType === 'add'" ref="upload" :action="action" :before-upload="beforeUpload" :headers="headers" + :limit="1" :on-error="onError" :on-success="handleSuccessUp" + :show-file-list="false" + style="float: right;"> + <el-button :loading="upLoading" size="small" style="position: relative; top: -4px;" + type="primary">闄勪欢涓婁紶 + </el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞:"> + <el-input v-model="calibrationRecord.remark" :disabled="operationType === 'view'" :rows="3" size="small" + style="width: 96%" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <h4> + <span style="display: flex;align-items: center;"> + <span class="line"></span><span>鏍告煡鏉$洰纭缁撴灉</span> + </span> + </h4> + <el-table ref="calibrateTable" :data="calibrateParams" stripe style="width: 100%;"> + <el-table-column label="缂栧彿" type="index" width="80"></el-table-column> + <el-table-column label="鏍告煡鍙傛暟" prop="measurementParameter" width="150"></el-table-column> + <el-table-column label="鏍告煡鑼冨洿" prop="rangeOfMeasurement" width="150"></el-table-column> + <el-table-column label="鏈�澶у厑璁歌宸�" prop="maxPermissibleError" width="150"></el-table-column> + <el-table-column label="鍒ゅ畾鏍囧噯" prop="judgmentCriteria" width="150"></el-table-column> + <el-table-column label="鏄惁鏍告煡" prop="isCalibration"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鏄惁鏍告煡 + </template> + <template slot-scope="scope"> + <el-radio-group v-model="scope.row.isCalibration" :disabled="operationType === 'view'"> + <el-radio label="0yes">鏄�</el-radio> + <el-radio label="1no">鍚�</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍒ゅ畾缁撴灉" prop="result"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鍒ゅ畾缁撴灉 + </template> + <template slot-scope="scope"> + <el-radio-group v-model="scope.row.result" :disabled="operationType === 'view'" @input="checkRadio()"> + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍗曢」缁撴灉璇存槑" prop="singleResultStatement"> + <template slot-scope="scope"> + <el-input v-model="scope.row.singleResultStatement" :disabled="operationType === 'view'" size="small"></el-input> + </template> + </el-table-column> + </el-table> + <span slot="footer" class="dialog-footer" style="float: right;margin-top: 10px"> + <el-button v-if="operationType === 'add'" @click="dialogVisible1 = false">鍙� 娑�</el-button> + <el-button v-if="operationType === 'add'" type="primary" @click="addRecord">纭� 瀹�</el-button> + </span> + </div> + </el-dialog> + </div> + </template> <script> +import ValueTable from '../../tool/value-table.vue' +import file from '../../../util/file'; export default { + components: { + ValueTable + }, + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + return { + search: { + size: 20, + current: 1, + total: 0 + }, + calibrateParamsLoading: false, + addCalibrateLoading: false, + form0: { + measurementParameter: '', // 璁¢噺鍙傛暟 + rangeOfMeasurement: '', + maxPermissibleError: '', + judgmentCriteria: '', + createdBy: '', + action: '', + deviceId: null + }, + form0Rules: { + measurementParameter: [ + {required: true, message: '璇疯緭鍏ヨ閲忓弬鏁�', trigger: 'blur'} + ], + rangeOfMeasurement: [ + {required: true, message: '璇疯緭鍏ラ噺绋嬭寖鍥�', trigger: 'blur'} + ], + maxPermissibleError: [ + {required: true, message: '璇疯緭鍏ユ渶澶у厑璁歌宸�', trigger: 'blur'} + ], + judgmentCriteria: [ + {required: true, message: '璇疯緭鍏ュ垽瀹氭爣鍑�', trigger: 'blur'} + ], + }, + dialogVisible0: false, + calibrationRecord: { + unitOfMeasure: '', // 鏍告煡浜� + calibrationDate: '', // 鏍告煡鏃ユ湡 + nextCalibrationDate: '', // 涓嬫鏍告煡鏃ユ湡 + calculatingApparatus: '', // 鏍告煡鍣ㄥ叿 + standardRange: '', // 鏍告煡鏍囧噯閲忕▼ + calibrationStandardUncertainty: '', // 鏍告煡鏍囧噯涓嶇‘瀹氬害 + byDocument: '', // 鏍告煡鎸囧涔� + certificateSerialNumber: '', // 妫�鏌ユ姤鍛婃寚瀵间功 + fileName: '', // 闄勪欢 + status: '', // 鏍告煡鎬荤粨璁� + remark: '', // 澶囨敞 + }, + formRules: { + unitOfMeasure: [{required: true, message: '璇疯緭鍏ユ牳鏌ヤ汉', trigger: 'blur'}], + calibrationDate: [{required: true, message: '璇烽�夋嫨鏍告煡鏃ユ湡', trigger: 'change'}], + nextCalibrationDate: [{required: true, message: '璇烽�夋嫨涓嬫鏍告煡鏃ユ湡', trigger: 'change'}], + calculatingApparatus: [{required: true, message: '璇疯緭鍏ユ牳鏌ュ櫒鍏�', trigger: 'blur'}], + standardRange: [{required: true, message: '璇疯緭鍏ユ牳鏌ユ爣鍑嗛噺绋�', trigger: 'blur'}], + calibrationStandardUncertainty: [{required: true, message: '璇疯緭鍏ユ牳鏌ユ爣鍑嗕笉纭畾搴�', trigger: 'blur'}], + byDocument: [{required: true, message: '璇疯緭鍏ユ牳鏌ユ寚瀵间功', trigger: 'blur'}], + certificateSerialNumber: [{required: true, message: '璇疯緭鍏ユ鏌ユ姤鍛婃寚瀵间功', trigger: 'blur'}], + status: [{required: true, message: '璇烽�夋嫨鏍告煡鎬荤粨璁�', trigger: 'change'}] + }, + calibrateParams: [], + tableData: [], + operationType: '', + dialogVisible1: false, + formData: { + person: '', + data1: '', + name: '', + }, + upLoading: false + } + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, + mounted() { + this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍告煡鍒楄〃鏁版嵁 + }, + methods: { + //鐘舵�佸垽瀹� + checkRadio(){ + let resultList = this.calibrateParams.map(ele=>ele.result) + if(resultList && resultList.filter(ele=>ele=='1no').length>0){ + this.calibrationRecord.status = '1no' + }else if(resultList && resultList.filter(ele=>ele=='2other').length==resultList.length){ + this.calibrationRecord.status = '2other' + }else if(resultList && resultList.filter(ele=>ele=='0yes').length==resultList.length){ + this.calibrationRecord.status = '0yes' + } + }, + //涓嬫鏍告煡鏃ユ湡:绂佺敤鍦ㄦ牳鏌ユ棩鏈熷墠鐨勬棩鏈� + disabledDate(time){ + let selectDate = this.calibrationRecord.calibrationDate + if(selectDate){ + let oldDate = new Date(selectDate) + return time <= oldDate.getTime() + } + return false + }, + handleSizeChange(val) { + this.search.size = val + this.getTableList(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val + this.getTableList(this.clickNodeVal.value); + }, + // 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅 + async getXmsg() { + this.calibrateParamsLoading = true + try { + await this.$axios.get(this.$api.deviceCheck.selectDeviceMetric + "?deviceId=" + this.clickNodeVal.value + "&type=examine").then(res => { + if (res.code == 200) { + this.calibrateParams = res.data + } + this.calibrateParamsLoading = false + }) + } catch (e) { + this.calibrateParamsLoading = false + } + }, + // 鏍″噯椤圭洰缁存姢 + calibrationMaintenance() { + this.dialogVisible0 = true + this.getXmsg(); + }, + addCalibrate() { + this.$refs['form0'].validate((valid) => { + if (valid) { + // 淇濆瓨 + this.calibrateParamsLoading = true + this.addCalibrateLoading = true + this.form0.deviceId = this.clickNodeVal.value; + const user = JSON.parse(localStorage.getItem('user')) + this.form0.createdBy = user.name; + this.form0.type = 'examine' + this.$axios.post(this.$api.deviceCheck.saveOrUpdateDeviceMetric, this.form0, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('淇濆瓨鎴愬姛') + this.$refs['form0'].resetFields() + this.getXmsg() // 鍒锋柊璁惧鏍″噯鍙傛暟琛ㄦ牸 + } + this.calibrateParamsLoading = false + this.addCalibrateLoading = false + }) + } else { + this.addCalibrateLoading = false + this.$message.warning('鏈夊繀濉」鏈~'); + } + }) + }, + // 鏌ヨ璁惧鏍告煡鍒楄〃 + getTableList(deviceId) { + this.$axios.get(this.$api.deviceCheck.deviceMetricRecordPage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&type=examine").then(res => { + this.tableData = res.data.records + this.search.total = res.data.total + }) + }, + // 鎻愪氦瑕佹坊鍔犵殑璁板綍 + addRecord() { + this.$refs['calibrationRecord'].validate((valid) => { + if (valid) { + try { + if (this.calibrateParams.some(m => m.isCalibration === undefined)) { + this.$message.error('璇烽�夋嫨鏄惁鏍告煡') + return + } + if (!this.calibrateParams.every(m => m.result !== undefined)) { + this.$message.error('璇烽�夋嫨鍒ゅ畾缁撴灉') + return + } + this.addRecordLoading = true + this.calibrationRecord.deviceId = this.clickNodeVal.value; + let user = JSON.parse(localStorage.getItem('user')) + this.calibrationRecord.createUser = user.name + this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams + this.calibrationRecord.type = 'examine' + this.$axios.post(this.$api.deviceCheck.addOrUpdateDeviceMetricRecord, this.calibrationRecord, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('娣诲姞鎴愬姛') + this.dialogVisible1 = false + this.getTableList(this.clickNodeVal.value) + } + this.addRecordLoading = false + }) + } catch (e) { + console.log('addRecord---', e) + this.addRecordLoading = false + } + } else { + this.$message.warning('鏈夊繀濉」鏈~'); + } + }) + }, + resetcalibrationRecord() { + this.$refs.calibrationRecord.resetFields() + }, + // 闄勪欢涓婁紶 + handleSuccessUp(response, file) { + if (response.code == 200) { + // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 + this.calibrationRecord.fileName = file.name + this.calibrationRecord.systemFileName = response.data + this.upLoading = false; + } else { + this.$message.error(response.message) + } + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + this.upLoading = true; + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + deleteFile() { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.systemFileName).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛锛�') + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // end + handleAttachmentClick(row) { + // 妯℃嫙涓嬭浇闄勪欢 + const imageUrl = this.javaApi+'/img/'+row.systemFileName; // 鍥剧墖 URL + file.downloadIamge(imageUrl,row.fileName) + // downloadImage(imageUrl, row.fileName); + }, + // 娣诲姞鏍告煡璁板綍 + add(type) { + this.operationType = type + this.dialogVisible1 = true + this.getXmsg() + }, + // 鏌ョ湅璇︽儏 + handleViewClick(type, row) { + this.$axios.get(this.$api.deviceCheck.showDeviceMetricsCopy + "?id=" + row.id + "&type=examine").then(res => { + this.calibrateParams = res.data + }) + this.calibrationRecord = {...row} + this.operationType = type + this.dialogVisible1 = true + }, + // 琛ㄦ牸鍒犻櫎鎿嶄綔 + handleDeleteClick(row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetricRecord + "?id=" + row.id).then(res => { + this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + this.$message.success('鍒犻櫎鎴愬姛锛�') + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }) + }, + handleDelete(row){ + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceMetrics + "?id=" + row.id).then(res => { + this.getXmsg(); + this.$message.success('鍒犻櫎鎴愬姛锛�') + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }) + } + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getTableList(newVal.value); + } + }, + } +} + +function downloadImage(url,name) { + const link = document.createElement('a'); + link.href = url; + link.download = name; // 鏂囦欢鍚� + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } </script> - <style scoped> +.dialog-content { + max-height: 70vh; /* 璁剧疆鏈�澶ч珮搴� */ + overflow-y: auto; /* 鍚敤鍨傜洿婊氬姩 */ +} +.tables { + width: 100%; + height: calc(100vh - 230px); +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + display: flex; + align-items: center; + height: 40px; +} + +.search_label { + width: 70px; + font-size: 14px; + text-align: right; + margin-right: 10px; +} + +.search_input { + width: calc(100% - 110px); +} + +.btns { + text-align: right; +} + +h4 { + font-weight: 400; + font-size: 16px; + display: flex; + justify-content: space-between; + margin: 10px 0; +} + +h4 .line { + display: inline-block; + width: 3px; + height: 16px; + background: #3A7BFA; + margin-right: 4px; +} + +.check { + background-color: #fff; + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.check_thing { + flex: 0 0 calc(20% - 10px); + margin-bottom: 20px; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.check_label { + font-size: 14px; + margin-bottom: 5px; +} + +.check_data .check_input { + width: 100%; +} + +.el-table { + font-size: 14px; + color: #333; +} + +.el-table thead { + background-color: #f5f5f5; +} </style> diff --git a/src/components/do/a6-device/device-overview.vue b/src/components/do/a6-device/device-overview.vue new file mode 100644 index 0000000..ed1ab0d --- /dev/null +++ b/src/components/do/a6-device/device-overview.vue @@ -0,0 +1,408 @@ +<!-- 璁惧鎬昏 --> +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 50px; + display: flex; + align-items: center; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: left; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + width: calc(100% - 40px); + height: calc(100vh - 17em); + /* padding: 10px; */ + overflow-y: auto; +} + +.card { + list-style-type: none; + display: grid; + grid-template-columns: repeat(auto-fit, 380px); + justify-content: start; + grid-gap: 16px; + min-height: 300px; +} + +.card li { + width: 380px; + height: 165px; + border-radius: 8px 8px 8px 8px; + border: 1px solid #EEEEEE; + margin: 0 !important; + display: flex; + align-items: center; + box-sizing: border-box; + padding: 16px; + font-size: 14px; + color: #666666; + position: relative; + overflow: hidden; +} + +.card li .img { + width: 114px; + height: 114px; + border-radius: 16px; + margin-right: 24px; +} + +.list-left .list-left-info { + line-height: 36px; + display: flex; +} + +.text-truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap +} + +.circles { + position: absolute; + width: 70px; + height: 70px; + right: 0; + top: 0; + z-index: 0; +} + +.circles .circle { + border-radius: 50%; + opacity: 0.2; +} + +.circle0, +.circle1, +.circle2 { + width: 60px; + height: 60px; + position: absolute; +} + +.circle3 { + width: 16px; + height: 16px; + position: absolute; +} + +.circle0 { + bottom: 6px; + left: 0; +} + +.circle1 { + bottom: 0; + right: -30px; +} + +.circle2 { + left: 0; + top: -30px; +} + +.circle3 { + top: 0; + right: 0; +} + +.success .circle { + background: #34BD66; +} + +.danger .circle { + background: #FF3838; +} + +.warning .circle { + background: #FBB247; +} +.info .circle { + background: #909399; +} +</style> + +<template> + <div class="role_manage"> + <div> + <el-form :model="entity" inline label-position="right" label-width="80px"> + <el-form-item label="鐘舵��:"> + <el-select v-model="entity.deviceStatus" placeholder="鍏ㄩ儴" size="small" clearable> + <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="璁惧鍚嶇О:"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.deviceName"></el-input> + </el-form-item> + <el-form-item> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + </el-form-item> + <el-form-item> + <el-button size="small" type="primary" + @click="currentPage = 1, keyMap = {}, list = [], finishLoding = false, refreshTable()">鏌� 璇�</el-button> + </el-form-item> + </el-form> + <!-- <div class="search_thing"> + <div class="search_label">鐘舵�侊細</div> + <el-select v-model="entity.deviceStatus" placeholder="鍏ㄩ儴" size="small" clearable> + <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + <div class="search_thing"> + <div class="search_label">璁惧鍚嶇О锛�</div> + <div class="search_input"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="entity.deviceName"></el-input> + </div> + </div> --> + + + <!-- <div class="search_thing" style="padding-left: 30px;"> + </div> --> + </div> + <div class="table" v-loading="loading"> + <scroll-pagination @load="refreshTable()" :finishLoding="finishLoding" :list="list" + v-if="list.length > 0 || loading"> + <ul class="card"> + <li v-for="(m, i) in list" :key="i"> + <el-image class="img" :src="javaApi + '/img/' + m.imageUpload"> + <div slot="error" class="image-error" style="width: 112px; + height: 112px; + border-radius: 16px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #EEEEEE;"> + <i class="el-icon-picture-outline" style="font-size:30px;color:#666666;"></i> + </div> + </el-image> + <div class="list-left"> + <div class="list-left-info"> + <span class="label">璁惧鍚嶇О锛�</span> + <span style="color:#3A7BFA; + font-size: 16px; + display: inline-block; + width: 129px; + word-break: break-all;" class="text-truncate" :title="m.deviceName">{{ m.deviceName ? m.deviceName : '鏃�' }}</span> + </div> + <div class="list-left-info"> + <span class="label">瑙勬牸鍨嬪彿锛�</span> + <span style="color:#333333;font-size: 16px;">{{ m.specificationModel ? m.specificationModel : '鏃�' + }}</span> + </div> + <div class="list-left-info"> + <span class="label">鐘舵�侊細</span> + <el-tag :type="m.type" v-if="m.deviceStatusName">{{ m.deviceStatusName }}</el-tag> + <span v-else style="color:#333333;font-size: 16px;">鏃�</span> + </div> + </div> + <div class="circles" :class="m.type"> + <div class="circle0 circle"></div> + <div class="circle1 circle"></div> + <div class="circle2 circle"></div> + <div class="circle3 circle"></div> + </div> + </li> + </ul> + </scroll-pagination> + <div v-if="list.length < 1 && !loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px"> + 鏆傛棤鏁版嵁 + </div> + </div> + </div> +</template> + +<script> +import ScrollPagination from '../../tool/scroll-paging.vue' +export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + components: { + ScrollPagination + }, + data() { + return { + entity: { + deviceStatus: null, + deviceName: null, + orderBy: { field: "id", order: "asc" } + }, + options: [], + list: [], + currentPage: 1, // 褰撳墠椤� + pageSize: 16, // 涓�椤�16鏉� + total: '', + loading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue + finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡 + keyMap: {}, + laboratoryNameIsNull: false, + } + }, + created() { + this.selectEnumByCategory() + this.keyMap = {}; + this.currentPage = 1; + this.list = []; + this.clickSidebar(this.clickNodeVal) + }, + methods: { + refreshTable() { + const key = `_${this.currentPage}` + const value = this.keyMap[key] + // 濡傛灉value瀛樺湪锛岃〃绀虹紦瀛樻湁鍊硷紝閭d箞闃绘璇锋眰 + if (value) { + return + } + // value涓嶅瓨鍦紝琛ㄧず绗竴娆¤姹�,璁剧疆鍗犱綅 + this.keyMap[key] = 'temp' + if (this.currentPage == 1) { + this.loading = true + } + if(this.list.length==0){ + this.finishLoding = false; + } + this.$axios.post(this.$api.deviceScope.selectDeviceParameter + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull, { + page: { + current: this.currentPage, + size: this.pageSize + }, + entity: this.entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.total = res.data.body.total + let list = res.data.body.records.map(m => { + switch (m.deviceStatus) { + case 0: + // 姝e父 + m.type = 'success' + break; + case 1: + // 缁翠慨 + m.type = 'warning' + break; + case 2: + // 鍋滅敤 + m.type = 'danger' + break; + case 3: + // 鎶ュ簾 + m.type = 'info' + break; + } + this.options.forEach(j => { + if (m.deviceStatus == j.value) { + m.deviceStatusName = j.label + } + }) + return m; + }) + if (list.length == 0) { + this.finishLoding = true; + } else { + if (list.length < this.pageSize) { + this.finishLoding = true; + } + this.list = this.list.concat(list) + if (this.total == this.list.length) { + this.finishLoding = true; + } + this.currentPage++; + } + } + this.loading = false + }) + }, + refresh() { + this.keyMap = {}; + this.currentPage = 1; + this.list = []; + this.finishLoding = false; + this.entity = { + deviceStatus: null, + deviceName: null, + orderBy: { field: "id", order: "asc" } + }; + this.refreshTable() + }, + // 鑾峰彇瀛楀吀 + selectEnumByCategory() { + this.$axios.post(this.$api.enums.selectEnumByCategory, { + category: "璁惧鐘舵��" + }).then(res => { + this.options = res.data + }) + }, + // 鐐瑰嚮渚ц竟鏍忓埛鏂� + clickSidebar(clickNodeVal) { + this.laboratoryNameIsNull = false + // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� + if (!clickNodeVal.value) { + this.finishLoding = false; + this.keyMap = {}; + this.currentPage = 1; + this.list = []; + this.entity.laboratoryName = null + this.entity.storagePoint = null + // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� + if (clickNodeVal.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + this.refreshTable(); + return + } + if (clickNodeVal.level == 1) { + this.entity.laboratoryName = clickNodeVal.label + // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� + } else if (clickNodeVal.level == 2) { + // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 + if (clickNodeVal.parent.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + } else { + this.entity.laboratoryName = clickNodeVal.parent.label + } + this.entity.storagePoint = clickNodeVal.label + } + this.refreshTable(); + } + } + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + this.clickSidebar(newVal) + } + } +} +</script> diff --git a/src/components/do/a6-device/fault.vue b/src/components/do/a6-device/fault.vue index 41b9377..e976690 100644 --- a/src/components/do/a6-device/fault.vue +++ b/src/components/do/a6-device/fault.vue @@ -1,13 +1,696 @@ +<!-- 璁惧鏁呴殰 --> <template> - <div>璁惧鏁呴殰</div> + <div> + <div class="search"> + <div class="search_thing"> + <div class="search_label">娴佺▼缂栧彿锛�</div> + <div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="search.processNumber" style="width: 100%;" + @keyup.enter.native="getTableList(clickNodeVal.value)"> + </el-input> + </div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="resetSearch">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="getTableList(clickNodeVal.value)">鏌� 璇�</el-button> + </div> + <div class="btns"> + <el-button size="small" type="primary" @click="dialogVisible = true, addRecode()">鏂板缓</el-button> + <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">瀵煎嚭</el-button> + </div> + </div> + <div> + <div class="tables" style="margin-top: 16px;"> + <el-table :data="faultParam" style="width: 100%" height="calc(100vh - 20em)"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column header-align="center" align="center" width="70" prop="prop" label="搴忓彿" + type="index"></el-table-column> + <el-table-column prop="processNumber" label="娴佺▼缂栧彿" min-width="180"></el-table-column> + <el-table-column prop="deviceName" label="璁惧鍚嶇О" min-width="150"></el-table-column> + <el-table-column prop="managementNumber" label="缁熶竴缂栧彿" min-width="150"></el-table-column> + <el-table-column prop="faultSituation" label="鏁呴殰鎯呭喌" min-width="130"></el-table-column> + <el-table-column prop="submitPerson" label="鎻愪氦浜�" min-width="130"></el-table-column> + <el-table-column prop="createTime" label="鎻愪氦鏃ユ湡" min-width="150"></el-table-column> + <el-table-column prop="currentState" label="褰撳墠鐘舵��" min-width="130"></el-table-column> + <el-table-column prop="currentResponsible" label="褰撳墠璐d换浜�" width="180"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column label="鎿嶄綔" fixed="right" min-width="150"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="showDetailsDialog(scope.row)">鏌ョ湅璇︽儏</el-button> + <el-button type="text" size="small" @click="handleDeleteClick(scope.$index, scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1" + style="margin-right: 5%;" :page-sizes="[10, 20, 30, 50, 100]" :page-size="search.size" + layout="->,total, sizes, prev, pager, next, jumper" :total="search.total"> + </el-pagination> + </div> + </div> + <el-dialog title="鏂板缁翠慨璁板綍" top="5vh" :visible.sync="dialogVisible" width="60%" @open="openRecordAcceptance" + :close-on-click-modal="false" :close-on-press-escape="false"> + <el-steps :active="currentStep" finish-status="success" align-center> + <el-step v-for="(v, i) in steps" style="cursor:pointer" :title="v" :key="i" + @click.native="choiceStep(i)"></el-step> + </el-steps> + <el-form ref="form" :model="form" label-position="right" label-width="120px"> + <!-- 鎻愪氦 --> + <div v-show="currentStepClick == 0"> + <el-card style="margin-top: 1em;"> + <el-row> + <el-col :span="24"> + <el-form-item label="娴佺▼缂栧彿:"> + <el-input v-model="form.processNumber" size="small" disabled></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О:"> + <el-input v-model="form.deviceName" size="small" disabled></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿:"> + <el-input v-model="form.specificationModel" size="small" disabled></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧缂栧彿:"> + <el-input v-model="form.managementNumber" size="small" disabled></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍑嗙‘搴﹂噺鍊�:" prop="measureOfAccuracy" + :rules="[{required: currentStep === 0, message: '璇疯緭鍏ュ噯纭害閲忓��', trigger: 'blur'}]"> + <el-input v-model="form.measureOfAccuracy" size="small" :disabled="currentStep !== 0"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏁呴殰鏃ユ湡:" prop="faultDate"> + <el-date-picker + v-model="form.faultDate" + type="date" + placeholder="閫夋嫨鏃ユ湡" size="small" format="yyyy-MM-dd" style="width: 100%" value-format="yyyy-MM-dd" :disabled="currentStep !== 0"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑕佹眰淇鏃ユ湡:" prop="requestRepairDate"> + <el-date-picker + v-model="form.requestRepairDate" + :picker-options="{ disabledDate: this.disabledDate }" + type="date" + placeholder="閫夋嫨鏃ユ湡" size="small" format="yyyy-MM-dd" style="width: 100%" value-format="yyyy-MM-dd" :disabled="currentStep !== 0"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鏁呴殰鎯呭喌:" prop="faultSituation" + :rules="[{required: currentStep === 0, message: '璇疯緭鍏ユ晠闅滄儏鍐�', trigger: 'blur'}]"> + <el-input v-model="form.faultSituation" type="textarea" size="small" :disabled="currentStep !== 0"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐩稿叧闄勪欢:"> + <el-input v-model="form.fileName" :disabled="true" size="small" style="width: 80%;"> + <el-button slot="append" icon="el-icon-delete-solid" @click="deleteFile" :disabled="currentStep !== 0"></el-button> + </el-input> + <el-upload ref="upload" style="float: right;" :action="action" :show-file-list="false" + :on-success="handleSuccess"> + <el-button style="position: relative;top: -4px;" class="uploadFile" slot="trigger" size="small" + type="primary" :disabled="currentStep !== 0">闄勪欢涓婁紶 + </el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬬幆鑺傝礋璐d汉:" prop="submitNextPesponsible" + :rules="[{required: currentStep === 0, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change'}]"> + <el-select v-model="form.submitNextPesponsible" placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%" :disabled="currentStep !== 0"> + <el-option v-for="(v, i) in users" :label="v.name" :value="v.name" :key="i"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.submitOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.submitDate }} + </el-col> + </el-row> + </div> + <!-- 璁惧绠$悊鍛樻剰瑙� --> + <div v-show="currentStepClick == 1"> + <el-card style="margin-top: 1em; height: 45vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="缁翠慨鏂瑰紡鍙婅垂鐢�:" prop="methodCost" + :rules="[{required: currentStep === 1, message: '璇疯緭鍏ョ淮淇柟寮忓強璐圭敤', trigger: 'blur'}]"> + <el-input v-model="form.methodCost" type="textarea" size="small" :disabled="currentStep !== 1"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="瀹℃牳鎰忚:" prop="adminAuditOption" + :rules="[{required: currentStep === 1, message: '璇疯緭鍏ュ鏍告剰瑙�', trigger: 'blur'}]"> + <el-input v-model="form.adminAuditOption" type="textarea" size="small" :disabled="currentStep !== 1"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬬幆鑺傝礋璐d汉:" prop="adminNextPesponsible" + :rules="[{required: currentStep === 1, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change'}]"> + <el-select v-model="form.adminNextPesponsible" placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%" :disabled="currentStep !== 1"> + <el-option v-for="(v, i) in users" :label="v.name" :value="v.name" :key="i"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.adminOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.adminDate }} + </el-col> + </el-row> + </div> + <!-- 鎶�鏈礋璐d汉鎰忚 --> + <div v-show="currentStepClick == 2"> + <el-card style="margin-top: 1em; height: 45vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="瀹℃牳鎰忚:" prop="technicalAuditOption" + :rules="[{required: currentStep === 2, message: '璇疯緭鍏ュ鏍告剰瑙�', trigger: 'blur'}]"> + <el-input v-model="form.technicalAuditOption" type="textarea" size="small" :disabled="currentStep !== 2"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬬幆鑺傝礋璐d汉:" prop="technicalNextPesponsible" + :rules="[{required: currentStep === 2, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change'}]"> + <el-select v-model="form.technicalNextPesponsible" placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%" :disabled="currentStep !== 2"> + <el-option v-for="(v, i) in users" :label="v.name" :value="v.name" :key="i"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.technicalOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.technicalDate }} + </el-col> + </el-row> + </div> + <!-- 缁翠慨鎯呭喌璁板綍 --> + <div v-show="currentStepClick == 3"> + <el-card style="margin-top: 1em; height: 45vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="缁翠慨鎯呭喌:" prop="maintainSituation" + :rules="[{required: currentStep === 3, message: '璇疯緭鍏ョ淮淇儏鍐�', trigger: 'blur'}]"> + <el-input v-model="form.maintainSituation" type="textarea" size="small" :disabled="currentStep !== 3"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬬幆鑺傝礋璐d汉:" prop="maintainNextPesponsible" + :rules="[{required: currentStep === 3, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change'}]"> + <el-select v-model="form.maintainNextPesponsible" placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%" :disabled="currentStep !== 3"> + <el-option v-for="(v, i) in users" :label="v.name" :value="v.name" :key="i"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.maintainOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.maintainDate }} + </el-col> + </el-row> + </div> + <!-- 缁翠慨鍚庣殑纭 --> + <div v-show="currentStepClick == 4"> + <el-card style="margin-top: 1em; height: 45vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="楠屾敹銆佺‘璁ゃ�佹牎鍑嗘儏鍐�:" prop="checkCalSituation" label-width="200" + :rules="[{required: currentStep === 4, message: '璇疯緭鍏ラ獙鏀躲�佺‘璁ゃ�佹牎鍑嗘儏鍐�', trigger: 'blur'}]"> + <el-input v-model="form.checkCalSituation" type="textarea" size="small" style="width: 100%" :disabled="currentStep !== 4"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.afterMaintenanceOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.afterMaintenanceDate }} + </el-col> + </el-row> + </div> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="submitForm('3reject')" v-if="currentStep !== 0 && currentStep !== 5" + :loading="sumbitLoading1">椹冲洖</el-button> + <el-button @click="submitForm('2save')" v-if="currentStep === 0" :loading="sumbitLoading2">淇濆瓨</el-button> + <el-button type="primary" v-if="currentStep !== 5" @click="submitForm('1submit')" :loading="sumbitLoading3"> + {{ currentStep === 0 ? '鎻愪氦' : '閫氳繃' }} + </el-button> + </span> + </el-dialog> + </div> </template> <script> -export default { +import {dateFormat} from '../../../util/date' +export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + return { + search: { + size: 20, + current: 1, + total: 0, + processNumber: '' + }, + users: [], + currentStep: 0, + currentStepClick: 0, + steps: ['鎻愪氦', '璁惧绠$悊鍛樻剰瑙�', '鎶�鏈礋璐d汉鎰忚', '缁翠慨鎯呭喌璁板綍', '缁翠慨鍚庣殑纭'], + outLoading: false, + form: {}, + faultParam: [], + dialogVisible: false, + sumbitLoading1: false, + sumbitLoading2: false, + sumbitLoading3: false, + } + }, + computed: { + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, + mounted() { + this.getTableList(this.clickNodeVal.value) + }, + methods: { + //瑕佹眰淇鏃ユ湡:绂佺敤鍦ㄦ晠闅滄棩鏈熷墠鐨勬棩鏈� + disabledDate(time){ + let selectDate = this.form.faultDate + if(selectDate){ + let selectTime = new Date(selectDate).getTime() - 28800000 + return time < selectTime + } + return false + }, + //鎻愪氦琛ㄥ崟 + async submitForm(saveState) { + let currentStepAction; + // 璁剧疆璇ユ搷浣滃垽鏂槸鍚︿负鎻愪氦锛屼繚瀛橈紝椹冲洖锛岄�氳繃 寮�鍚痩oding + switch (saveState) { + // 鎻愪氦锛岄�氳繃 + case '1submit': + currentStepAction = this.currentStep + 1 + this.sumbitLoading1 = true + break + // 淇濆瓨 + case '2save': + currentStepAction = this.currentStep + this.sumbitLoading2 = true + break + // 椹冲洖 + case '3reject': + currentStepAction = this.currentStep - 1 + this.sumbitLoading3 = true + break + default: + break + } + this.$refs.form.validate((valid) => { + if (valid === true || saveState !== '1submit') { + // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂� + let user = JSON.parse(localStorage.getItem('user')) + const dateTime = dateFormat(new Date()) + // 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡 + switch (this.currentStep) { + case 0: + this.form.submitUser = user.name + this.form.submitOperatingPersonnel = user.name + this.form.submitDate = dateTime + break + case 1: + this.form.adminOperatingPersonnel = user.name + this.form.adminDate = dateTime + break + case 2: + this.form.technicalOperatingPersonnel = user.name + this.form.technicalDate = dateTime + break + case 3: + this.form.maintainOperatingPersonnel = user.name + this.form.maintainDate = dateTime + break + case 4: + this.form.afterMaintenanceOperatingPersonnel = user.name + this.form.afterMaintenanceDate = dateTime + break + default: + break + } + // 鑾峰彇褰撳墠鐜妭璐熻矗浜� + switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) { + case 0: + this.form.currentResponsible = this.form.submitOperatingPersonnel + break + case 1: + this.form.currentResponsible = this.form.departmentOperatingPersonnel + break + case 2: + this.form.currentResponsible = this.form.measuringRoomOperatingPersonnel + break + case 3: + this.form.currentResponsible = this.form.approvalOperatingPersonnel + break + default: + break + } + // 鑾峰彇褰撳墠鐘舵�� + this.form.currentState = currentStepAction === 5 ? '鍏抽棴' : this.steps[currentStepAction] + this.form.deviceId = this.clickNodeVal.value + this.$axios.post(this.$api.deviceCheck.addOrUpdateDeviceFaultOne, this.form, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.getTableList(this.clickNodeVal.value) + this.dialogVisible = false + } + this.closeLoading() + }) + } else { + let step = this.steps[this.currentStep] + this.$message.warning(step + ' 娴佺▼涓湁蹇呭~椤规湭濉紒'); + this.closeLoading() + } + }); + }, + closeLoading() { + this.sumbitLoading1 = false + this.sumbitLoading2 = false + this.sumbitLoading3 = false + }, + openRecordAcceptance() { + // 鑾峰彇璁惧鍩虹淇℃伅 + this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => { + this.form.deviceName = res.data.deviceName + this.form.manufacturer = res.data.manufacturer + this.form.specificationModel = res.data.specificationModel + this.form.managementNumber = res.data.managementNumber + }); + // 鑾峰彇璐熻矗浜轰俊鎭� + this.getUserList() + }, + // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� + getUserList() { + this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + if (res.code == 200) { + this.users = res.data + } + }) + }, + handleSizeChange(val) { + this.search.size = val + this.getTableList(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val + this.getTableList(this.clickNodeVal.value); + }, + deleteFile() { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.systemFileName).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛锛�') + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + choiceStep(index) { + this.currentStepClick = index + }, + //鏂囨。 + handleSuccess(response, file, fileList) { + if (response.code == 200) { + this.form.fileName = response.data + this.$message.success('涓婁紶鎴愬姛') + } else { + this.$message.error(response.message) + } + }, + onError(error, file, fileList) { + // 鏂囦欢涓婁紶澶辫触鏃剁殑澶勭悊閫昏緫 + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + return true; + } + }, + resetSearch() { + this.search = { + size: 20, + current: 1, + total: 0, + processNumber: '', + } + this.getTableList(this.clickNodeVal.value); + }, + //鑾峰彇鎵�鏈変俊鎭� + getTableList(deviceId) { + this.$axios.get(this.$api.deviceCheck.deviceFaultOnePage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&processNumber=" + this.search.processNumber).then(res => { + if (res.code == 200) { + this.faultParam = res.data.records + this.search.total = res.data.total + } + }) + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.post(this.$api.deviceCheck.exportRewardAndPunishmentRecords, { + deviceId: this.clickNodeVal.value + }, {responseType: "blob"}).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res], {type: 'application/octet-stream'}); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鏁呴殰琛�.xlsx'; + link.click(); + }).finally(() => { + this.outLoading = false + }) + }, + selectAllByOne(row) { + this.dialogVisible = true; + this.formData = this.HaveJson(row); + }, + //娣诲姞璁板綍鎸夐挳 + addRecode() { + this.currentStep = 0; + this.currentStepClick = 0; + }, + //鏌ョ湅璇︽儏 + showDetailsDialog(row) { + this.form = {...row} + this.currentStep = this.steps.indexOf(this.form.currentState) === -1 ? 5 : this.steps.indexOf(this.form.currentState) + this.currentStepClick = this.currentStep === 5 ? 0 : this.currentStep + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + this.dialogVisible = true + }, + //鍒犻櫎鎿嶄綔 + handleDeleteClick(index, row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceFaultOne + '?id=' + row.id).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getTableList(this.clickNodeVal.value) + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getTableList(newVal.value); + } + }, + dialogVisible(newVal) { + if (!newVal) { + this.form = {} + this.closeLoading() + this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳 + this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖� + this.$refs['form'].clearValidate() + } + } + } } </script> <style scoped> +h4 { + font-weight: 400; + font-size: 16px; + /* display: flex; + justify-content: space-between; */ + margin: 10px 0; +} +/* +淇濆瓨鎻愪氦鎸夐挳鏍峰紡 +*/ +h4 .title { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; +} + +h4 .title .line { + display: inline-block; + width: 3px; + height: 16px; + background: #3A7BFA; + margin-right: 4px; +} + +.tables { + width: 100%; + height: calc(100vh - 230px); +} + +.el-from { + max-width: 400px; + margin: 0 auto; +} + +.form-row { + display: flex; + justify-content: space-between; +} + +.dialogBottom { + margin-top: 14px; + display: flex; + justify-content: space-between; +} + +.form-operation { + display: flex; + justify-content: center; +} + +.form-item { + display: flex; + margin-right: 100px; +} + +.label { + margin-right: 20px; + line-height: 40px; +} + +.value { + font-weight: normal; + line-height: 40px; +} + +.form-row .el-form-item { + flex: 1; + /* 姣忎釜琛ㄥ崟椤瑰崰鎹浉鍚屾瘮渚嬬殑绌洪棿 */ + margin-right: 100px; + /* 鍙�夛細涓哄彸渚у厓绱犳坊鍔犻棿璺� */ +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + display: flex; + align-items: center; + justify-content: space-between; + height: 40px; +} + +.search_label { + width: 70px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 120px); +} + +.btns { + position: absolute; + right: 0px; + top: 50%; + transform: translate(0, -50%); +} + +.form .search_label { + width: 120px; +} </style> diff --git a/src/components/do/a6-device/files.vue b/src/components/do/a6-device/files.vue index 247d503..bd95c1b 100644 --- a/src/components/do/a6-device/files.vue +++ b/src/components/do/a6-device/files.vue @@ -1,416 +1,577 @@ +<!-- 璁惧妗f --> <template> <div class="page"> <div class="page-header"> <h4><span class="line"></span><span>璁惧妗f</span></h4> <div class="btns"> - <el-button type="primary" size="small" @click="dialogVisible=true" style="margin-right: 16px;">淇妗f</el-button> - <!-- <el-button type="primary" size="small">娣诲姞闄勪欢</el-button> --> - <el-upload - class="upload-demo" - :action="action" - :headers="headers" - :show-file-list="false" - :limit="1" - :before-upload="beforeUpload" - :on-success="handleSuccess" - ref="upload" - :on-error="onError"> - <el-button size="small" type="primary" :loading="inLoading">娣诲姞闄勪欢</el-button> - </el-upload> + <el-button type="primary" size="small" @click="openEditForm" + style="">淇妗f</el-button> + <el-button type="primary" size="small" @click="dialogVisible1 = true" + style="">娣诲姞闄勪欢</el-button> + <el-button type="primary" v-if="isPermission('showDeviceQrCodeButton')" size="small" @click="deviceDialog = true" + style="">鏌ョ湅璁惧浜岀淮鐮�</el-button> + <el-button type="primary" size="small" @click="handleDownOne" + style="">瀵煎嚭</el-button> </div> </div> <el-divider></el-divider> - <el-row :gutter="20"> - <el-col :span="6"> - <el-image src="" fit="fill" style="width: 200px;height: 300px;border: 1px solid #000;border-radius: 10px;margin-left: 30px;margin-top: 20px;"> - <div slot="error" class="image-slot"> - <i class="el-icon-picture-outline" style="font-size: 40px;"></i> + <div class="main_div"> + <el-row :gutter="20"> + <el-col :span="6"> + <!-- 鍔犳椂闂存埑閬垮厤娴忚鍣ㄧ紦瀛橀棶棰� --> + <el-image :src="`${javaApi}/img/${Mdata.imageUpload}`" fit="fill" :key="'personalPicture' + timeStamp" + style="width: 200px;height: 300px;border: 1px solid #000;border-radius: 10px;margin-left: 30px;margin-top: 20px;"> + <div slot="error" class="image-slot"> + <i class="el-icon-picture-outline" style="font-size: 40px;"></i> + </div> + </el-image> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <label>璁惧鍚嶇О</label> + <!-- <p>{{ Mdata.deviceName }}</p> --> + <el-tooltip + class="item" + :content="Mdata.deviceName" + > + <span class="text-ellipsis" >{{ Mdata.deviceName }}</span> + </el-tooltip> </div> - </el-image> - </el-col> - <el-col :span="8"> - <div class="form-item"> - <label>璁惧鍚嶇О</label> - <p>{{ handleData('鎵弿鐢甸暅(甯﹁兘璋�)') }}</p> - </div> - <div class="form-item"> - <label>澶х被</label> - <p>{{ handleData('鍒嗘瀽浠櫒') }}</p> - </div> - <div class="form-item"> - <label>鍐呴儴缂栧彿</label> - <p>{{ handleData('鎵弿鐢甸暅(甯﹁兘璋�)') }}</p> - </div> - <div class="form-item"> - <label>鐢熶骇鍘傚</label> - <p>{{ handleData('鎵弿鐢甸暅(甯﹁兘璋�)') }}</p> - </div> - <div class="form-item"> - <label>璧勪骇缂栫爜</label> - <p>{{ handleData('鎵弿鐢甸暅(甯﹁兘璋�)') }}</p> - </div> - <div class="form-item"> - <label>鍑哄巶鏃ユ湡</label> - <p>{{ handleData('2024-7-20') }}</p> - </div> - <div class="form-item"> - <label>鍚敤鏃ユ湡</label> - <p>{{ handleData('2024-7-20') }}</p> - </div> - <div class="form-item"> - <label>鏍稿噯鍛ㄦ湡(鏈�)</label> - <p>{{ handleData('12') }}</p> - </div> - <div class="form-item"> - <label>妫�娴嬬被鍨�</label> - <p>{{ handleData('12') }}</p> - </div> - <div class="form-item"> - <label>鎶ュ簾鏃堕棿</label> - <p>{{ handleData('12') }}</p> - </div> - <div class="form-item"> - <label>鍑嗙‘搴﹂噺鍊�</label> - <p>{{ handleData('12') }}</p> - </div> - <div class="form-item"> - <label>琚巿鏉冧汉</label> - <p>{{ handleData('12') }}</p> - </div> - <div class="form-item"> - <label>缁翠慨璁板綍</label> - <p>{{ handleData('12') }}</p> - </div> - </el-col> - <el-col :span="10"> - <div class="form-item"> - <label>瑙勬牸鍨嬪彿</label> - <p>{{ handleData('JSM-6010LA') }}</p> - </div> - <div class="form-item"> + <div class="form-item"> + <label>璁惧绫诲瀷</label> + <p>{{ Mdata.largeCategory }}</p> + </div> + + <div class="form-item"> + <label>绠$悊缂栧彿</label> + <p>{{ Mdata.managementNumber }}</p> + </div> + <div class="form-item"> + <label>鎵�灞為儴闂�</label> + <p>{{ Mdata.laboratoryName }}</p> + </div> + <div class="form-item"> + <label>鐢熶骇鍘傚</label> + <!-- <p>{{ Mdata.manufacturer }}</p> --> + <el-tooltip + class="item" + :content="Mdata.manufacturer" + > + <span class="text-ellipsis" >{{ Mdata.manufacturer }}</span> + </el-tooltip> + </div> + <div class="form-item"> + <label>璧勪骇缂栫爜</label> + <p class="text-ellipsis">{{ Mdata.assetCode }}</p> + </div> + + <div class="form-item"> + <label>鍑哄巶鏃ユ湡</label> + <p>{{ Mdata.acquisitionDate | formaterDateTime }}</p> + </div> + <div class="form-item"> + <label>鍚敤鏃ユ湡</label> + <p>{{ Mdata.activationDate | formaterDateTime }}</p> + </div> + <div class="form-item"> + <label>鏍稿噯鍛ㄦ湡(鏈�)</label> + <p>{{ Mdata.calibrationDate }}</p> + </div> + + <div class="form-item"> + <label>鎶ュ簾鏃堕棿</label> + <p>{{ handleData() }}</p> + </div> + <div class="form-item"> + <label>鍑嗙‘搴﹂噺鍊�</label> + <el-tooltip + class="item" + :content="Mdata.technicalIndicators" + > + <span class="text-ellipsis">{{ Mdata.technicalIndicators }}</span> + </el-tooltip> + <!-- <p>{{ Mdata.technicalIndicators }}</p> --> + </div> + <div class="form-item"> + <label>缁翠慨璁板綍</label> + <p>{{ handleData() }}</p> + </div> + <div class="form-item"> + <label>琚巿鏉冧汉</label> + <p>{{ Mdata.authorizedPersonName }}</p> + </div> + + </el-col> + <el-col :span="10"> + <div class="form-item"> + <label>瑙勬牸鍨嬪彿</label> + <p>{{ Mdata.specificationModel }}</p> + </div> + <!-- <div class="form-item"> <label>缁嗙被</label> - <p>{{ handleData('鍒嗘瀽浠櫒') }}</p> - </div> - <div class="form-item"> - <label>璁惧鐘舵��</label> - <el-radio-group v-model="form.value1" disabled> - <el-radio :label="0" style="width: 40px;">鍚堟牸</el-radio> - <el-radio :label="1" style="width: 40px;">缁翠慨</el-radio> - <el-radio :label="2" style="width: 40px;">鍋滅敤</el-radio> - <el-radio :label="3" style="width: 40px;">鎶ュ簾</el-radio> - </el-radio-group> - </div> - <div class="form-item"> - <label>鍑哄巶缂栧彿</label> <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>瀛樻斁鐐�</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>璐疆鏃ユ湡</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>浜у湴</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>鏈�杩戞函婧愭棩鏈�</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>閲囪喘璐圭敤(鍏�)</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>鍋滅敤鏃堕棿</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>璁惧璐熻矗浜�</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>楠屾敹璁板綍</label> - <p>{{ handleData() }}</p> - </div> - <div class="form-item"> - <label>鏍稿噯璇佷功</label> - <p>{{ handleData() }}</p> - </div> - </el-col> - </el-row> - <h4 style="margin-bottom: 10px;margin-top: 10px;"><span class="line"></span><span>闄勪欢鍜岀浉鍏虫枃妗�</span></h4> - <div class="tables"> - <ValueTable ref="ValueTable" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex" style="min-height: 400px;"/> + </div> --> + <div class="form-item"> + <label>鍑哄巶缂栧彿</label> + <p>{{ Mdata.factoryNo }}</p> + </div> + <div class="form-items"> + <label>璁惧鐘舵��</label> + <el-radio-group v-model="Mdata.deviceStatus" style="margin-left: 10px;"> + <el-radio :label="0" :disabled="Mdata.deviceStatus != 0">姝e父</el-radio> + <el-radio :label="1" :disabled="Mdata.deviceStatus != 1">缁翠慨</el-radio> + <el-radio :label="2" :disabled="Mdata.deviceStatus != 2">鍋滅敤</el-radio> + <el-radio :label="3" :disabled="Mdata.deviceStatus != 3">鎶ュ簾</el-radio> + </el-radio-group> + </div> + <div class="form-item"> + <label>瀛樻斁鐐�</label> + <p>{{ Mdata.storagePoint }}</p> + </div> + <div class="form-item"> + <label>浜у湴</label> + <p>{{ Mdata.origin }}</p> + </div> + <div class="form-item"> + <label>妫�楠岄」</label> + <el-tooltip + class="item" + effect="dark" + :content="Mdata.insProductItem" + placement="top" + > + <span class="text-ellipsis" >{{ Mdata.insProductItem }}</span> + </el-tooltip> + </div> + <div class="form-item"> + <label>璐疆鏃ユ湡</label> + <p>{{ Mdata.acquisitionDate | formaterDateTime }}</p> + </div> + + <div class="form-item"> + <label>鏈�杩戞函婧愭棩鏈�</label> + <p>{{ Mdata.lastCalibrationDate | formaterDateTime }}</p> + </div> + <div class="form-item"> + <label>閲囪喘璐圭敤(鍏�)</label> + <p>{{ Mdata.unitPrice }}</p> + </div> + <div class="form-item"> + <label>鍋滅敤鏃堕棿</label> + <p>{{ Mdata.nextCalibrationDate | formaterDateTime }}</p> + </div> + <div class="form-item"> + <label>璁惧璐熻矗浜�</label> + <p>{{ Mdata.equipmentManagerName }}</p> + </div> + <div class="form-item"> + <label>楠屾敹璁板綍</label> + <p>{{ handleData() }}</p> + </div> + <div class="form-item"> + <label>鏍稿噯璇佷功</label> + <p>{{ Mdata.calibrateNo }}</p> + </div> + </el-col> + </el-row> + <h4 style="margin-bottom: 10px;margin-top: 10px;"><span class="line"></span><span>闄勪欢鍜岀浉鍏虫枃妗�</span></h4> + <el-table height="200px" :data="tableDataA"> + <el-table-column header-align="center" align="center" prop="prop" label="搴忓彿" type="index" width="60" /> + <el-table-column prop="documentType" label="绫诲瀷" min-width="100"> + <template v-slot="scope"> + {{ scope.row.documentType === '0' ? '闄勪欢' : scope.row.documentType === '1' ? '鏂囨。' : '' }} + </template> + </el-table-column> + <el-table-column prop="name" label="鍚嶇О" min-width="150" /> + <el-table-column prop="number" label="缂栧彿" min-width="150" /> + <el-table-column prop="version" label="鐗堟湰" min-width="80" /> + <el-table-column prop="quantity" label="浠芥暟" min-width="80" /> + <el-table-column prop="pageCount" label="椤电爜" min-width="80" /> + <el-table-column prop="provider" label="鎻愪緵鑰�" min-width="150" /> + <el-table-column prop="provideDate" label="鎻愪緵鏃ユ湡" min-width="150" /> + <el-table-column prop="comments" label="澶囨敞" min-width="150" /> + <el-table-column fixed="right" label="鎿嶄綔" min-width="180"> + <template slot-scope="scope"> + <el-button type="text" size="small" @click="handleAttachmentClick(scope.row)">涓嬭浇闄勪欢</el-button> + <el-button type="text" size="small" @click="handleViewClick(scope.row)">鏌ョ湅</el-button> + <el-button type="text" size="small" @click="handleDeleteClick(scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> </div> - <el-dialog title="妗f淇" :visible.sync="dialogVisible" width="70%" :before-close="handleClose"> - <el-row style="display:flex;justify-content: space-around;"> - <!-- 宸﹁竟甯冨眬 --> - <el-col :span="7"> - <el-col> - <!-- 鍥剧墖 --> - <el-image class="img" style="width:100%;height: 320px;marginBottom:16px" - :src="javaApi+'/img/'+formData.imageUpload"> - <div slot="error" class="image-error" style="width: calc(100% -2px); + <!-- 淇 --> + <el-dialog title="淇妗f" top="5vh" :visible.sync="dialogVisible" width="70%" @open="openFileRevisionDialog" + :before-close="handleClose"> + <el-row style="display:flex;justify-content: space-around;"> + <!-- 宸﹁竟甯冨眬 --> + <el-col :span="7"> + <el-col> + <!-- 鍥剧墖 --> + <el-image class="img" style="width:100%;height: 320px;margin-bottom:16px" + :src="javaApi + '/img/' + editData.imageUpload"> + <div slot="error" class="image-error" style="width: calc(100% -2px); height: 318px; border-radius: 16px; display: flex; align-items: center; justify-content: center; border: 1px solid #EEEEEE;"> - <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i> - </div> - </el-image> - <!-- 琛ㄥ崟 --> - <el-form :model="formData" label-width="120px"> - <el-form-item label="浠櫒鍚嶇О:" required> - <el-input v-model="formData.deviceName" size="small"></el-input> - </el-form-item> - <el-form-item label="浠櫒鍚嶇ОEN:" required> - <el-input v-model="formData.enDeviceName" size="small"></el-input> - </el-form-item> - <el-form-item label="瑙勬牸鍨嬪彿:" required> - <el-input v-model="formData.specificationModel" size="small"></el-input> - </el-form-item> - <el-form-item label="鐢熶骇鍘傚:"> - <el-input v-model="formData.manufacturer" size="small"></el-input> - </el-form-item> - </el-form> - </el-col> - </el-col> - <!-- 涓棿甯冨眬 --> - <el-col :span="7"> - <el-form :model="formData" label-width="116px"> - <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:"> - <el-input v-model="formData.calibrationServices" size="small"></el-input> - </el-form-item> - <el-form-item label="鍑哄巶缂栧彿:"> - <el-input v-model="formData.factoryNo" size="small"></el-input> - </el-form-item> - <el-form-item label="绠$悊缂栧彿:" required> - <el-input v-model="formData.managementNumber" size="small"></el-input> - </el-form-item> - <el-form-item label="璐疆鏃ユ湡:"> - <el-date-picker style="width:100%" v-model="formData.acquisitionDate" type="date" - format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </el-form-item> - <el-form-item label="鍚敤鏃ユ湡:" required> - <el-date-picker style="width:100%" v-model="formData.activationDate" type="date" - format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </el-form-item> - <el-form-item label="绠$悊浜�:"> - <el-select v-model="formData.equipmentManager" placeholder="璇烽�夋嫨" size="small" style="width:100%"> - <el-option v-for="item in responsiblePersonList" :key="item.value" :label="item.label" - :value="item.value"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="瀛樻斁鐐�:"> - <el-input v-model="formData.storagePoint" size="small"></el-input> - </el-form-item> - <el-form-item label="鎶�鏈寚鏍�:"> - <el-input v-model="formData.technicalIndicators" :rows="7" type="textarea" size="small"></el-input> - </el-form-item> - </el-form> - </el-col> - <!-- 鍙宠竟甯冨眬 --> - <el-col :span="7"> - <el-form :model="formData" label-width="140px" ref="ruleForm"> + <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i> + </div> + </el-image> + <!-- 琛ㄥ崟 --> + <el-form :model="editData" label-width="120px" ref="rules1" :rules="rules1"> + <el-form-item label="浠櫒鍚嶇О:" prop="deviceName"> + <el-input v-model="editData.deviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="浠櫒鍚嶇ОEN:" prop="enDeviceName"> + <el-input v-model="editData.enDeviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿:" prop="specificationModel"> + <el-input v-model="editData.specificationModel" size="small"></el-input> + </el-form-item> + <el-form-item label="鐢熶骇鍘傚:"> + <el-input v-model="editData.manufacturer" size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + </el-col> + <!-- 涓棿甯冨眬 --> + <el-col :span="7"> + <el-form :model="editData" label-width="116px" ref="rules2" :rules="rules1"> + <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:"> + <el-input v-model="editData.calibrationServices" disabled size="small"></el-input> + </el-form-item> + <el-form-item label="璧勪骇缂栫爜:"> + <el-input v-model="editData.assetCode" size="small"></el-input> + </el-form-item> + <el-form-item label="浜у湴:"> + <el-input v-model="editData.origin" size="small"></el-input> + </el-form-item> + <el-form-item label="鍑哄巶缂栧彿:"> + <el-input v-model="editData.factoryNo" size="small"></el-input> + </el-form-item> + <el-form-item label="绠$悊缂栧彿:" prop="managementNumber"> + <el-input v-model="editData.managementNumber" size="small"></el-input> + </el-form-item> + <el-form-item label="璐疆鏃ユ湡:"> + <el-date-picker style="width:100%" v-model="editData.acquisitionDate" type="date" format="yyyy-MM-dd" + value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鍚敤鏃ユ湡:" prop="activationDate"> + <el-date-picker style="width:100%" v-model="editData.activationDate" type="date" format="yyyy-MM-dd" + value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="璐熻矗浜�:"> + <el-select v-model="editData.equipmentManager" placeholder="璇烽�夋嫨" size="small" style="width:100%"> + <el-option v-for="item in responsiblePersonList" :key="item.name" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="瀛樻斁鐐�:"> + <el-input v-model="editData.storagePoint" size="small"></el-input> + </el-form-item> + <el-form-item label="鎶�鏈寚鏍�:"> + <el-input v-model="editData.technicalIndicators" :rows="7" type="textarea" size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + <!-- 鍙宠竟甯冨眬 --> + <el-col :span="7"> + <el-form :model="editData" label-width="140px" ref="ruleForm" :rules="rules1"> <!-- 瀹為獙瀹ゅ垪琛� --> <el-form-item label="鎵�灞為儴闂�:"> - <el-select v-model="formData.subordinateDepartmentsId" placeholder="璇烽�夋嫨" size="small" style="width:100%"> + <el-select v-model="editData.subordinateDepartmentsId" placeholder="璇烽�夋嫨" size="small" style="width:100%"> <el-option v-for="item in subordinateDepartmentsList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="妫�娴嬮」鐩�:"> - <el-cascader - v-model="formData.insProductIds" - :options="options" - :show-all-levels="false" - :props="props" - placeholder="璇烽�夋嫨" size="small" - style="width:100%;" - :collapse-tags="true" - separator="," - filterable - clearable></el-cascader> + <el-cascader v-model="editData.insProductIds" :options="options" :show-all-levels="false" :props="props" + placeholder="璇烽�夋嫨" size="small" style="width:100%;" :collapse-tags="true" separator="," filterable + clearable></el-cascader> </el-form-item> - <el-form-item label="鏈�杩戞牎鍑嗘棩鏈�:"> - <el-date-picker style="width:100%" v-model="formData.latestTraceability" format="yyyy-MM-dd" - value-format="yyyy-MM-dd" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </el-form-item> - <el-form-item label="涓嬫鏍″噯鏃ユ湡:"> - <el-date-picker style="width:100%" v-model="formData.latestTraceability" format="yyyy-MM-dd" - value-format="yyyy-MM-dd" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </el-form-item> + <!-- <el-form-item label="鏈�杩戞牎鍑嗘棩鏈�:"> + <el-date-picker style="width:100%" v-model="Mdata.latestTraceability" format="yyyy-MM-dd" + value-format="yyyy-MM-dd" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> --> + <!-- <el-form-item label="涓嬫鏍″噯鏃ユ湡:"> + <el-date-picker style="width:100%" v-model="Mdata.nextCalibrationDate" format="yyyy-MM-dd" + value-format="yyyy-MM-dd HH:mm:ss" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> --> <el-form-item label="璁惧绫诲瀷:"> - <el-select v-model="formData.largeCategory" placeholder="璇烽�夋嫨" size="small" style="width:100%"> - <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" - :value="item.value"> + <el-select v-model="editData.largeCategory" placeholder="璇烽�夋嫨" size="small" style="width:100%"> + <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="鍗曚环(涓囧厓):"> - <el-input v-model="formData.unitPrice" size="small"></el-input> + <el-input v-model="editData.unitPrice" size="small"></el-input> </el-form-item> - <el-form-item label="褰撳墠鐘舵��:" required> - <el-select v-model="formData.deviceStatus" placeholder="璇烽�夋嫨" size="small" style="width:100%"> - <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="鏍″噯鍛ㄦ湡锛堟湀锛�:" required> - <el-input v-model="formData.calibrationDate" size="small"></el-input> + <el-form-item label="褰撳墠鐘舵��:" prop="deviceStatus"> + <el-select v-model="editData.deviceStatus" placeholder="璇烽�夋嫨" size="small" style="width:100%"> + <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> </el-form-item> - <el-form-item label="鍥剧墖:"> - <div - style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;"> - <div v-show="formData.imageName" class="picName">{{formData.imageName}}</div> - <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false" - accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload" - :on-error="onError" ref='upload'> - <el-button type="text" style="height:30px;padding-top:8px">涓婁紶</el-button> - </el-upload> - </div> - </el-form-item> - </el-form> - </el-col> - </el-row> - <span slot="footer" class="dialog-footer"> - <el-row> - <el-button @click="handleClose">鍙� 娑�</el-button> - <el-button type="primary" @click="submitForm" :loading="upLoad">纭� 瀹�</el-button> - </el-row> - </span> - </el-dialog> + <el-form-item label="鏍″噯鍛ㄦ湡锛堟湀锛�:" prop="calibrationDate"> + <el-input v-model="editData.calibrationDate" size="small"></el-input> + </el-form-item> + <el-form-item label="琚巿鏉冧汉:"> + <el-select v-model="editData.authorizedPerson" multiple placeholder="璇烽�夋嫨" size="small" style="width:100%"> + <el-option v-for="item in responsiblePersonList" :key="item.name" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鍥剧墖:"> + <!-- <div + style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;"> + <div v-show="Mdata.imageName" class="picName">{{ Mdata.imageName }}</div> + <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false" + accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload" + :on-error="onError" ref='upload'> + <el-button type="text" style="height:30px;padding-top:8px"><span v-if="Mdata.imageName"></span></el-button> + </el-upload> + </div> --> + + <div> + <div v-show="editData.imageName" class="picName">{{ editData.imageName }}</div> + <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false" + accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload" + :on-error="onError" ref='upload' class="avatar-uploader" + > + <img v-if="editData.imageUpload" :src="javaApi + '/img/' + editData.imageUpload" class="avatar"> + <i v-else class="el-icon-plus avatar-uploader-icon"></i> + </el-upload> + </div> + </el-form-item> + </el-form> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="handleClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm" :loading="upLoad">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + <el-dialog title="娣诲姞璁惧闄勪欢" top="5vh" v-if="dialogVisible1" :visible.sync="dialogVisible1" width="40%"> + <el-form ref="form" :model="addFile" label-width="120px"> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="缁存姢绫诲瀷锛�"> + <el-radio-group v-model="addFile.documentType"> + <el-radio :label="0">闄勪欢</el-radio> + <el-radio :label="1">鏂囨。</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妗f鍚嶇О锛�"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addFile.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="搴撳彿/璧勪骇缂栧彿:"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addFile.number"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐗堟湰锛�"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addFile.version"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浠芥暟锛�"> + <el-input-number v-model="addFile.quantity" controls-position="right" style="width: 100%;" size="small" + :min="0" :max="10"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="椤电爜锛�"> + <el-input-number v-model="addFile.pageCount" controls-position="right" style="width: 100%;" size="small" + :min="0" :max="10"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎻愪緵鑰咃細"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addFile.provider"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="褰掓。鏃ユ湡锛�"> + <el-date-picker type="date" style="width:100%" placeholder="璇烽�夋嫨鏃ユ湡" size="small" v-model="addFile.archiveDate" + format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞锛�"> + <el-input type="textarea" :rows="2" size="small" v-model="addFile.comments"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="闄勪欢锛�" style="float: left;"> + <el-upload class="upload-demo" :action="action" :headers="headers" ref="uploadFile" :on-error="onError" + :on-remove="handleRemove" :on-success="onSuccess" :before-remove="beforeRemove" multiple :limit="1" + :on-exceed="handleExceed" :file-list="fileList"> + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="dialogVisible1 = false" size="small">鍙� 娑�</el-button> + <el-button type="primary" @click="saveRecord" size="small" :loading="isLoading">{{ isAddFileUpdate == true ? + '鏇存柊' : + '纭� 瀹�' }}</el-button> + </el-row> + </span> + </el-dialog> + <el-dialog + title="璁惧浜岀淮鐮�" + :visible.sync="deviceDialog" + top="5vh" + width="30%"> + <div style="width:90%;text-align: right;"> + <el-button type="primary" size="mini" @click="clickGeneratePicture">涓嬭浇鍥剧墖</el-button> + <el-button type="primary" size="mini" @click="labelPrint">鏍囩鎵撳嵃</el-button> + </div> + <div class="device-main" ref="deviceQrCode" id="deviceCode"> + <div class="device-center" > + <p class="device-title">{{Mdata.deviceName}}</p> + <div class="device-footer"> + <div> + <vueQr class="qr-code" :text="'https://zttx-lims.ztt.cn:8021/lims/qr/qrScan?code='+Mdata.managementNumber+'&type=device'" :size="200" :margin="10"></vueQr> + </div> + <div class="device-number"> + <span class="device-text">璁惧缂栫爜:</span> + <span class="device-text">{{Mdata.managementNumber}}</span> + </div> + <div class="device-name"> + <span class="device-text">璁惧鍨嬪彿:</span> + <span class="device-text">{{Mdata.specificationModel}}</span> + </div> + </div> + </div> + </div> + </el-dialog> </div> </template> <script> +import { MessageBox } from 'element-ui' import ValueTable from '../../tool/value-table.vue' +import fileDownload from '../../../util/file' +import vueQr from 'vue-qr' +import PrintJS from 'print-js' +import domtoimage from 'dom-to-image'; +import {isPermission} from '../../../util/auth' export default { - components: { - ValueTable + filters:{ + formaterDateTime(dateTime){ + if(dateTime === undefined || dateTime === null || dateTime === ''){ + return dateTime + } + return dateTime.split(" ")[0] + } }, - data(){ - return{ - componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - isPage:false, - do: [{ - id: 'getFile', - font: '闄勪欢', - type: 'text', - method: 'getFile' - }, { - id: 'handleLook', - font: '鏌ョ湅', - type: 'text', - method: 'handleLook' - },{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy', - disabFun: (row, index) => { - return row.state === '宸插鏍�' || row.state === '宸叉壒鍑�' - } - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex:0, - dialogVisible:false, - inLoading:false, - form: { - value1:'' + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + components: { + ValueTable, + vueQr + }, + data() { + return { + isPermission:isPermission, + deviceDialog: false,//鏌ョ湅璁惧浜岀淮鐮佸脊妗� + rules1: { + deviceName: [ + { required: true, message: '璇疯緭鍏ヤ华鍣ㄥ悕绉�', trigger: 'blur' }, + ], + enDeviceName: [ + { required: true, message: '璇疯緭鍏ヤ华鍣ㄥ悕绉癊N', trigger: 'blur' }, + ], + specificationModel: [ + { required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }, + ], + managementNumber: [ + { required: true, message: '璇疯緭鍏ョ鐞嗙紪鍙�', trigger: 'blur' }, + ], + activationDate: [ + { required: true, message: '璇疯緭鍏ュ惎鐢ㄦ棩鏈�', trigger: 'blur' }, + ], + deviceStatus: [ + { required: true, message: '璇疯緭鍏ュ綋鍓嶇姸鎬�', trigger: 'blur' }, + ], + calibrationDate: [ + { required: true, message: '璇疯緭鍏ユ牎鍑嗗懆鏈�(鏈�)', trigger: 'blur' }, + ], }, - upLoad:false, - formData:{}, - responsiblePersonList:[], - subordinateDepartmentsList:[], - options:[], - equipmentList:[], - deviceStatusList:[], - props: { multiple: true,emitPath:false,value:'id',label:'name' }, + // dateForm: { + + // }, + fileList: [], // 娣诲姞闄勪欢涓婁紶鏂囦欢鍒楄〃 + timeStamp: '', // 缁欏浘鐗囨坊鍔爇ey锛屽湪姣忔鍔犺浇椤甸潰鐨勬椂鍊欐柊寤烘椂闂存埑 + equipmentManager: [], + formLabelWidth: '100px', + dialogVisible1: false, + recordNumber: '', + inLoading: false, // 鎺у埗涓婁紶鎸夐挳鍔犺浇鐘舵�� + isLoading: false, // 鎺у埗纭畾鎸夐挳鍔犺浇鐘舵�� + formData: {}, + tableDataA: [], + num: 1, + //娣诲姞闄勪欢鏁版嵁鏀堕泦 + addFile: { + documentType: '', // 缁存姢绫诲瀷 + archiveDate: null, // 褰掓。鏃ユ湡 + name: '', // 妗f鍚嶇О + number: '', // 搴撳彿/璧勪骇缂栧彿 + version: '', // 鐗堟湰 + quantity: 1, // 浠芥暟 + pageCount: 1, // 椤电爜 + provider: '', // 鎻愪緵鑰� + comments: "", // 澶囨敞 + fileName: "", // 鏂囦欢鍘熷悕绉� + systemFileName: "", // 绯荤粺鐢熸垚鍚嶇О + }, + componentData: { + entity: { name: "", orderBy: { field: "id", order: "asc" } }, + page: { current: "1", size: "80" } + }, + upIndex: 0, + dialogVisible: false, + dialogVisible1: false, + inLoading: false, + upLoad: false, + responsiblePersonList: [], + subordinateDepartmentsList: [], + options: [], + equipmentList: [], + deviceStatusList: [], + props: { multiple: true, emitPath: false, value: 'id', label: 'name' }, + // 鏀堕泦璁惧妗f鏁版嵁 + Mdata: { + deviceName: null + }, + isAddFileUpdate: false, + editData: { + authorizedPerson: [], + }, } }, computed: { @@ -423,90 +584,288 @@ return this.javaApi + this.$api.deviceScope.uploadFile } }, - mounted(){ - this.selectDevicePrincipal() - this.obtainItemParameterList() - this.getInsProductIds() - this.selectEnumByCategory() + mounted() { + // 鏀堕泦鏁版嵁 + this.getList(this.clickNodeVal.value) + // 鑾峰彇鐩稿叧鏂囨。鐨勬暟鎹� + this.getPage() + this.timeStamp = Date.now() }, methods: { - handleData(m){ - if(m){ + /** + * 灏嗛〉闈㈡寚瀹氳妭鐐瑰唴瀹硅浆涓哄浘鐗� + * 1.鎷垮埌鎯宠杞崲涓哄浘鐗囩殑鍐呭鑺傜偣DOM锛� + * 2.杞崲锛屾嬁鍒拌浆鎹㈠悗鐨刢anvas + * 3.杞崲涓哄浘鐗� + */ + clickGeneratePicture() { + const _than = this + domtoimage.toPng(_than.$refs.deviceQrCode,{ quality: 1,width:440,}).then(function (dataUrl) { + // 灏嗚浆鎹㈠悗鐨勫浘鍍忔暟鎹瓨鍌ㄤ负 data URL + fileDownload.downloadIamge(dataUrl,_than.Mdata.deviceName) + }); + }, + //鎵撳嵃璁惧浜岀淮鐮� + labelPrint(){ + PrintJS({ + printable: 'deviceCode',//椤甸潰 + type: "html",//鏂囨。绫诲瀷 + maxWidth:360, + css: ['/static/css/device-print.css'], + style: '@page { size: auto; margin: 0mm;}', + targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕� + }); + }, + openFileRevisionDialog() { + // 鑾峰彇妗f淇璐熻矗浜轰笅鎷夋鏁版嵁 + this.selectDevicePrincipal() + // 鑾峰彇妗f淇鎵�灞為儴闂ㄤ笅鎷夋鏁版嵁 + this.obtainItemParameterList() + // 鑾峰彇妗f淇璁惧鐘舵�佷笅鎷夋鏁版嵁 + this.selectEnumByCategory() + // 鑾峰彇妗f淇妫�楠岄」鐩骇鑱斿脊妗嗘暟鎹� + this.getInsProductIds() + }, + //闄勪欢鍜岀浉鍏虫枃妗d簨浠� + handleAttachmentClick(row) { + console.log(row) + if (row.fileName && row.documentType == 0) { + const fileUrl = this.javaApi + '/img/' + row.fileName; + fileDownload.downloadIamge(fileUrl, row.systemFileName) + } else if (row.fileName && row.documentType == 1) { + const url = this.javaApi+'/word/'+ row.fileName + const link = document.createElement('a'); + link.href = url; + link.download = row.fileName; + link.click(); + this.$message.success('涓嬭浇鎴愬姛') + } else { + this.$message.warning('鏈笂浼犳枃浠讹紒') + } + }, + handleViewClick(row) { + this.isAddFileUpdate = true + this.addFile = { ...row } + this.dialogVisible1 = true + if (row.fileName) { + const obj = Object.assign({ + name: row.fileName, + url: row.fileName, + status: 'success', + uid: Date.now(), + }) + this.fileList.push(obj) + } + }, + handleDeleteClick(row) { + // 鍒犻櫎閫昏緫 + MessageBox.confirm('纭畾瑕佸垹闄よ璁板綍鍚楋紵', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(() => { + this.$axios.delete(this.$api.getDocuments.list + "/" + row.id).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getPage() + } + }) + }).catch(() => { + this.$message.info('宸插彇娑堝垹闄�') + }) + }, + saveRecord() { + //杞崲鏁版嵁 + this.addFile.deviceId = this.clickNodeVal.value + let obj= this.addFile.systemFileName + this.addFile.systemFileName = obj.name + this.addFile.fileName = obj.url + + // 鏇存柊 + if (this.isAddFileUpdate) { + this.$axios.put(this.$api.getDocuments.updateDocument, this.addFile, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('鏇存柊鎴愬姛') + this.dialogVisible1 = false; + this.getPage() + } + }) + } else { + // 鏂板 + this.$axios.post(this.$api.getDocuments.list, this.addFile).then(res => { + if (res.code == 200) { + this.$message.success('淇濆瓨鎴愬姛') + this.dialogVisible1 = false; + this.getPage() + } + }) + } + }, + onSuccess(response, file, fileList) { + if (response.code == 200) { + this.addFile.systemFileName = response.data + this.addFile.fileName = file.name + } else { + this.$refs.uploadFile.clearFiles() + this.$message.error('涓婁紶澶辫触锛�' + response.message) + } + }, + handleRemove(file, fileList) { + this.deleteFile(this.addFile.systemFileName) + }, + deleteFile(fileName) { + this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + fileName).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�') + }) + }, + handleExceed(files, fileList) { + this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶); + }, + beforeRemove(file, fileList) { + return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋); + }, + // 鑾峰彇鐩稿叧鏂囨。鏁版嵁鐨刟pi + getPage() { + this.$axios.get(this.$api.getDocuments.get + "/" + this.clickNodeVal.value).then(res => { + if (res.code == 200) + this.tableDataA = res.data + }) + }, + // 鏀堕泦鏁版嵁 + getList(id) { + this.$axios + .get( + this.$api.deviceScope.selectDeviceByCode + "?id=" + id) + .then(res => { + // 灏嗗垎绫诲垪琛ㄧ殑淇℃伅瀛樿捣鏉� + if (res.code == 200) { + this.Mdata = res.data; + this.Mdata.insProductIds = this.Mdata.insProductIds.split(',') + this.Mdata.authorizedPerson = JSON.parse(this.Mdata.authorizedPerson) + } + }); + }, + handleData(m) { + if (m) { return m - }else{ + } else { return '-' } }, - handleClose(){ + handleClose() { this.dialogVisible = false }, - handleSuccess(response,){ - this.inLoading = false; - if (response.code == 200) { - this.$message.success('涓婁紶鎴愬姛') - // 鏇存柊椤甸潰 - }else{ - this.$message.error(response.message) - } + //鎵撳紑淇妗f寮规 + openEditForm(){ + this.editData = JSON.parse(JSON.stringify(this.Mdata)) + this.$nextTick(()=>{ + this.dialogVisible = true + }) }, - submitForm(){ - if(!this.formData.deviceName){ - this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉�') + //淇妗f + submitForm() { + let flag = true + this.$refs['rules1'].validate((valid) => { + if (!valid) { + flag = false; + return false; + } + }); + this.$refs['rules2'].validate((valid) => { + if (!valid) { + flag = false; + return false; + } + }); + this.$refs['ruleForm'].validate((valid) => { + if (!valid) { + flag = false; + return false; + } + }); + if(!flag) { + return; + } + delete this.editData.nextCalibrationDate + delete this.editData.createTime + delete this.editData.updateTime + delete this.editData.createUser + delete this.editData.updateUser + delete this.editData.orderBy + // this.Mdata.equipmentManager = 1; + + this.editData.userAllow = this.equipmentManager.toString(); + this.editData.insProductIds = Array.isArray(this.editData.insProductIds) + ? this.editData.insProductIds.join(',') + : ''; + this.upLoad = true; + this.editData.authorizedPerson = JSON.stringify(this.editData.authorizedPerson) + this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.editData, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + this.upLoad = false return } - if(!this.formData.enDeviceName){ - this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉癊N') - return + this.$message.success('淇敼鎴愬姛') + this.upLoad = false + this.getList(this.clickNodeVal.value) + this.dialogVisible = false + }).catch(e => { + this.$message.error('淇敼澶辫触') + this.dialogVisible = false + this.upLoad = false + }) + }, + // 瀵煎嚭 + handleDownOne(row) { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.exportDeviceFile + '?deviceId=' + this.clickNodeVal.value, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧妗f鍗�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧妗f鍗�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } } - if(!this.formData.specificationModel){ - this.$message.error('鏈緭鍏ヨ鏍煎瀷鍙�') - return - } - if(!this.formData.managementNumber){ - this.$message.error('鏈緭鍏ョ鐞嗙紪鍙�') - return - } - if(!this.formData.activationDate){ - this.$message.error('鏈緭鍏ュ惎鐢ㄦ棩鏈�') - return - } - if(this.formData.deviceStatus==='' || this.formData.deviceStatus===null){ - this.$message.error('鏈�夋嫨褰撳墠鐘舵��') - return - } - if(!this.formData.calibrationDate){ - this.$message.error('鏈緭鍏ユ牎鍑嗗懆鏈燂紙鏈堬級') - return - } - delete this.formData.createTime - delete this.formData.updateTime - delete this.formData.createUser - delete this.formData.updateUser - this.formData.insProductIds = this.formData.insProductIds?this.formData.insProductIds.join():'' - this.upLoad = true; - this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.formData, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { - if (res.code === 201) { - this.upLoad = false - return - } - this.$message.success('淇敼鎴愬姛') - this.upLoad = false - this.dialogVisible = false - }).catch(e => { - this.$message.error('淇敼澶辫触') - this.dialogVisible = false - this.upLoad = false - }) + }) }, handleSuccessUpImg2(response) { if (response.code == 200) { this.$nextTick(() => { - this.formData.imageUpload = response.data.url; - this.formData.imageName = response.data.name; + this.editData.imageUpload = response.data.url; + this.editData.imageName = response.data.name; + console.log(this.javaApi + 'img/' + this.editData.imageUpload); + }) } }, @@ -525,21 +884,18 @@ }, // 鑾峰彇璐熻矗浜哄垪琛� selectDevicePrincipal() { - this.$axios.get(this.$api.deviceScope.selectDevicePrincipal).then(res => { - let data = [] - res.data.forEach(a => { - data.push({ - label: a.name, - value: a.id - }) - }) - this.responsiblePersonList = data + this.$axios.post(this.$api.user.selectUserList, this.componentData, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + this.responsiblePersonList = res.data.body.records; }) }, obtainItemParameterList() { this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => { let data = [] - res.data.forEach(a=>{ + res.data.forEach(a => { data.push({ label: a.laboratoryName, value: a.id @@ -548,22 +904,22 @@ this.subordinateDepartmentsList = data }) }, - getInsProductIds(){ + getInsProductIds() { this.$axios.post(this.$api.capacityScope.getInsProduction).then(res => { - this.options = res.data.map((m,i)=>{ + this.options = res.data.map((m, i) => { m.id = m.name; return m }) - this.options.forEach(item=>{ - if(item.children.length==0){ + this.options.forEach(item => { + if (item.children.length == 0) { item.children = null; - }else{ - item.children.forEach(m=>{ - if(m.children.length==0){ + } else { + item.children.forEach(m => { + if (m.children.length == 0) { m.children = null; - }else{ - m.children.forEach(n=>{ - if(n.children&&n.children.length==0){ + } else { + m.children.forEach(n => { + if (n.children && n.children.length == 0) { n.children = null; } }) @@ -579,8 +935,8 @@ category: "璁惧鐘舵��" }).then(res => { this.deviceStatusList = res.data - this.deviceStatusList.forEach(a=>{ - if(!isNaN(a.value)){ + this.deviceStatusList.forEach(a => { + if (!isNaN(a.value)) { a.value = parseInt(a.value) } }) @@ -591,59 +947,233 @@ this.equipmentList = res.data }) }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getList(newVal.value) + this.getPage() + } + }, + dialogVisible1(newVal) { + if (newVal == false) { + this.isAddFileUpdate = false + this.addFile = {} + this.fileList = [] + } + } } } </script> <style scoped> -.page{ - width: 100%; - height: 100%; +.main_div { + height: calc(100vh - 15em); overflow-y: auto; overflow-x: hidden; } -.page-header{ + +.page { + width: 100%; + height: 100%; +} + +.page-header { display: flex; justify-content: space-between; + margin-top: 10px; } -h4{ + +h4 { display: flex; align-items: center; } -h4 .line{ + +h4 .line { display: inline-block; width: 3px; height: 16px; background: #3A7BFA; margin-right: 4px; } -.tables{ - width: calc(100vw - 390px); + +.tables { + width: 100%; } + .el-image { position: relative; } -.el-icon-picture-outline{ + +.el-icon-picture-outline { position: absolute; left: 50%; top: 50%; - transform: translate(-50%,-50%); + transform: translate(-50%, -50%); } -.form-item{ + +.form-item { line-height: 34px; display: flex; align-items: center; font-size: 14px; } -.form-item label{ - width: 110px; + +.text-ellipsis { + display: inline-block; + width: 200px; /* 鎴栬�呮偍鍙互璁剧疆涓�涓叿浣撶殑瀹藉害鍊� */ + box-sizing: border-box; /* 纭繚padding鍜宐order涓嶅奖鍝嶅厓绱犵殑鎬诲搴� */ + white-space: nowrap; /* 绂佹鏂囨湰鎹㈣ */ + text-overflow: ellipsis; /* 浣跨敤鐪佺暐鍙疯〃绀鸿鎴柇鐨勬枃鏈� */ + overflow: hidden; /* 闅愯棌瓒呭嚭瀹瑰櫒鐨勫唴瀹� */ +} + +.form-items { + line-height: 34px; + /* display: flex; */ + /* align-items: center; */ + margin-left: 15%; + font-size: 14px; +} + + +.form-item label { + min-width: 130px; display: inline-block; text-align: right; margin-right: 20px; color: #999; } + +.form-item p { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + /* 杩欓噷璁剧疆浣犳兂瑕佺殑琛屾暟 */ + -webkit-box-orient: vertical; +} + .btns { display: flex; align-items: center; } + +.search_thing, +.check_thing { + display: flex; + justify-content: space-between; + align-items: center; + gap: 1rem; +} + +.search_label, +.check_label { + width: 120px; +} + +.search_input, +.check_data, +.check_input { + flex-grow: 1; +} + +.avatar-uploader .el-upload { + border: 1px dashed #190505; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; + } + .avatar-uploader .el-upload:hover { + border-color: #409EFF; + } + .avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; + } + .avatar { + width: 178px; + height: 178px; + display: block; + } + +.device-main{ + width:90%; + margin:0px 5%; + height:460px; + padding:25px 0px; + background-color: #fff; +} +.device-center{ + width:90%; + height:460px; + margin:0px 5%; + border-radius: 15px; + background-color: #fff; + overflow: hidden; + /* box-shadow: 3px 3px 8px 0 rgba(0, 0, 0, 0.3); */ + filter: drop-shadow(0px 5px 5px rgba(0,0,0,0.3)) +} +.device-title{ + position: relative; + top:20px; + z-index: 2; + font-size: clamp(1rem, 0.582rem + 1.59vw, 1.475rem); + font-weight: bold; + color: #4f6ab2; + width: 100%; + height:90px; + line-height: 100px; + text-align: center; +} +.device-footer{ + width:100%; + height:420px; + background-color: #3361d0; + position: relative +} +.device-footer::after{ + content: ""; + width: 100%; + height: 70px; + position: absolute; + top:-30px; + border-radius: 0 0 50% 50%; + background-color: #fff; +} +.device-footer .qr-code{ + width: 55%; + height: 200px; + position: relative; + top: 60px; + left:22.5%; + background-color: #fff; + border-radius: 15px; + overflow: hidden; +} +.device-number{ + width:80%; + height: 20px; + margin-left:20%; + position: relative; + top: 80px; +} +.device-text{ + color:#fff; + font-weight: bold; + font-size:100%; +} +.device-name{ + width:80%; + margin-left:20%; + height: 20px; + position: relative; + top: 90px; +} </style> diff --git a/src/components/do/a6-device/maintenance.vue b/src/components/do/a6-device/maintenance.vue index 2f3b5ac..51e37f6 100644 --- a/src/components/do/a6-device/maintenance.vue +++ b/src/components/do/a6-device/maintenance.vue @@ -1,214 +1,329 @@ +<!-- 璁惧缁存姢 --> <template> <div> <div class="search"> <div class="search_thing"> - <div class="search_label">鍏抽敭瀛楋細</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value" @keyup.enter.native="refreshTable()"></el-input></div> + <div class="search_label">娴佺▼缂栧彿锛�</div> + <div class="search_input"><el-input v-model="search.deviceNumber" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="getAllMessage(clickNodeVal.value)"></el-input></div> </div> <div class="search_thing" style="padding-left: 30px;"> - <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + <el-button size="small" @click="resetSearch">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="getAllMessage(clickNodeVal.value)">鏌� 璇�</el-button> </div> <div class="btns"> - <el-button size="small" type="primary" @click="dialogVisible=true">鏂板缓</el-button> - <el-button size="small" type="primary">瀵煎嚭</el-button> + <el-button size="small" type="primary" @click="dialogVisible = true; add()">娣诲姞缁存姢璁板綍</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleDownOne">瀵煎嚭</el-button> </div> </div> - <div class="tables" style="margin-top: 16px;"> - <ValueTable ref="ValueTable" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> + <div class="tables" style="margin-top: 10px;"> + <el-table ref="table" :data="MaintainParam" height="calc(100vh - 20em)"> + <el-table-column label="搴忓彿" type="index" width="120"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="娴佺▼缂栧彿" min-width="180" prop="deviceNumber" /> + <el-table-column label="璁惧鍚嶇О" min-width="150" prop="deviceName" /> + <el-table-column label="绠$悊缂栧彿" min-width="150" prop="managementNumber" /> + <el-table-column label="缁存姢鍐呭" min-width="150" prop="content" /> + <el-table-column label="缁存姢鏃堕棿" min-width="150" prop="date" /> + <el-table-column label="鎻愪氦浜�" min-width="150" prop="name" /> + <el-table-column label="鎻愪氦鏃ユ湡" min-width="150" prop="date"> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="110"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleViewClick(scope.row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(scope.$index, scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> </div> - <el-dialog - title="浠櫒璁惧缁存姢璁板綍琛�" - :visible.sync="dialogVisible" - width="30%" - style="max-height: 80vh;margin-top: 10vh;" - :close-on-click-modal="false" - :close-on-press-escape="false"> - <div class="form"> - <div class="search_thing"> - <div class="search_label">璁惧缂栧彿锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">璁惧鍚嶇О锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">缁熶竴缂栧彿锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value"></el-input></div> - </div> - <div class="search_thing" style="margin: 10px 0;"> - <div class="search_label">缁存姢鍐呭锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value" type="textarea" - :rows="2"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">缁存姢鏃堕棿锛�</div> - <div class="search_input"> - <el-date-picker style="width:100%" v-model="value" type="date" - format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </div> - </div> - <div class="search_thing"> - <div class="search_label">缁存姢绫诲瀷锛�</div> - <div class="search_input"> - <el-radio-group v-model="value"> - <el-radio :label="0">浣跨敤鍓嶅悗缁存姢</el-radio> - <el-radio :label="1">璁″垝涓淮鎶�</el-radio> - </el-radio-group> - </div> - </div> - <div class="search_thing"> - <div class="search_label">涓嬫缁存姢鏃堕棿锛�</div> - <div class="search_input"> - <el-date-picker style="width:100%" v-model="value" type="date" - format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </div> - </div> - <div class="search_thing"> - <div class="search_label">缁存姢浜猴細</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value"></el-input></div> - </div> - <div class="search_thing" style="margin: 10px 0;"> - <div class="search_label">澶囨敞锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="value" type="textarea" - :rows="2"></el-input></div> - </div> - </div> + <!-- 鏂板缓缁存姢 --> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" + title="娣诲姞缁存姢璁板綍" + top="5vh" width="60%"> + <el-form ref="form" :model="formData" label-width="130px"> + <el-row> + <el-col :span="24"> + <el-form-item label="娴佺▼缂栧彿:" prop="deviceNumber"> + <el-input v-model="formData.deviceNumber" clearable disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О:" prop="deviceName"> + <el-input v-model="formData.deviceName" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绠$悊缂栧彿:" prop="managementNumber"> + <el-input v-model="formData.managementNumber" clearable disabled placeholder="璇疯緭鍏�" + size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ョ淮鎶ゅ唴瀹�', trigger: 'blur' }]" label="缁存姢鍐呭:" + prop="content"> + <el-input v-model="formData.content" placeholder="璇疯緭鍏�" size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ョ淮鎶ゆ椂闂�', trigger: 'blur' }]" label="缁存姢鏃堕棿:" prop="date"> + <el-date-picker v-model="formData.date" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" + style="width:100%" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ョ淮鎶ゆ椂闂�', trigger: 'blur' }]" label="缁存姢绫诲瀷:" + prop="maintenanceType"> + <el-radio-group v-model="formData.maintenanceType" :disabled="!this.editMode"> + <el-radio :label="0">浣跨敤鍓嶅悗缁存姢</el-radio> + <el-radio :label="1">璁″垝涓淮鎶�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇烽�夋嫨涓嬫缁存姢鏃堕棿', trigger: 'blur' }]" label="涓嬫缁存姢鏃堕棿:" + prop="nextDate"> + <el-date-picker + v-model="formData.nextDate" + :picker-options="{ disabledDate: this.disabledDate }" + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" size="small" + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ョ淮鎶や汉', trigger: 'blur' }]" label="缁存姢浜�:" prop="name"> + <el-input v-model="formData.name" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞:"> + <el-input v-model="formData.comments" placeholder="璇疯緭鍏�" size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="dialogVisible = false">纭� 瀹�</el-button> + <el-button v-if="editMode" @click="dialogVisible = false">鍙� 娑�</el-button> + <el-button v-if="editMode" type="primary" @click="addRecord">纭� 瀹�</el-button> </span> </el-dialog> </div> </template> <script> -import ValueTable from '../../tool/value-table.vue' export default { - components: { - ValueTable - }, - data(){ - return { - value:'', - componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'handleLook', - font: '鏌ョ湅', - type: 'text', - method: 'handleLook' - },{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy', - disabFun: (row, index) => { - return row.state === '宸插鏍�' || row.state === '宸叉壒鍑�' - } - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex:0, - dialogVisible:true + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } } }, - methods:{ - refreshTable(){} + data() { + return { + search: { + size: 20, + current: 1, + total: 0, + deviceNumber: '' + }, + editMode: false, + dialogVisible: false, + //琛ㄥ崟缁存姢鍐呭 + formData: {}, + //琛ㄥご鏄剧ず + MaintainParam: [], + outLoading: false + } + }, + mounted() { + this.getAllMessage(this.clickNodeVal.value) + }, + methods: { + //涓嬫缁存姢鏃ユ湡:绂佺敤鍦ㄧ淮鎶ゆ棩鏈熷墠鐨勬棩鏈� + disabledDate(time){ + let selectDate = this.formData.date + if(selectDate){ + let oldDate = new Date(selectDate) + return time <= oldDate.getTime() + } + return false + }, + handleSizeChange(val) { + this.search.size = val + this.getAllMessage(this.clickNodeVal.value) + }, + handleCurrentChange(val) { + this.search.current = val + this.getAllMessage(this.clickNodeVal.value) + }, + //鎿嶄綔璇︽儏鏌ョ湅 + handleViewClick(row) { + this.editMode = false; + this.dialogVisible = true; + this.formData = row; + }, + // 瀵煎嚭 + handleDownOne() { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.exportMaintenanceRecord + '?deviceId=' + this.clickNodeVal.value, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧缁存姢淇濆吇璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧缁存姢淇濆吇璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + //鎿嶄綔璇︽儏鍒犻櫎 + handleDeleteClick(index, row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deviceMaintenanceDelete + '/' + row.id).then(res => { + }) + this.MaintainParam.splice(index, 1); + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + //鐐瑰嚮鍚庡彲缂栬緫 + add() { + this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => { + this.formData.deviceName = res.data.deviceName + this.formData.managementNumber = res.data.managementNumber + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + }); + this.editMode = true; + }, + //娣诲姞缁存姢璁板綍 + addRecord() { + this.$refs['form'].validate((valid) => { + if (valid) { + this.formData.deviceId = this.clickNodeVal.value; + this.$axios.post(this.$api.deviceCheck.deviceMaintainAdd, this.formData).then(res => { + if (res.code == 200) { + this.$message.success('娣诲姞鎴愬姛'); + this.getAllMessage(this.clickNodeVal.value) + } + }) + this.MaintainParam.push(this.formData) + this.dialogVisible = false; + this.formData = {}; //娓呯┖琛ㄥ崟 + } + }) + }, + resetSearch() { + this.search = { + size: 20, + current: 1, + total: 0, + deviceNumber: '', + } + this.getAllMessage(this.clickNodeVal.value); + }, + //鑾峰彇琛ㄥ崟璁惧缁存姢淇℃伅 + getAllMessage(deviceId) { + this.$axios.get(this.$api.deviceCheck.getDeviceMaintenancePage + "?deviceId=" + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&deviceNumber=" + this.search.deviceNumber).then(res => { + if (res.code == 200) { + this.MaintainParam = res.data.records + this.search.total = res.data.total + } + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getAllMessage(newVal.value) + } + }, + dialogVisible(newVal) { + if (newVal === false) { + this.formData = {} + this.$refs['form'].clearValidate() + } + } } } </script> <style scoped> -.tables{ - width: calc(100vw - 390px); - height: calc(100vh - 230px); +h4 { + font-weight: 400; + font-size: 16px; + display: flex; + justify-content: space-between; + margin: 10px 0; } + +h4 .line { + display: inline-block; + width: 3px; + height: 16px; + background: #3A7BFA; + margin-right: 4px; +} + +.tables { + width: 100%; + height: calc(100vh - 17em); +} + .search { background-color: #fff; - height: 40px; display: flex; align-items: center; position: relative; + margin-top: 10px; } .search_thing { @@ -218,21 +333,30 @@ } .search_label { - width: 70px; + width: 80px; font-size: 14px; text-align: right; } .search_input { - width: calc(100% - 120px); + width: 73%; } -.btns{ + +.btns { position: absolute; - right: 40px; + right: 0px; top: 50%; - transform: translate(0,-50%); + transform: translate(0, -50%); } -.form .search_label{ + +.btns_thing { + position: absolute; + right: 230px; + top: 50%; + transform: translate(0, -50%); +} + +.form .search_label { width: 120px; } </style> diff --git a/src/components/do/a6-device/management.vue b/src/components/do/a6-device/management.vue new file mode 100644 index 0000000..8925775 --- /dev/null +++ b/src/components/do/a6-device/management.vue @@ -0,0 +1,1041 @@ +<!-- 璁惧宸ュ叿鏄庣粏 --> +<template> + <div class="role_manage"> + <div class="search" v-show="!showData"> + <div class="search_thing"> + <div class="search_label">鐘舵�侊細</div> + <el-select v-model="componentData.entity.deviceStatus" placeholder="鍏ㄩ儴" size="small"> + <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </div> + <div class="search_thing"> + <div class="search_label">璁惧鍚嶇О锛�</div> + <div class="search_input"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.deviceName" + @keyup.enter.native="refreshTable()"> + </el-input> + </div> + </div> + <div class="search_thing"> + <div class="search_label">瑙勬牸鍨嬪彿锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="componentData.entity.specificationModel" + @keyup.enter.native="refreshTable()"></el-input> + </div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + <el-button size="small" type="primary" @click="dialogVisible2 = true">鏂� 澧�</el-button> + <el-button size="small" type="primary" @click="handleDownOne">瀵� 鍑�</el-button> + </div> + </div> + <div class="table" v-show="!showData"> + <!-- 璇硶 瀛愮粍浠堕�氳繃 this.$emit +浼犲叆鏂规硶鍚� 璋冪敤鐖剁粍浠舵柟娉� 渚嬪 this.$emit锛坰electAllByOne锛� 灏遍渶鍦ㄧ埗缁勪欢澹版槑骞朵紶鍏� @selectAllByOne="selectAllByOne" --> + <ValueTable @selectAllByOne="selectAllByOne" @isUpdate="isUpdate" ref="ValueTable" + :dateFormat="dateFormat" + :upUrl="$api.deviceScope.upDeviceParameter" :delUrl="$api.deviceScope.delDeviceParameter" + :componentData="componentData" :key="upIndex" :url="$api.deviceScope.selectDeviceParameter + '?laboratoryNameIsNull=' + laboratoryNameIsNull" /> + </div> + <el-dialog :title="isUp ? '璁惧璇︽儏' : '妗f淇'" :visible.sync="dialogVisible" width="70%" + top="5vh" + :before-close="handleClose"> + <el-row style="display:flex;justify-content: space-around;max-height: 75vh;overflow-y: auto;"> + <!-- 宸﹁竟甯冨眬 --> + <el-col :span="7"> + <el-col> + <!-- 鍥剧墖 --> + <el-image class="img" style="width:100%;height: 320px;marginBottom:16px" + :src="javaApi + '/img/' + formData.imageUpload"> + <div slot="error" class="image-error" style="width: calc(100% -2px); + height: 318px; + border-radius: 16px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #EEEEEE;"> + <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i> + </div> + </el-image> + <!-- 琛ㄥ崟 --> + <el-form :label-position="labelPosition" :model="formData" label-width="120px"> + <el-form-item label="浠櫒鍚嶇О:" required> + <el-input :disabled="isUp" v-model="formData.deviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="浠櫒鍚嶇ОEN:" required> + <el-input :disabled="isUp" v-model="formData.enDeviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿:" required> + <el-input :disabled="isUp" v-model="formData.specificationModel" + size="small"></el-input> + </el-form-item> + <el-form-item label="鐢熶骇鍘傚:"> + <el-input :disabled="isUp" v-model="formData.manufacturer" size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + </el-col> + <!-- 涓棿甯冨眬 --> + <el-col :span="7"> + <el-form :label-position="labelPosition" :model="formData" label-width="116px"> + <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:"> + <el-input :disabled="isUp" v-model="formData.calibrationServices" size="small"></el-input> + </el-form-item> + <el-form-item label="鍑哄巶缂栧彿:"> + <el-input :disabled="isUp" v-model="formData.factoryNo" size="small"></el-input> + </el-form-item> + <el-form-item label="绠$悊缂栧彿:" required> + <el-input :disabled="isUp" v-model="formData.managementNumber" size="small"></el-input> + </el-form-item> + <el-form-item label="璐疆鏃ユ湡:"> + <el-date-picker :disabled="isUp" style="width:100%" v-model="formData.acquisitionDate" + type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" + placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鏍″噯鏃ユ湡:" required> + <el-date-picker :disabled="isUp" style="width:100%" v-model="formData.activationDate" + type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" + placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="绠$悊浜�:"> + <el-select v-model="formData.equipmentManager" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option :disabled="isUp" v-for="item in responsiblePersonList" :key="item.value" + :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="瀛樻斁鐐�:"> + <el-input :disabled="isUp" v-model="formData.storagePoint" size="small"></el-input> + </el-form-item> + <el-form-item label="鎶�鏈寚鏍�:"> + <el-input :disabled="isUp" v-model="formData.technicalIndicators" :rows="7" type="textarea" + size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + <!-- 鍙宠竟甯冨眬 --> + <el-col :span="7"> + <el-form :label-position="labelPosition" :model="formData" label-width="140px" ref="ruleForm"> + <!-- 瀹為獙瀹ゅ垪琛� --> + <el-form-item label="鎵�灞為儴闂�:"> + <el-select :disabled="isUp" v-model="formData.subordinateDepartmentsId" placeholder="璇烽�夋嫨" + size="small" style="width:100%"> + <el-option v-for="item in subordinateDepartmentsList" :key="item.value" + :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="妫�娴嬮」鐩�:"> + <el-cascader :disabled="isUp" v-model="formData.insProductIds" :options="options" + :show-all-levels="false" :props="props" placeholder="璇烽�夋嫨" size="small" + style="width:100%;" :collapse-tags="!isUp" separator="," filterable + clearable></el-cascader> + </el-form-item> + <el-form-item label="鏈�杩戞牎鍑嗘棩鏈�:" v-if="isUp"> + <el-date-picker :disabled="isUp" style="width:100%" v-model="formData.latestTraceability" + format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" size="small" + placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="涓嬫鏍″噯鏃ユ湡:" v-if="isUp"> + <el-date-picker :disabled="isUp" style="width:100%" v-model="formData.latestTraceability" + format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" size="small" + placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="璁惧绫诲瀷:"> + <el-select :disabled="isUp" v-model="formData.largeCategory" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鍗曚环(涓囧厓):"> + <el-input :disabled="isUp" v-model="formData.unitPrice" size="small"></el-input> + </el-form-item> + <el-form-item label="褰撳墠鐘舵��:" required> + <el-select :disabled="isUp" v-model="formData.deviceStatus" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鏍″噯鍛ㄦ湡锛堟湀锛�:" required> + <el-input :disabled="isUp" v-model="formData.calibrationDate" size="small"></el-input> + </el-form-item> + <el-form-item label="鍥剧墖:"> + <div + style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;"> + <div v-show="formData.imageName" class="picName">{{ formData.imageName }}</div> + <el-upload :disabled="isUp" :action="action" :on-success="handleSuccessUpImg2" + :show-file-list="false" accept='image/jpg,image/jpeg,image/png' :headers="headers" + :on-change="beforeUpload" :on-error="onError" ref='upload'> + <el-button type="text" style="height:30px;padding-top:8px">涓婁紶</el-button> + </el-upload> + </div> + </el-form-item> + </el-form> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-row v-if="!isUp"> + <el-button @click="handleClose">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm" :loading="upLoad">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + <!-- 鏂板--> + <el-dialog title="鏂板璁惧" top="5vh" :visible.sync="dialogVisible2" width="70%" :before-close="handleClose2"> + <el-row style="display:flex;justify-content: space-around;"> + <!-- 宸﹁竟甯冨眬 --> + <el-col :span="7"> + <el-col> + <!-- 鍥剧墖 --> + <el-image class="img" style="width:100%;height: 320px;margin-bottom:16px" + :src="javaApi + '/img/' + formData2.imageUpload"> + <div slot="error" class="image-error" style="width: calc(100% -2px); + height: 318px; + border-radius: 16px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #EEEEEE;"> + <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i> + </div> + </el-image> + <!-- 琛ㄥ崟 --> + <el-form :label-position="labelPosition" :model="formData2" label-width="120px"> + <el-form-item label="浠櫒鍚嶇О:" required> + <el-input v-model="formData2.deviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="浠櫒鍚嶇ОEN:" required> + <el-input v-model="formData2.enDeviceName" size="small"></el-input> + </el-form-item> + <el-form-item label="瑙勬牸鍨嬪彿:" required> + <el-input v-model="formData2.specificationModel" size="small"></el-input> + </el-form-item> + <el-form-item label="鐢熶骇鍘傚:"> + <el-input v-model="formData2.manufacturer" size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + </el-col> + <!-- 涓棿甯冨眬 --> + <el-col :span="7"> + <el-form :label-position="labelPosition" :model="formData2" label-width="110px"> + <!-- <el-form-item label="鐢熶骇鍘傚EN:"> + <el-input v-model="formData2.factoryNo" size="small"></el-input> + </el-form-item> --> + <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:"> + <el-input v-model="formData2.calibrationServices" size="small"></el-input> + </el-form-item> + <el-form-item label="鍑哄巶缂栧彿:"> + <el-input v-model="formData2.factoryNo" size="small"></el-input> + </el-form-item> + <el-form-item label="绠$悊缂栧彿:" required> + <el-input v-model="formData2.managementNumber" size="small"></el-input> + </el-form-item> + <el-form-item label="璐疆鏃ユ湡:"> + <el-date-picker style="width:100%" v-model="formData2.acquisitionDate" type="date" + format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鍚敤鏃ユ湡:" required> + <el-date-picker style="width:100%" v-model="formData2.activationDate" type="date" + format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="绠$悊浜�:"> + <el-select v-model="formData2.equipmentManager" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in responsiblePersonList" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="瀛樻斁鐐�:"> + <el-input v-model="formData2.storagePoint" size="small"></el-input> + </el-form-item> + <el-form-item label="鎶�鏈寚鏍�:"> + <el-input v-model="formData2.technicalIndicators" :rows="7" type="textarea" + size="small"></el-input> + </el-form-item> + </el-form> + </el-col> + <!-- 鍙宠竟甯冨眬 --> + <el-col :span="7"> + <el-form :label-position="labelPosition" :model="formData2" label-width="120px" ref="ruleForm"> + <!-- 瀹為獙瀹ゅ垪琛� --> + <el-form-item label="鎵�灞為儴闂�:"> + <el-select v-model="formData2.subordinateDepartmentsId" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in subordinateDepartmentsList" :key="item.value" + :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="妫�娴嬮」鐩�:"> + <el-cascader v-model="formData2.insProductIds" :options="options" :show-all-levels="false" + :props="props" placeholder="璇烽�夋嫨" size="small" style="width:100%" collapse-tags + separator="," filterable clearable></el-cascader> + </el-form-item> + <el-form-item label="璁惧绫诲瀷:"> + <el-select v-model="formData2.largeCategory" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鍗曚环(涓囧厓):"> + <el-input v-model="formData2.unitPrice" size="small"></el-input> + </el-form-item> + <el-form-item label="褰撳墠鐘舵��:" required> + <el-select v-model="formData2.deviceStatus" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option v-for="item in deviceStatusList" :key="item.id" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鏍″噯鍛ㄦ湡锛堟湀锛�:" required> + <el-input v-model="formData2.calibrationDate" size="small"></el-input> + </el-form-item> + <el-form-item label="鍥剧墖:"> + <div + style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;line-height:32px;display:flex;justify-content: space-around;font-size: 13px;"> + <div v-show="formData2.imageName" class="picName">{{ formData2.imageName }}</div> + <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false" + accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload" + :on-error="onError" ref='upload'> + <el-button type="text" style="height:30px;padding-top:8px">涓婁紶</el-button> + </el-upload> + </div> + </el-form-item> + </el-form> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="handleClose2">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm2" :loading="upLoad2">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible3" width="400px"> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>IP锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.ip"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.collectUrl"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍌ㄥ瓨鍦板潃锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.storageUrl"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍙傜収锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.refer"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>X锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.x"></el-input> + </div> + <div class="search_thing" style="margin-bottom: 14px;"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>Y锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.y"></el-input> + </div> + <div class="search_thing"> + <div class="search_label">鍏紡锛�</div> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.formula"></el-input> + </div> + <span slot="footer" class="dialog-footer"> + <el-row> + <el-button @click="dialogVisible3 = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm3" :loading="upLoad3">纭� 瀹�</el-button> + </el-row> + </span> + </el-dialog> + <dataAcquisitionConfig v-if="showData" :deviceId="deviceId" /> + </div> +</template> + +<script> +import ValueTable from '../../tool/value-table.vue' +import dataAcquisitionConfig from './acquisition-config.vue' +export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + components: { + ValueTable, + dataAcquisitionConfig, + }, + data() { + return { + dateFormat: 'yyyy-MM-dd', + deviceId: '', + fileTypeOptions: [ + { label: 'csv', value: '.csv' }, + { label: 'db', value: '.db' }, + { label: 'mdb', value: '.mdb' }, + { label: 'word', value: '.docx' }, + { label: 'excel', value: '.xlsx' }, + { label: 'txt', value: '.txt' }, + { label: 'png', value: '.png' }, + ], + //鏄惁鏄。妗堜慨璁� true涓嶆槸 false鏄� + isUp: true, + formData: { + }, + formData2: { + imageUpload: '', + imageName: '' + }, + value: '', + props: { multiple: true, emitPath: false, value: 'id', label: 'name' }, + options: [], + labelPosition: 'right', + dialogVisible: false, + dialogVisible2: false, + addPower: false, + showData: false, // 鏁伴噰閰嶇疆椤甸潰 + tableList: [], + componentData: { + entity: { + largeCategory: null, + orderBy: { + field: 'id', + order: 'asc' + } + }, + init: false, + isIndex: true, + showSelect: false, + select: false, + do: [{ + id: 'delete', + font: '鍒犻櫎', + type: 'text', + method: 'doDiy' + }, { + id: 'archives', + font: '妗f淇', + type: 'text', + method: 'isUpdate' + }, { + id: 'handleConfig', + font: '鏁伴噰閰嶇疆', + type: 'text', + method: 'handleConfig', + disabFun: (row, index) => { + return row.insProductItem == null || row.insProductItem === '' + } + }], + headNoShow: ['enDeviceName'], + tagField: { + deviceStatus: { + select: [] + }, + equipmentManager: { + select: [] + }, + authorizedPerson: { + select: [] + }, + insProductIds: { + select: [] + } + }, + linkEvent: { + deviceName: { + method: 'selectAllByOne' + } + }, + selectField: { + authorizedPerson: { + select: [], + choose: true + }, + equipmentManager: { + select: [] + }, + insProductIds: { + select: [], + choose: true + }, + largeCategory: { + select: [] + }, + }, + requiredAdd: [], + requiredUp: [], + needSort: ['deviceName', 'acquisitionDate', 'activationDate', 'lastCalibrationDate', 'nextCalibrationDate', 'deviceStatus'], + }, + entityCopy: {}, + upIndex: 0, + addDia: true, + addPower: true, + //璁惧绫诲瀷鍒楄〃 + equipmentList: [], + // 璐熻矗浜哄垪琛� + responsiblePersonList: [], + // 鎺堟潈浜哄垪琛� + authorizerList: [], + // 褰撳墠鐘舵�佸垪琛� + deviceStatusList: [], + // 鎵�灞為儴闂� + subordinateDepartmentsList: [], + upLoad: false, + upLoad2: false, + dialogVisible3: false, + upLoad3: false, + configForm: {}, + laboratoryNameIsNull: false + } + }, + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + action() { + return this.javaApi + this.$api.deviceScope.uploadFile + } + }, + mounted() { + this.entityCopy = this.HaveJson(this.componentData.entity) + this.getPower() + this.selectEnumByCategory() + this.selectDevicePrincipal() + this.obtainItemParameterList() + this.getInsProductIds() + // this.$customEvents.$on('largeCategory', this.handleNotification); + // 鍒濆鍖� + this.clickSidebar(this.clickNodeVal) + }, + methods: { + //鍒嗙被 + handleNotification(cate) { + this.componentData.entity.largeCategory = cate + }, + obtainItemParameterList() { + this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.laboratoryName, + value: a.id + }) + }) + this.subordinateDepartmentsList = data + }) + }, + refreshTable(e) { + this.$refs['ValueTable'].selectList(e) + }, + refresh() { + this.componentData.entity.deviceStatus = null + this.componentData.entity.deviceName = null + this.componentData.entity.specificationModel = null + this.refreshTable() + // this.upIndex++ + }, + // 瀵煎嚭 + handleDownOne() { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.exportEquipmentDetails, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧浠櫒涓�瑙堣〃.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧浠櫒涓�瑙堣〃.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鏉冮檺鍒嗛厤 + getPower(radio) { + let power = JSON.parse(sessionStorage.getItem('power')) + let up = false + let del = false + let add = false + let config = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'upDeviceParameter') { + up = true + } + if (power[i].menuMethod == 'delDeviceParameter') { + del = true + } + if (power[i].menuMethod == 'addDeviceParameter') { + add = true + } + if (power[i].menuMethod == 'saveDataAcquisitionConfiguration') { + config = true + } + } + if (!config) { + this.componentData.do.splice(2, 1) + } + if (!up) { + this.componentData.do.splice(1, 1) + } + if (!del) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + }, + // 鑾峰彇瀛楀吀 + selectEnumByCategory() { + this.$axios.post(this.$api.enums.selectEnumByCategory, { + category: "璁惧鐘舵��" + }).then(res => { + this.deviceStatusList = res.data + this.deviceStatusList.forEach(a => { + if (!isNaN(a.value)) { + a.value = parseInt(a.value) + } + }) + this.componentData.tagField.deviceStatus.select = res.data + }) + this.$axios.post(this.$api.enums.selectEnumByCategory, { + category: "璁惧鍒嗙被" + }).then(res => { + this.equipmentList = res.data + }) + }, + // 鑾峰彇璐熻矗浜哄垪琛� + selectDevicePrincipal() { + this.$axios.get(this.$api.deviceScope.selectDevicePrincipal).then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.name, + value: a.id + }) + }) + this.responsiblePersonList = data + this.authorizerList = data + this.componentData.tagField.equipmentManager = data + this.componentData.tagField.authorizedPerson = data + }) + }, + getInsProductIds() { + this.$axios.post(this.$api.capacityScope.getInsProduction).then(res => { + this.componentData.tagField.insProductIds.select = [] + this.componentData.selectField.insProductIds.select = [] + this.options = res.data.map((m, i) => { + m.id = m.name; + let children = m.children.map(n => { + n.label = n.name; + n.value = n.id; + return n + }) + this.componentData.tagField.insProductIds.select = [...this.componentData.tagField.insProductIds.select, ...children] + this.componentData.selectField.insProductIds.select = [...this.componentData.selectField.insProductIds.select, ...children] + return m + }) + this.options.forEach(item => { + if (item.children.length == 0) { + item.children = null; + } else { + item.children.forEach(m => { + if (m.children.length == 0) { + m.children = null; + } else { + m.children.forEach(n => { + if (n.children && n.children.length == 0) { + n.children = null; + } + }) + } + }) + } + }) + }) + }, + handleClose() { + this.formData = {} + this.formData2 = { + imageUpload: '', + imageName: '' + } + this.dialogVisible = false; + this.upLoad = false; + }, + handleClose2() { + this.formData = {} + this.formData2 = { + imageUpload: '', + imageName: '' + } + this.dialogVisible2 = false; + this.upLoad = false; + }, + selectAllByOne(row) { + this.isUp = true + //鎵撳紑寮规 + this.dialogVisible = true; + //row = 鐐瑰嚮瀵瑰簲琛屽�� + //澶嶅埗缁檉ormData + this.formData = this.HaveJson(row); + console.log(row.insProductIds + 'valll'); + this.formData.insProductIds = row.insProductIds ? row.insProductIds.split(',') : []; + }, + isUpdate(row) { + //淇敼 isUp 涓烘。妗堜慨鏀� + this.isUp = false + //鎵撳紑寮规 + this.dialogVisible = true; + //row = 鐐瑰嚮瀵瑰簲琛屽�间竴琛屽�� + //澶嶅埗缁檉ormData + this.formData = this.HaveJson(row); + if (typeof (row.insProductIds) === 'number') { + row.insProductIds = row.insProductIds + '' + } + this.formData.insProductIds = row.insProductIds ? row.insProductIds.split(',') : []; + // 灏嗘椂闂存牸寮忎负yyyy-MM-dd 杩涜杞崲 + const dateRegex = /^\d{4}-\d{2}-\d{2}$/ + Object.keys(this.formData).forEach(key => { + if(dateRegex.test(this.formData[key])) { + this.formData[key] = `${this.formData[key]} 00:00:00` + } + }) + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + // 涓婁紶鍥剧墖鎴愬姛 + handleSuccessUpImg(response,) { + if (response.code == 200) { + this.formData.imageUpload = response.data.url; + this.formData.imageName = response.data.name; + } + }, + handleSuccessUpImg2(response) { + if (response.code == 200) { + this.$nextTick(() => { + this.formData.imageUpload = response.data.url; + this.formData.imageName = response.data.name; + this.formData2.imageUpload = response.data.url; + this.formData2.imageName = response.data.name; + }) + } + }, + submitForm() { + if (!this.formData.deviceName) { + this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉�') + return + } + if (!this.formData.enDeviceName) { + this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉癊N') + return + } + if (!this.formData.specificationModel) { + this.$message.error('鏈緭鍏ヨ鏍煎瀷鍙�') + return + } + if (!this.formData.managementNumber) { + this.$message.error('鏈緭鍏ョ鐞嗙紪鍙�') + return + } + if (!this.formData.activationDate) { + this.$message.error('鏈緭鍏ュ惎鐢ㄦ棩鏈�') + return + } + if (this.formData.deviceStatus === '' || this.formData.deviceStatus === null) { + this.$message.error('鏈�夋嫨褰撳墠鐘舵��') + return + } + if (!this.formData.calibrationDate) { + this.$message.error('鏈緭鍏ユ牎鍑嗗懆鏈燂紙鏈堬級') + return + } + delete this.formData.createTime + delete this.formData.updateTime + delete this.formData.createUser + delete this.formData.updateUser + this.formData.insProductIds = this.formData.insProductIds ? this.formData.insProductIds.join() : '' + this.upLoad = true; + this.formData.authorizedPerson = JSON.stringify(this.formData.authorizedPerson) + console.log('this.formData',this.formData); + this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.formData, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + this.upLoad = false + return + } + this.$message.success('淇敼鎴愬姛') + this.upLoad = false + this.refreshTable('page') + this.dialogVisible = false + }).catch(e => { + this.$message.error('淇敼澶辫触') + this.dialogVisible = false + this.upLoad = false + }) + }, + submitForm2() { + if (!this.formData2.deviceName) { + this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉�') + return + } + if (!this.formData2.enDeviceName) { + this.$message.error('鏈緭鍏ヤ华鍣ㄥ悕绉癊N') + return + } + if (!this.formData2.specificationModel) { + this.$message.error('鏈緭鍏ヨ鏍煎瀷鍙�') + return + } + if (!this.formData2.managementNumber) { + this.$message.error('鏈緭鍏ョ鐞嗙紪鍙�') + return + } + if (!this.formData2.activationDate) { + this.$message.error('鏈緭鍏ュ惎鐢ㄦ棩鏈�') + return + } + if (!this.formData2.deviceStatus) { + this.$message.error('鏈�夋嫨褰撳墠鐘舵��') + return + } + if (!this.formData2.calibrationDate) { + this.$message.error('杈撳叆鏍″噯鍛ㄦ湡锛堟湀锛�') + return + } + this.upLoad2 = true; + this.formData2.insProductIds = this.formData2.insProductIds.join() + this.$axios.post(this.$api.deviceScope.addDeviceParameter, this.formData2, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + this.upLoad2 = false + return + } + this.$message.success('鎻愪氦鎴愬姛') + this.upLoad2 = false + this.refreshTable('page') + this.dialogVisible2 = false + this.formData2 = { + imageUpload: '', + imageName: '' + } + }).catch(e => { + this.$message.error('鎻愪氦澶辫触') + this.dialogVisible2 = false + this.upLoad2 = false + }) + }, + handleConfig(row) { + let list = [] + if(row.insProductItem){ + list = row.insProductItem.split(';') + } + let list2 = [] + list.map((item) => { + const obj = Object.assign({ + deviceId: row.id, + insProductItem: item, + }) + list2.push(obj) + }) + this.tableList = list2 + this.deviceId = row.id + this.$nextTick(()=>{ + this.showData = true + }) + }, + closeDataVue() { + this.clickSidebar(this.clickNodeVal) + this.showData = false + }, + submitForm3() { + if (!this.configForm.ip) { + this.$message.error('璇峰~鍐橧P'); + return + } + if (!this.configForm.collectUrl) { + this.$message.error('璇峰~鍐欓噰闆嗗湴鍧�'); + return + } + if (!this.configForm.storageUrl) { + this.$message.error('璇峰~鍐欏偍瀛樺湴鍧�'); + return + } + if (!this.configForm.refer) { + this.$message.error('璇峰~鍐欏弬鐓�'); + return + } + if (!this.configForm.x) { + this.$message.error('璇峰~鍐橷'); + return + } + if (!this.configForm.y) { + this.$message.error('璇峰~鍐橸'); + return + } + + this.upLoad3 = true + this.$axios.post(this.$api.deviceScope.numberCollect, this.configForm, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + this.upLoad3 = false + if (res.code === 201) { + return + } + this.$message.success('鎿嶄綔鎴愬姛') + this.refreshTable('page') + this.dialogVisible3 = false + }).catch(e => { + this.$message.error('鎿嶄綔澶辫触') + this.dialogVisible3 = false + this.upLoad3 = false + }) + }, + // 鐐瑰嚮渚ц竟鏍忓埛鏂� + clickSidebar(clickNodeVal) { + this.laboratoryNameIsNull = false + // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� + if (!clickNodeVal.value) { + this.list = []; + this.componentData.entity.laboratoryName = null + this.componentData.entity.storagePoint = null + // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� + if (clickNodeVal.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + this.refreshTable('page') + return + } + if (clickNodeVal.level == 1) { + this.componentData.entity.laboratoryName = clickNodeVal.label + // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� + } else if (clickNodeVal.level == 2) { + // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 + if (clickNodeVal.parent.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + } else { + this.componentData.entity.laboratoryName = clickNodeVal.parent.label + } + this.componentData.entity.storagePoint = clickNodeVal.label + } + this.refreshTable('page') + } + } + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + this.clickSidebar(newVal) + } + } +} +</script> + +<style scoped> +.role_manage { + width: 100%; + height: 100%; +} + +.title { + line-height: 15px; +} + +.search { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 10px; +} + +.search_thing { + width: 17em; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + margin-top: 12px; + background-color: #fff; + height: calc(100vh - 17em); +} + +.el-form-item { + margin-bottom: 16px; +} + +.picName { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + word-break: break-all; + width: 120px; +} +</style> diff --git a/src/components/do/a6-device/operation-instruction.vue b/src/components/do/a6-device/operation-instruction.vue new file mode 100644 index 0000000..969c3b4 --- /dev/null +++ b/src/components/do/a6-device/operation-instruction.vue @@ -0,0 +1,562 @@ +<!-- 浣滀笟鎸囧涔� --> +<template> + <div> + <div style="width:100%;height:30px;margin:5px 0px"> + <el-row> + <el-col :span="12" style="text-align: left;"> + <p style="line-height: 30px;">浣滀笟鎸囧涔�</p> + </el-col> + <el-col :span="12" style="text-align: right;"> + <el-button size="small" type="primary" @click="getList">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="dialogVisible = true">鍙楁帶鐢宠</el-button> + </el-col> + </el-row> + </div> + <el-table :data="tableData" border height="calc(100vh - 18em)"> + <el-table-column type="index" label="搴忓彿" width="120"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="鐢宠缂栧彿" min-width="150" prop="applicationNumber"></el-table-column> + <el-table-column label="璁惧鍚嶇О" min-width="150" prop="deviceName"></el-table-column> + <el-table-column label="璁惧缂栧彿" min-width="150" prop="deviceNumber"></el-table-column> + <el-table-column label="璁惧鍨嬪彿" min-width="150" prop="deviceModel"></el-table-column> + <el-table-column label="鏂囦欢缂栧彿" min-width="150" prop="documentNumber"></el-table-column> + <el-table-column label="鏂囦欢鍚嶅瓧" min-width="150" prop="fileName"></el-table-column> + <el-table-column label="鏂囨。璇存槑" min-width="150" prop="documentNote"></el-table-column> + <el-table-column label="涓婁紶浜�" min-width="150" prop="uploaderName"></el-table-column> + <el-table-column label="涓婁紶鏃堕棿" min-width="150" prop="updateTime"></el-table-column> + <el-table-column label="鐢熸晥鏃堕棿" min-width="150" prop="entryIntoForceTime"></el-table-column> + <el-table-column label="瀹℃壒浜�" min-width="150" prop="approverName"></el-table-column> + <el-table-column label="瀹℃壒鐘舵��" min-width="150" prop="status"> + <template v-slot="scope"> + {{scope.row.status === true ? '閫氳繃' : scope.row.status === false ? '涓嶉�氳繃' : '鏈鏍�'}} + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" min-width="180" fixed="right" prop="name"> + <template v-slot="scope"> + <el-button type="text" size="small" @click="downloadFile(scope.row.fileSystemName)">涓嬭浇</el-button> + <el-button type="text" size="small" style="color: red;" @click="deleteHomeworkGuidebook(scope.row)">鍒犻櫎</el-button> + <el-button type="text" size="small" @click="instructionEditFun(scope.row)">缂栬緫</el-button> + <el-button type="text" size="small" @click="approval(scope.row)">瀹℃壒</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1" + :page-sizes="[10, 20, 30, 50, 100]" :page-size="search.size" + layout="->,total, sizes, prev, pager, next, jumper" + :total="search.total"> + </el-pagination> + <el-dialog :visible.sync="dialogVisible" title="鍙楁帶鐢宠" width="60%"> + <div style="height: 60vh; overflow-y: auto; overflow-x: hidden;"> + <el-form ref="form1" label-width="110px" :model="instructionForm"> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="鐢宠缂栧彿:"> + <el-input v-model="instructionForm.applicationNumber" disabled size="small" clearable></el-input> + </el-form-item> + <el-form-item label="闄勪欢锛�" style="float: left;"> + <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList1" + :headers="headers" + :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove1" + :on-success="onSuccess1" + class="upload-demo" multiple> + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐢宠閮ㄩ棬:"> + <el-input v-model="instructionForm.applicationDepartment" clearable size="small"></el-input> + </el-form-item> + <el-form-item label="璐d换浜�:"> + <el-input v-model="instructionForm.personLiable" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鍙楁帶鐢宠璇存槑:" prop="controlledApplicationDescription" + :rules="[{required: true, message: '璇疯緭鍏ュ彈鎺х敵璇疯鏄�', trigger: 'blur'}]"> + <el-input v-model="instructionForm.controlledApplicationDescription" type="textarea" + clearable></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="text-align: right; margin-bottom: 10px"> + <el-button size="small" type="primary" @click="dialogVisible1 = true">娣诲姞鍙楁帶鏂囦欢</el-button> + <el-button size="small" @click="delFile">鍒犻櫎</el-button> + </div> + <el-table :data="documentTableData" border style="width: 100%;" + tooltip-effect="dark" + :row-key="getRowKey" + @selection-change="handleSelectionChange" height="30em"> + <el-table-column type="selection" width="55%"> + </el-table-column> + <el-table-column label="搴忓彿" prop="id" type="index" width="60"></el-table-column> + <el-table-column label="璁惧鍚嶇О" prop="deviceName" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column label="璁惧缂栧彿" prop="deviceNumber" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column label="璁惧鍨嬪彿" prop="deviceModel" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column label="鏂囦欢缂栧彿" prop="documentNumber" show-overflow-tooltip + min-width="125"></el-table-column> + <el-table-column label="鏂囦欢鍚嶇О" prop="fileName" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column label="涓婁紶浜�" prop="author" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column label="涓婁紶鏃堕棿" prop="updateTime" show-overflow-tooltip min-width="125"></el-table-column> + <el-table-column min-width="100" label="鎿嶄綔" fixed="right"> + <template #default="{row, $index}"> + <el-button type="text" size="small" @click="downloadFile(row.fileSystemName)">涓嬭浇</el-button> + <el-button type="text" @click="editFun(row, $index)">缂栬緫</el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer"> + <el-button @click="dialogVisible = false" size="small">鍙� 娑�</el-button> + <el-button size="small" type="primary" @click="submitFun">鎻愪氦</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="dialogVisible1" title="娣诲姞璁惧浣滀笟鎸囧涔�" width="40%"> + <div style="height: 50vh;"> + <el-form ref="form" :model="form" label-width="90px"> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="鏂囦欢绫诲瀷:" prop="documentType" + :rules="[{required: true, message: '璇疯緭鍏ユ枃浠剁被鍨�', trigger: 'blur'}]"> + <el-input v-model="form.documentType" clearable size="small" placeholder="璇疯緭鍏ユ枃浠剁被鍨�"></el-input> + </el-form-item> + <el-form-item label="璁惧鍚嶇О:" prop="deviceName" + :rules="[{required: true, message: '璇烽�夋嫨璁惧', trigger: 'change'}]"> + <el-select v-model="form.deviceName" size="small" clearable style="width: 100%" + placeholder="璇烽�夋嫨璁惧鍚嶇О" + @change="onDeviceNameChange" filterable> + <el-option v-for="item in deviceNameOption" + :key="item.id" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏂囨。缂栧彿:" prop="documentNumber" + :rules="[{required: true, message: '璇疯緭鍏ユ枃妗g紪鍙�', trigger: 'blur'}]"> + <el-input v-model="form.documentNumber" size="small" clearable placeholder="璇疯緭鍏ユ枃妗g紪鍙�"></el-input> + </el-form-item> + <el-form-item label="绠$悊缂栧彿:"> + <el-input v-model="form.deviceNumber" size="small" clearable disabled + placeholder="璇疯緭鍏ョ鐞嗙紪鍙�"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏂囦欢鐗堟湰:" prop="documentVersion" + :rules="[{required: true, message: '璇疯緭鍏ユ枃浠剁増鏈�', trigger: 'blur'}]"> + <el-input v-model="form.documentVersion" size="small" placeholder="璇疯緭鍏ユ枃浠剁増鏈�" clearable></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浣滆��:" prop="author" + :rules="[{required: true, message: '璇疯緭鍏ヤ綔鑰�', trigger: 'blur'}]"> + <el-input v-model="form.author" size="small" clearable></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎻愪氦鏃ユ湡:" prop="submitDate" + :rules="[{required: true, message: '璇烽�夋嫨鎻愪氦鏃ユ湡', trigger: 'change'}]"> + <el-date-picker v-model="form.submitDate" format="yyyy-MM-dd" style="width: 100%" size="small" clearable + placeholder="閫夋嫨鏃ユ湡" + type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鏂囨。璇存槑:" prop="documentNote" + :rules="[{required: true, message: '璇疯緭鍏ユ枃妗h鏄�', trigger: 'blur'}]"> + <el-input v-model="form.documentNote" placeholder="璇疯緭鍏ユ枃妗h鏄�" type="textarea" clearable></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="闄勪欢锛�" style="float: left;"> + <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList" + :headers="headers" + :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove" + :on-success="onSuccess" + class="upload-demo" multiple> + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <span slot="footer"> + <el-button @click="dialogVisible1 = false" size="small">鍙� 娑�</el-button> + <el-button type="primary" @click="addFile" size="small">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import fileDownload from "../../../util/file"; + +export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + name: '', + components: {}, + data() { + return { + search: { + size: 20, + current: 1, + total: 0 + }, + dialogVisible: false, + dialogVisible1: false, + value: '', + selectRow: null, + device: null, + form: { + documentType: '', + documentNumber: '', + deviceName: '', + deviceModel: '', + deviceNumber: '', + fileName: '', + fileSystemName: '', + submitDate: '', + documentNote: '', + }, + tableData: [], + documentTableData: [], + formData: {}, + fileList: [], + fileList1: [], + laboratoryNameIsNull: false, + devices: [], //璁惧鍒楄〃鏁版嵁 + deviceNameOption: [], //璁惧鍚嶇О涓嬫媺妗嗘暟鎹� + entity: { + deviceName: null, + laboratoryName: '', + storagePoint: '' + }, + selectedRow: [], + instructionForm: { + applicationNumber: '', // 鐢宠缂栧彿 + applicationDepartment: '', // 鐢宠閮ㄩ棬 + personLiable: '', // 璐d换浜� + controlledApplicationDescription: '', // 鍙楁帶鐢宠璇存槑 + } + } + }, + mounted() { + this.getAllDevice(); + this.getList() + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal) { + this.getList() + this.clickSidebar(newVal) + } + }, + dialogVisible1(newVal) { + this.form.deviceName = this.clickNodeVal.label + this.onDeviceNameChange() + if (newVal === false) { + this.$refs.form.resetFields() + // this.form = {} + this.fileList = [] + } + }, + dialogVisible(newVal) { + if (newVal === false) { + this.instructionForm = {} + this.documentTableData = [] + this.fileList1 = [] + } + } + }, + methods: { + approval(row) { + this.$confirm('鏄惁瀹℃壒閫氳繃锛�', '鎻愮ず', { + confirmButtonText: '閫氳繃', + cancelButtonText: '涓嶉�氳繃', + type: 'warning' + }).then(() => { + this.approvalFun(row.id, true) + }).catch(() => { + this.approvalFun(row.id, false) + }); + }, + approvalFun(id, status) { + this.$axios.get(this.$api.deviceCheck.approvalOfHomeworkInstructionManual + "?id=" + id + "&status=" + status).then(res => { + this.getList() + }) + this.$message({ + type: 'success', + message: '鎿嶄綔鎴愬姛!' + }); + }, + getRowKey (row) { + return row.index + }, + deleteHomeworkGuidebook(row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceCheck.homeworkGuidebook + "?id=" + row.id + "&instructionId=" + row.instructionId).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�') + this.getList() + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + downloadFile(fileName) { + let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName) + if (state) { + let url = this.javaApi + '/img/' + fileName; + fileDownload.downloadIamge(url, fileName) + } else { + const url = this.javaApi+'/word/'+ fileName + const link = document.createElement('a'); + link.href = url; + link.download = fileName; + link.click(); + this.$message.success('涓嬭浇鎴愬姛') + } + }, + instructionEditFun(row) { + this.dialogVisible = true + this.$axios.get(this.$api.deviceCheck.homeworkGuidebookEditor + "?instructionId=" + row.instructionId).then(res => { + if (res.code == 200) { + this.instructionForm = res.data.instruction; + if (this.instructionForm.fileSystemName) { + this.fileList1.push({name: this.instructionForm.fileName}) + } + this.documentTableData = res.data.list; + // 鍒犻櫎鐢� + this.documentTableData.forEach((v, k) => { + v.index = k + }) + } + }) + }, + handleSizeChange(val) { + this.search.size = val + this.getList() + }, + handleCurrentChange(val) { + this.search.current = val + this.getList() + }, + submitFun() { + this.$refs.form1.validate((valid) => { + if (valid) { + this.instructionForm.feTempHumRecordList = this.documentTableData + this.$axios.post(this.$api.deviceCheck.newHomeworkGuidebookAdded, this.instructionForm, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('鎿嶄綔鎴愬姛锛�') + this.dialogVisible = false + this.getList() + } + }) + } else { + return false; + } + }); + }, + clickSidebar(clickNodeVal) { + this.laboratoryNameIsNull = false + // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� + if (!clickNodeVal.value) { + this.list = []; + this.entity.laboratoryName = null + this.entity.storagePoint = null + // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� + if (clickNodeVal.label === '鍏朵粬') { + this.laboratoryNameIsNull = true + this.getAllDevice() + return + } + if (clickNodeVal.level === 1) { + this.entity.laboratoryName = clickNodeVal.label + // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� + } else if (clickNodeVal.level === 2) { + // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 + if (clickNodeVal.parent.label === '鍏朵粬') { + this.laboratoryNameIsNull = true + } else { + this.entity.laboratoryName = clickNodeVal.parent.label + } + this.entity.storagePoint = clickNodeVal.label + } + this.getAllDevice() + } + }, + //鏂板 + addFile() { + this.$refs.form.validate((valid) => { + if (valid) { + if (this.form.index !== undefined) { + this.$set(this.documentTableData, this.form.index, this.form) + this.dialogVisible1 = false; + this.$message.success('淇敼鎴愬姛'); + } else { + this.documentTableData.push(this.form); + // 鍒犻櫎鐢� + this.documentTableData.forEach((v, k) => { + v.index = k + }) + this.dialogVisible1 = false; + this.$message.success('娣诲姞鎴愬姛'); + } + } else { + return false; + } + }); + }, + editFun(row, index) { + this.form = {...row} + // 鏇存柊鐢� + this.form.index = index; + // 鍥炴樉鍒楄〃 + if (this.form.fileSystemName) { + this.fileList.push({name: this.form.fileName}) + } + this.dialogVisible1 = true + }, + handleSelectionChange(selected) { + this.selectedRow = selected + }, + async delFile() { + if (this.selectedRow.length === 0) { + this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑閫夐」'); + return; + } + // 鍒犻櫎淇濆瓨濂界殑鏁版嵁 + let ids = this.selectedRow + .filter(item => item.id!== undefined) + .map(item => item.id).join(','); + //鏈夐敊璇� + const res = await this.$axios.get(this.$api.deviceCheck.deleteHomeworkGuidebook + '?ids=' + ids); + if (res.code === 200) { + // 鍒犻櫎瑙嗗浘鐨勬暟鎹� + for (const resKey in this.selectedRow) { + this.documentTableData = this.documentTableData.filter(item => item.index === this.selectedRow[resKey].index) + } + this.$message.success({ + message: '鍒犻櫎鎴愬姛', + type: 'success' + }); + } + }, + onSuccess(response, file, fileList) { + this.form.fileName = file.name; + this.form.fileSystemName = response.data; + }, + onSuccess1(response, file, fileList) { + this.instructionForm.fileName = file.name; + this.instructionForm.fileSystemName = response.data; + }, + onError(error, file, fileList) { + this.$message.error('涓婁紶澶辫触:', error, file, fileList); + }, + handleRemove(file, fileList) { + this.form.fileName = '' + this.form.fileSystemName = '' + }, + handleRemove1(file, fileList) { + this.form.fileName = '' + this.form.fileSystemName = '' + }, + beforeRemove(file) { + return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋) + }, + handleExceed(files, fileList) { + this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙); + }, + getList() { + this.$axios.get(this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions + "?size=" + this.search.size + "¤t=" + this.search.current).then(res => { + if (res.code == 200) { + this.tableData = res.data.records; + this.search.total = res.data.total + } + }) + }, + getAllDevice() { + this.$axios.post(this.$api.deviceScope.selectDeviceParameter + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull, { + page: { + current: 1, + size: -1 + }, + entity: this.entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.devices = res.data.body.records; + this.updateDeviceNameOptions(); + } + }) + }, + // 鏇存柊璁惧鍚嶇О涓嬫媺妗嗙殑閫夐」 + updateDeviceNameOptions() { + this.deviceNameOption = this.devices.map(device => ({ + value: device.deviceName, + label: device.deviceName + })); + }, + // 璁惧鍚嶇О鏀瑰彉鏃惰Е鍙� + onDeviceNameChange() { + // 鏍规嵁閫変腑鐨勮澶囧悕绉帮紝鏇存柊绠$悊缂栧彿涓嬫媺妗嗙殑閫夐」 + const selectedDevice = this.devices.find(device => device.deviceName === this.form.deviceName); + if (selectedDevice) { + this.form.deviceNumber = selectedDevice.managementNumber; + this.form.deviceModel = selectedDevice.specificationModel; + this.form.deviceId = selectedDevice.id + } + }, + }, + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + action() { + return this.javaApi + this.$api.personnel.saveCNASFile + } + }, +} +</script> + +<style scoped> + +h4 { + font-weight: 400; + font-size: 16px; + display: flex; + justify-content: flex-end; + margin: 10px 0; +} +</style> diff --git a/src/components/do/a6-device/operation-overview.vue b/src/components/do/a6-device/operation-overview.vue index a1084da..c0c809d 100644 --- a/src/components/do/a6-device/operation-overview.vue +++ b/src/components/do/a6-device/operation-overview.vue @@ -1,100 +1,65 @@ +<!-- 璁惧杩愯鎬昏 --> <template> - <div class="page"> - <echart-module :id="'page-left'" :config="chartConfig" :datas="chartData" class="page-left"></echart-module> - <div class="page-right"> - <div class="form-item"> - <label>鏁呴殰娆℃暟</label> - <span>0</span> - </div> - <div class="form-item"> - <label>鏈�杩戞晠闅滄棩鏈�</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>鏈�杩戞牎鍑嗘棩鏈�</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>涓嬫鏍″噯鏃ユ湡</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>鏍″噯鎬荤粨璁�</label> - <el-radio-group v-model="form.value1" disabled> - <el-radio :label="0">鍚堟牸</el-radio> - <el-radio :label="1">涓嶅悎鏍�</el-radio> - <el-radio :label="2">鍏朵粬</el-radio> - </el-radio-group> - </div> - <div class="form-item"> - <label>鏈�杩戞牳鏌ユ棩鏈�</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>涓嬫鏍告煡鏃ユ湡</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>鏍告煡鎬荤粨璁�</label> - <el-radio-group v-model="form.value1" disabled> - <el-radio :label="0">鍚堟牸</el-radio> - <el-radio :label="1">涓嶅悎鏍�</el-radio> - <el-radio :label="2">鍏朵粬</el-radio> - </el-radio-group> - </div> - <div class="form-item"> - <label>鏈�杩戠淮鎶ゆ棩鏈�</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>涓嬫缁存姢鏃ユ湡</label> - <el-date-picker - v-model="form.value1" - type="date" - size="small" - placeholder="閫夋嫨鏃ユ湡" style="width: calc(100% - 200px);" readonly> - </el-date-picker> - </div> - <div class="form-item"> - <label>缁存姢绫诲瀷</label> - <el-radio-group v-model="form.value1" disabled> - <el-radio :label="0">浣跨敤鍓嶅悗缁存姢</el-radio> - <el-radio :label="1">璁″垝涓淮鎶�</el-radio> - </el-radio-group> - </div> - <div class="form-item"> - <label>娴嬮噺椤圭洰</label> - <span>1111111</span> + <div> + <div class="page"> + <echart-module id="'page-left'" :config="chartConfig" :datas="chartData" class="page-left"></echart-module> + <div class="page-right"> + <div class="form-item"> + <label>鍚敤鏃堕暱(骞�)</label> + <span>{{deviceData.usedYears}}</span> + </div> + <div class="form-item"> + <label>鏁呴殰娆℃暟</label> + <span>{{deviceData.faultCount}}</span> + </div> + <div class="form-item"> + <label>鏈�杩戞晠闅滄棩鏈�</label> + <span>{{ deviceData.faultDate }}</span> + </div> + <div class="form-item"> + <label>鏈�杩戞牎鍑嗘棩鏈�</label> + <span>{{deviceData.lastCalibrationDate }}</span> + </div> + <div class="form-item"> + <label>涓嬫鏍″噯鏃ユ湡</label> + <span>{{deviceData.nextCalibrationDate}}</span> + </div> + <div class="form-item"> + <label>鏍″噯鎬荤粨璁�</label> + <span :class="formatColorStyle(deviceData.calibrateStatus)">{{ deviceData.calibrateStatus }}</span> + </div> + <div class="form-item"> + <label>鏈�杩戞牳鏌ユ棩鏈�</label> + <span>{{deviceData.lastExamineDate}}</span> + </div> + <div class="form-item"> + <label>涓嬫鏍告煡鏃ユ湡</label> + <span>{{deviceData.nextExamineDate}}</span> + </div> + <div class="form-item"> + <label>鏍告煡鎬荤粨璁�</label> + <span :class="formatColorStyle(deviceData.examineStatus)">{{deviceData.examineStatus}}</span> + </div> + <div class="form-item"> + <label>璁惧杩愯鐘舵��</label> + <span :class="formatColorStyle(deviceData.deviceStatus)">{{deviceData.deviceStatus}}</span> + </div> + <div class="form-item"> + <label>鏈�杩戠淮鎶ゆ棩鏈�</label> + <span>{{ deviceData.maintenanceDate }}</span> + </div> + <div class="form-item"> + <label>涓嬫缁存姢鏃ユ湡</label> + <span>{{ deviceData.nextMaintenanceDate }}</span> + </div> + <div class="form-item"> + <label>缁存姢绫诲瀷</label> + <span>{{ deviceData.maintenanceType }}</span> + </div> + <div class="form-item"> + <label>娴嬮噺椤圭洰</label> + <span>{{ deviceData.insProduct }}</span> + </div> </div> </div> </div> @@ -102,8 +67,17 @@ <script> import EchartModule from '../../tool/echart.vue' + export default { components: {EchartModule}, + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, data(){ return { chartConfig:{ @@ -112,16 +86,77 @@ type:'gauge' }, chartData:{ - xData:[], - yData:[ - { - title:'浠诲姟鎺ユ敹閲�', - data:[] - } - ] + formatter: "宸茶繃鏍″噯鏃ユ湡鐧惧垎姣�: {c}%", + color:[ + [0.3, '#21a700'], + [0.7, '#0066ff'], + [1, '#d80000'] + ], + value: 0, }, form:{ value1:'' + }, + formData:{ + usedAge:12 + }, + //璁惧鏁版嵁鏀堕泦 + deviceData:{ + + } + } + }, + mounted(){ + //鑾峰彇璁惧鏁呴殰鐨勪俊鎭� + this.getDeviceInfo(this.clickNodeVal.value); + }, + methods:{ + formatColorStyle(status){ + if(status==null || status=="" || status==undefined){ + return "" + } + let styleStr = '' + switch(status){ + case"鍚堟牸": + styleStr = 'success' + break; + case"涓嶅悎鏍�": + styleStr = 'failed' + break; + case"鍏朵粬": + styleStr = 'other' + break; + case"姝e父": + styleStr = 'success' + break; + case"缁翠慨": + styleStr = 'other' + break; + case"鍋滅敤": + styleStr = 'stop' + break; + case"鎶ュ簾": + styleStr = 'failed' + break; + } + return styleStr; + }, + //鑾峰彇璁惧杩愯鎬昏淇℃伅 + getDeviceInfo(deviceId){ + this.$axios.get(this.$api.deviceFault.getDevice+"/"+deviceId).then(res=>{ + if(res.code==200){ + this.deviceData=res.data + this.chartData.value = res.data.progress + } + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� + if (this.clickNodeVal.value) { + this.getDeviceInfo(newVal.value) } } } @@ -131,7 +166,7 @@ <style scoped> .page{ width: 100%; - height: 100%; + height: 100vh; display: flex; } .page-left{ @@ -142,6 +177,8 @@ } .page-right{ flex: 1; + height:calc(100% - 200px); + overflow: scroll; /* background: red; */ } .form-item{ @@ -155,7 +192,19 @@ text-align: right; margin-right: 20px; } ->>>.el-radio__input.is-disabled+span.el-radio__label{ +.el-radio__input.is-disabled+span.el-radio__label{ color: #606266 !important; } +.success{ + color:#21a700 +} +.failed{ + color:#d80000 +} +.other{ + color: #e8a849; +} +.stop{ + color: #909399; +} </style> diff --git a/src/components/do/a6-device/record.vue b/src/components/do/a6-device/record.vue index 0d26a3d..3675e0e 100644 --- a/src/components/do/a6-device/record.vue +++ b/src/components/do/a6-device/record.vue @@ -1,13 +1,479 @@ +<!-- 浣跨敤璁板綍 --> <template> - <div>璁惧璁板綍</div> + <div> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鏍峰搧缂栧彿锛�</div> + <el-input v-model="search.sampleCode" clearable placeholder="璇疯緭鍏�" size="small" style="width: 70%;" + @keyup.enter.native="getTableList(clickNodeVal.value)"></el-input> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="resetSearch">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="getTableList(clickNodeVal.value)">鏌� 璇�</el-button> + </div> + <div class="btns"> + <el-button size="small" type="primary" @click="dialogVisible = true, openAdd()">鏂� 寤�</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵� 鍑�</el-button> + </div> + </div> + <div class="tables" style="margin-top: 10px;"> + <el-table ref="Recordtable" :data="formParamList" height="calc(100vh - 20em)"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column label="搴忓彿" type="index" width="120"> + <template v-slot="scope"> + <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + </template> + </el-table-column> + <el-table-column label="鏍峰搧缂栧彿" min-width="180" prop="sampleCode" /> + <el-table-column label="璁惧鍚嶇О" min-width="150" prop="deviceName" /> + <el-table-column label="绠$悊缂栧彿" min-width="150" prop="managementNumber" /> +<!-- <el-table-column label="娓╁害(掳C)" min-width="120" prop="temperature" />--> +<!-- <el-table-column label="婀垮害(%RH)" min-width="120" prop="humidity" />--> + <el-table-column label="浣跨敤鍓�" min-width="120" prop="useBefore"> + <template v-slot="scope"> + {{ scope.row.useBefore === 1 ? '姝e父' : '涓嶆甯�' }} + </template> + </el-table-column> + <el-table-column label="浣跨敤鍚�" min-width="120" prop="useAfter"> + <template v-slot="scope"> + {{ scope.row.useAfter === 1 ? '姝e父' : '涓嶆甯�' }} + </template> + </el-table-column> +<!-- <el-table-column label="寮傚父鎯呭喌" min-width="120" prop="abnormal" />--> + <el-table-column label="浣跨敤寮�濮嬫棩鏈�" min-width="150" prop="useStartDate" /> + <el-table-column label="浣跨敤缁撴潫鏃ユ湡" min-width="150" prop="useEndDate" /> + <el-table-column label="浣跨敤浜�" min-width="120" prop="usePerson" /> + <el-table-column label="澶囨敞" min-width="120" prop="remark" /> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="showDetailsDialog('edit',scope.row)">缂栬緫</el-button> + <el-button size="small" type="text" @click="showDetailsDialog('view',scope.row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(scope.$index, scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> + </div> + <el-dialog :visible.sync="dialogVisible" title="浠櫒璁惧浣跨敤璁板綍琛�" top="5vh" width="55%"> + <el-form ref="form" :model="form" label-width="130px"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: true, message: '鏍峰搧缂栧彿', trigger: 'blur' }]" label="鏍峰搧缂栧彿:" prop="sampleCode"> + <el-input v-model="form.sampleCode" :disabled="operationType === 'view'" size="small" style="width: 100%;"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О:" required> + <el-input v-model="form.deviceName" :disabled="operationType === 'view'" size="small" style="width: 100%;"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绠$悊缂栧彿:" required> + <el-input v-model="form.managementNumber" :disabled="operationType === 'view'" size="small" style="width: 100%;"></el-input> + </el-form-item> + </el-col> +<!-- <el-col :span="12">--> +<!-- <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ユ俯搴�(掳C)', trigger: 'blur' }]" label="娓╁害(掳C):"--> +<!-- prop="temperature">--> +<!-- <el-input v-model="form.temperature" :disabled="isShow" size="small" style="width: 100%;"></el-input>--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- <el-col :span="12">--> +<!-- <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ユ箍搴�(%RH)', trigger: 'blur' }]" label="婀垮害(%RH):"--> +<!-- prop="humidity">--> +<!-- <el-input v-model="form.humidity" :disabled="isShow" size="small" style="width: 100%;"></el-input>--> +<!-- </el-form-item>--> +<!-- </el-col>--> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇烽�夋嫨浣跨敤鍓�', trigger: 'change' }]" label="浣跨敤鍓�:" + prop="useBefore"> + <el-radio-group v-model="form.useBefore" :disabled="operationType === 'view'"> + <el-radio :label="1">姝e父</el-radio> + <el-radio :label="0">涓嶆甯�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇烽�夋嫨浣跨敤鍚�', trigger: 'change' }]" label="浣跨敤鍚�:" + prop="useAfter"> + <el-radio-group v-model="form.useAfter" :disabled="operationType === 'view'"> + <el-radio :label="1">姝e父</el-radio> + <el-radio :label="0">涓嶆甯�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> +<!-- <el-col v-if="form.useAfter === 0" :span="24">--> +<!-- <el-form-item :rules="[{ required: form.useAfter === 0, message: '璇疯緭鍏ュ紓甯告儏鍐�', trigger: 'blur' }]" label="寮傚父鎯呭喌:"--> +<!-- prop="abnormal">--> +<!-- <el-input v-model="form.abnormal" :disabled="operationType === 'view'" size="small" style="width: 100%;"--> +<!-- type="textarea"></el-input>--> +<!-- </el-form-item>--> +<!-- </el-col>--> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ヤ娇鐢ㄦ棩鏈�', trigger: 'blur' }]" label="浣跨敤鏃ユ湡:" + prop="useDateList"> + <el-date-picker + v-model="form.useDateList" :disabled="operationType === 'view'" end-placeholder="缁撴潫鏃ユ湡" format="yyyy-MM-dd HH:mm:ss" + size="small" + start-placeholder="寮�濮嬫棩鏈�" + style="width:100%" + type="datetimerange" + value-format="yyyy-MM-dd HH:mm:ss"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ヤ娇鐢ㄤ汉', trigger: 'change' }]" label="浣跨敤浜�:" + prop="usePersonId"> + <el-select @change="usePersonName" v-model="form.usePersonId" :disabled="operationType === 'view'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞:"> + <el-input v-model="form.remark" :disabled="operationType === 'view'" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogVisible = false">鍙� 娑�</el-button> + <el-button v-if="operationType !== 'view'" type="primary" @click="saveRecord">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> </template> - <script> export default { - + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + return { + search: { + size: 20, + current: 1, + total: 0, + sampleCode: '' + }, + responsiblePersonList: {}, + isShow: false, + outLoading: false, + userList: [], + form: { + // deviceId:'', + processNumber: '', + deviceName: '', + managementNumber: '', + //娓╁害 + temperature: '', + //婀垮害 + humidity: '', + //浣跨敤鍓� + useBefore: 1, + //浣跨敤鍚� + useAfter: 1, + //寮傚父鎯呭喌 + abnormal: '', + useDateList: [], + //浣跨敤鏃ユ湡 + useStartDate: null, + useEndDate: null, + //浣跨敤浜� + usePerson: '', + usePersonId: '', + //澶囨敞 + remark: '', + }, + dialogVisible: false, + operationType: '', + formParamList: [], + } + }, + mounted() { + this.getTableList(this.clickNodeVal.value); + }, + methods: { + handleSizeChange(val) { + this.search.size = val + this.getTableList(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val + this.getTableList(this.clickNodeVal.value); + }, + resetSearch() { + this.search = { + size: 20, + current: 1, + total: 0, + sampleCode: '', + } + this.getTableList(this.clickNodeVal.value); + }, + async getTableList(deviceId) { + await this.$axios.get(this.$api.deviceCheck.deviceRecordPage + "?deviceId=" + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&sampleCode=" + this.search.sampleCode).then(res => { + if (res.code == 200) { + this.formParamList = res.data.records + this.search.total = res.data.total + } + }) + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.exportUseRecord + "?deviceId=" + this.clickNodeVal.value, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧浣跨敤璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧浣跨敤璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + //鏂板缓 + openAdd() { + this.operationType = 'add' + this.getUserList() + this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => { + this.form.deviceName = res.data.deviceName + this.form.managementNumber = res.data.managementNumber + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + }); + }, + usePersonName (value) { + const index = this.userList.findIndex(item => item.id === value) + if (index > -1) { + this.form.usePerson = this.userList[index].name + } + }, + //纭娣诲姞璁板綍 + saveRecord() { + this.$refs.form.validate((valid) => { + if (valid) { + this.form.useStartDate = this.form.useDateList[0] + this.form.useEndDate = this.form.useDateList[1] + this.form.deviceId = this.clickNodeVal.value + if (this.operationType === 'add') { + this.$axios.post(this.$api.deviceCheck.saveDeviceRecord, this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.getTableList(this.clickNodeVal.value) + this.dialogVisible = false + } + }) + this.dialogVisible = false; + } else { + this.$axios.post(this.$api.deviceCheck.updateDeviceRecord, this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('淇敼鎴愬姛') + this.getTableList(this.clickNodeVal.value) + this.dialogVisible = false + } + }) + this.dialogVisible = false; + } + } + }); + }, + //鏌ョ湅璇︽儏 + showDetailsDialog(type,row) { + this.operationType = type; + console.log(row) + this.dialogVisible = true; + this.getUserList() + this.form = row; + let list = [] + if (row.useStartDate === null) { + row.useStartDate = '' + } + if (row.useEndDate === null) { + row.useEndDate = '' + } + list.push(row.useStartDate) + list.push(row.useEndDate) + this.$set(this.form, 'useDateList', list) + }, + handleDeleteClick(index, row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceRecord + '?id=' + row.id).then(res => { + this.formParamList.splice(index, 1); + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getTableList(newVal.value); + } + }, + dialogVisible(newVal) { + if (newVal === false) { + this.form = { + // deviceId:'', + sampleCode: '', + deviceName: '', + managementNumber: '', + //娓╁害 + temperature: '', + //婀垮害 + humidity: '', + //浣跨敤鍓� + useBefore: 1, + //浣跨敤鍚� + useAfter: 1, + //寮傚父鎯呭喌 + abnormal: '', + //浣跨敤鏃ユ湡 + useDateList: [], + //浣跨敤浜� + usePersonId: '', + //澶囨敞 + remark: '', + } + this.$refs.form.clearValidate() + } + } + } } </script> <style scoped> +.tables { + width: 100%; + height: calc(100vh - 15em); +} +.el-from { + max-width: 400px; + margin: 0 auto; +} + +.form-row { + display: flex; + justify-content: space-between; +} + +.el-input { + width: calc(100% - 120px); + /* 纭繚杈撳叆妗嗗搴︿竴鑷� */ +} + +.form-row .el-form-item { + flex: 1; + /* 姣忎釜琛ㄥ崟椤瑰崰鎹浉鍚屾瘮渚嬬殑绌洪棿 */ + margin-right: 100px; + /* 鍙�夛細涓哄彸渚у厓绱犳坊鍔犻棿璺� */ +} + +/* 绉婚櫎鏈�鍚庝竴涓厓绱犵殑鍙宠竟璺� */ +.form-row .el-form-item:last-child { + margin-right: 0; + +} + +.search { + background-color: #fff; + margin-top: 10px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + display: flex; + align-items: center; + height: 40px; + +} + +.search_label { + width: 80px; + font-size: 14px; + text-align: right; + margin-right: 10px; +} + +.btns { + position: absolute; + right: 0px; + top: 50%; + transform: translate(0, -50%); +} </style> diff --git a/src/components/do/a6-device/resource-reservation.vue b/src/components/do/a6-device/resource-reservation.vue new file mode 100644 index 0000000..6f61a6f --- /dev/null +++ b/src/components/do/a6-device/resource-reservation.vue @@ -0,0 +1,504 @@ +<!-- 璧勬簮棰勫畾 --> +<template> + <div class=""> + <div style="margin-top: 10px"> + <el-row class="title"> + <el-col :span="12" style="text-align: left;">棰勫畾鎬昏</el-col> + <el-col :span="12" style="text-align: left;padding-bottom:10px"> + <el-date-picker + v-model="startTime" + format="yyyy-MM-dd" + placeholder="閫夋嫨璧峰鏃ユ湡" + size="mini" + type="date" + value-format="yyyy-MM-dd"/> + 鑷� + <el-date-picker + v-model="endTime" + format="yyyy-MM-dd" + placeholder="閫夋嫨缁撴潫鏃ユ湡" + size="mini" + type="date" + value-format="yyyy-MM-dd"/> + <el-button size="mini" type="primary" @click="ValidateAndQuery">鏌� 璇�</el-button> + </el-col> + </el-row> + </div> + <div class="table-container"> + <el-table :data="tableData" border class="scrollable-table" style="width: 100%"> + <el-table-column label="搴忓彿" + type="index" + width="60"> + </el-table-column> + <el-table-column label="璁惧" min-width="60" prop="deviceName"/> + <el-table-column label="鏃堕棿" min-width="60" prop="time"/> + <el-table-column v-for="date in dates" :key="date" :label="date"> + <template #default="{ row }"> + <el-button v-if="!row[date]" size="mini" type="primary" @click="openModal(date, row)"> + {{ getDisplayText(row, date) }} + </el-button> + <span v-else></span> + </template> + </el-table-column> + </el-table> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="showModal" title="棰勫畾淇℃伅" + top="5vh" width="70%"> + <h4> + <el-button v-if="isBeforeDate()" size="small" @click="cancelReservation(selectedRow)">鍙栨秷棰勫畾</el-button> + <el-button v-if="isBeforeDate()" size="small" type="primary" @click="openAdd()">鏂板缓棰勫畾</el-button> + </h4> + <el-table ref="table" :data="tableData2" style="width: 100%" tooltip-effect="dark" + @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55%"> + </el-table-column> + <el-table-column label="搴忓彿" width="120"> + <template #default="{ row, $index }"> + <!-- 浣跨敤 $index 鏉ヨ幏鍙栬绱㈠紩锛岄�氬父浠�0寮�濮嬶紝鎵�浠�+1浠ョ鍚堝父瑙勫簭鍙蜂範鎯� --> + {{ $index + 1 }} + </template> + </el-table-column> + <el-table-column label="棰勫畾缂栧彿" prop="deviceNumber" width="120"> + </el-table-column> + <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip> + </el-table-column> + <el-table-column label="鑱旂郴浜�" prop="linkPerson" show-overflow-tooltip> + </el-table-column> + <el-table-column label="鑱旂郴鐢佃瘽" prop="phone" show-overflow-tooltip> + </el-table-column> + <el-table-column label="棰勫畾璇存槑" prop="reservationSpecification" show-overflow-tooltip> + </el-table-column> + <el-table-column label="鍒涘缓浜�" prop="name" show-overflow-tooltip> + </el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" prop="createDate" show-overflow-tooltip> + </el-table-column> + </el-table> + </el-dialog> + </div> + <el-dialog :visible.sync="addVisiable" title="鏂板缓棰勫畾" top="5vh" width="40%"> + <el-form ref="addReservationForm" :model="addReservation" :rules="rules" label-width="90px"> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="棰勫畾璁惧:"> + <el-input v-model="addReservation.deviceName"></el-input> + </el-form-item> + <el-form-item label="瀹㈡埛鍚嶇О:"> + <el-input v-model="addReservation.customerName"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="棰勫畾鏃堕棿:"> + <el-input v-model="addReservation.reservationTime"></el-input> + </el-form-item> + <el-form-item label="娴佺▼缂栧彿:"> + <el-input v-model="addReservation.deviceNumber"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴浜�:"> + <el-input v-model="addReservation.linkPerson"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴鐢佃瘽:" prop="phone"> + <el-input v-model="addReservation.phone"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="棰勫畾璇存槑:" required> + <el-input v-model="addReservation.reservationSpecification" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="addVisiable = false">鍙� 娑�</el-button> + <el-button type="primary" @click="addRecord">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + + return { + // startDate: new Date(), + // endDate: new Date(new Date().setDate(new Date().getDate() + 3)), + // startDate:'', + // endDate:'', + timeSlots: ['09:00-12:00', '13:00-18:00', '18:00-22:00'], + dates: [], + showModal: false, + selectedDate: '', + selectedTime: '', + selectedDevice: '', + tableData: [ + { + id: '', + deviceName: '', + date: '' + } + ], + tableData2: [], + selectedReservationId: null, // 鐢ㄤ簬瀛樺偍閫変腑鐨処D + selectedRow: null, + addVisiable: false, + laboratoryNameIsNull: false, + currentPage: 1, // 褰撳墠椤� + pageSize: 16, // 涓�椤�16鏉� + startTime: '', + endTime: '', + entity: { + deviceName: null, + laboratoryName: '', + storagePoint: '', + }, + addReservation: { + deviceName: '', + reservationTime: '', + specificTime: '', + customerName: '', + deviceNumber: '', + linkPerson: '', + phone: '', + reservationSpecification: '' + }, + total: '', + // loading:true, + componentData: { + entity: { + largeCategory: null, + orderBy: { + field: 'id', + order: 'asc' + } + }, + }, + yuyue: null, + yuyuetime: '', + rules: { + phone: [ + {required: true, message: '璇疯緭鍏ヨ仈绯荤數璇�', + trigger: 'blur'}, + {pattern: /^1[3456789]\d{9}$/, + message: '璇疯緭鍏ユ纭殑鎵嬫満鍙风爜', + trigger: ['blur', 'change'] + } + ] + }, + appointment: '' + } + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + this.clickSidebar(newVal) + } + }, + + created() { + this.clickSidebar(this.clickNodeVal) + this.initDate(); + }, + mounted() { + this.getAllDeviceParam(); + + }, + methods: { + isBeforeDate() { + let currentDate = this.$moment().format('YYYY-MM-DD') + let currentTime = this.$moment().format('HH') + const appointment = this.appointment && this.appointment.split('-') + let appointment0 = '' + let appointment1 = '' + if (appointment !== '') { + appointment0 = appointment[0].slice(0,2) + appointment1 = appointment[1].slice(0,2) + } + if (currentDate < this.yuyuetime) { + // 鏈潵鐨勬棩鏈燂紝涓�瀹氳兘鏂板棰勭害 + return true + } else if (currentDate === this.yuyuetime) { + // 褰撳ぉ鐨勬棩鏈燂紝宸茬粡杩囦簡鐨勬椂闂翠笉鍙彇娑堝拰鏂板 + if (currentTime < appointment1) { + return true + } else if (currentTime > appointment1) { + return false + } + } + }, + getDisplayText(row, date) { + if (!row || row.dateList === null || row.dateList === undefined || row.dateList === "") { + return '棰勭害'; + } + var dateLst = row.dateList + for (const dateLstElement of dateLst) { + if (dateLstElement.date === date) { + if (dateLstElement.value === 0) { + return '棰勭害'; + } else { + return dateLstElement.value; + } + } + } + return '棰勭害'; + }, + + ValidateAndQuery() { + if (!this.startTime || !this.endTime) { + this.$message.error('璇烽�夋嫨鏃ユ湡鑼冨洿'); + return; + } + if((new Date(this.endTime)-new Date(this.startTime))/(1000*60*60*24) >= 10) { + this.$message.error('鍙兘棰勭害10澶╀互鍐�'); + return; + } + if (new Date(this.startTime) > new Date(this.endTime)) { + this.$message.error('寮�濮嬫棩鏈熶笉鑳藉ぇ浜庣粨鏉熸棩鏈�'); + return; + } + this.query(); + }, + initDate(){ + if(this.startTime=='' || this.endTime=='' ||this.startTime==null||this.endTime==null){ + const daysAdd = 3; + const now = new Date(); + this.startTime = now.getFullYear() + "-" + + String(now.getMonth() + 1).padStart(2, '0') + "-" + + String(now.getDate()).padStart(2, '0'); + let endTime = new Date(now); + endTime.setDate(now.getDate() + daysAdd); + this.endTime = endTime.getFullYear() + "-" + + String(endTime.getMonth() + 1).padStart(2, '0') + "-" + + String(endTime.getDate()).padStart(2, '0'); + const start = new Date(this.startTime); + const end = new Date(this.endTime); + const tempDates = []; + while (start<=end) { + const year = start.getFullYear(); + const month = String(start.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝鎵�浠ュ姞1锛屽苟浣跨敤padStart琛�0 + const day = String(start.getDate()).padStart(2, '0'); // 浣跨敤padStart琛�0 + tempDates.push(`${year}-${month}-${day}`); + start.setDate(start.getDate() + 1); + } + this.dates = tempDates; + this.getStartTimeAndEndTime(); + }}, + query() { + if (this.startTime && this.endTime) { + const start = new Date(this.startTime); + const end = new Date(this.endTime); + const tempDates = []; + while (start <= end) { + const year = start.getFullYear(); + const month = String(start.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝鎵�浠ュ姞1锛屽苟浣跨敤padStart琛�0 + const day = String(start.getDate()).padStart(2, '0'); // 浣跨敤padStart琛�0 + tempDates.push(`${year}-${month}-${day}`); + start.setDate(start.getDate() + 1); + } + this.dates = tempDates; + this.getStartTimeAndEndTime(); + } + }, + //鏌ヨ鏃堕棿 + getStartTimeAndEndTime(){ + //鏌ヨ閫昏緫 + this.$axios.post(this.$api.deviceReservate.get + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull + "&starttime=" + this.startTime + "&endtime=" + this.endTime, { + page: { + current: this.currentPage, + size: this.pageSize + }, + entity: this.entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + const devices = res.data.body; + this.initTable(devices) + } + }) + }, + updateDates() { + if (this.startTime && this.endTime) { + const start = new Date(this.startDate); + const end = new Date(this.endDate); + const tempDates = []; + while (start <= end) { + const month = start.getMonth() + 1; + const day = start.getDate(); + tempDates.push(`${month}/${day}`); + start.setDate(start.getDate() + 1); + } + this.dates = tempDates; + this.initTableData(devices); + } + }, + getAllDeviceParam() { + this.$axios.post(this.$api.deviceReservate.get + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull, { + page: { + current: this.currentPage, + size: this.pageSize + }, + entity: this.entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + const devices = res.data.body; + this.initTable(devices) + } + }) + }, + initTable(devices) { + this.tableData = devices; + }, + openModal(date, row) { + this.yuyue = row; + this.yuyuetime = date; + this.appointment = row.time + this.showModal = true; + this.getList(); + }, + openAdd() { + this.addVisiable = true; + this.addReservation.deviceId = this.yuyue.id; + // this.addReservation.deviceNumber = this.yuyue.deviceNumber; + this.addReservation.deviceName = this.yuyue.deviceName; + this.addReservation.reservationTime = this.yuyuetime + " " + this.yuyue.time; + this.addReservation.specificTime = this.yuyue.time; + this.addReservation.deviceNumber = 'TX-ABC-01'+Math.floor(Math.random() * 10 + 1); + }, + handleSelectionChange(selected) { + this.selectedRow = selected.length > 0 ? selected : null; + }, + async cancelReservation(selectedRow) { + if (!selectedRow || selectedRow.length == 0) { + this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑棰勭害'); + return; + } + let ids = selectedRow.map(item => item.id).join(','); + try { + const res = await this.$axios.delete(this.$api.deviceReservate.del + '/' + ids); + if (res.code === 200) { + this.$message.success({ + message: '鍒犻櫎鎴愬姛', + type: 'success' + }); + this.getList(); + this.query(); + this.showModal = false; + } else { + this.$message.error({ + message: '鍒犻櫎澶辫触', + type: 'error' + }); + } + } catch (error) { + this.$message.error({ + message: '鍒犻櫎杩囩▼涓彂鐢熼敊璇紝璇风◢鍚庨噸璇�', + type: 'error' + }); + } + }, + addRecord() { + this.$refs.addReservationForm.validate((valid) => { + if (valid) { + this.addReservation.reservationTime = this.yuyuetime; + this.$axios.post(this.$api.deviceReservate.save, this.addReservation).then(res => { + if (res.code == 200) { + this.$message.success('淇濆瓨鎴愬姛') + this.addVisiable = false + this.getList(); + this.query(); + this.addReservation = {}; + } + }) + } else { + this.$message.error({message: '璇锋鏌ヨ〃鍗曞~鍐欐槸鍚︽纭�', type: 'error'}); + return false; + } + }); + }, + getList() { + this.$axios.post(this.$api.deviceReservate.list + "?deviceId=" + this.yuyue.id + "&reservationTime=" + this.yuyuetime + "&specificTime=" + this.yuyue.time).then(res => { + if (res.code == 200) { + this.tableData2 = res.data; + } + }) + }, + // 鐐瑰嚮渚ц竟鏍忓埛鏂� + clickSidebar(clickNodeVal) { + this.laboratoryNameIsNull = false + // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� + if (!clickNodeVal.value) { + this.finishLoding = false; + this.keyMap = {}; + this.currentPage = 1; + this.list = []; + this.entity.laboratoryName = null + this.entity.storagePoint = null + // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� + if (clickNodeVal.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + this.getAllDeviceParam(); + return + } + if (clickNodeVal.level == 1) { + this.entity.laboratoryName = clickNodeVal.label + // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� + } else if (clickNodeVal.level == 2) { + // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 + if (clickNodeVal.parent.label == '鍏朵粬') { + this.laboratoryNameIsNull = true + } else { + this.entity.laboratoryName = clickNodeVal.parent.label + } + this.entity.storagePoint = clickNodeVal.label + } + this.getAllDeviceParam(); + } + } + }, + +} +</script> + +<style scoped> +.table-container { + overflow: auto; + height: 500px; + /* 鍙互鏍规嵁闇�瑕佽皟鏁撮珮搴� */ +} + +.scrollable-table { + max-height: 100%; + overflow-y: auto; + /* overflow-x: auto; */ +} + +h4 { + font-weight: 400; + font-size: 16px; + display: flex; + justify-content: flex-end; + margin: 10px 0; +} + +.form-row { + display: flex; + justify-content: space-between; +} +</style> diff --git a/src/components/do/a6-device/state.vue b/src/components/do/a6-device/state.vue index fa4c76c..ceb8aa1 100644 --- a/src/components/do/a6-device/state.vue +++ b/src/components/do/a6-device/state.vue @@ -1,13 +1,650 @@ +<!-- 璁惧鍋滅敤鍚敤 --> <template> - <div>璁惧鍋滅敤/鍚敤</div> + <div> + <div class="search"> + <el-row :gutter="10" style="width: 100%;"> + <el-col :span="20" style="display: flex;flex-wrap: wrap;"> + <div class="search_thing"> + <div class="search_label">娴佺▼缂栧彿锛�</div> + <div class="search_input"> + <el-input v-model="search.processNumber" clearable placeholder="璇疯緭鍏�" size="small" style="width: 100%" + @keyup.enter.native="getDeviceStatePage(clickNodeVal.value)"></el-input> + </div> + </div> + <div class="search_thing" style="padding-left: 20px;"> + <el-button size="small" @click="resetSearch">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="getDeviceStatePage(clickNodeVal.value)">鏌� 璇�</el-button> + </div> + </el-col> + <el-col :span="4"> + <div class="btns"> + <el-button size="small" type="primary" @click="dialogVisible = true">鏂板缓</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button> + </div> + </el-col> + </el-row> + </div> + <div> + <el-table :data="tableDatalist" height="calc(100vh - 20em)" style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" + width="70"></el-table-column> + <el-table-column label="娴佺▼缂栧彿" min-width="180" prop="processNumber"></el-table-column> + <el-table-column label="璁惧鍚嶇О" min-width="180" prop="deviceName"></el-table-column> + <el-table-column label="绠$悊缂栧彿" min-width="150" prop="managementNumber"></el-table-column> + <el-table-column label="璁惧鐘舵��" min-width="130" prop="deviceStatus"> + <template #default="{ row }"> + {{ row.deviceStatus === '0scrap' ? '鎶ュ簾' : row.deviceStatus === '1startUsing' ? '鍚敤' : '鍋滅敤' }} + </template> + </el-table-column> + <el-table-column label="鍋滅敤/鍚敤鐞嗙敱" min-width="180" prop="reason"></el-table-column> + <el-table-column label="鎻愪氦浜�" min-width="130" prop="createUser"></el-table-column> + <el-table-column label="鎻愪氦鏃ユ湡" min-width="150" prop="createTime"></el-table-column> + <el-table-column label="褰撳墠鐘舵��" min-width="130" prop="currentState"></el-table-column> + <el-table-column label="褰撳墠璐d换浜�" min-width="180" prop="currentResponsible"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column fixed="right" label="鎿嶄綔" min-width="150"> + <template #default="{ row }"> + <el-button size="small" type="text" @click="handleViewClick(row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleDownOne(row)">瀵煎嚭</el-button> + <el-button size="small" type="text" @click="handleDeleteClick(row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="璁惧鎯呭喌" top="5vh" + width="60%" @open="openRecordAcceptance"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step v-for="(v, i) in steps" :key="i" :title="v" style="cursor:pointer" + @click.native="choiceStep(i)"></el-step> + </el-steps> + <el-form ref="form" :model="form" :rules="rules" label-width="130px"> + <div v-show="currentStepClick === 0"> + <el-card style="margin-top: 1em; height: 42vh; overflow-y: scroll;"> + <!-- 鍗$墖 --> + <el-row> + <el-col :span="24"> + <el-form-item label="娴佺▼缂栧彿锛�"> + <el-input v-model="form.processNumber" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绠$悊缂栧彿锛�"> + <el-input v-model="form.managementNumber" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О锛�"> + <el-input v-model="form.deviceName" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿锛�"> + <el-input v-model="form.specificationModel" disabled size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ラ厤浠�', trigger: 'blur' }]" label="閰嶄欢锛�" + prop="accessoryPart"> + <el-input v-model="form.accessoryPart" :disabled="currentStep !== 0" size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇烽�夋嫨璁惧鐘舵��', trigger: 'change' }]" label="璁惧鎯呭喌锛�" + prop="deviceStatus"> + <el-select v-model="form.deviceStatus" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" + style="width:100%"> + <el-option label="鎶ュ簾" value="0scrap"></el-option> + <el-option label="鍚敤" value="1startUsing"></el-option> + <el-option label="鍋滅敤" value="2stopUsing"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇疯緭鍏ュ仠鐢ㄥ惎鐢ㄧ悊鐢�', trigger: 'blur' }]" label="鍋滅敤鍚敤鐞嗙敱锛�" + prop="reason"> + <el-input v-model="form.reason" :disabled="currentStep !== 0" :rows="3" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 0, message: '璇烽�夋嫨涓嬬幆鑺傝矗浠讳汉', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="submitNextPesponsible"> + <el-select v-model="form.submitNextPesponsible" :disabled="currentStep !== 0" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.submitOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.submitDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 1"> + <el-card style="margin-top: 1em; height: 42vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item label="閮ㄩ棬璐熻矗浜烘剰瑙侊細" prop="departmentReviewOpinion"> + <el-input v-model="form.departmentReviewOpinion" :disabled="currentStep !== 1" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 1, message: '璇疯緭鍏ヤ笅鐜妭璐d换浜�', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="departmentNextPesponsible"> + <el-select v-model="form.departmentNextPesponsible" :disabled="currentStep !== 1" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.departmentOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.departmentDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 2"> + <el-card style="margin-top: 1em; height: 42vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 2, message: '璇疯緭鍏ヨ閲忓鎰忚', trigger: 'blur' }]" label="璁¢噺瀹ゆ剰瑙侊細" + prop="measuringRoomReviewOpinion"> + <el-input v-model="form.measuringRoomReviewOpinion" :disabled="currentStep !== 2" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 2, message: '璇疯緭鍏ヤ笅鐜妭璐d换浜�', trigger: 'blur' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="measuringRoomNextPesponsible"> + <el-select v-model="form.measuringRoomNextPesponsible" :disabled="currentStep !== 2" clearable filterable + placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.measuringRoomOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.measuringRoomDate }} + </el-col> + </el-row> + </div> + <div v-show="currentStepClick === 3"> + <el-card style="margin-top: 1em; height: 42vh; overflow-y: scroll;"> + <el-row> + <el-col :span="24"> + <el-form-item :rules="[{ required: currentStep === 3, message: '璇疯緭鍏ユ壒鍑嗘剰瑙�', trigger: 'blur' }]" label="鎵瑰噯鎰忚锛�" + prop="approvalOpinion"> + <el-input v-model="form.approvalOpinion" :disabled="currentStep !== 3" size="small" + type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item :rules="[{ required: currentStep === 3, message: '璇疯緭鍏ヤ笅鐜妭璐熻矗浜�', trigger: 'change' }]" label="涓嬬幆鑺傝矗浠讳汉锛�" + prop="approvalNextPesponsible"> + <el-select v-model="form.approvalNextPesponsible" :disabled="currentStep !== 3" clearable + filterable placeholder="璇烽�夋嫨涓嬬幆鑺傝礋璐d汉" size="small" style="width: 100%;"> + <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-card> + <el-row style="margin-top: 1em;"> + <el-col :span="4"> + 鎿嶄綔浜猴細{{ form.approvalOperatingPersonnel }} + </el-col> + <el-col :span="6"> + 鏃ユ湡锛歿{ form.approvalDate }} + </el-col> + </el-row> + </div> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button v-if="currentStep !== 0 && currentStep !== 4" :loading="sumbitLoading1" + @click="submitForm('3reject')">椹冲洖</el-button> + <el-button v-if="currentStep === 0" :loading="sumbitLoading2" @click="submitForm('2save')">淇濆瓨</el-button> + <el-button v-if="currentStep !== 4" :loading="sumbitLoading3" type="primary" @click="submitForm('1submit')"> + {{ currentStep === 0 ? '鎻愪氦' : '閫氳繃' }} + </el-button> + </span> + </el-dialog> + </div> </template> - <script> +import { dateFormat } from '../../../util/date' export default { + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + return { + outLoading: false, // 瀵煎嚭loading + dialogVisible: false, + form: {}, + currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳 + currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖� + steps: ['鎻愪氦', '閮ㄩ棬璐熻矗浜�', '璁¢噺瀹�', '鎵瑰噯浜�'], + responsibleOptions: [], // 涓嬬幆鑺傝礋璐d汉 + tableDatalist: [], // table琛ㄦ牸 + rules: { + quantity: [{ required: true, message: '璇疯緭鍏ユ暟閲�', trigger: 'blur' }], + }, + search: { + size: 20, + current: 1, + total: 0, + processNumber: '' + }, + sumbitLoading1: false, + sumbitLoading2: false, + sumbitLoading3: false, + } + }, + mounted() { + this.getDeviceStatePage(this.clickNodeVal.value) + }, + methods: { + // 鍒嗛〉 + handleSizeChange(val) { + this.search.size = val + this.getDeviceStatePage(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange(val) { + this.search.current = val + this.getDeviceStatePage(this.clickNodeVal.value) + }, + //鎻愪氦琛ㄥ崟 + async submitForm(saveState) { + let currentStepAction; + // 璁剧疆璇ユ搷浣滃垽鏂槸鍚︿负鎻愪氦锛屼繚瀛橈紝椹冲洖锛岄�氳繃 寮�鍚痩oding + switch (saveState) { + // 鎻愪氦锛岄�氳繃 + case '1submit': + currentStepAction = this.currentStep + 1 + this.sumbitLoading1 = true + break + // 淇濆瓨 + case '2save': + currentStepAction = this.currentStep + this.sumbitLoading2 = true + break + // 椹冲洖 + case '3reject': + currentStepAction = this.currentStep - 1 + this.sumbitLoading3 = true + break + default: + break + } + this.$refs.form.validate((valid) => { + if (valid === true || saveState !== '1submit') { + // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂� + let user = JSON.parse(localStorage.getItem('user')) + const dateTime = dateFormat(new Date()) + // 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡 + switch (this.currentStep) { + case 0: + this.form.createUser = user.name + this.form.submitOperatingPersonnel = user.name + this.form.submitDate = dateTime + break + case 1: + this.form.departmentOperatingPersonnel = user.name + this.form.departmentDate = dateTime + break + case 2: + this.form.measuringRoomOperatingPersonnel = user.name + this.form.measuringRoomDate = dateTime + break + case 3: + this.form.approvalOperatingPersonnel = user.name + this.form.approvalDate = dateTime + break + default: + break + } + // 鑾峰彇褰撳墠鐜妭璐熻矗浜� + switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) { + case 0: + this.form.currentResponsible = this.form.submitOperatingPersonnel + break + case 1: + this.form.currentResponsible = this.form.departmentOperatingPersonnel + break + case 2: + this.form.currentResponsible = this.form.measuringRoomOperatingPersonnel + break + case 3: + this.form.currentResponsible = this.form.approvalOperatingPersonnel + break + default: + break + } + // 鑾峰彇褰撳墠鐘舵�� + this.form.currentState = currentStepAction === 4 ? '鍏抽棴' : this.steps[currentStepAction] + this.form.deviceId = this.clickNodeVal.value + this.$axios.post(this.$api.deviceCheck.saveDeviceState, this.form, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.getDeviceStatePage(this.clickNodeVal.value) + this.dialogVisible = false + this.closeLoading() + } + this.closeLoading() + }) + } else { + let step = this.steps[this.currentStep] + this.$message.warning(step + ' 娴佺▼涓湁蹇呭~椤规湭濉紒'); + this.closeLoading() + } + }); + }, + closeLoading() { + this.sumbitLoading1 = false + this.sumbitLoading2 = false + this.sumbitLoading3 = false + }, + choiceStep(index) { + this.currentStepClick = index + }, + openRecordAcceptance() { + // 鑾峰彇璁惧鍩虹淇℃伅 + this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => { + this.form.deviceName = res.data.deviceName + this.form.specificationModel = res.data.specificationModel + this.form.managementNumber = res.data.managementNumber + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + }); + // 鑾峰彇璐熻矗浜轰俊鎭� + this.getUserList() + }, + // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� + getUserList() { + this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + if (res.code == 200) { + this.responsibleOptions = res.data + } + }) + }, + // 鏌ョ湅 + handleViewClick(row) { + this.form = { ...row } + // 濡傛灉绱㈠紩涓�6琛ㄧず鍏ㄩ儴閫氳繃 + this.currentStep = this.steps.indexOf(this.form.currentState) === -1 ? 4 : this.steps.indexOf(this.form.currentState) + this.currentStepClick = this.currentStep === 4 ? 0 : this.currentStep + this.$nextTick(() => { + this.$refs['form'].clearValidate() + }) + this.dialogVisible = true + }, + // 瀵煎嚭 + handleDownOne(row) { + this.outLoading = true + this.$axios.get(this.$api.deviceCheck.exportDeviceStatus + '?deviceId=' + row.deviceId + '&processNumber=' + row.processNumber, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鍋�/鍚敤.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鍋�/鍚敤.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + handleDeleteClick(row) { + this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.delete(this.$api.deviceCheck.deleteDeviceState + '?stateId=' + row.stateId).then(res => { + if (res.code == 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getDeviceStatePage(this.clickNodeVal.value) + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true + this.$axios.post(this.$api.deviceCheck.deviceStateExport, { + deviceId: this.clickNodeVal.value, + processNumber: this.search.processNumber + }, {responseType: "blob"}).then(res => { + this.outLoading = false + const blob = new Blob([res], {type: 'application/octet-stream'}); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鍋滅敤/鍚敤.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鍋滅敤/鍚敤.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }).finally(() => { + this.outLoading = false + }) + }, + resetSearch() { + this.search = { + size: 20, + current: 1, + total: 0, + processNumber: '', + } + this.getDeviceStatePage(this.clickNodeVal.value); + }, + getDeviceStatePage(deviceId) { + this.$axios.get(this.$api.deviceCheck.getDeviceStatePage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&processNumber=" + this.search.processNumber).then(res => { + if (res.code == 200) { + this.tableDatalist = res.data.records + this.search.total = res.data.total + } + }) + } + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.componentData.entity.deviceId = this.clickNodeVal.value + this.entityCopy = this.HaveJson(this.componentData.entity) + this.getDeviceStatePage(newVal.value) + } + }, + dialogVisible(newVal) { + if (!newVal) { + this.form = { + } + this.closeLoading() + this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳 + this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖� + this.$refs['form'].clearValidate() + } + } + }, } </script> <style scoped> +.dialog-content { + max-height: 70vh; + /* 璁剧疆鏈�澶ч珮搴� */ + overflow-y: auto; + /* 鍚敤鍨傜洿婊氬姩 */ +} +h4 { + font-weight: 400; + font-size: 16px; + margin: 10px 0; +} + +/* +淇濆瓨鎻愪氦鎸夐挳鏍峰紡 +*/ +h4 .title { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; +} + +h4 .title .line { + display: inline-block; + width: 3px; + height: 16px; + background: #3A7BFA; + margin-right: 4px; +} + +.tables { + width: 100%; + height: calc(100vh - 15em); +} + +.el-from { + max-width: 400px; + margin: 0 auto; +} + +.form-row { + display: flex; + justify-content: space-between; +} + + +.form-row .el-form-item { + flex: 1; + /* 姣忎釜琛ㄥ崟椤瑰崰鎹浉鍚屾瘮渚嬬殑绌洪棿 */ + margin-right: 100px; + /* 鍙�夛細涓哄彸渚у厓绱犳坊鍔犻棿璺� */ +} + +/* 绉婚櫎鏈�鍚庝竴涓厓绱犵殑鍙宠竟璺� */ +.form-row .el-form-item:last-child { + margin-right: 0; + +} + +.search { + background-color: #fff; + margin: 10px 0; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + display: flex; + align-items: center; + height: 40px; +} + +.search_label { + width: 70px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: 70%; +} + +.btns { + position: absolute; + right: 0; + top: 50%; + transform: translate(0, -50%); +} + +.form .search_label { + width: 120px; +} </style> diff --git a/src/components/equipment/acceptance-form.vue b/src/components/equipment/acceptance-form.vue new file mode 100644 index 0000000..21229d4 --- /dev/null +++ b/src/components/equipment/acceptance-form.vue @@ -0,0 +1,210 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧楠屾敹鍗�" + width="80%" @close="resetForm"> + <el-form ref="modelForm" + :model="form" :rules="rules" label-width="180px"> + <el-col :span="12"> + <el-form-item label="鍒拌揣鏃ユ湡锛�" prop="arrivalDate"> + <el-date-picker + v-model="form.arrivalDate" + type="date" + placeholder="閫夋嫨鏃ユ湡" + size="small" + format="yyyy-MM-dd" + style="width: 100%" + value-format="yyyy-MM-dd" + :disabled="operationType === 'view'"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閲戦锛�" prop="goldAmount"> + <el-input v-model="form.goldAmount" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="缁翠慨鍗曚綅锛�" prop="maintenanceunit"> + <el-input v-model="form.maintenanceunit" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏀惰澶囦富鏈哄拰澶囦欢鎯呭喌锛�" prop="spareParts"> + <el-input v-model="form.spareParts" :disabled="operationType === 'view'" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瀹夎銆佽皟璇曟儏鍐碉細" prop="installationDebugging"> + <el-input v-model="form.installationDebugging" :disabled="operationType === 'view'" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="楠屾敹鎯呭喌锛�" prop="checkSituation"> + <el-input v-model="form.checkSituation" :disabled="operationType === 'view'" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎺ユ敹绛惧瓧锛�" prop="receivingSignature"> + <el-input v-model="form.receivingSignature" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍘傚浠h〃锛�" prop="producer"> + <el-input v-model="form.producer" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎺ユ敹浜猴細" prop="recipient"> + <el-input v-model="form.recipient" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎺ユ敹鏃ユ湡锛�" prop="recipientDate"> + <el-date-picker + v-model="form.recipientDate" + type="date" + placeholder="閫夋嫨鏃ユ湡" + size="small" + format="yyyy-MM-dd" + style="width: 100%" + value-format="yyyy-MM-dd" + :disabled="operationType === 'view'"> + </el-date-picker> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="operationType !== 'view'" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "acceptance-form", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + arrivalDate: '', + goldAmount: '', + maintenanceunit: '', + spareParts: '', + installationDebugging: '', + checkSituation: '', + receivingSignature: '', + producer: '', + recipient: '', + recipientDate: '', + deviceId: '', + }, + operationType: '', + rules: { + arrivalDate: [{required: true, message: '璇烽�夋嫨鍒拌揣鏃ユ湡', trigger: 'change'}], + }, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + // 鎵撳紑寮规 + openDialog(type, id, deviceId) { + this.dialogVisible = true + this.operationType = type + this.form.acceptanceId = id + this.form.deviceId = deviceId + this.getUserList() + if (this.form.acceptanceId) { + this.searchInfo() + } + }, + // 鏌ヨ璇︽儏 + searchInfo() { + this.$axios.get(this.$api.deviceAcceptance.getDeviceAcceptance + '?acceptanceId=' + this.form.acceptanceId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + } + }).catch(error => { + console.error(error) + }) + }, + // 鎻愪氦琛ㄥ崟 + submitForm() { + this.$refs.modelForm.validate((valid) => { + if (valid) { + if (this.operationType === 'add') { + this.$axios.post(this.$api.deviceAcceptance.addDeviceAcceptance, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.$axios.post(this.$api.deviceAcceptance.updateDeviceAcceptance, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('淇敼鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + } + }) + }, + // 鍏抽棴寮规 + resetForm() { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList() { + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/accident-form.vue b/src/components/equipment/accident-form.vue new file mode 100644 index 0000000..60b83a4 --- /dev/null +++ b/src/components/equipment/accident-form.vue @@ -0,0 +1,236 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="dialogVisible" title="浠櫒璁惧浜嬫晠鎶ュ憡鍗�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓鎶ュ憡鍗�" @click.native="setStep(0)"></el-step> + <el-step title="浜嬫晠鎹熷け鎯呭喌璇勪及" @click.native="setStep(1)"></el-step> + <el-step title="閮ㄩ棬璐熻矗浜烘剰瑙�" @click.native="setStep(2)"></el-step> + <el-step title="鎶�鏈礋璐d汉鎰忚" @click.native="setStep(3)"></el-step> + <el-step title="涓讳换鎰忚" @click.native="setStep(4)"></el-step> + </el-steps> + <el-form ref="modelForm" + :model="form" :rules="rules" label-width="160px"> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鍦扮偣锛�" prop="address"> + <el-input v-model="form.address" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鏃ユ湡锛�" prop="accidentDate"> + <el-date-picker + v-model="form.accidentDate" + :disabled="currentStep !== 0" + format="yyyy-MM-dd HH:mm:ss" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 100%" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="浜嬫晠鎯呭喌鎻忚堪锛�" prop="descriptionOfAccident"> + <el-input v-model="form.descriptionOfAccident" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="璇烽�夋嫨璇勪及浜猴細" prop="assessorUserId"> + <el-select v-model="form.assessorUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="浜嬫晠鎹熷け鎯呭喌璇勪及锛�" prop="assessorOpinion"> + <el-input v-model="form.assessorOpinion" :disabled="currentStep !== 1" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="璇烽�夋嫨閮ㄩ棬璐熻矗浜猴細" prop="departmentHeadUserId"> + <el-select v-model="form.departmentHeadUserId" :disabled="currentStep !== 1" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="閮ㄩ棬璐熻矗浜烘剰瑙侊細" prop="departmentHeadOpinion"> + <el-input v-model="form.departmentHeadOpinion" :disabled="currentStep !== 2" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="璇烽�夋嫨鎶�鏈礋璐d汉锛�" prop="technicalDirectorUserId"> + <el-select v-model="form.technicalDirectorUserId" :disabled="currentStep !== 2" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 3" :span="24"> + <el-form-item label="鎶�鏈礋璐d汉鎰忚锛�" prop="technicalDirectorOpinion"> + <el-input v-model="form.technicalDirectorOpinion" :disabled="currentStep !== 3" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 3" :span="24"> + <el-form-item label="璇烽�夋嫨涓讳换锛�" prop="directorHeadUserId"> + <el-select v-model="form.directorHeadUserId" :disabled="currentStep !== 3" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 4" :span="24"> + <el-form-item label="涓讳换鎰忚锛�" prop="directorHeadOpinion"> + <el-input v-model="form.directorHeadOpinion" :disabled="currentStep !== 4" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep !== 5" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "accident-form", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + accidentReportId: '', + address: '', + accidentDate: '', + descriptionOfAccident: '', + assessorUserId: '', + assessorOpinion: '', + departmentHeadUserId: '', + departmentHeadOpinion: '', + technicalDirectorUserId: '', + technicalDirectorOpinion: '', + directorHeadUserId: '', + directorHeadOpinion: '', + flowType: '', + deviceId: '', + }, + currentStep: 0, + showStep: 0, + rules: { + assessorUserId: [{ required: true, message: '璇烽�夋嫨璇勪及浜�', trigger: 'change' }], + departmentHeadUserId: [{ required: true, message: '璇烽�夋嫨閮ㄩ棬璐熻矗浜�', trigger: 'change' }], + technicalDirectorUserId: [{ required: true, message: '璇烽�夋嫨鎶�鏈礋璐d汉', trigger: 'change' }], + directorHeadUserId: [{ required: true, message: '璇烽�夋嫨涓讳换', trigger: 'change' }], + directorHeadOpinion: [{ required: true, message: '璇峰~鍐欐剰瑙�', trigger: 'blur' }], + }, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + // 鎵撳紑寮规 + openDialog (id, deviceId) { + this.dialogVisible = true + this.form.accidentReportId = id + this.form.deviceId = deviceId + this.getUserList() + if (this.form.accidentReportId) { + this.searchInfo() + } + }, + // 鏌ヨ璇︽儏 + searchInfo () { + this.$axios.get(this.$api.deviceAccidentReport.getDeviceAccidentReport+'?accidentReportId=' + this.form.accidentReportId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + if (res.data.isFinish === 0) { + if (this.form.assessorUserId) { + this.currentStep = 1 + this.showStep = 1 + } + if (this.form.departmentHeadUserId) { + this.currentStep = 2 + this.showStep = 2 + } + if (this.form.technicalDirectorUserId) { + this.currentStep = 3 + this.showStep = 3 + } + if (this.form.directorHeadUserId) { + this.currentStep = 4 + this.showStep = 4 + } + } else { + this.currentStep = 5 + this.showStep = 4 + } + } + }).catch(error => { + console.error(error) + }) + }, + setStep (step) { + this.showStep = step + }, + // 鎻愪氦琛ㄥ崟 + submitForm () { + this.form.flowType = this.currentStep + this.$refs.modelForm.validate((valid) => { + if (valid) { + this.$axios.post(this.$api.deviceAccidentReport.addDeviceAccidentReport, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }) + }, + // 鍏抽棴寮规 + resetForm () { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/addVerificationYearPlanDia.vue b/src/components/equipment/addVerificationYearPlanDia.vue new file mode 100644 index 0000000..aea6f00 --- /dev/null +++ b/src/components/equipment/addVerificationYearPlanDia.vue @@ -0,0 +1,248 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="applicationForm" title="娣诲姞璁惧鏍告煡璁″垝" + width="80%" @close="closeDialog"> + <div style="display: flex;align-items: center;"> + <el-button style="margin-right: 10px" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + <span style="width: 80px">璁″垝鍚嶇О锛�</span> + <el-input style="width: 300px;margin-right: 10px" v-model="form.planName" clearable size="small"></el-input> + <span style="width: 60px">骞翠唤锛�</span> + <el-date-picker + v-model="form.planYear" + type="year" + value-format="yyyy" + clearable + size="small" + format="yyyy" + placeholder="閫夋嫨骞�"> + </el-date-picker> + </div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="examinePlanDetailsList" + id="templateParamTable" row-key="deviceId" + height="300px" style="width: 100% ;"> + <el-table-column label="璁惧鍚嶇О" min-width="190" prop="deviceName"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceName" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="璁惧缂栧彿" min-width="190" prop="deviceNumber"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceNumber" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鏍告煡鏃堕棿" min-width="170" prop="checkTime"> + <template slot-scope="scope"> + <el-date-picker v-model="scope.row.checkTime" + clearable + format="yyyy-MM" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM"> + </el-date-picker> + </template> + </el-table-column> + <el-table-column label="鏍告煡鎸囨爣" min-width="120" prop="checkIndex"> + <template slot-scope="scope"> + <el-input v-model="scope.row.checkIndex" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鏍告煡鏂规硶" min-width="120" prop="checkMethod"> + <template slot-scope="scope"> + <el-input v-model="scope.row.checkMethod" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="缁撴灉濡備綍鍒ゅ畾" min-width="90" prop="howResults"> + <template slot-scope="scope"> + <el-input v-model="scope.row.howResults" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="鏍告煡璐d换浜�" min-width="170" prop="checkChargerUserId"> + <template slot-scope="scope"> + <el-select v-model="scope.row.checkChargerUserId" placeholder="璇烽�夋嫨" size="small" style="width: 100%" @change="setCheckChargerUser(scope.row.checkChargerUserId, scope.row)"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </template> + </el-table-column> + <el-table-column label="澶囨敞" min-width="170" prop="remark"> + <template slot-scope="scope"> + <el-input v-model="scope.row.remark" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center"> + <template slot-scope="scope"> + <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="addEquipDia" title="鏂板骞村害璁″垝" width="50%"> + <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" + style="width: 100%" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55"></el-table-column> + <el-table-column label="璁惧鍚嶇О" prop="label"></el-table-column> + <el-table-column prop="value" label="璁惧缂栧彿"></el-table-column> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button @click="addEquipDia = false">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import Sortable from "sortablejs"; + +export default { + name: "addVerificationYearPlanDia", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + applicationForm: false, + addEquipDia: false, + submitFormLoading: false, + equipOptions: [], + examinePlanDetailsList: [], + selectionRows: [], + userList: [], + form: { + planName: '', + planYear: '', + examinePlanDetailsList: [], + } + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + openDialog () { + this.form = { + planName: '', + planYear: '', + examinePlanDetailsList: [], + } + this.applicationForm = true + this.getUserList() + }, + // 娣诲姞璁惧 + addTableRow () { + this.addEquipDia = true + this.getEquipOptions() + }, + handleSelectionChange (selection) { + this.selectionRows = selection + }, + setCheckChargerUser (id, row) { + const index = this.userList.findIndex(item => item.id === id) + if (index > -1) { + row.checkChargerUser = this.userList[index].name + } + }, + changeMachineName () { + this.examinePlanDetailsList = [] + this.selectionRows.map(val => { + this.examinePlanDetailsList.push({deviceId: val.id, deviceName: val.label, deviceNumber: val.value, specificationModel: val.specificationModel}) + }) + this.addEquipDia = false + this.rowDrop() + }, + rowDrop() { + const that = this + const tbody = document.querySelector( + '#templateParamTable .el-table__body-wrapper tbody' + ) + if (!this.sortTable) { + this.sortTable = Sortable.create(tbody, { + animation: 200, //鍔ㄧ敾鏃堕暱 + handle: ".el-table__row", //鍙嫋鎷藉尯鍩焎lass + //鎷栨嫿涓簨浠� + onMove: ({ dragged, related }) => { + const oldRow = that.examinePlanDetailsList[dragged.rowIndex] //鏃т綅缃暟鎹� + const newRow = that.examinePlanDetailsList[related.rowIndex] //琚嫋鎷界殑鏂版暟鎹� + }, + //鎷栨嫿缁撴潫浜嬩欢 + onEnd: evt => { + const curRow = that.examinePlanDetailsList.splice(evt.oldIndex, 1)[0]; + that.examinePlanDetailsList.splice(evt.newIndex, 0, curRow); + } + }) + } + }, + // 鍒犻櫎琛ㄦ牸琛� + deleteRow (index) { + this.examinePlanDetailsList.splice(index, 1) + }, + // 鎻愪氦鏂板 + submitForm() { + this.form.examinePlanDetailsList = this.HaveJson(this.examinePlanDetailsList) + this.submitFormLoading = true + this.$axios.post(this.$api.deviceExaminePlan.addDeviceExaminePlan, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.closeDialog() + this.$emit('closeDia') + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + closeDialog () { + this.applicationForm = false + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +</style> diff --git a/src/components/equipment/addYearPlanDia.vue b/src/components/equipment/addYearPlanDia.vue new file mode 100644 index 0000000..f4ff90d --- /dev/null +++ b/src/components/equipment/addYearPlanDia.vue @@ -0,0 +1,231 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="applicationForm" title="娣诲姞璁惧鏍″噯璁″垝" + width="80%" @close="closeDialog"> + <div style="display: flex;align-items: center;"> + <el-button style="margin-right: 10px" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + <span style="width: 80px">璁″垝鍚嶇О锛�</span> + <el-input style="width: 300px;margin-right: 10px" v-model="form.planName" clearable size="small"></el-input> + <span style="width: 60px">骞翠唤锛�</span> + <el-date-picker + v-model="form.planYear" + type="year" + value-format="yyyy" + clearable + size="small" + format="yyyy" + placeholder="閫夋嫨骞�"> + </el-date-picker> + </div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="calibrationPlanDetailList" + id="templateParamTable" row-key="deviceId" + height="300px" style="width: 100% ;"> + <el-table-column label="璁惧鍚嶇О鍙婂瀷鍙�" min-width="190" prop="deviceName"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceName" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="浠櫒缂栧彿" min-width="190" prop="deviceNumber"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceNumber" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="璁惧鏁伴噺" min-width="120" prop="deviceAmount"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceAmount" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="妫�瀹氬崟浣�" min-width="120" prop="verificationUnit"> + <template slot-scope="scope"> + <el-input v-model="scope.row.verificationUnit" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="妫�瀹氬懆鏈�" min-width="120" prop="verificationCycles"> + <template slot-scope="scope"> + <el-input v-model="scope.row.verificationCycles" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鏈�杩戞瀹氭椂闂�" min-width="170" prop="lastDate"> + <template slot-scope="scope"> + <el-date-picker v-model="scope.row.lastDate" + clearable + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </template> + </el-table-column> + <el-table-column label="鏈勾璁″垝鏍″噯鏃堕棿" min-width="170" prop="planDate"> + <template slot-scope="scope"> + <el-date-picker v-model="scope.row.planDate" + clearable + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </template> + </el-table-column> + <el-table-column label="澶囨敞" min-width="170" prop="remark"> + <template slot-scope="scope"> + <el-input v-model="scope.row.remark" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center"> + <template slot-scope="scope"> + <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="addEquipDia" title="鏂板骞村害璁″垝" width="50%"> + <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" + style="width: 100%" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55"></el-table-column> + <el-table-column label="璁惧鍚嶇О" prop="label"></el-table-column> + <el-table-column prop="value" label="璁惧缂栧彿"></el-table-column> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button @click="addEquipDia = false">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import Sortable from "sortablejs"; + +export default { + name: "addYearPlanDia", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + applicationForm: false, + addEquipDia: false, + submitFormLoading: false, + equipOptions: [], + calibrationPlanDetailList: [], + selectionRows: [], + form: { + planName: '', + planYear: '', + calibrationPlanDetailList: [], + } + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + openDialog () { + this.form = { + planName: '', + planYear: '', + examinePlanDetailsList: [], + } + this.applicationForm = true + }, + // 娣诲姞璁惧 + addTableRow () { + this.addEquipDia = true + this.getEquipOptions() + }, + handleSelectionChange (selection) { + this.selectionRows = selection + }, + changeMachineName () { + this.calibrationPlanDetailList = [] + this.selectionRows.map(val => { + this.calibrationPlanDetailList.push({deviceId: val.id, deviceName: val.label, deviceNumber: val.value, specificationModel: val.specificationModel}) + }) + this.addEquipDia = false + this.rowDrop() + }, + rowDrop() { + const that = this + const tbody = document.querySelector( + '#templateParamTable .el-table__body-wrapper tbody' + ) + if (!this.sortTable) { + this.sortTable = Sortable.create(tbody, { + animation: 200, //鍔ㄧ敾鏃堕暱 + handle: ".el-table__row", //鍙嫋鎷藉尯鍩焎lass + //鎷栨嫿涓簨浠� + onMove: ({ dragged, related }) => { + const oldRow = that.calibrationPlanDetailList[dragged.rowIndex] //鏃т綅缃暟鎹� + const newRow = that.calibrationPlanDetailList[related.rowIndex] //琚嫋鎷界殑鏂版暟鎹� + }, + //鎷栨嫿缁撴潫浜嬩欢 + onEnd: evt => { + const curRow = that.calibrationPlanDetailList.splice(evt.oldIndex, 1)[0]; + that.calibrationPlanDetailList.splice(evt.newIndex, 0, curRow); + } + }) + } + }, + // 鍒犻櫎琛ㄦ牸琛� + deleteRow (index) { + this.calibrationPlanDetailList.splice(index, 1) + }, + // 鎻愪氦鏂板 + submitForm() { + this.form.calibrationPlanDetailList = this.HaveJson(this.calibrationPlanDetailList) + this.submitFormLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.addDeviceCalibrationPlan, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.closeDialog() + this.$emit('closeDia') + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + closeDialog () { + this.applicationForm = false + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + }, +} +</script> + +<style scoped> +</style> diff --git a/src/components/equipment/applicationForm.vue b/src/components/equipment/applicationForm.vue new file mode 100644 index 0000000..e129b69 --- /dev/null +++ b/src/components/equipment/applicationForm.vue @@ -0,0 +1,239 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="鍒╃敤澶栭儴浠櫒璁惧鐢宠琛�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓鐢宠琛�" @click.native="setStep(0)"></el-step> + <el-step title="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙�" @click.native="setStep(1)"></el-step> + <el-step title="璁¢噺瀹ゆ剰瑙�" @click.native="setStep(2)"></el-step> + <el-step title="鎵瑰噯浜�" @click.native="setStep(3)"></el-step> + </el-steps> + <el-form ref="modelForm" + :model="form" :rules="rules" label-width="160px"> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鍗曚綅鍚嶇О锛�" prop="unitName"> + <el-input v-model="form.unitName" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鍦板潃锛�" prop="address"> + <el-input v-model="form.address" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="浠櫒鍚嶇О锛�" prop="deviceName"> + <el-input v-model="form.deviceName" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鍨嬪彿锛�" prop="deviceModel"> + <el-input v-model="form.deviceModel" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="閰嶄欢锛�" prop="parts"> + <el-input v-model="form.parts" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="瀵规柟浠櫒缂栧彿锛�" prop="instrumentNumber"> + <el-input v-model="form.instrumentNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="浠櫒鎶�鏈寚鏍囷細" prop="technicalIndex"> + <el-input v-model="form.technicalIndex" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="闇�姹傛妧鏈姹傦細" prop="technicalRequirements"> + <el-input v-model="form.technicalRequirements" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="鍒╃敤鍘熷洜锛�" prop="useReason"> + <el-input v-model="form.useReason" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜猴細" prop="departmentHeadUserId"> + <el-select v-model="form.departmentHeadUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙侊細" prop="departmentHeadOpinion"> + <el-input v-model="form.departmentHeadOpinion" :disabled="currentStep !== 1" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="璁¢噺瀹よ礋璐d汉锛�" prop="meteringRoomUserId"> + <el-select v-model="form.meteringRoomUserId" :disabled="currentStep !== 1" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="璁¢噺瀹ゆ剰瑙侊細" prop="meteringRoomOpinion"> + <el-input v-model="form.meteringRoomOpinion" :disabled="currentStep !== 2" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="鎵瑰噯浜猴細" prop="approverUserId"> + <el-select v-model="form.approverUserId" :disabled="currentStep !== 2" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 3" :span="24"> + <el-form-item label="鎵瑰噯浜烘剰瑙侊細" prop="approverOpinion"> + <el-input v-model="form.approverOpinion" :disabled="currentStep !== 3" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep !== 4" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "applicationForm", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + externalApplyId: '', + unitName: '', + address: '', + deviceName: '', + deviceModel: '', + parts: '', + instrumentNumber: '', + technicalIndex: '', + technicalRequirements: '', + useReason: '', + departmentHeadUserId: '', + departmentHeadOpinion: '', + meteringRoomUserId: '', + meteringRoomOpinion: '', + approverUserId: '', + approverOpinion: '', + flowType: '' + }, + currentStep: 0, + showStep: 0, + rules: { + departmentHeadUserId: [{ required: true, message: '璇烽�夋嫨鐢宠閮ㄩ棬璐熻矗浜�', trigger: 'change' }], + meteringRoomUserId: [{ required: true, message: '璇烽�夋嫨璁¢噺瀹よ礋璐d汉', trigger: 'change' }], + approverUserId: [{ required: true, message: '璇烽�夋嫨鎵瑰噯浜�', trigger: 'change' }], + }, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + // 鎵撳紑寮规 + openDialog (id) { + this.dialogVisible = true + this.form.externalApplyId = id + this.getUserList() + if (this.form.externalApplyId) { + this.searchInfo() + } + }, + // 鏌ヨ璇︽儏 + searchInfo () { + this.$axios.get(this.$api.deviceExternalApply.getDeviceExternalApply+'?externalApplyId=' + this.form.externalApplyId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + if (res.data.isFinish === 0) { + if (this.form.departmentHeadUserId) { + this.currentStep = 1 + this.showStep = 1 + } + if (this.form.meteringRoomUserId) { + this.currentStep = 2 + this.showStep = 2 + } + if (this.form.approverUserId) { + this.currentStep = 3 + this.showStep = 3 + } + } else { + this.currentStep = 4 + this.showStep = 3 + } + } + }).catch(error => { + console.error(error) + }) + }, + setStep (step) { + this.showStep = step + }, + // 鎻愪氦琛ㄥ崟 + submitForm () { + this.form.flowType = this.currentStep + this.$refs.modelForm.validate((valid) => { + if (valid) { + this.$axios.post(this.$api.deviceExternalApply.addDeviceExternalApply, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }) + }, + // 鍏抽棴寮规 + resetForm () { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/check-record.vue b/src/components/equipment/check-record.vue new file mode 100644 index 0000000..62d538c --- /dev/null +++ b/src/components/equipment/check-record.vue @@ -0,0 +1,424 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧鏈熼棿鏍告煡姣斿璁板綍琛�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓璁惧鏍告煡瀵规瘮璁板綍"></el-step> + <el-step title="瀹℃牳"></el-step> + </el-steps> + <el-row> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 110px">浠櫒鍚嶇О锛�</span> + <el-select v-model="form.deviceName" + :disabled="currentStep !== 0" + class="table_input" + clearable + filterable + placeholder="璁惧鍚嶇О" + size="small" + style="width:200px" + @change="(val)=>changeMachineName(val)"> + <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.label"> + {{item.label + '-' + item.value}} + </el-option> + </el-select> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">浠櫒缂栧彿锛�</span> + <el-input v-model="form.deviceNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">绮惧害绛夌骇锛�</span> + <el-input v-model="form.accuracyGrade" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + </el-row> + <div style="margin: 10px">鏍告煡浣跨敤鐗╄川</div> + <el-row> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">鍚嶇О锛�</span> + <el-input v-model="form.materialName" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">缂栧彿锛�</span> + <el-input v-model="form.materialNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">绮惧害/涓嶇‘瀹氬害锛�</span> + <el-input v-model="form.materialAccuracyUncertainty" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">鍨嬪彿锛�</span> + <el-input v-model="form.materialModel" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">鏍告煡鏂瑰紡锛�</span> + <el-input v-model="form.materialCheckMethod" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">鏍告煡椤圭洰锛�</span> + <el-input v-model="form.materialCheckItems" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">娓╁害锛�</span> + <el-input v-model="form.temperature" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="8"> + <div class="form-item"> + <span style="width: 130px">婀垮害锛�</span> + <el-input v-model="form.humidity" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + </el-row> + <el-button size="small" style="margin: 10px 0" type="primary" @click="addRow">娣诲姞</el-button> + <el-table :data="recordDetailList" height="300" style="width: 100%"> + <el-table-column label="娴嬭瘯鐐�" min-width="130" prop="testPoint"> + <template slot-scope="scope"> + <el-input v-model="scope.row.testPoint" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue1" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue1" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue2" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue2" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue3" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue3" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue4" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue4" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue5" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue5" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column min-width="180"> + <template slot="header" slot-scope="scope"> + <el-input v-model="form.dataValue6" :disabled="currentStep !== 0" size="small"/> + </template> + <template slot-scope="scope"> + <el-input v-model="scope.row.dataValue6" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + </el-table> + <table border="1" cellspacing="10" class="table"> + <tr> + <td>鏈�澶у亸宸�</td> + <th> + <el-input v-model="form.maximun1" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.maximun2" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.maximun3" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.maximun4" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.maximun5" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.maximun6" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + </tr> + <tr> + <td>鐩稿鍋忓樊</td> + <th> + <el-input v-model="form.relative1" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.relative2" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.relative3" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.relative4" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.relative5" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + <th> + <el-input v-model="form.relative6" :disabled="currentStep !== 0" clearable size="small"></el-input> + </th> + </tr> + </table> + <el-row> + <el-col :span="24"> + <div class="form-item"> + <span style="width: 80px">鍒ゅ畾锛�</span> + <el-input v-model="form.determine" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="24"> + <div class="form-item"> + <span style="width: 80px">澶囨敞锛�</span> + <el-input v-model="form.remark" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </div> + </el-col> + <el-col :span="24"> + <div class="form-item"> + <span style="width: 116px">瀹℃牳浜猴細</span> + <el-select v-model="form.reviewUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep === 0" :loading="submitFormLoading" type="primary" @click="submitCheck">纭� 瀹�</el-button> + <el-button v-if="currentStep === 1" :loading="submitFormLoading" @click="examine(0)">涓嶉�氳繃</el-button> + <el-button v-if="currentStep === 1" :loading="submitFormLoading" type="primary" @click="examine(1)">閫� 杩�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "check-record", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + recordDetailList: [], + search: "", + form: { + deviceName: '', + deviceNumber: '', + accuracyGrade: '', + materialName: '', + materialNumber: '', + materialAccuracyUncertainty: '', + materialModel: '', + materialCheckMethod: '', + materialCheckItems: '', + temperature: '', + humidity: '', + recordDetailList: [], + dataValue1: '', + dataValue2: '', + dataValue3: '', + dataValue4: '', + dataValue5: '', + dataValue6: '', + maximun1: '', + maximun2: '', + maximun3: '', + maximun4: '', + maximun5: '', + maximun6: '', + relative1: '', + relative2: '', + relative3: '', + relative4: '', + relative5: '', + relative6: '', + determine: '', + remark: '', + planDetailsId: '', + checkerUserId: '', + }, + currentStep: 0, + distributionDetailList: [ + {label: '鏈�澶у亸宸�', value: 1}, + {label: '鐩稿鍋忓樊', value: 2}, + ], + equipOptions: [], + submitFormLoading: false, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + openDialog (row) { + this.dialogVisible = true + this.form.planDetailsId = row.planDetailsId + this.getEquipOptions() + this.getUserList() + this.searchInfo() + }, + searchInfo () { + this.$axios.get(this.$api.deviceExaminePlan.getExamineRecord+'?planDetailsId=' + this.form.planDetailsId).then(res => { + if (res.code === 200) { + let planDetailsId = this.form.planDetailsId + this.form = {...res.data} + this.form.planDetailsId = planDetailsId + this.recordDetailList = this.form.recordDetailList || [] + if (!this.form.checkerUserId) { + this.currentStep = 0 + } else { + this.currentStep = 1 + } + if (this.form.reviewStatus === 1) { + this.currentStep = 2 + } + } + }).catch(error => { + console.error(error) + }) + }, + // 璧嬪�间华鍣ㄧ紪鍙� + changeMachineName (value) { + const index = this.equipOptions.findIndex(item => item.deviceName === value) + this.form.deviceNumber = this.equipOptions[index].managementNumber + }, + addRow () { + this.recordDetailList.push({testPoint: ''}) + }, + // 鎻愪氦琛ㄥ崟 + submitCheck () { + console.log(333,this.form) + this.form.recordDetailList = this.HaveJson(this.recordDetailList) + this.submitFormLoading = true + this.$axios.post(this.$api.deviceExaminePlan.addExamineRecord, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + // 鎻愪氦瀹℃牳 + examine (statue) { + const params = { + planDetailsId: this.form.planDetailsId, + reviewStatus: statue, + } + this.$axios.post(this.$api.deviceExaminePlan.reviewExamineRecord, + params, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('瀹℃牳鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + resetForm () { + this.dialogVisible = false + this.$emit('closeDialog1') + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + m.id = m.id + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.table td { + padding: 10px; +} +.table th { + padding: 10px; +} +.form { + display: flex; + align-items: center; +} +.form-item { + display: flex; + align-items: center; + margin-right: 10px; + margin-top: 10px; +} +>>>.el-dialog__body { + max-height: 650px; + overflow-y: auto; +} +</style> diff --git a/src/components/equipment/equipment-acceptance.vue b/src/components/equipment/equipment-acceptance.vue new file mode 100644 index 0000000..8bda75d --- /dev/null +++ b/src/components/equipment/equipment-acceptance.vue @@ -0,0 +1,377 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="鍒拌揣鏃ユ湡" min-width="150" prop="arrivalDate"></el-table-column> + <el-table-column label="閲戦" min-width="100" prop="goldAmount"></el-table-column> + <el-table-column label="缁翠慨鍗曚綅" min-width="150" prop="maintenanceunit"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" label="鎿嶄綔" min-width="180"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleForm('edit',scope.row.acceptanceId)">缂栬緫</el-button> + <el-button size="small" type="text" @click="handleForm('view',scope.row.acceptanceId)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="record(scope.row)">闄勪欢</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.acceptanceId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.acceptanceId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <acceptance-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></acceptance-form> + <!--涓婁紶鎶ュ憡--> + <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢" width="80%" @closed="closeFilesLook"> + <div style="display: flex;justify-content: space-between;"> + <el-upload ref='upload' + :action="fileAction" + :auto-upload="true" + :before-upload="fileBeforeUpload" + :data="{acceptanceId: acceptanceId}" + :headers="headers" :on-error="onError" + :on-success="handleSuccessUp" + :show-file-list="false" + accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;"> + <el-button size="small" style="height: 38px" type="primary">闄勪欢涓婁紶</el-button> + </el-upload> + </div> + <div> + <ZTTable + ref="yearTable" + :column="columnData" + :height="'calc(100vh - 30em)'" + :highlightCurrentRow="true" + :table-data="tableData" + :table-loading="tableLoading" + style="margin-top: 0.5em;"> + </ZTTable> + </div> + </el-dialog> + <el-dialog + :visible.sync="lookDialogVisible" + fullscreen + title="鏌ョ湅闄勪欢" top="5vh" width="800px"> + <filePreview v-if="lookDialogVisible" :currentFile="{}" + :fileUrl="fileUrl" style="height: 90vh;overflow-y: auto;"/> + </el-dialog> + </div> +</template> + +<script> +import AcceptanceForm from "./acceptance-form.vue"; +import ZTTable from "../caorui/ZTTable/index.vue"; +import filePreview from "../tool/file-preview.vue"; + +export default { + name: "equipment-acceptance", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {filePreview, ZTTable, AcceptanceForm}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false, + filesDialogVisible: false, + columnData: [ + { + label: '鏂囦欢鍚嶇О', + prop: 'fileName', + minWidth: '150px' + }, + { + dataType: 'action', + minWidth: '100', + label: '鎿嶄綔', + fixed: 'right', + operation: [ + { + name: '棰勮', + type: 'text', + clickFun: (row) => { + this.handleLook(row) + } + }, + { + name: '涓嬭浇', + type: 'text', + clickFun: (row) => { + this.upload(row) + } + }, + { + name: '鍒犻櫎', + type: 'text', + color: '#f56c6c', + clickFun: (row) => { + this.delete(row) + } + } + ] + } + ], + tableData: [], + tableLoading: false, + acceptanceId: '', // 涓婁紶闄勪欢褰撳墠琛岀殑id + currentInfo:{}, + lookDialogVisible: false, + fileUrl: '' + } + }, + mounted() { + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData(deviceId) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceAcceptance.pageDeviceAcceptance, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + deviceId: deviceId, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm(type, id) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(type, id, this.clickNodeVal.value) + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鎵撳紑鎶ュ憡寮规 + record (row) { + this.filesDialogVisible = true + this.acceptanceId = row.acceptanceId + this.searchTableList() + }, + // 鏌ヨ闄勪欢鍒楄〃 + searchTableList () { + this.tableLoading = true + this.$axios.get(this.$api.deviceAcceptance.getDeviceAcceptanceFileList + '?acceptanceId=' + this.acceptanceId).then(res => { + this.tableLoading = false + if (res.code === 201) return + this.tableData = res.data + }).catch(err => { + this.tableLoading = false + console.log('err---', err); + }) + }, + // 鏌ョ湅鏂囦欢 + handleLook(row){ + this.currentInfo = row + this.lookDialogVisible = true + const state = /\.(jpg|jpeg|png|gif)$/i.test(this.currentInfo.fileUrl) + if (state) { + this.fileUrl = this.javaApi+'/img/'+ this.currentInfo.fileUrl + } else { + this.fileUrl = this.javaApi+'/word/'+ this.currentInfo.fileUrl + } + }, + // 涓嬭浇 + upload (row) { + let url = ''; + if(row.type==1){ + url = this.javaApi+'/img/'+row.fileUrl + file.downloadIamge(url,row.fileName) + }else{ + url = this.javaApi+'/word/'+row.fileUrl + const link = document.createElement('a'); + link.href = url; + link.download = row.fileName; + link.click(); + } + }, + // 鍒犻櫎 + delete (row) { + this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.tableLoading = true + this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptanceFileList + '?acceptanceFileId=' + row.acceptanceFileId).then(res => { + this.tableLoading = false + if (res.code === 201) return + this.$message.success('鍒犻櫎鎴愬姛') + this.searchTableList() + }).catch(err => { + this.tableLoading = false + console.log('err---', err); + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 涓婁紶闄勪欢 + fileBeforeUpload(file) { + let flag = true + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + flag = false + } + if (!flag) { + return Promise.reject(flag); //姝g‘鐨勭粓姝� + } + }, + onError(err, file, fileList,type) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + handleSuccessUp(response, ) { + this.upLoading = false; + if (response.code == 200) { + this.$message.success('涓婁紶鎴愬姛'); + this.searchTableList() + } + }, + closeFilesLook () { + this.filesDialogVisible = false + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceAcceptance.exportDeviceAcceptance + '?acceptanceId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], {type: 'application/octet-stream'}); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧楠屾敹.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧楠屾敹.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptance + '?acceptanceId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(newVal.value); + } + }, + }, + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + fileAction() { + return this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile + + } + }, +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-accident.vue b/src/components/equipment/equipment-accident.vue new file mode 100644 index 0000000..ab6969a --- /dev/null +++ b/src/components/equipment/equipment-accident.vue @@ -0,0 +1,194 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData(clickNodeVal.value)">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> +<!-- <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="unitName"></el-table-column>--> +<!-- <el-table-column label="鍨嬪彿" min-width="100" prop="model"></el-table-column>--> + <el-table-column label="鍦扮偣" min-width="150" prop="address"></el-table-column> + <el-table-column label="鏃ユ湡" min-width="180" prop="accidentDate"></el-table-column> + <el-table-column label="浜嬫晠鎯呭喌" min-width="180" prop="descriptionOfAccident" show-overflow-tooltip></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="120"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleForm(scope.row.accidentReportId)">鎿嶄綔</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.accidentReportId)">瀵煎嚭</el-button> + <el-button :disabled="scope.row.isFinish === 1" size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.accidentReportId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <accident-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></accident-form> + </div> +</template> + +<script> +import AccidentForm from "./accident-form.vue"; + +export default { + name: "equipment-accident", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {AccidentForm}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false + } + }, + mounted() { + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData(deviceId) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceAccidentReport.pageDeviceAccidentReport, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + deviceId: deviceId, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm(id) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(id, this.clickNodeVal.value) + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceAccidentReport.exportDeviceAccidentReport + '?accidentReportId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧浜嬫晠鎶ュ憡鍗�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧浜嬫晠鎶ュ憡鍗�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceAccidentReport.delDeviceAccidentReport + '?accidentReportId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(newVal.value); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-calibration-plan.vue b/src/components/equipment/equipment-calibration-plan.vue new file mode 100644 index 0000000..5808033 --- /dev/null +++ b/src/components/equipment/equipment-calibration-plan.vue @@ -0,0 +1,602 @@ +<template> +<!-- 璁惧鏍″噯璁″垝--> + <div> + <div> + <div style="margin: 10px 0;display: flex;align-items: center;justify-content: space-between;"> + <span>骞村害璁″垝琛�</span> + <div> + <el-button size="small" type="primary" @click="getYearTableData">鍒锋柊</el-button> + <el-button style="margin-right: 10px" size="small" type="primary" @click="addYearPlan">鏂板</el-button> +<!-- <el-button size="small" type="primary" @click="record">瀵煎叆</el-button>--> + </div> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDataLoading" :data="yearTableData" + height="calc(60vh - 20em)" + highlight-current-row + style="width: 100% ;" @current-change="currentChange"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="骞翠唤" min-width="80" prop="planYear"></el-table-column> + <el-table-column label="璁″垝鍚嶇О" min-width="180" prop="planName"></el-table-column> + <el-table-column label="缂栧埗浜�" min-width="100" prop="writeName"></el-table-column> + <el-table-column label="缂栧埗鏃ユ湡" min-width="150" prop="writeTime"></el-table-column> + <el-table-column label="鎵瑰噯鐘舵��" min-width="100" prop="ratifyStatus"> + <template slot-scope="scope"> + <el-tag v-if="scope.row.ratifyStatus === 1" type="success">鎵瑰噯</el-tag> + <el-tag v-if="scope.row.ratifyStatus === 0" type="danger">涓嶆壒鍑�</el-tag> + </template> + </el-table-column> + <el-table-column label="鎵瑰噯鍐呭" min-width="150" prop="ratifyRemark"></el-table-column> + <el-table-column label="鎵瑰噯浜�" min-width="100" prop="ratifyName"></el-table-column> + <el-table-column label="鎵瑰噯鏃堕棿" min-width="150" prop="ratifyTime"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="140"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleApprove(scope.row.planId)">鎵瑰噯</el-button> + <el-button size="small" type="text" @click="downLoadPost(scope.row.planId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.planId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> + </div> + </div> + <div> + <span>骞村害璁″垝鏄庣粏琛�</span> + <div class="title"> + <div class="title-search"> + <span style="width: 120px;font-size: 14px">璁惧鍚嶇О鍙婂瀷鍙凤細</span> + <el-input v-model="searchForm.deviceName" clearable size="small" style="margin-right: 10px;width: 220px"></el-input> + <span style="width: 80px;font-size: 14px">浠櫒缂栧彿锛�</span> + <el-input v-model="searchForm.deviceNumber" clearable size="small" style="margin-right: 10px;width: 220px"></el-input> + <el-button size="small" type="primary" @click="getYearTableDetailData(currentRow)">鏌� 璇�</el-button> + <el-button size="small" @click="reset">閲� 缃�</el-button> + </div> + <div> + <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + </div> + </div> + <div> + <el-table ref="yearTableDetailData" v-loading="yearTableDetailDataLoading" + :data="yearTableDetailData" + height="calc(60vh - 20em)" style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="璁惧鍚嶇О鍙婂瀷鍙�" min-width="180" prop="deviceName"></el-table-column> + <el-table-column label="璁惧鏁伴噺" min-width="180" prop="deviceAmount"></el-table-column> + <el-table-column label="浠櫒缂栧彿" min-width="150" prop="deviceNumber"></el-table-column> + <el-table-column label="妫�瀹氬崟浣�" min-width="150" prop="verificationUnit"> </el-table-column> + <el-table-column label="妫�瀹氬懆鏈�" min-width="150" prop="verificationCycles"></el-table-column> + <el-table-column label="鏈�杩戞瀹氭椂闂�" min-width="150" prop="lastDate"></el-table-column> + <el-table-column label="鏈勾璁″垝鏍″噯鏃堕棿" min-width="150" prop="planDate"></el-table-column> + <el-table-column label="澶囨敞" min-width="150" prop="remark"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="140"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleForm('edit', scope.row)">缂栬緫</el-button> + <el-button size="small" type="text" @click="handleForm('view', scope.row)">鏌ョ湅</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun1(scope.row.planDetailId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="璁惧鏍″噯璁″垝" + width="80%" @close="resetForm"> + <el-form ref="modelForm" :model="form" :rules="rules" label-width="150px"> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О鍙婂瀷鍙凤細" prop="deviceName"> + <el-input v-model="form.deviceName" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鏁伴噺锛�" prop="deviceAmount"> + <el-input v-model="form.deviceAmount" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浠櫒缂栧彿锛�" prop="deviceNumber"> + <el-input v-model="form.deviceNumber" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�瀹氬崟浣嶏細" prop="verificationUnit"> + <el-input v-model="form.verificationUnit" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�瀹氬懆鏈燂細" prop="verificationCycles"> + <el-input v-model="form.verificationCycles" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈�杩戞瀹氭椂闂达細" prop="lastDate"> + <el-date-picker v-model="form.lastDate" + :disabled="operationType === 'view'" + clearable + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈勾璁″垝鏍″噯鏃堕棿锛�" prop="planDate"> + <el-date-picker v-model="form.planDate" + :disabled="operationType === 'view'" + clearable + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶囨敞锛�" prop="remark"> + <el-input v-model="form.remark" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="approvalDialog" title="鎵瑰噯" width="30%" @close="approvalDialog = false"> + <span> + 鎵瑰噯澶囨敞锛� + <el-input v-model="ratifyRemark" type="textarea"></el-input> + </span> + <span slot="footer" class="dialog-footer"> + <el-button :loading="approvalLoading" @click="handleApproval(0)">涓嶆壒鍑�</el-button> + <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">鎵� 鍑�</el-button> + </span> + </el-dialog> + <!--涓婁紶鎶ュ憡--> + <el-dialog :visible.sync="uploadDia" title="鏁版嵁瀵煎叆" width="500px"> + 骞翠唤锛� + <el-date-picker + v-model="planYear" + type="year" + value-format="yyyy" + clearable + format="yyyy" + placeholder="閫夋嫨骞�"> + </el-date-picker> + <div style="margin: 0 auto;"> + <el-upload ref="upload1" :action="action" :auto-upload="false" :file-list="fileList" :headers="headers" :limit="1" + accept='.doc,.docx' + :on-change="beforeUpload" :on-error="onError" :on-success="handleSuccessUp" drag + name="file"> + <i class="el-icon-upload"></i> + <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> + </el-upload> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="uploadDia = false">鍙� 娑�</el-button> + <el-button :loading="uploading" type="primary" @click="submitUpload()">涓� 浼�</el-button> + </span> + </el-dialog> + <add-year-plan-dia v-if="addYearPlanDia" ref="addYearPlanDia" @closeDia="closeDia"></add-year-plan-dia> + </div> +</template> + +<script> +import AddYearPlanDia from "./addYearPlanDia.vue"; +import AddVerificationYearPlanDia from "./addVerificationYearPlanDia.vue"; + +export default { + name: "equipment-calibration-plan", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {AddVerificationYearPlanDia, AddYearPlanDia}, + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + searchForm: { + deviceName: '', + deviceNumber: '', + }, + yearTableData: [], + yearTableDetailData: [], + pagination: { + size: 10, + current: 1, + total: 0, + }, + pagination1: { + size: 10, + current: 1, + total: 0, + }, + form: { + deviceName: '', + deviceAmount: '', + deviceNumber: '', + verificationUnit: '', + verificationCycles: '', + lastDate: '', + planDate: '', + remark: '', + planId: '', + planDetailId: '', + }, + operationType: '', + rules: { + deviceNumber: [{ required: true, message: '璇峰~鍐欎华鍣ㄧ紪鍙�', trigger: 'blur' }], + planDate: [{ required: true, message: '璇烽�夋嫨鏃ユ湡', trigger: 'change' }], + }, + yearTableDataLoading: false, + yearTableDetailDataLoading: false, + currentRow: {}, + approvalDialog: false, + approvalLoading: false, + submitFormLoading: false, + ratifyRemark: '', + currentRowId: '', + uploadDia: false, + uploading: false, + addYearPlanDia: false, + fileList: [], + planYear: '', + } + }, + mounted() { + this.getYearTableData() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ骞村害璁″垝琛� + getYearTableData () { + this.yearTableDataLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.pageDeviceCalibrationPlan,{ + page: { + current: 1, + size: 99, + }, + entity: {} + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableData = res.data.records + this.pagination.total = res.data.total + if (this.yearTableData.length > 0) { + this.currentRow = this.yearTableData[0] + this.$refs.yearTable.setCurrentRow(this.currentRow) + } + } + this.yearTableDataLoading = false + }).catch(err => { + this.yearTableDataLoading = false + }) + }, + // 鍒嗛〉 + handleSizeChange(val) { + this.pagination.size = val + this.getYearTableData() + }, + // 鍒嗛〉 + handleCurrentChange(val) { + this.pagination.current = val + this.getYearTableData() + }, + // 骞村害璁″垝琛�-鎵瑰噯 + handleApprove(id) { + this.currentRowId = id + this.approvalDialog = true + }, + // 骞村害璁″垝琛�-瀵煎嚭 + downLoadPost(planId) { + this.$axios.get(this.$api.deviceCalibrationPlan.exportDeviceCalibrationPlanDetail + '?planId=' + planId,{responseType: "blob"}).then(res => { + const blob = new Blob([res],{ type: 'application/msword' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鏍″噯璁″垝.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鏍″噯璁″垝.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 骞村害璁″垝琛�-鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceCalibrationPlan.delQualitySupervise + '?planId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableData(); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 骞村害璁″垝璇︽儏琛�-鍒犻櫎 + deleteFun1(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceCalibrationPlan.delDeviceCalibrationPlanDetail + '?planDetailsId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.currentRow) + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + currentChange (row) { + this.currentRow = row + this.getYearTableDetailData(this.currentRow) + }, + getYearTableDetailData (row) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.pageDeviceCalibrationPlanDetail,{ + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + planId: row.planId, + deviceName: this.searchForm.deviceName, + deviceNumber: this.searchForm.deviceNumber, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + reset () { + this.searchForm = { + deviceName: '', + deviceNumber: '', + } + this.getYearTableDetailData(this.currentRow) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.currentRow) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.currentRow) + }, + // 鎵撳紑寮规 + handleForm (type, row) { + this.operationType = type + this.dialogVisible = true + this.form.planId = this.currentRow.planId + if (this.operationType !== 'add') { + this.$nextTick(() => { + this.form = this.HaveJson(row) + }) + }else{ + this.form = { + deviceName: '', + deviceAmount: '', + deviceNumber: '', + verificationUnit: '', + verificationCycles: '', + lastDate: '', + planDate: '', + remark: '', + planId: this.currentRow.planId, + planDetailId: '', + } + } + }, + // 鎻愪氦琛ㄥ崟 + submitForm () { + this.$refs.modelForm.validate(valid => { + if (valid) { + if (this.operationType === 'add') { + this.submitFormLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.addDeviceCalibrationPlanDetail, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.dialogVisible = false + this.getYearTableData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.submitFormLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.updateDeviceCalibrationPlanDetail, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.dialogVisible = false + this.getYearTableData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + } + }) + }, + // 鎵撳紑鏂板寮规 + addYearPlan () { + this.addYearPlanDia = true + this.$nextTick(() => { + this.$refs.addYearPlanDia.openDialog() + }) + }, + closeDia () { + this.addYearPlanDia = false + this.getYearTableData() + }, + submitUpload() { + if (!this.planYear) { + this.$message.warning('璇烽�夋嫨骞翠唤') + return; + } + if (this.$refs.upload1.uploadFiles.length === 0) { + this.$message.error('鏈�夋嫨鏂囦欢') + return + } + this.uploading = true + this.$refs.upload1.submit(); + }, + // 鎻愪氦鎵瑰噯 + handleApproval (status) { + const personTrainingUpdateDto = { + planId: this.currentRowId, + ratifyRemark: this.ratifyRemark, + ratifyStatus: status + } + this.approvalLoading = true + this.$axios.post(this.$api.deviceCalibrationPlan.ratifyDeviceCalibrationPlan, personTrainingUpdateDto, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code === 200) { + this.$message.success('鎻愪氦鎴愬姛锛�'); + this.approvalDialog = false + this.getYearTableData(); + } + this.approvalLoading = false + }).catch(() => { + this.approvalLoading = false + }) + }, + resetForm () { + this.$refs.modelForm.resetFields(); + this.dialogVisible = false + }, + // 鎵撳紑鎶ュ憡寮规 + record (row) { + this.uploadDia = true + }, + // 瀵煎叆娴佺▼ + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + handleSuccessUp(response) { + this.uploading = false; + if (response.code == 200) { + this.$message.success('涓婁紶鎴愬姛'); + this.getYearTableData() + } else { + this.$message.error('涓婁紶澶辫触') + } + }, + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + action() { + return this.javaApi + this.$api.deviceCalibrationPlan.importDeviceCalibrationPlan + '?planYear=' + this.planYear + } + }, +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-check.vue b/src/components/equipment/equipment-check.vue new file mode 100644 index 0000000..3518b5d --- /dev/null +++ b/src/components/equipment/equipment-check.vue @@ -0,0 +1,333 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧鏈熼棿鏍告煡姣斿璁板綍琛�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓璁惧鏍告煡瀵规瘮璁板綍"></el-step> + <el-step title="瀹℃牳"></el-step> + </el-steps> + <div class="form"> + <div class="form-item"> + <span style="width: 116px">鏍告煡鏂瑰紡锛�</span> + <el-input v-model="form.checkMethod" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </div> + <div class="form"> + <div class="form-item"> + <span style="width: 80px">A浠櫒鍚嶇О锛�</span> + <el-select v-model="form.adeviceId" + :disabled="currentStep !== 0" + class="table_input" + clearable + filterable + placeholder="璁惧鍚嶇О" + size="small" + style="width:200px" + @change="(val)=>changeMachineName(val, 'A')"> + <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> + {{item.label + '-' + item.value}} + </el-option> + </el-select> + </div> + <div class="form-item"> + <span style="width: 116px">A浠櫒缂栧彿锛�</span> + <el-input v-model="form.adeviceNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + <div class="form-item"> + <span style="width: 150px">A浠櫒娴嬪畾鑼冨洿/涓嶇‘瀹氬害锛�</span> + <el-input v-model="form.arangeUncertainty" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </div> + <div class="form"> + <div class="form-item"> + <span style="width: 80px">B浠櫒鍚嶇О锛�</span> + <el-select v-model="form.bdeviceId" + :disabled="currentStep !== 0" + class="table_input" + clearable + filterable + placeholder="璁惧鍚嶇О" + size="small" + style="width:200px" + @change="(val)=>changeMachineName(val, 'B')"> + <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> + {{item.label + '-' + item.value}} + </el-option> + </el-select> + </div> + <div class="form-item"> + <span style="width: 116px">B浠櫒缂栧彿锛�</span> + <el-input v-model="form.bdeviceNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + <div class="form-item"> + <span style="width: 150px">B浠櫒娴嬪畾鑼冨洿/涓嶇‘瀹氬害锛�</span> + <el-input v-model="form.brangeUncertainty" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </div> + <div class="form"> + <div class="form-item"> + <span style="width: 80px">C浠櫒鍚嶇О锛�</span> + <el-select v-model="form.cdeviceId" + :disabled="currentStep !== 0" + class="table_input" + clearable + filterable + placeholder="璁惧鍚嶇О" + size="small" + style="width:200px" + @change="(val)=>changeMachineName(val, 'C')"> + <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> + {{item.label + '-' + item.value}} + </el-option> + </el-select> + </div> + <div class="form-item"> + <span style="width: 116px">C浠櫒缂栧彿锛�</span> + <el-input v-model="form.cdeviceNumber" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + <div class="form-item"> + <span style="width: 150px">C浠櫒娴嬪畾鑼冨洿/涓嶇‘瀹氬害锛�</span> + <el-input v-model="form.crangeUncertainty" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + </div> + <div> + <el-button v-if="currentStep === 0" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + </div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="recordContrastDetailsList" + height="300px" + style="width: 100% ;"> + <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column> + <el-table-column label="鏍告煡椤圭洰" min-width="170" prop="checkItems"> + <template slot-scope="scope"> + <el-input v-model="scope.row.checkItems" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="A浠櫒绀哄��" min-width="120" prop="indicationA"> + <template slot-scope="scope"> + <el-input v-model="scope.row.indicationA" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="B浠櫒绀哄��" min-width="120" prop="indicationB"> + <template slot-scope="scope"> + <el-input v-model="scope.row.indicationB" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="C浠櫒绀哄��" min-width="120" prop="indicationC"> + <template slot-scope="scope"> + <el-input v-model="scope.row.indicationC" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="宸��" min-width="90" prop="dvalue"> + <template slot-scope="scope"> + <el-input v-model="scope.row.dvalue" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鐩稿鍋忓樊" min-width="90" prop="deviation"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviation" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鍒ゅ畾" min-width="110" prop="determine"> + <template slot-scope="scope"> + <el-input v-model="scope.row.determine" :disabled="currentStep !== 0" clearable size="small"></el-input> + </template> + </el-table-column> + </el-table> + </div> + <div class="form"> + <div class="form-item"> + <span style="width: 116px">缁煎悎鍒ゅ畾锛�</span> + <el-input v-model="form.judgment" :disabled="currentStep !== 0" clearable size="small"></el-input> + </div> + <div class="form-item"> + <span style="width: 116px">瀹℃牳浜猴細</span> + <el-select v-model="form.reviewUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </div> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep === 0" :loading="submitFormLoading" type="primary" @click="submitCheck">纭� 瀹�</el-button> + <el-button v-if="currentStep === 1" :loading="submitFormLoading" @click="examine(0)">涓嶉�氳繃</el-button> + <el-button v-if="currentStep === 1" :loading="submitFormLoading" type="primary" @click="examine(1)">閫� 杩�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "equipment-check", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + currentStep: 0, + showStep: 0, + form: { + checkerTime: '', + checkMethod: '', + adeviceId: '', + adeviceNumber: '', + arangeUncertainty: '', + bdeviceId: '', + bdeviceNumber: '', + brangeUncertainty: '', + cdeviceId: '', + cdeviceNumber: '', + crangeUncertainty: '', + recordContrastDetailsList: [], + judgment: '', + reviewUserId: '', + reviewStatus: '', + planDetailsId: '', + }, + equipOptions: [], + recordContrastDetailsList: [], + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + openDialog (row) { + this.dialogVisible = true + this.form.planDetailsId = row.planDetailsId + this.getEquipOptions() + this.getUserList() + this.searchInfo() + }, + searchInfo () { + this.$axios.get(this.$api.deviceExaminePlan.getExamineRecordContrast+'?planDetailsId=' + this.form.planDetailsId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + this.recordContrastDetailsList = this.form.recordContrastDetailsList || [] + if (!this.form.reviewUserId) { + this.currentStep = 0 + } else { + this.currentStep = 1 + } + if (this.form.reviewStatus === 1) { + this.currentStep = 2 + } + } + }).catch(error => { + console.error(error) + }) + }, + // 璧嬪�间华鍣ㄧ紪鍙� + changeMachineName (value, type) { + const index = this.equipOptions.findIndex(item => item.id === value) + if (index > -1) { + if (type === 'A') { + this.$set(this.form, 'adeviceNumber', this.equipOptions[index].value) + } + if (type === 'B') { + this.$set(this.form, 'bdeviceNumber', this.equipOptions[index].value) + } + if (type === 'C') { + this.$set(this.form, 'cdeviceNumber', this.equipOptions[index].value) + } + } + }, + // 娣诲姞琛ㄦ牸鏁版嵁 + addTableRow () { + this.recordContrastDetailsList.push({checkItems: ''}) + }, + submitCheck () { + this.form.recordContrastDetailsList = this.HaveJson(this.recordContrastDetailsList) + this.submitFormLoading = true + this.$axios.post(this.$api.deviceExaminePlan.addExamineRecordContrast, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + examine (statue) { + const params = { + planDetailsId: this.form.planDetailsId, + reviewStatus: statue, + } + this.$axios.post(this.$api.deviceExaminePlan.reviewExamineRecordContrast, + params, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('瀹℃牳鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + resetForm () { + this.dialogVisible = false + this.$emit('closeDialog') + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + m.id = m.id + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form { + display: flex; + align-items: center; +} +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/equipment-failure.vue b/src/components/equipment/equipment-failure.vue new file mode 100644 index 0000000..272c74c --- /dev/null +++ b/src/components/equipment/equipment-failure.vue @@ -0,0 +1,193 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData(clickNodeVal.value)">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> +<!-- <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="unitName"></el-table-column>--> +<!-- <el-table-column label="鍨嬪彿" min-width="100" prop="address"></el-table-column>--> + <el-table-column label="瀹夎鍦扮偣" min-width="150" prop="location"></el-table-column> + <el-table-column label="鎹熷潖鎴栨晠闅滄儏鍐�" min-width="180" prop="damageOrMalfunction"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="140"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleForm(scope.row.maintenanceId)">鎿嶄綔</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.maintenanceId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.maintenanceId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <failure-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></failure-form> + </div> +</template> + +<script> +import FailureForm from "./failure-form.vue"; + +export default { + name: "equipment-failure", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {FailureForm}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false + } + }, + mounted() { + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData(deviceId) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceBreakdownMaintenance.pageDeviceBreakdownMaintenance, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + deviceId: deviceId, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm(id) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(id, this.clickNodeVal.value) + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceBreakdownMaintenance.exportDeviceBreakdownMaintenance + '?maintenanceId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧淇悊鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧淇悊鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceBreakdownMaintenance.delDeviceBreakdownMaintenance + '?maintenanceId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(newVal.value); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-maintenance-plan.vue b/src/components/equipment/equipment-maintenance-plan.vue new file mode 100644 index 0000000..14dddd9 --- /dev/null +++ b/src/components/equipment/equipment-maintenance-plan.vue @@ -0,0 +1,425 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="骞翠唤" min-width="80" prop="planYear"></el-table-column> + <el-table-column label="缂栧埗浜�" min-width="120" prop="compiler"></el-table-column> + <el-table-column label="缂栧埗鏃堕棿" min-width="150" prop="datePreparation"></el-table-column> + <el-table-column label="瀹℃牳浜�" min-width="150" prop="audit"></el-table-column> + <el-table-column label="瀹℃牳鏃堕棿" min-width="180" prop="auditDate"></el-table-column> + <el-table-column label="瀹℃牳鐘舵��" min-width="180" prop="status"> + <template slot-scope="scope"> + <el-tag v-if="scope.row.status === 1" type="success">閫� 杩�</el-tag> + <el-tag v-if="scope.row.status === 0" type="danger">涓嶉�氳繃</el-tag> + </template> + </el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="180"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('edit', scope.row)">缂栬緫</el-button> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('check', scope.row)">瀹℃牳</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.maintenancePlanId)">瀵煎嚭</el-button> + <el-button :disabled="scope.row.status === 1" size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.maintenancePlanId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="applicationForm" title="璁惧淇濆吇璁″垝琛�" + width="80%" @close="closeDialog"> + <div style="display: flex;align-items: center;"> + <el-button v-if="operationType !== 'check'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + <span style="width: 60px">骞翠唤锛�</span> + <el-date-picker + v-model="form.planYear" + type="year" + value-format="yyyy" + clearable + size="small" + format="yyyy" + placeholder="閫夋嫨骞�"> + </el-date-picker> + </div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="deviceMaintenancePlanDetails" + id="templateParamTable" row-key="deviceId" + height="300px" + style="width: 100% ;"> + <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column> + <el-table-column label="璁惧鍚嶇О" min-width="170" prop="deviceName"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceName" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="璁惧缂栧彿" min-width="140" prop="deviceNumber"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceNumber" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="褰掑睘瀹為獙瀹�" min-width="120" prop="storagePoint"> + <template slot-scope="scope"> + <el-input v-model="scope.row.storagePoint" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="淇濆吇鍏抽敭閮ㄤ綅" min-width="120" prop="maintenanceSite"> + <template slot-scope="scope"> + <el-input v-model="scope.row.maintenanceSite" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="淇濆吇鍐呭" min-width="120" prop="maintenanceContent"> + <template slot-scope="scope"> + <el-input v-model="scope.row.maintenanceContent" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="淇濆吇鍛ㄦ湡" min-width="90" prop="maintenanceIntervals"> + <template slot-scope="scope"> + <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center"> + <template slot-scope="scope"> + <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(0)">涓嶉�氳繃</el-button> + <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(1)">閫� 杩�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="addEquipDia" title="娣诲姞璁惧" width="50%"> + <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" + style="width: 100%" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55"></el-table-column> + <el-table-column label="璁惧鍚嶇О" prop="label" width="190"></el-table-column> + <el-table-column prop="value" label="璁惧缂栧彿" width="130"></el-table-column> + <el-table-column prop="managementNumber" label="褰掑睘瀹為獙瀹�"></el-table-column> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button @click="addEquipDia = false">鍙� 娑�</el-button> + <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="changeMachineName">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import Sortable from "sortablejs"; + +export default { + name: "equipment-maintenance-plan", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + deviceMaintenancePlanDetails: [], + selectionRows: [], + deviceIds: [], + applicationForm: false, + submitFormLoading: false, + operationType: '', + equipOptions: [], + form: { + planYear: '', + deviceMaintenancePlanDetails: [] + }, + addEquipDia: false, + } + }, + mounted() { + this.getYearTableDetailData() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData() { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceMaintenancePlan.selectDeviceMaintenancePlanByPage, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: {} + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + // 鎵撳紑鏂板鍜岀紪杈戝脊妗� + handleForm(type, row) { + this.operationType = type + this.applicationForm = true + this.form = { + planYear: '', + deviceMaintenancePlanDetails: [], + } + this.deviceMaintenancePlanDetails = [] + if (row) { + this.maintenancePlanId = row.maintenancePlanId + this.$axios.get(this.$api.deviceMaintenancePlan.getMaintenancePlanDetail+'?maintenancePlanId=' + this.maintenancePlanId).then(res => { + if (res.code === 200) { + this.form = res.data + this.deviceMaintenancePlanDetails = this.form.deviceMaintenancePlanDetails + } + }).catch(error => { + console.error(error) + }) + } + this.getEquipOptions() + }, + // 娣诲姞璁惧 + addTableRow () { + this.addEquipDia = true + this.getEquipOptions() + }, + handleSelectionChange (selection) { + this.selectionRows = selection + }, + // 璧嬪�间华鍣ㄧ紪鍙� + changeMachineName () { + this.deviceMaintenancePlanDetails = [] + this.selectionRows.map(val => { + this.deviceMaintenancePlanDetails.push({deviceId: val.id, deviceName: val.label, deviceNumber: val.value, storagePoint: val.storagePoint}) + }) + this.addEquipDia = false + this.rowDrop() + }, + rowDrop() { + const that = this + const tbody = document.querySelector( + '#templateParamTable .el-table__body-wrapper tbody' + ) + if (!this.sortTable) { + this.sortTable = Sortable.create(tbody, { + animation: 200, //鍔ㄧ敾鏃堕暱 + handle: ".el-table__row", //鍙嫋鎷藉尯鍩焎lass + //鎷栨嫿涓簨浠� + onMove: ({ dragged, related }) => { + const oldRow = that.deviceMaintenancePlanDetails[dragged.rowIndex] //鏃т綅缃暟鎹� + const newRow = that.deviceMaintenancePlanDetails[related.rowIndex] //琚嫋鎷界殑鏂版暟鎹� + }, + //鎷栨嫿缁撴潫浜嬩欢 + onEnd: evt => { + const curRow = that.deviceMaintenancePlanDetails.splice(evt.oldIndex, 1)[0]; + that.deviceMaintenancePlanDetails.splice(evt.newIndex, 0, curRow); + } + }) + } + }, + // 鍒犻櫎琛ㄦ牸琛� + deleteRow (index) { + this.deviceMaintenancePlanDetails.splice(index, 1) + }, + // 鎻愪氦鏂板鍜屼慨鏀� + submitForm () { + this.form.deviceMaintenancePlanDetails = this.HaveJson(this.deviceMaintenancePlanDetails) + this.submitFormLoading = true + if (this.operationType === 'add') { + this.$axios.post(this.$api.deviceMaintenancePlan.addMaintenancePlan, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.$axios.post(this.$api.deviceMaintenancePlan.updateMaintenancePlan, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('淇敼鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }, + // 鎻愪氦瀹℃牳 + checkStatus (status) { + const params = { + status: status, + maintenancePlanId: this.maintenancePlanId + } + this.$axios.post(this.$api.deviceMaintenancePlan.addMaintenancePlan, + params, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('瀹℃牳鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData() + }, + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceMaintenancePlan.exportDeviceMaintenancePlan + '?maintenancePlanId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧缁存姢淇濆吇璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧缁存姢淇濆吇璁板綍.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceMaintenancePlan.deleteMaintenancePlan + '?maintenancePlanId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-scrap.vue b/src/components/equipment/equipment-scrap.vue new file mode 100644 index 0000000..4a85d99 --- /dev/null +++ b/src/components/equipment/equipment-scrap.vue @@ -0,0 +1,193 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData(clickNodeVal.value)">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> +<!-- <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="unitName"></el-table-column>--> +<!-- <el-table-column label="鍨嬪彿" min-width="100" prop="address"></el-table-column>--> + <el-table-column label="閰嶄欢" min-width="150" prop="parts"></el-table-column> + <el-table-column label="缂栧彿" min-width="100" prop="number"></el-table-column> + <el-table-column label="鎶ュ簾鐞嗙敱" min-width="150" prop="reasonsForScrap"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="120"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleForm(scope.row.scrappedId)">鎿嶄綔</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.scrappedId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.scrappedId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <scrap-application-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></scrap-application-form> + </div> +</template> + +<script> +import scrapApplicationForm from "./scrapApplicationForm.vue"; + +export default { + name: "equipment-scrap", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {scrapApplicationForm}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false + } + }, + mounted() { + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData (deviceId) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceScrapped.pageDeviceScrapped,{ + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + deviceId: deviceId, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm (id) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(id, this.clickNodeVal.value) + }) + }, + closeDialog () { + this.applicationForm = false + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceScrapped.exportDeviceScrapped + '?scrappedId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鎶ュ簾鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鎶ュ簾鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceScrapped.delDeviceScrapped + '?scrappedId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(newVal.value); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/equipment-verification-plan.vue b/src/components/equipment/equipment-verification-plan.vue new file mode 100644 index 0000000..d065bef --- /dev/null +++ b/src/components/equipment/equipment-verification-plan.vue @@ -0,0 +1,682 @@ +<template> + <!-- 璁惧鏍告煡璁″垝--> + <div> + <div> + <div style="margin: 10px 0;display: flex;align-items: center;justify-content: space-between;"> + <span>骞村害璁″垝琛�</span> + <div style="display: flex;align-items: center;"> + <el-button style="margin-right: 10px" size="small" type="primary" @click="getYearTableData">鍒锋柊</el-button> + <el-button style="margin-right: 10px" size="small" type="primary" @click="addYearPlan">鏂板</el-button> +<!-- <el-upload ref="upload" :action="action"--> +<!-- :before-upload="beforeUpload" :headers="headers" :on-error="onError"--> +<!-- :on-success="handleSuccessUp" :show-file-list="false" accept='.xls,.xlsx'>--> +<!-- <el-button :loading="upLoading" size="small" type="primary">瀵煎叆</el-button>--> +<!-- </el-upload>--> + </div> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDataLoading" :data="yearTableData" + height="calc(60vh - 20em)" + highlight-current-row + style="width: 100% ;" @current-change="currentChange"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="骞翠唤" min-width="80" prop="planYear"></el-table-column> + <el-table-column label="璁″垝鍚嶇О" min-width="180" prop="planName"></el-table-column> + <el-table-column label="缂栧埗浜�" min-width="100" prop="writeName"></el-table-column> + <el-table-column label="缂栧埗鏃ユ湡" min-width="150" prop="writeTime"></el-table-column> + <el-table-column label="鎵瑰噯鐘舵��" min-width="100" prop="ratifyStatus"> + <template slot-scope="scope"> + <el-tag v-if="scope.row.ratifyStatus === 1" type="success">鎵瑰噯</el-tag> + <el-tag v-if="scope.row.ratifyStatus === 0" type="danger">涓嶆壒鍑�</el-tag> + </template> + </el-table-column> + <el-table-column label="鎵瑰噯鍐呭" min-width="150" prop="ratifyRemark"></el-table-column> + <el-table-column label="鎵瑰噯浜�" min-width="100" prop="ratifyName"></el-table-column> + <el-table-column label="鎵瑰噯鏃堕棿" min-width="150" prop="ratifyTime"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="140"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleApprove(scope.row.planId)">鎵瑰噯</el-button> + <el-button size="small" type="text" @click="downLoadPost(scope.row.planId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.planId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> + </el-pagination> + </div> + </div> + <div> + <span>骞村害璁″垝鏄庣粏琛�</span> + <div class="title"> + <div class="title-search"> + <span style="width: 120px;font-size: 14px">璁惧缂栧彿锛�</span> + <el-input v-model="searchForm.deviceNumber" clearable size="small" style="margin-right: 10px;width: 220px"></el-input> + <span style="width: 80px;font-size: 14px">璁惧鍚嶇О锛�</span> + <el-input v-model="searchForm.deviceName" clearable size="small" style="margin-right: 10px;width: 220px"></el-input> + <el-button size="small" type="primary" @click="getYearTableDetailData(currentRow)">鏌� 璇�</el-button> + <el-button size="small" @click="reset">閲� 缃�</el-button> + </div> + <div> + <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + </div> + </div> + <div> + <el-table ref="yearTableDetailData" v-loading="yearTableDetailDataLoading" + :data="yearTableDetailData" + height="calc(60vh - 20em)" style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="璁惧缂栧彿" min-width="180" prop="deviceNumber"></el-table-column> + <el-table-column label="璁惧鍚嶇О" min-width="180" prop="deviceName"></el-table-column> + <el-table-column label="鏍告煡鏃堕棿" min-width="150" prop="checkTime"></el-table-column> + <el-table-column label="鏍告煡鎸囨爣" min-width="150" prop="checkIndex"> </el-table-column> + <el-table-column label="鏍告煡鏂规硶" min-width="150" prop="checkMethod"></el-table-column> + <el-table-column label="缁撴灉濡備綍鍒ゅ畾" min-width="150" prop="howResults"></el-table-column> + <el-table-column label="鏍告煡璐熻矗浜�" min-width="150" prop="checkChargerUser"></el-table-column> + <el-table-column label="澶囨敞" min-width="150" prop="remark"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="260"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleForm('edit', scope.row)">缂栬緫</el-button> + <el-button size="small" type="text" @click="handleForm('view', scope.row)">鏌ョ湅</el-button> + <el-button size="small" type="text" @click="handleRecord(scope.row)">璁板綍</el-button> + <el-button size="small" type="text" @click="handleCheck(scope.row)">瀵规瘮</el-button> + <el-button size="small" type="text" @click="handleDown(scope.row)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun1(scope.row.planDetailsId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="璁惧鏍告煡璁″垝" + width="80%" @close="resetForm"> + <el-form ref="modelForm" :model="form" :rules="rules" label-width="110px"> + <el-col :span="12"> + <el-form-item label="璁惧缂栧彿锛�" prop="deviceNumber"> + <el-input v-model="form.deviceNumber" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璁惧鍚嶇О锛�" prop="deviceName"> + <el-input v-model="form.deviceName" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍告煡鏃堕棿锛�" prop="checkTime"> + <el-date-picker v-model="form.checkTime" + :disabled="operationType === 'view'" + clearable + format="yyyy-MM" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width:100%" + type="date" + value-format="yyyy-MM"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍告煡鎸囨爣锛�" prop="checkIndex"> + <el-input v-model="form.checkIndex" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍告煡鏂规硶锛�" prop="checkMethod"> + <el-input v-model="form.checkMethod" :disabled="operationType === 'view'" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="缁撴灉濡備綍鍒ゅ畾锛�" prop="howResults"> + <el-input v-model="form.howResults" :disabled="operationType === 'view'" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏍告煡璐d换浜猴細" prop="checkChargerUserId"> + <el-select v-model="form.checkChargerUserId" @change="setCheckChargerUser" :disabled="operationType === 'view'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶囨敞锛�" prop="remark"> + <el-input v-model="form.remark" :disabled="operationType === 'view'" clearable size="small"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="approvalDialog" title="鎵瑰噯" width="30%" @close="approvalDialog = false"> + <span> + 鎵瑰噯澶囨敞锛� + <el-input v-model="ratifyRemark" type="textarea"></el-input> + </span> + <span slot="footer" class="dialog-footer"> + <el-button :loading="approvalLoading" @click="handleApproval(0)">涓嶆壒鍑�</el-button> + <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">鎵� 鍑�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="downloadDialog" title="瀵煎嚭" width="600px"> + <span> + <el-button :loading="outLoading" plain type="primary" @click="controlDown">鏍告煡璁板綍</el-button> + <el-button :loading="outLoading" plain type="primary" @click="processingDown">鏍告煡姣斿璁板綍</el-button> + </span> + <span slot="footer" class="dialog-footer"> + <el-button @click="downloadDialog = false">鍙� 娑�</el-button> + </span> + </el-dialog> + <equipment-check v-if="equipmentCheck" ref="equipmentCheck" @closeDialog="closeDialog"></equipment-check> + <check-record v-if="checkRecord" ref="checkRecord" @closeDialog1="closeDialog1"></check-record> + <add-verification-year-plan-dia v-if="addYearPlanDia" ref="addYearPlanDia" @closeDia="closeDia"></add-verification-year-plan-dia> + </div> +</template> + +<script> +import EquipmentCheck from "./equipment-check.vue"; +import CheckRecord from "./check-record.vue"; +import AddVerificationYearPlanDia from "./addVerificationYearPlanDia.vue"; + +export default { + name: "equipment-verification-plan", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {AddVerificationYearPlanDia, CheckRecord, EquipmentCheck}, + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + upLoading: false, + dialogVisible: false, + searchForm: { + deviceName: '', + deviceNumber: '', + }, + yearTableData: [], + yearTableDetailData: [], + pagination: { + size: 10, + current: 1, + total: 0, + }, + pagination1: { + size: 10, + current: 1, + total: 0, + }, + form: { + deviceNumber: '', + deviceName: '', + checkTime: '', + checkIndex: '', + checkMethod: '', + howResults: '', + checkChargerUserId: '', + checkChargerUser: '', + remark: '', + planId: '', + planDetailsId: '', + }, + operationType: '', + rules: { + deviceNumber: [{ required: true, message: '璇峰~鍐欒澶囩紪鍙�', trigger: 'blur' }], + checkMethod: [{ required: true, message: '璇峰~鍐欐牳鏌ユ柟娉�', trigger: 'blur' }], + }, + yearTableDataLoading: false, + yearTableDetailDataLoading: false, + currentRow: {}, + approvalDialog: false, + approvalLoading: false, + submitFormLoading: false, + ratifyRemark: '', + currentRowId: '', + userList: [], + equipmentCheck: false, + checkRecord: false, + addYearPlanDia: false, + downloadDialog: false, + outLoading: false, + downRow: {} + } + }, + mounted() { + this.getYearTableData() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ骞村害璁″垝琛� + getYearTableData () { + this.yearTableDataLoading = true + this.$axios.post(this.$api.deviceExaminePlan.pageDeviceExaminePlan,{ + page: { + current: 1, + size: 99, + }, + entity: {} + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableData = res.data.records + this.pagination.total = res.data.total + if (this.yearTableData.length > 0) { + this.currentRow = this.yearTableData[0] + this.$refs.yearTable.setCurrentRow(this.currentRow) + } + } + this.yearTableDataLoading = false + }).catch(err => { + this.yearTableDataLoading = false + }) + }, + // 鍒嗛〉 + handleSizeChange(val) { + this.pagination.size = val + this.getYearTableData() + }, + // 鍒嗛〉 + handleCurrentChange(val) { + this.pagination.current = val + this.getYearTableData() + }, + // 鎵撳紑鏂板寮规 + addYearPlan () { + this.addYearPlanDia = true + this.$nextTick(() => { + this.$refs.addYearPlanDia.openDialog() + }) + }, + closeDia () { + this.addYearPlanDia = false + this.getYearTableData() + }, + // 骞村害璁″垝琛�-鎵瑰噯 + handleApprove(id) { + this.currentRowId = id + this.approvalDialog = true + }, + // 骞村害璁″垝琛�-瀵煎嚭 + downLoadPost(planId) { + this.$axios.get(this.$api.deviceExaminePlan.exportDeviceExaminePlanDetail + '?planId=' + planId,{responseType: "blob"}).then(res => { + const blob = new Blob([res],{ type: 'application/msword' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鏈熼棿鏍告煡璁″垝琛�.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鏈熼棿鏍告煡璁″垝琛�.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 骞村害璁″垝琛�-鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceExaminePlan.delQualitySupervise + '?planId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableData(); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 骞村害璁″垝璇︽儏琛�-鍒犻櫎 + deleteFun1(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceExaminePlan.delDeviceExaminePlanDetail + '?planDetailsId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.currentRow) + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + currentChange (row) { + this.currentRow = row + this.getYearTableDetailData(this.currentRow) + }, + getYearTableDetailData (row) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceExaminePlan.pageDeviceExaminePlanDetail,{ + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + planId: row.planId, + deviceName: this.searchForm.deviceName, + deviceNumber: this.searchForm.deviceNumber, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + reset () { + this.searchForm = { + deviceName: '', + deviceNumber: '', + } + this.getYearTableDetailData(this.currentRow) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.currentRow) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.currentRow) + }, + // 鎵撳紑寮规 + handleForm (type, row) { + this.getUserList() + this.operationType = type + this.dialogVisible = true + this.form.planId = this.currentRow.planId + if (this.operationType !== 'add') { + this.$nextTick(() => { + this.form = this.HaveJson(row) + }) + }else{ + this.form = { + deviceNumber: '', + deviceName: '', + checkTime: '', + checkIndex: '', + checkMethod: '', + howResults: '', + checkChargerUserId: '', + checkChargerUser: '', + remark: '', + planId: this.currentRow.planId, + planDetailsId: '', + } + } + }, + // 鎻愪氦琛ㄥ崟 + submitForm () { + this.$refs.modelForm.validate(valid => { + if (valid) { + if (this.operationType === 'add') { + this.submitFormLoading = true + this.$axios.post(this.$api.deviceExaminePlan.addDeviceExaminePlanDetail, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.dialogVisible = false + this.getYearTableData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.submitFormLoading = true + this.$axios.post(this.$api.deviceExaminePlan.updateDeviceExaminePlanDetail, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.dialogVisible = false + this.getYearTableData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + } + }) + }, + // 鎻愪氦鎵瑰噯 + handleApproval (status) { + const personTrainingUpdateDto = { + planId: this.currentRowId, + ratifyRemark: this.ratifyRemark, + ratifyStatus: status + } + this.approvalLoading = true + this.$axios.post(this.$api.deviceExaminePlan.ratifyDeviceExaminePlan, personTrainingUpdateDto, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code === 200) { + this.$message.success('鎻愪氦鎴愬姛锛�'); + this.approvalDialog = false + this.getYearTableData(); + } + this.approvalLoading = false + }).catch(() => { + this.approvalLoading = false + }) + }, + resetForm () { + this.$refs.modelForm.resetFields(); + this.dialogVisible = false + }, + // 鎵撳紑瀵规瘮娴佺▼寮规 + handleCheck (row) { + this.equipmentCheck = true + this.$nextTick(() => { + this.$refs.equipmentCheck.openDialog(row) + }) + }, + // 鍏抽棴瀵规瘮寮规 + closeDialog () { + this.equipmentCheck = false + this.getYearTableDetailData(this.currentRow) + }, + // 鎵撳紑璁板綍寮规 + handleRecord (row) { + this.checkRecord = true + this.$nextTick(() => { + this.$refs.checkRecord.openDialog(row) + }) + }, + // 鍏抽棴璁板綍寮规 + closeDialog1 () { + this.checkRecord = false + this.getYearTableDetailData(this.currentRow) + }, + // 鎵撳紑瀵煎嚭寮规 + handleDown (row) { + this.downRow = row + this.downloadDialog = true + }, + // 鏍告煡璁板綍瀵煎嚭 + controlDown () { + this.outLoading = true + this.$axios.get(this.$api.deviceExaminePlan.exportReviewExamineRecordDetail + '?planDetailsId=' + this.downRow.planDetailsId, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鏈熼棿鏍告煡璁板綍琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鏈熼棿鏍告煡璁板綍琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鏍告煡瀵规瘮瀵煎嚭 + processingDown () { + this.outLoading = true + this.$axios.get(this.$api.deviceExaminePlan.exportReviewExamineRecordContrast + '?planDetailsId=' + this.downRow.planDetailsId, { + responseType: "blob" + }).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res], { type: 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧鏈熼棿鏍告煡姣斿璁板綍琛�.doc'; + link.click(); + }) + }, + // 瀵煎叆娴佺▼ + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); + this.$refs.upload.clearFiles() + return false; + } else { + this.upLoading = true; + return true; + } + }, + onError(err, file, fileList) { + this.$message.error('涓婁紶澶辫触') + this.$refs.upload.clearFiles() + }, + handleSuccessUp(response) { + this.upLoading = false; + if (response.code == 200) { + this.$message.success('涓婁紶鎴愬姛'); + this.getYearTableData() + } else if (response.code == 201) { + this.$message.error(response.message) + } + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + setCheckChargerUser (val) { + const index = this.userList.findIndex(item => item.id === val) + if (index > -1) { + this.form.checkChargerUser = this.userList[index].name + } + }, + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + 'token': sessionStorage.getItem('token') + } + }, + action() { + return this.javaApi + this.$api.deviceExaminePlan.importDeviceExaminePlan + } + }, +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/failure-form.vue b/src/components/equipment/failure-form.vue new file mode 100644 index 0000000..4190f6b --- /dev/null +++ b/src/components/equipment/failure-form.vue @@ -0,0 +1,198 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧淇悊鐢宠琛�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓鐢宠琛�" @click.native="setStep(0)"></el-step> + <el-step title="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙�" @click.native="setStep(1)"></el-step> + <el-step title="缁翠慨璁板綍" @click.native="setStep(2)"></el-step> + </el-steps> + <el-form ref="modelForm" + :model="form" :rules="rules" label-width="160px"> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="瀹夎鍦扮偣锛�" prop="location"> + <el-input v-model="form.location" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鎹熷潖鎴栨晠闅滄儏鍐碉細" prop="damageOrMalfunction"> + <el-input v-model="form.damageOrMalfunction" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="瑕佹眰淇鏃ユ湡锛�" prop="repairDate"> + <el-date-picker + v-model="form.repairDate" + :disabled="currentStep !== 0" + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0 && currentStep !== 0" :span="12"> + <el-form-item label="鐢宠浜猴細" prop="applicantUser"> + <el-input v-model="form.applicantUser" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="12"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜猴細" prop="departmentHeadUserId"> + <el-select v-model="form.departmentHeadUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙侊細" prop="departmentHeadOpinion"> + <el-input v-model="form.departmentHeadOpinion" :disabled="currentStep !== 1" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="缁翠慨璁颁簨锛�" prop="maintenanceRecord"> + <el-input v-model="form.maintenanceRecord" :disabled="currentStep !== 2" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="缁翠慨浜猴細" prop="maintenanceUser"> + <el-input v-model="form.maintenanceUser" :disabled="currentStep !== 2" clearable size="small"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep !== 3" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "failure-form", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + location: '', + damageOrMalfunction: '', + repairDate: '', + departmentHeadUserId: '', + departmentHeadOpinion: '', + maintenanceRecord: '', + maintenanceUser: '', + applicantUser: '', + flowType: '', + deviceId: '', + isFinish: '', + }, + currentStep: 0, + showStep: 0, + rules: { + departmentHeadUserId: [{required: true, message: '璇烽�夋嫨鐢宠閮ㄩ棬璐熻矗浜�', trigger: 'change'}], + departmentHeadOpinion: [{required: true, message: '璇峰~鍐欐剰瑙�', trigger: 'blur'}], + }, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + // 鎵撳紑寮规 + openDialog(id, deviceId) { + this.dialogVisible = true + this.form.maintenanceId = id + this.form.deviceId = deviceId + this.getUserList() + if (this.form.maintenanceId) { + this.searchInfo() + } + }, + // 鏌ヨ璇︽儏 + searchInfo() { + this.$axios.get(this.$api.deviceBreakdownMaintenance.getDeviceBreakdownMaintenance + '?maintenanceId=' + this.form.maintenanceId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + if (this.form.isFinish === 0) { + if (this.form.departmentHeadUserId) { + this.currentStep = 1 + this.showStep = 1 + } + if (this.form.departmentHeadOpinion) { + this.currentStep = 2 + this.showStep = 2 + } + } else { + this.currentStep = 3 + this.showStep = 2 + } + } + }).catch(error => { + console.error(error) + }) + }, + setStep(step) { + this.showStep = step + }, + // 鎻愪氦琛ㄥ崟 + submitForm() { + this.form.flowType = this.currentStep + this.$refs.modelForm.validate((valid) => { + if (valid) { + this.$axios.post(this.$api.deviceBreakdownMaintenance.addDeviceBreakdownMaintenance, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }) + }, + // 鍏抽棴寮规 + resetForm() { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList() { + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/inspection-form.vue b/src/components/equipment/inspection-form.vue new file mode 100644 index 0000000..454e6ff --- /dev/null +++ b/src/components/equipment/inspection-form.vue @@ -0,0 +1,276 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="璁惧鐐规璁板綍琛�" + width="80%" @close="resetForm"> + <el-row> + <el-col :span="24"> + <div class="form-item"> + <span style="width: 103px">娴嬮噺鑼冨洿锛�</span> + <el-input v-model="form.measurementScope" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="24" style="text-align: center;margin-bottom: 10px">鐐规浣跨敤鐗╄川</el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">鍚嶇О锛�</span> + <el-input v-model="form.materialName" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">瑙勬牸鍨嬪彿锛�</span> + <el-input v-model="form.materialModel" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">绠$悊缂栧彿锛�</span> + <el-input v-model="form.materialManagementNumber" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">绮惧害绛夌骇锛�</span> + <el-input v-model="form.materialAccuracyGrade" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="24" style="text-align: center;margin-bottom: 10px">娴嬭瘯鐜</el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">娓╁害锛�</span> + <el-input v-model="form.temperature" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">婀垮害锛�</span> + <el-input v-model="form.humidity" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + </el-row> + <div> + <el-button v-if="operationType === 'add'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + </div> + <div style="text-align: center">娴嬭瘯鏁版嵁璁板綍</div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="details" + height="300px" + style="width: 100% ;"> + <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column> + <el-table-column label="娴嬭瘯椤圭洰" min-width="170" prop="testItems"> + <template slot-scope="scope"> + <el-input v-model="scope.row.testItems" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鏍囧噯鍊�" min-width="120" prop="standardValue"> + <template slot-scope="scope"> + <el-input v-model="scope.row.standardValue" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="瀹炴祴鍊�" min-width="120" prop="measuredValue"> + <template slot-scope="scope"> + <el-input v-model="scope.row.measuredValue" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="绀哄�艰宸�" min-width="120" prop="indicationError"> + <template slot-scope="scope"> + <el-input v-model="scope.row.indicationError" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鍏佽璇樊" min-width="90" prop="allowableError"> + <template slot-scope="scope"> + <el-input v-model="scope.row.allowableError" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鍗曢」缁撹" min-width="90" prop="singleItemConclusion"> + <template slot-scope="scope"> + <el-input v-model="scope.row.singleItemConclusion" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + </el-table> + </div> + <el-row> + <el-col :span="24"> + <div class="form-item"> + <span style="width: 103px">娴嬭瘯缁撹锛�</span> + <el-input v-model="form.testConclusion" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">澶囨敞锛�</span> + <el-input v-model="form.remark" :disabled="operationType === 'check'" clearable size="small"></el-input> + </div> + </el-col> + <el-col :span="12"> + <div class="form-item"> + <span style="width: 116px">璇烽�夋嫨澶嶆牳浜猴細</span> + <el-select v-model="form.reviewerId" :disabled="operationType === 'check'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary" @click="submitCheck">纭� 瀹�</el-button> + <el-button v-if="operationType === 'check'" :loading="submitFormLoading" @click="examine(0)">涓嶉�氳繃</el-button> + <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary" @click="examine(1)">閫� 杩�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "inspection-form", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + measurementScope: '', + materialName: '', + materialModel: '', + materialManagementNumber: '', + materialAccuracyGrade: '', + temperature: '', + humidity: '', + testConclusion: '', + remark: '', + reviewerId: '', + deviceId: '', + inspectionRecordId: '', + }, + operationType: '', + equipOptions: [], + details: [], + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + openDialog(id,deviceId, type) { + this.dialogVisible = true + this.operationType = type + this.form.deviceId = deviceId + this.form.inspectionRecordId = id + this.getUserList() + if (this.form.inspectionRecordId) { + this.searchInfo() + } + }, + searchInfo() { + this.$axios.get(this.$api.deviceInspectionRecord.getDeviceInspectionRecord + '?inspectionRecordId=' + this.form.inspectionRecordId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + this.details = this.form.details || [] + } + }).catch(error => { + console.error(error) + }) + }, + // 娣诲姞琛ㄦ牸鏁版嵁 + addTableRow() { + this.details.push({testItems: ''}) + }, + submitCheck() { + this.form.details = this.HaveJson(this.details) + this.submitFormLoading = true + if (this.operationType === 'add') { + this.$axios.post(this.$api.deviceInspectionRecord.addDeviceInspectionRecord, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.$axios.post(this.$api.deviceInspectionRecord.updateDeviceInspectionRecord, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }, + examine(status) { + const params = { + inspectionRecordId: this.form.inspectionRecordId, + status: status, + } + this.$axios.post(this.$api.deviceInspectionRecord.reviewDeviceInspectionRecord, + params, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('瀹℃牳鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + resetForm() { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList() { + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form { + display: flex; + align-items: center; +} + +.form-item { + display: flex; + align-items: center; + margin-right: 20px; + margin-bottom: 10px; +} +</style> diff --git a/src/components/equipment/inspection-of-equipment.vue b/src/components/equipment/inspection-of-equipment.vue new file mode 100644 index 0000000..b47b5de --- /dev/null +++ b/src/components/equipment/inspection-of-equipment.vue @@ -0,0 +1,202 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData(clickNodeVal.value)">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('', 'add')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="鍚嶇О" min-width="150" prop="materialName"></el-table-column> + <el-table-column label="瑙勬牸鍨嬪彿" min-width="100" prop="materialModel"></el-table-column> + <el-table-column label="绠$悊缂栧彿" min-width="150" prop="materialManagementNumber"></el-table-column> + <el-table-column label="绮惧害绛夌骇" min-width="180" prop="materialAccuracyGrade"></el-table-column> + <el-table-column label="娓╁害" min-width="100" prop="temperature"></el-table-column> + <el-table-column label="婀垮害" min-width="100" prop="humidity"></el-table-column> + <el-table-column label="澶嶆牳鐘舵��" min-width="180" prop="status"> + <template slot-scope="scope"> + <el-tag v-if="scope.row.status === 1" type="success">閫� 杩�</el-tag> + <el-tag v-if="scope.row.status === 0" type="danger">涓嶉�氳繃</el-tag> + </template> + </el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="180"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm(scope.row.inspectionRecordId, 'edit')">缂栬緫</el-button> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm(scope.row.inspectionRecordId, 'check')">瀹℃牳</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.inspectionRecordId)">瀵煎嚭</el-button> + <el-button :disabled="scope.row.status === 1" size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.inspectionRecordId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <inspection-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></inspection-form> + </div> +</template> + +<script> +import InspectionForm from "./inspection-form.vue"; + +export default { + name: "inspection-of-equipment", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {InspectionForm}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false + } + }, + mounted() { + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData(deviceId) { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceInspectionRecord.getDeviceInspectionRecordByPage, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + deviceId: deviceId, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm(id, type) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(id, this.clickNodeVal.value, type) + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData(this.clickNodeVal.value) + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceInspectionRecord.exportDeviceInspectionRecord + '?inspectionRecordId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鐐规璁板綍琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '璁惧鐐规璁板綍琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceInspectionRecord.deleteDeviceInspectionRecord + '?inspectionRecordId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(newVal.value); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/quantity-value-traceability-plan.vue b/src/components/equipment/quantity-value-traceability-plan.vue new file mode 100644 index 0000000..8e78d1c --- /dev/null +++ b/src/components/equipment/quantity-value-traceability-plan.vue @@ -0,0 +1,434 @@ +<template> + <div> + <div> + <div style="margin: 10px 0;text-align: right"> + <el-button size="small" type="primary" @click="getYearTableDetailData">鍒锋柊</el-button> + <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="骞翠唤" min-width="80" prop="planYear"></el-table-column> + <el-table-column label="鏂囦欢鍚嶇О" min-width="120" prop="compiler"></el-table-column> + <el-table-column label="缂栧埗浜�" min-width="150" prop="compiler"></el-table-column> + <el-table-column label="缂栧埗鏃堕棿" min-width="150" prop="datePreparation"></el-table-column> + <el-table-column label="鎵瑰噯浜�" min-width="180" prop="audit"></el-table-column> + <el-table-column label="鎵瑰噯鐘舵��" min-width="180" prop="status"> + <template slot-scope="scope"> + <el-tag v-if="scope.row.status === 1" type="success">鎵� 鍑�</el-tag> + <el-tag v-if="scope.row.status === 0" type="danger">涓嶆壒鍑�</el-tag> + </template> + </el-table-column> + <el-table-column label="鎵瑰噯鏃堕棿" min-width="180" prop="auditDate"></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="180"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('edit', scope.row)">缂栬緫</el-button> + <el-button :disabled="scope.row.status === 1" size="small" type="text" @click="handleForm('check', scope.row)">鎵瑰噯</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.traceabilityManagementId)">瀵煎嚭</el-button> + <el-button :disabled="scope.row.status === 1" size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.traceabilityManagementId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="applicationForm" title="浠櫒璁惧閲忓�兼函婧愮鐞嗘�讳綋璁″垝" + width="80%" @close="closeDialog"> + <div style="display: flex;align-items: center;"> + <el-button v-if="operationType !== 'check'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button> + <span style="width: 60px">骞翠唤锛�</span> + <el-date-picker + v-model="form.planYear" + type="year" + value-format="yyyy" + clearable + size="small" + format="yyyy" + placeholder="閫夋嫨骞�"> + </el-date-picker> + </div> + <div style="margin: 10px 0"> + <el-table ref="yearTable" :data="deviceTraceabilityManagementDetails" + height="300px" id="templateParamTable" row-key="deviceId" + style="width: 100% ;"> + <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column> + <el-table-column label="璁惧鍚嶇О" min-width="170" prop="deviceId"> + <template slot-scope="scope"> + <el-input v-model="scope.row.deviceName" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鍨嬪彿" min-width="140" prop="specificationModel"> + <template slot-scope="scope"> + <el-input v-model="scope.row.specificationModel" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="璁惧缂栧彿" min-width="140" prop="managementNumber"> + <template slot-scope="scope"> + <el-input v-model="scope.row.managementNumber" :disabled="operationType === 'check'" clearable size="small"></el-input> + </template> + </el-table-column> + <el-table-column label="鎶�鏈寚鏍囧弬鏁�" min-width="120" prop="technicalIndexParameters"> + <template slot-scope="scope"> + <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="鎶�鏈寚鏍囪姹�" min-width="120" prop="technicalRequirements"> + <template slot-scope="scope"> + <el-input v-model="scope.row.technicalRequirements" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="妫�瀹氬懆鏈�" min-width="120" prop="verificationCycle"> + <template slot-scope="scope"> + <el-input v-model="scope.row.verificationCycle" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="妫�瀹氬崟浣�" min-width="90" prop="verificationUnit"> + <template slot-scope="scope"> + <el-input v-model="scope.row.verificationUnit" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column label="澶囨敞" min-width="90" prop="remark"> + <template slot-scope="scope"> + <el-input v-model="scope.row.remark" :disabled="operationType === 'check'" clearable size="small" type="textarea"></el-input> + </template> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center"> + <template slot-scope="scope"> + <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(0)">涓嶉�氳繃</el-button> + <el-button v-if="operationType ==='check'" :loading="submitFormLoading" type="primary" @click="checkStatus(1)">閫� 杩�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="addEquipDia" title="娣诲姞璁惧" width="50%"> + <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" + style="width: 100%" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55"></el-table-column> + <el-table-column label="璁惧鍚嶇О" prop="label" width="190"></el-table-column> + <el-table-column prop="specificationModel" label="鍨嬪彿" width="120"></el-table-column> + <el-table-column prop="managementNumber" label="璁惧缂栧彿"></el-table-column> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button @click="addEquipDia = false">鍙� 娑�</el-button> + <el-button v-if="operationType !=='check'" :loading="submitFormLoading" type="primary" @click="changeMachineName">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import Sortable from "sortablejs"; + +export default { + name: "quantity-value-traceability-plan", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + props: { + clickNodeVal: { + type: Object, + default: () => { + } + } + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + deviceTraceabilityManagementDetails: [], + selectionRows: [], + deviceIds: [], + applicationForm: false, + submitFormLoading: false, + operationType: '', + equipOptions: [], + form: { + planYear: '', + deviceTraceabilityManagementDetails: [] + }, + addEquipDia: false, + } + }, + mounted() { + this.getYearTableDetailData() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData() { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceTraceabilityManagement.selectDeviceTraceabilityManagementByPage, { + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: {} + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + // 鎵撳紑鏂板鍜岀紪杈戝脊妗� + handleForm(type, row) { + this.operationType = type + this.applicationForm = true + this.form = { + planYear: '', + deviceTraceabilityManagementDetails: [] + }, + this.deviceTraceabilityManagementDetails = [] + if (row) { + this.traceabilityManagementId = row.traceabilityManagementId + this.$axios.get(this.$api.deviceTraceabilityManagement.getTraceabilityManagementDetail + '?traceabilityManagementId=' + this.traceabilityManagementId).then(res => { + if (res.code === 200) { + this.form = res.data + this.deviceTraceabilityManagementDetails = this.form.deviceTraceabilityManagementDetails + } + }).catch(error => { + console.error(error) + }) + } + }, + // 娣诲姞璁惧 + addTableRow () { + this.addEquipDia = true + this.getEquipOptions() + }, + handleSelectionChange (selection) { + this.selectionRows = selection + }, + // 璧嬪�间华鍣ㄧ紪鍙� + changeMachineName() { + this.deviceTraceabilityManagementDetails = [] + this.selectionRows.map(val => { + this.deviceTraceabilityManagementDetails.push({deviceId: val.id,managementNumber: val.value, deviceName: val.label, specificationModel: val.specificationModel}) + }) + this.addEquipDia = false + this.rowDrop() + }, + rowDrop() { + const that = this + const tbody = document.querySelector( + '#templateParamTable .el-table__body-wrapper tbody' + ) + if (!this.sortTable) { + this.sortTable = Sortable.create(tbody, { + animation: 200, //鍔ㄧ敾鏃堕暱 + handle: ".el-table__row", //鍙嫋鎷藉尯鍩焎lass + //鎷栨嫿涓簨浠� + onMove: ({ dragged, related }) => { + const oldRow = that.deviceTraceabilityManagementDetails[dragged.rowIndex] //鏃т綅缃暟鎹� + const newRow = that.deviceTraceabilityManagementDetails[related.rowIndex] //琚嫋鎷界殑鏂版暟鎹� + }, + //鎷栨嫿缁撴潫浜嬩欢 + onEnd: evt => { + const curRow = that.deviceTraceabilityManagementDetails.splice(evt.oldIndex, 1)[0]; + that.deviceTraceabilityManagementDetails.splice(evt.newIndex, 0, curRow); + } + }) + } + }, + // 鍒犻櫎琛ㄦ牸琛� + deleteRow (index) { + this.deviceTraceabilityManagementDetails.splice(index, 1) + }, + // 鎻愪氦鏂板鍜屼慨鏀� + submitForm() { + this.form.deviceTraceabilityManagementDetails = this.HaveJson(this.deviceTraceabilityManagementDetails) + this.submitFormLoading = true + if (this.operationType === 'add') { + this.$axios.post(this.$api.deviceTraceabilityManagement.addTraceabilityManagement, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } else { + this.$axios.post(this.$api.deviceTraceabilityManagement.updateTraceabilityManagement, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('淇敼鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }, + // 鎻愪氦瀹℃牳 + checkStatus(status) { + const params = { + status: status, + traceabilityManagementId: this.traceabilityManagementId + } + this.$axios.post(this.$api.deviceTraceabilityManagement.reviewTraceabilityManagementStatus, + params, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('瀹℃牳鎴愬姛') + this.applicationForm = false + this.getYearTableDetailData() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + }, + closeDialog() { + this.applicationForm = false + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData() + }, + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceTraceabilityManagement.exportDeviceTraceabilityManagement + '?traceabilityManagementId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], {type: 'application/octet-stream'}); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧閲忓�兼函婧愮鐞嗘�讳綋璁″垝.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '浠櫒璁惧閲忓�兼函婧愮鐞嗘�讳綋璁″垝.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceTraceabilityManagement.deleteTraceabilityManagement + '?traceabilityManagementId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions() { + this.equipOptions = [] + this.$axios.get(this.$api.deviceScope.deviceScopeSearch + '?status=0').then(res => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map(m => { + m.value = m.managementNumber + m.label = m.deviceName + return m + }) + } + }).catch(error => { + console.error(error) + }) + }, + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getYearTableDetailData(); + } + }, + } +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/equipment/scrapApplicationForm.vue b/src/components/equipment/scrapApplicationForm.vue new file mode 100644 index 0000000..65a02d5 --- /dev/null +++ b/src/components/equipment/scrapApplicationForm.vue @@ -0,0 +1,199 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="浠櫒璁惧鎶ュ簾鐢宠琛�" + width="80%" @close="resetForm"> + <el-steps :active="currentStep" align-center finish-status="success"> + <el-step title="濉啓鐢宠琛�" @click.native="setStep(0)"></el-step> + <el-step title="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙�" @click.native="setStep(1)"></el-step> + <el-step title="璁¢噺瀹ゆ剰瑙�" @click.native="setStep(2)"></el-step> + <el-step title="鎵瑰噯浜�" @click.native="setStep(3)"></el-step> + </el-steps> + <el-form ref="modelForm" + :model="form" :rules="rules" label-width="160px"> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="閰嶄欢锛�" prop="parts"> + <el-input v-model="form.parts" :disabled="currentStep !== 0" clearable size="small"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="鎶ュ簾鐞嗙敱锛�" prop="reasonsForScrap"> + <el-input v-model="form.reasonsForScrap" :disabled="currentStep !== 0" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 0" :span="24"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜猴細" prop="departmentHeadUserId"> + <el-select v-model="form.departmentHeadUserId" :disabled="currentStep !== 0" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙侊細" prop="departmentHeadOpinion"> + <el-input v-model="form.departmentHeadOpinion" :disabled="currentStep !== 1" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 1" :span="24"> + <el-form-item label="璁¢噺瀹よ礋璐d汉锛�" prop="meteringRoomUserId"> + <el-select v-model="form.meteringRoomUserId" :disabled="currentStep !== 1" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="璁¢噺瀹ゆ剰瑙侊細" prop="meteringRoomOpinion"> + <el-input v-model="form.meteringRoomOpinion" :disabled="currentStep !== 2" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + <el-col v-if="showStep === 2" :span="24"> + <el-form-item label="鎵瑰噯浜猴細" prop="approverUserId"> + <el-select v-model="form.approverUserId" :disabled="currentStep !== 2" placeholder="璇烽�夋嫨" size="small" style="width: 50%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col v-if="showStep === 3" :span="24"> + <el-form-item label="鎵瑰噯浜烘剰瑙侊細" prop="approverOpinion"> + <el-input v-model="form.approverOpinion" :disabled="currentStep !== 3" clearable size="small" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="resetForm">鍙� 娑�</el-button> + <el-button v-if="currentStep !== 4" :loading="submitFormLoading" type="primary" @click="submitForm">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "scrapApplicationForm", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + dialogVisible: false, + submitFormLoading: false, + form: { + parts: '', + reasonsForScrap: '', + departmentHeadUserId: '', + departmentHeadOpinion: '', + meteringRoomUserId: '', + meteringRoomOpinion: '', + approverUserId: '', + approverOpinion: '', + flowType: '', + deviceId: '', + isFinish: '', + }, + currentStep: 0, + showStep: 0, + rules: { + departmentHeadUserId: [{ required: true, message: '璇烽�夋嫨鐢宠閮ㄩ棬璐熻矗浜�', trigger: 'change' }], + meteringRoomUserId: [{ required: true, message: '璇烽�夋嫨璁¢噺瀹よ礋璐d汉', trigger: 'change' }], + approverUserId: [{ required: true, message: '璇烽�夋嫨鎵瑰噯浜�', trigger: 'change' }], + }, + userList: [], + } + }, + mounted() { + + }, + // 鏂规硶闆嗗悎 + methods: { + // 鎵撳紑寮规 + openDialog (id, deviceId) { + this.dialogVisible = true + this.form.scrappedId = id + this.form.deviceId = deviceId + this.getUserList() + if (this.form.scrappedId) { + this.searchInfo() + } + }, + // 鏌ヨ璇︽儏 + searchInfo () { + this.$axios.get(this.$api.deviceScrapped.getDeviceScrapped+'?scrappedId=' + this.form.scrappedId).then(res => { + if (res.code === 200) { + this.form = {...res.data} + if (this.form.isFinish === 0) { + if (this.form.departmentHeadUserId) { + this.currentStep = 1 + this.showStep = 1 + } + if (this.form.meteringRoomUserId) { + this.currentStep = 2 + this.showStep = 2 + } + if (this.form.approverUserId) { + this.currentStep = 3 + this.showStep = 3 + } + } else { + this.currentStep = 4 + this.showStep = 3 + } + } + }).catch(error => { + console.error(error) + }) + }, + setStep (step) { + this.showStep = step + }, + // 鎻愪氦琛ㄥ崟 + submitForm () { + this.form.flowType = this.currentStep + this.$refs.modelForm.validate((valid) => { + if (valid) { + this.$axios.post(this.$api.deviceScrapped.addDeviceScrapped, + this.form, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.$message.success('鏂板鎴愬姛') + this.resetForm() + } + this.submitFormLoading = false + }).catch(err => { + this.submitFormLoading = false + }) + } + }) + }, + // 鍏抽棴寮规 + resetForm () { + this.dialogVisible = false + this.$emit('closeDialog') + }, + getUserList(){ + this.$axios.post(this.$api.user.selectUserList, { + page: {current: -1, size: -1,}, + entity: {name: null} + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + return + } + this.userList = res.data.body.records + }) + }, + }, +} +</script> + +<style scoped> +.form-item { + display: flex; + align-items: center; + margin-right: 20px; +} +</style> diff --git a/src/components/equipment/using-external-instruments.vue b/src/components/equipment/using-external-instruments.vue new file mode 100644 index 0000000..11de340 --- /dev/null +++ b/src/components/equipment/using-external-instruments.vue @@ -0,0 +1,198 @@ +<template> + <div> + <div> + <div class="title"> + <div class="title-search"> + <span style="width: 80px;font-size: 14px">鍗曚綅鍚嶇О锛�</span> + <el-input v-model="searchForm.unitName" clearable size="small" style="margin-right: 10px;width: 220px"></el-input> + <el-button size="small" type="primary" @click="getYearTableDetailData">鏌� 璇�</el-button> + <el-button size="small" @click="reset">閲� 缃�</el-button> + </div> + <div> + <el-button size="small" type="primary" @click="handleForm('')">鏂板</el-button> + </div> + </div> + <div> + <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;"> + <!-- 琛ㄦ牸鍒� --> + <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> + <el-table-column label="鍗曚綅鍚嶇О" min-width="150" prop="unitName"></el-table-column> + <el-table-column label="鍦板潃" min-width="100" prop="address"></el-table-column> + <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="deviceName"></el-table-column> + <el-table-column label="鍨嬪彿" min-width="100" prop="deviceModel"></el-table-column> + <el-table-column label="閰嶄欢" min-width="150" prop="parts"></el-table-column> + <el-table-column label="瀵规柟浠櫒缂栧彿" min-width="150" prop="instrumentNumber"></el-table-column> + <el-table-column label="浠櫒鎶�鏈寚鏍�" min-width="150" prop="technicalIndex" show-overflow-tooltip></el-table-column> + <el-table-column label="闇�姹傛妧鏈寚鏍�" min-width="150" prop="technicalRequirements" show-overflow-tooltip></el-table-column> + <!-- 鎿嶄綔鎸夐挳 --> + <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="150"> + <template slot-scope="scope"> + <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleForm(scope.row.externalApplyId)">鎿嶄綔</el-button> + <el-button size="small" type="text" @click="handleDownOne(scope.row.externalApplyId)">瀵煎嚭</el-button> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.externalApplyId)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> + </el-pagination> + </div> + </div> + <application-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></application-form> + </div> +</template> + +<script> +import ApplicationForm from "./applicationForm.vue"; + +export default { + name: "using-external-instruments", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {ApplicationForm}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + searchForm: { + unitName: '', + }, + pagination1: { + size: 10, + current: 1, + total: 0, + }, + yearTableDetailDataLoading: false, + yearTableDetailData: [], + applicationForm: false + } + }, + mounted() { + this.getYearTableDetailData() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ + getYearTableDetailData () { + this.yearTableDetailDataLoading = true + this.$axios.post(this.$api.deviceExternalApply.pageDeviceExternalApply,{ + page: { + current: this.pagination1.current, + size: this.pagination1.size, + }, + entity: { + unitName: this.searchForm.unitName, + } + }, { + headers: { + 'Content-Type': 'application/json' + }, + noQs: true + }).then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records + this.pagination1.total = res.data.total + } + this.yearTableDetailDataLoading = false + }).catch(err => { + this.yearTableDetailDataLoading = false + }) + }, + handleForm (id) { + this.applicationForm = true + this.$nextTick(() => { + this.$refs.applicationForm.openDialog(id) + }) + }, + closeDialog () { + this.applicationForm = false + this.getYearTableDetailData() + }, + // 閲嶇疆 + reset () { + this.searchForm = { + unitName: '', + } + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleSizeChange1(val) { + this.pagination1.size = val + this.getYearTableDetailData() + }, + // 鍒嗛〉 + handleCurrentChange1(val) { + this.pagination1.current = val + this.getYearTableDetailData() + }, + // 瀵煎嚭 + handleDownOne(id) { + this.outLoading = true + this.$axios.get(this.$api.deviceExternalApply.exportDeviceExternalApply + '?externalApplyId=' + id, { + responseType: "blob" + }).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '鍒╃敤澶栭儴浠櫒璁惧鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '鍒╃敤澶栭儴浠櫒璁惧鐢宠琛�.doc'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } + }) + }, + // 鍒犻櫎 + deleteFun(id) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$axios.get(this.$api.deviceExternalApply.delDeviceExternalApply + '?externalApplyId=' + id).then(res => { + this.$message.success('鍒犻櫎鎴愬姛锛�'); + this.getYearTableDetailData(); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + }, +} +</script> + +<style scoped> +.title { + display: flex; + justify-content: space-between; + align-items: center; +} +.title-search { + display: flex; + align-items: center; + margin: 10px 0; +} +</style> diff --git a/src/components/view/a6-device.vue b/src/components/view/a6-device.vue index b904515..168f9ef 100644 --- a/src/components/view/a6-device.vue +++ b/src/components/view/a6-device.vue @@ -1,18 +1,25 @@ <template> <div class="device-page"> <div class="device-left"> - <el-input placeholder="杈撳叆璁惧鍚嶇О" suffix-icon="el-icon-search" v-model="deviceName" size="small" - @keyup.enter="geList" - style="margin-bottom: 5px;" clearable @change="geList"></el-input> - <el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'label' }" node-key="id" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen" - @node-collapse="nodeClose" v-loading="loading" :expand-on-click-node="false" - :default-expanded-keys="expandedKeys" - style="height:calc(100% - 46px);overflow-y: scroll;scrollbar-width: none;"> - <div class="custom-tree-node" slot-scope="{ node, data }"> + <el-input v-model="deviceName" class="div_left_input" clearable placeholder="杈撳叆璁惧鍚嶇О" + size="small" suffix-icon="el-icon-search" @blur="searchFilter" @clear="searchFilter" + @keyup.enter.native="searchFilter"></el-input> + <el-tree ref="tree" v-loading="loading" :data="list" :expand-on-click-node="false" + :filter-node-method="filterNode" :props="{ children: 'children', label: 'label' }" highlight-current node-key="id" + style="height:calc(100% - 46px); + overflow-y: scroll; + scrollbar-width: none;" @node-click="handleNodeClick" @node-expand="nodeOpen" @node-collapse="nodeClose"> + <div slot-scope="{ node, data }" class="custom-tree-node"> <el-row style="width: 100%;"> <el-col :span="21" :title="data.label"> <span class="single-line-ellipsis" style="width: 100%;display: inline-block;"> - <i :class="`node_i ${data.children != undefined ? (data.code==='[1]'?'el-icon-folder-opened':'el-icon-folder') : 'el-icon-tickets'}`"></i> + <i :class="`node_i ${data.children != undefined + ? data.code === '[1]' + ? 'el-icon-folder-opened' + : 'el-icon-folder' + : 'el-icon-tickets' + }` + "></i> {{ data.label }} </span> </el-col> @@ -21,30 +28,125 @@ </el-tree> </div> <div class="device-right"> - <el-radio-group v-model="currentPage" size="small"> - <el-radio-button :label="item.id" v-for="(item,index) in tabList" :key="index" - size="small">{{ item.title }}</el-radio-button> - </el-radio-group> - <div class="device-right-content"> - <component :is="currentPage"></component> + <div v-if="isShowAll"> + <el-tabs v-model="menuListActiveName" class="main_right" type="border-card"> + <el-tab-pane label="璁惧鎬昏" name="璁惧鎬昏"> + <overview v-if="menuListActiveName == '璁惧鎬昏'" :clickNodeVal="clickNodeVal" /> + </el-tab-pane> + <el-tab-pane label="璁惧宸ュ叿鏄庣粏" name="璁惧宸ュ叿鏄庣粏"> + <management v-if="menuListActiveName == '璁惧宸ュ叿鏄庣粏'" :clickNodeVal="clickNodeVal" /> + </el-tab-pane> +<!-- <el-tab-pane label="璧勬簮棰勫畾" name="璧勬簮棰勫畾">--> +<!-- <resourceReservation v-if="menuListActiveName == '璧勬簮棰勫畾'" :clickNodeVal="clickNodeVal"/>--> +<!-- </el-tab-pane>--> + <el-tab-pane label="璁惧鏍″噯璁″垝" name="璁惧鏍″噯璁″垝"> + <equipment-calibration-plan v-if="menuListActiveName == '璁惧鏍″噯璁″垝'" :clickNodeVal="clickNodeVal"></equipment-calibration-plan> + </el-tab-pane> + <el-tab-pane label="璁惧鏍告煡璁″垝" name="璁惧鏍告煡璁″垝"> + <equipment-verification-plan v-if="menuListActiveName == '璁惧鏍告煡璁″垝'" :clickNodeVal="clickNodeVal"></equipment-verification-plan> + </el-tab-pane> + <el-tab-pane label="璁惧淇濆吇璁″垝" name="璁惧淇濆吇璁″垝"> + <equipment-maintenance-plan v-if="menuListActiveName == '璁惧淇濆吇璁″垝'" :clickNodeVal="clickNodeVal"></equipment-maintenance-plan> + </el-tab-pane> + <el-tab-pane label="閲忓�兼函婧愯鍒�" name="閲忓�兼函婧愯鍒�"> + <quantity-value-traceability-plan v-if="menuListActiveName == '閲忓�兼函婧愯鍒�'" :clickNodeVal="clickNodeVal"></quantity-value-traceability-plan> + </el-tab-pane> + <el-tab-pane label="鍒╃敤澶栭儴浠櫒璁惧" name="鍒╃敤澶栭儴浠櫒璁惧"> + <using-external-instruments v-if="menuListActiveName == '鍒╃敤澶栭儴浠櫒璁惧'" :clickNodeVal="clickNodeVal"></using-external-instruments> + </el-tab-pane> + </el-tabs> + </div> + <div v-if="!isShowAll"> + <el-tabs v-model="tabListActiveName" class="main_right" type="border-card" @tab-click="handleClick"> +<!-- <el-tab-pane label="璁惧杩愯鎬昏" name="璁惧杩愯鎬昏">--> +<!-- <operationOverview v-if="tabListActiveName == '璁惧杩愯鎬昏'" :clickNodeVal="clickNodeVal"/>--> +<!-- </el-tab-pane>--> + <el-tab-pane label="璁惧妗f" name="璁惧妗f"> + <files v-if="tabListActiveName == '璁惧妗f'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧楠屾敹" name="璁惧楠屾敹"> +<!-- <checkAndAccept v-if="tabListActiveName == '璁惧楠屾敹'" :clickNodeVal="clickNodeVal"/>--> + <equipment-acceptance v-if="tabListActiveName == '璁惧楠屾敹'" :clickNodeVal="clickNodeVal"></equipment-acceptance> + </el-tab-pane> + <el-tab-pane label="璁惧鏍″噯" name="璁惧鏍″噯"> + <calibration v-if="tabListActiveName == '璁惧鏍″噯'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> +<!-- <el-tab-pane label="璁惧鏍告煡" name="璁惧鏍告煡">--> +<!-- <check v-if="tabListActiveName == '璁惧鏍告煡'" :clickNodeVal="clickNodeVal"/>--> +<!-- </el-tab-pane>--> + <el-tab-pane label="璁惧缁存姢" name="璁惧缁存姢"> + <maintenance v-if="tabListActiveName == '璁惧缁存姢'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧鍊熺敤" name="璁惧鍊熺敤"> + <borrow v-if="tabListActiveName == '璁惧鍊熺敤'" :clickNodeVal="clickNodeVal" /> + </el-tab-pane> +<!-- <el-tab-pane label="璁惧鏁呴殰" name="璁惧鏁呴殰">--> +<!-- <fault v-if="tabListActiveName == '璁惧鏁呴殰'" :clickNodeVal="clickNodeVal" />--> +<!-- </el-tab-pane>--> + <el-tab-pane label="浣跨敤璁板綍" name="浣跨敤璁板綍"> + <record v-if="tabListActiveName == '浣跨敤璁板綍'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧鍋滅敤/鍚敤" name="璁惧鍋滅敤/鍚敤"> + <state v-if="tabListActiveName == '璁惧鍋滅敤/鍚敤'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧鎶ュ簾" name="璁惧鎶ュ簾"> + <equipment-scrap v-if="tabListActiveName == '璁惧鎶ュ簾'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧鏁呴殰涓庣淮淇�" name="璁惧鏁呴殰涓庣淮淇�"> + <equipment-failure v-if="tabListActiveName == '璁惧鏁呴殰涓庣淮淇�'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧鐐规" name="璁惧鐐规"> + <inspection-of-equipment v-if="tabListActiveName == '璁惧鐐规'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="璁惧浜嬫晠" name="璁惧浜嬫晠"> + <equipment-accident v-if="tabListActiveName == '璁惧浜嬫晠'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + <el-tab-pane label="浣滀笟鎸囧涔�" name="浣滀笟鎸囧涔�"> + <operationInstruction v-if="tabListActiveName == '浣滀笟鎸囧涔�'" :clickNodeVal="clickNodeVal"/> + </el-tab-pane> + </el-tabs> </div> </div> </div> </template> <script> -import operationOverview from '../do/a6-device/operation-overview.vue'; -import files from '../do/a6-device/files.vue'; -import checkAndAccept from '../do/a6-device/check-and-accept.vue'; -import calibration from '../do/a6-device/calibration.vue'; -import check from '../do/a6-device/check.vue'; -import maintenance from '../do/a6-device/maintenance.vue'; +import operationOverview from "../do/a6-device/operation-overview.vue"; +import files from "../do/a6-device/files.vue"; +import checkAndAccept from "../do/a6-device/check-and-accept.vue"; +import calibration from "../do/a6-device/calibration.vue"; +import check from "../do/a6-device/check.vue"; +import maintenance from "../do/a6-device/maintenance.vue"; import borrow from "../do/a6-device/borrow.vue"; import fault from "../do/a6-device/fault.vue"; -import record from '../do/a6-device/record.vue'; -import state from '../do/a6-device/state.vue'; +import record from "../do/a6-device/record.vue"; +import state from "../do/a6-device/state.vue"; +import management from "../do/a6-device/management.vue"; +import overview from "../do/a6-device/device-overview.vue"; +import resourceReservation from "../do/a6-device/resource-reservation.vue"; +import operationInstruction from "../do/a6-device/operation-instruction.vue"; +import EquipmentCalibrationPlan from "../equipment/equipment-calibration-plan.vue"; +import EquipmentVerificationPlan from "../equipment/equipment-verification-plan.vue"; +import UsingExternalInstruments from "../equipment/using-external-instruments.vue"; +import EquipmentScrap from "../equipment/equipment-scrap.vue"; +import EquipmentFailure from "../equipment/equipment-failure.vue"; +import InspectionOfEquipment from "../equipment/inspection-of-equipment.vue"; +import EquipmentAccident from "../equipment/equipment-accident.vue"; +import EquipmentMaintenancePlan from "../equipment/equipment-maintenance-plan.vue"; +import EquipmentAcceptance from "../equipment/equipment-acceptance.vue"; +import QuantityValueTraceabilityPlan from "../equipment/quantity-value-traceability-plan.vue"; export default { - components:{ + components: { + QuantityValueTraceabilityPlan, + EquipmentAcceptance, + EquipmentMaintenancePlan, + EquipmentAccident, + InspectionOfEquipment, + EquipmentFailure, + EquipmentScrap, + UsingExternalInstruments, + EquipmentVerificationPlan, + EquipmentCalibrationPlan, operationOverview, files, checkAndAccept, @@ -55,137 +157,109 @@ fault, record, state, + management, + overview, + resourceReservation, + operationInstruction }, - data(){ + data() { return { - deviceName:'', - loading:false, - tabList:[ - { - id:'operationOverview', - title:'璁惧杩愯鎬昏', - }, - { - id:'files', - title:'璁惧妗f', - }, - { - id:'checkAndAccept', - title:'璁惧楠屾敹', - }, - { - id:'calibration', - title:'璁惧鏍″噯', - }, - { - id:'check', - title:'璁惧鏍告煡', - }, - { - id:'maintenance', - title:'璁惧缁存姢', - }, - { - id:'borrow', - title:'璁惧鍊熺敤', - }, - { - id:'fault', - title:'璁惧鏁呴殰', - }, - { - id:'record', - title:'浣跨敤璁板綍', - }, - { - id:'state', - title:'璁惧鍋滅敤/鍚敤', - }, - ], - currentPage:'operationOverview', - expandedKeys:[], - selectTree:'', - list:[] - } + isShowAll: true, + deviceName: "", // 渚ц竟鏍忔悳绱� + loading: false, + tabListActiveName: '璁惧妗f', + menuListActiveName: '璁惧鎬昏', + list: [], + clickNodeVal: {} + }; }, - mounted(){ - this.geList() + mounted() { + // 鍒濆鍖栬皟鐢� + this.geList(); }, - methods:{ - geList(){ + methods: { + handleClick(tab, event) { + }, + searchFilter() { + this.$refs.tree.filter(this.deviceName) + }, + filterNode(value, data) { + if (!value) return true; + return data.label.indexOf(value) !== -1; + }, + // 鐖剁骇 + geList() { this.loading = true; - this.$axios.get(this.$api.deviceScope.treeDevice+'?deviceName='+this.deviceName).then(res => { - this.loading = false; - let data = res.data - data.forEach((item,index) => { - item.id = index +1 - item.label = item.largeCategory - item.children.forEach((m,i)=>{ - m.label = m.deviceName - }) - }) - this.list = data - }) + this.$axios.get( + this.$api.deviceScope.treeDevice + ).then(res => { + let data = res.data; + this.list = data; + this.loading = false + }); }, - handleNodeClick(val, node, el) { //鏍戠殑鍊� - this.selectTree = '' - this.getNodeParent(node) - this.selectTree = this.selectTree.replace(' - ', '') - let data = this.selectTree.split(' - ') - let data2 = '' - for (let index = data.length - 1; index >= 0; index--) { - data2 += " - " + data[index] - } - this.selectTree = data2.replace(' - ', '') - - this.currentPage = 'operationOverview'; - }, - getNodeParent(val) { - if (val.parent != null) { - if(val.data.children === null){ - this.selectTree += ' - ' + val.label + ' - ' + 'null' - }else{ - this.selectTree += ' - ' + val.label - } - this.getNodeParent(val.parent) + handleNodeClick(val, node, el) { + // 鐐瑰嚮涓存椂缂撳瓨 + this.clickNodeVal = val; + // 瀛樺偍鐖剁骇鑺傜偣绾ф暟 + this.clickNodeVal.level = node.level + this.clickNodeVal.parent = node.parent.data + // 鏄惁鏄剧ず璁惧璇︽儏 + if (!val.value) { + this.isShowAll = true + } else { + this.isShowAll = false } }, nodeOpen(data, node, el) { - $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened') + $($(el.$el).find(".node_i")[0]).attr( + "class", + "node_i el-icon-folder-opened" + ); }, nodeClose(data, node, el) { - $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') + $($(el.$el).find(".node_i")[0]).attr("class", "node_i el-icon-folder"); }, } -} +}; </script> <style scoped> -.device-page{ +.device-page { display: flex; padding-top: 10px; padding-bottom: 10px; box-sizing: border-box; width: 100%; } -.device-left{ - width: 200px; + +.device-left { + width: 250px; height: 100%; background: #fff; margin-right: 10px; border-radius: 16px; box-sizing: border-box; padding: 10px 16px; + flex-shrink: 0; } -.device-right{ + +.device-right { background: #fff; - flex: 1; + width: calc(100% - 260px); + height: 100%; border-radius: 16px; box-sizing: border-box; padding: 10px 16px; } -.device-right-content{ - margin-top: 10px; + +.showLargeCategory { + width: 100%; + height: 100%; +} + +.device-right-content { + /* margin-top: 10px; */ height: calc(100% - 42px); width: 100%; } @@ -199,4 +273,12 @@ color: orange; font-size: 18px; } + +.main_right { + height: calc(100% - 5px); + overflow: hidden; +} +>>>.el-tabs__content { + padding-top: 0; +} </style> diff --git a/src/main.js b/src/main.js index 2aabee7..e3d8da8 100644 --- a/src/main.js +++ b/src/main.js @@ -22,7 +22,7 @@ //鏈湴 // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; // const javaApi = 'http://127.0.0.1:8001'; -// const javaApi = 'http://172.20.10.5:8001'; +// const javaApi = 'http://10.37.202.58:8001'; //閫氫俊娴嬭瘯搴� // Vue.prototype.LOCATIONVUE = "http://10.1.13.77:8080"; @@ -31,11 +31,11 @@ // 閫氫俊姝e紡搴� // Vue.prototype.LOCATIONVUE = "http://192.168.22.29:8080"; // const javaApi = 'http://192.168.22.29:8001/lims/'; -const javaApi = 'https://ztwxlims.ztt.cn:7443/lims/'; +// const javaApi = 'https://ztwxlims.ztt.cn:7443/lims/'; // //浜� -// Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080"; -// const javaApi = 'http://114.132.189.42:1234'; +Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080"; +const javaApi = 'http://114.132.189.42:1234'; // //妫�娴嬩腑蹇冩寮忓簱 // Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080"; diff --git a/src/util/auth.js b/src/util/auth.js new file mode 100644 index 0000000..dc22f5f --- /dev/null +++ b/src/util/auth.js @@ -0,0 +1,17 @@ +/** + * 鍒ゆ柇褰撳墠瑙掕壊鏄惁鏈夎鏉冮檺 + * @param {*} methodName + * @returns + */ +export function isPermission(methodName){ + if(undefined != methodName && '' != methodName && null!=methodName){ + //褰撳墠瑙掕壊鎵�鏈夐�変腑鐨勬潈闄� + let power = JSON.parse(sessionStorage.getItem('power')) + for (var i = 0; i < power.length; i++) { + if (methodName && power[i].menuMethod == methodName) { + return true + } + } + } + return false +} diff --git a/static/js/menu.js b/static/js/menu.js index 7ca7e0d..2b482be 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -243,7 +243,7 @@ // ] // }, { - v: "5 缁撴瀯瑕佹眰", + v: "缁撴瀯瑕佹眰", i: "font icon-jiegouyaoqiu", p: "", c: [ @@ -264,19 +264,19 @@ v: "瀹為獙瀹よ祫璐�", i: "font icon-erjidaohang", u: "a5-laboratory-qualifications", - g: "C鑳藉姏鑼冨洿鍜岃祫璐�", + g: "鑳藉姏鑼冨洿鍜岃祫璐�", p: "getCertificationDetail" }, { v: "鑳藉姏鑼冨洿", i: "font icon-erjidaohang", u: "a5-capacity-scope", - g: "C鑳藉姏鑼冨洿鍜岃祫璐�", + g: "鑳藉姏鑼冨洿鍜岃祫璐�", p: "selectItemParameterList selectTestObjectList" }, { v: "鍦烘墍鎴栬鏂�", i: "font icon-erjidaohang", u: "a5-laboratory-management", - g: "D鍦烘墍鎴栬鏂�", + g: "鍦烘墍鎴栬鏂�", p: "selectItemParameter" } // , { @@ -300,7 +300,7 @@ // } ] }, { - v: "6 璧勬簮瑕佹眰", + v: "璧勬簮瑕佹眰", i: "font icon-ziyuanyaoqiu", p: "", c: [ @@ -315,21 +315,21 @@ v: "浜哄憳鎬昏", i: "font icon-erjidaohang", u: "a6-personnel-overview", - g: "6.2 浜哄憳", + g: "浜哄憳", p: "selectPersonnelOverview" }, { v: "浜哄憳", i: "font icon-erjidaohang", u: "a6-personnel", - g: "6.2 浜哄憳", + g: "浜哄憳", p: "" }, { v: "璁炬柦鍜岀幆澧冩潯浠�", i: "font icon-erjidaohang", u: "a6-facilities-environment", - g: "6.3 璁炬柦鍜岀幆澧冩潯浠�", + g: "璁炬柦鍜岀幆澧冩潯浠�", p: "" }, { @@ -337,32 +337,32 @@ i: "font icon-erjidaohang", // u: "a6-device", u:"a6-device-management", - g: "6.4 璁惧", + g: "璁惧", p: "" }, { v: "閲忓�兼函婧愯鍒�", i: "font icon-erjidaohang", u: "a6-quantity-value-traceability-plan", - g: "6.5 璁¢噺婧簮鎬�", + g: "璁¢噺婧簮鎬�", p: "" }, { v: "鏍囧噯鐗╄川娓呭崟", i: "font icon-erjidaohang", u: "a6-standard-material-list", - g: "6.5 璁¢噺婧簮鎬�", + g: "璁¢噺婧簮鎬�", p: "" }, { v: "鏍囧噯鐗╄川楠屾敹", i: "font icon-erjidaohang", u: "a6-standard-material-accep", - g: "6.5 璁¢噺婧簮鎬�", + g: "璁¢噺婧簮鎬�", p: "" }, { v: "鏍囧噯鐗╄川棰嗙敤", i: "font icon-erjidaohang", u: "a6-standard-material-requisition", - g: "6.5 璁¢噺婧簮鎬�", + g: "璁¢噺婧簮鎬�", p: "" }, // { @@ -376,13 +376,13 @@ v: "鏈嶅姟鍜屼緵搴斿搧閲囪喘", i: "font icon-erjidaohang", u: "a6.service-and-supply-purchase", - g: "6.6 澶栭儴鎻愪緵鐨勪骇鍝佸拰鏈嶅姟", + g: "澶栭儴鎻愪緵鐨勪骇鍝佸拰鏈嶅姟", p: "" },{ v: "渚涘簲鍟嗙鐞�", i: "font icon-erjidaohang", u: "a6-supplier-manage", - g: "6.6 澶栭儴鎻愪緵鐨勪骇鍝佸拰鏈嶅姟", + g: "澶栭儴鎻愪緵鐨勪骇鍝佸拰鏈嶅姟", p: "" }, // { @@ -401,7 +401,7 @@ ] }, { - v: "7 杩囩▼瑕佹眰", + v: "杩囩▼瑕佹眰", i: "font icon-guochengyaoqiu", p: "", c: [ @@ -409,7 +409,7 @@ v: "妫�楠屽鎵樺崟", i: "font icon-erjidaohang", u: "a7-contract-review", - g: "7.1 瑕佹眰銆佹爣涔﹀拰鍚堝悓璇勫", + g: "瑕佹眰銆佹爣涔﹀拰鍚堝悓璇勫", p: "pageProcessOrder" }, // { @@ -423,25 +423,25 @@ v: "瀹為獙瀹ょ殑妫�娴嬭兘鍔涙。妗�", i: "font icon-erjidaohang", u: "a7-standard-method", - g: "7.2 鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", + g: "鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", p: "selectStandardMethodList" }, { v: "鏍囧噯鏌ユ柊", i: "font icon-erjidaohang", u: "a7-standard-novelty-retrieval", - g: "7.2 鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", + g: "鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", p: "" }, { v: "鏍囧噯鏂规硶鐨勫彉鏇�", i: "font icon-erjidaohang", u: "a7-changes-standard-methods", - g: "7.2 鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", + g: "鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", p: "" }, { v: "鏂规硶楠岃瘉", i: "font icon-erjidaohang", u: "a7-method-verification", - g: "7.2 鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", + g: "鏂规硶鐨勯�夋嫨銆侀獙璇佸拰纭", p: "" }, // { @@ -455,13 +455,13 @@ v: "鏍峰搧鎺ユ敹", i: "font icon-erjidaohang", u: "a7-sample-registration", - g: "7.4 妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�", + g: "妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�", p: "pageProcessTotaldeal" },{ v: "妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�", i: "font icon-erjidaohang", u: "a7-sample-disposal", - g: "7.4 妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�", + g: "妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�", p: "pageProcessTotaldeal" }, // { @@ -475,43 +475,43 @@ v: "娴嬮噺涓嶇‘瀹氬害鐨勮瘎瀹�", i: "font icon-erjidaohang", u: "a7-uncertainty-evaluation", - g: "7.6 娴嬮噺涓嶇‘瀹氬害鐨勮瘎瀹�", + g: "娴嬮噺涓嶇‘瀹氬害鐨勮瘎瀹�", p: "pageProcessEvaluate" }, { v: "璐ㄩ噺鐩戞帶璁″垝", i: "font icon-erjidaohang", u: "a7-Ensure-results-validity", - g: "7.7 纭繚缁撴灉鏈夋晥鎬�", + g: "纭繚缁撴灉鏈夋晥鎬�", p: "" }, { v: "璐ㄩ噺鐩戠潱璁″垝", i: "font icon-erjidaohang", u: "a7-quality-control-plan", - g: "7.7 纭繚缁撴灉鏈夋晥鎬�", + g: "纭繚缁撴灉鏈夋晥鎬�", p: "" }, { v: "鎶ュ憡缁撴灉", i: "font icon-erjidaohang", u: "a7-report-results", - g: "7.8 鎶ュ憡缁撴灉", + g: "鎶ュ憡缁撴灉", p: "pageProcessReport" },{ v: "鎶曡瘔鎯呭喌姹囨�昏〃", i: "font icon-erjidaohang", u: "a7-complaint", - g: "7.9 鎶曡瘔", + g: "鎶曡瘔", p: "pageProcessComplain" }, { v: "涓嶇鍚堥」", i: "font icon-erjidaohang", u: "a7-nonconforming-item", - g: "7.10 涓嶇鍚堝伐浣�", + g: "涓嶇鍚堝伐浣�", p: "" }, { v: "涓嶇鍚堥」鐨勫垎甯�", i: "font icon-erjidaohang", u: "a7-distribution-of-nonconforming", - g: "7.10 涓嶇鍚堝伐浣�", + g: "涓嶇鍚堝伐浣�", p: "" }, // { @@ -524,7 +524,7 @@ ] }, { - v: "8 浣撶郴绠$悊瑕佹眰", + v: "浣撶郴绠$悊瑕佹眰", i: "font icon-guanlitixiyaoqiu", p: "", c: [ @@ -545,49 +545,49 @@ v: "绠$悊浣撶郴鏂囦欢鐨勬帶鍒�", i: "font icon-erjidaohang", u: "a8-file-handling", - g: "8.3 绠$悊浣撶郴鏂囦欢鐨勬帶鍒�", + g: "绠$悊浣撶郴鏂囦欢鐨勬帶鍒�", p: "doManageDocumentList pageManageDocumentControlled" },{ v: "鏂囦欢瀹℃壒璁板綍", i: "font icon-erjidaohang", u: "a8-document-approval-records", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordCheck" },{ v: "澶栨潵鏂囦欢纭璁板綍", i: "font icon-erjidaohang", u: "a8-external-document-confirmation-records", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordTotal" },{ v: "鎵�鏈夋枃浠讹紙鍐呫�佸閮ㄦ枃浠讹級鐨勫彂鏀句笌鍥炴敹璁板綍", i: "font icon-erjidaohang", u: "a8-distribution-retrieval-records-all-documents", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordIssueRecycle" },{ v: "鏂囦欢淇鐢宠瀹℃壒璁板綍", i: "font icon-erjidaohang", u: "a8-document-revision-request-approval-records", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordAudit" },{ v: "鏂囦欢瀹氭湡瀹℃煡璁板綍", i: "font icon-erjidaohang", u: "a8-periodic-document-review-records", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordIntervals" },{ v: "浣滃簾鏂囦欢閿�姣佽褰�", i: "font icon-erjidaohang", u: "a8-obsolete-document-destruction-records", - g: "8.4 璁板綍鐨勬帶鍒�", + g: "璁板綍鐨勬帶鍒�", p: "pageManageRecordCancel" }, { v: "搴斿椋庨櫓鍜屾満閬囩殑鎺柦", i: "font icon-erjidaohang", u: "a8-measures_deal_risks_opportunities", - g: "8.5 搴斿椋庨櫓鍜屾満閬囩殑鎺柦", + g: "搴斿椋庨櫓鍜屾満閬囩殑鎺柦", p: "" }, // { @@ -601,25 +601,25 @@ v: "瀹㈡埛婊℃剰搴�", i: "font icon-erjidaohang", u: "a8-customer-satisfaction", - g: "8.6 鏀硅繘", + g: "鏀硅繘", p: "" }, { v: "绾犳鎺柦", i: "font icon-erjidaohang", u: "a8-corrective-action", - g: "8.7 绾犳鎺柦", + g: "绾犳鎺柦", p: "" }, { v: "鍐呭绠$悊", i: "font icon-erjidaohang", u: "a8-internal-audit-management", - g: "8.8 鍐呭绠$悊", + g: "鍐呭绠$悊", p: "" }, { v: "绠$悊璇勫", i: "font icon-erjidaohang", u: "a9-management-review", - g: "8.9 绠$悊璇勫", + g: "绠$悊璇勫", p: "" }] } -- Gitblit v1.9.3