From 237f95b05e0f122ee9ec7beaf82ba366a8b220ed Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期六, 15 二月 2025 14:50:59 +0800 Subject: [PATCH] 修改设备模块bug --- src/components/do/a6-device/files.vue | 1236 ++++++++----- src/components/do/a6-device/borrow.vue | 852 +++++--- src/components/do/a6-device/operation-instruction.vue | 868 ++++++-- src/components/equipment/quantity-value-traceability-plan.vue | 774 +++++-- src/components/equipment/equipment-acceptance.vue | 534 +++-- src/components/do/a6-device/calibration.vue | 995 +++++++--- src/assets/api/controller.js | 114 + 7 files changed, 3,540 insertions(+), 1,833 deletions(-) diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index 92016a1..941345d 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -90,7 +90,10 @@ responsi, deviceReservate, deviceInstruction, - borrow + borrow, + getDocuments, + product, + deviceBorrow }; } @@ -203,6 +206,7 @@ }; const deviceScope = { + selectUserList: "/deviceScope/selectUserList", //鑾峰彇鐢ㄦ埛鍒楄〃 selectDeviceParameter: "/deviceScope/selectDeviceParameter", //鏌ヨ璁惧璇︽儏鍒楄〃 addDeviceParameter: "/deviceScope/addDeviceParameter", //娣诲姞璁惧璇︽儏鍙傛暟 delDeviceParameter: "/deviceScope/delDeviceParameter", //鍒犻櫎璁惧璇︽儏鍙傛暟 @@ -653,7 +657,92 @@ // 6.2 浜哄憳 const personnel = { selectCNSAPersonTree: "/personBasicInfo/selectCNSAPersonTree", // 鏌ヨCNAS浜哄憳渚ц竟鏍� - saveCNASFile: "/personBasicInfo/saveCNASFile" // 鍏叡鏂囦欢淇濆瓨鎺ュ彛 + getAnnex: "/personBasicInfo/getAnnex", // 鑾峰彇闄勪欢 + basicInformationOfPersonnelSelectPage: + "personBasicInfo/basicInformationOfPersonnelSelectPage", // 鑾峰彇浜哄憳鍒楄〃 + getAnnexByUserId: "/personBasicInfo/getAnnexByUserId", + addAnnex: "/personBasicInfo/addAnnex", // 娣诲姞闄勪欢 + deleteAnnex: "/personBasicInfo/deleteAnnex", // 鍒犻櫎闄勪欢 + updateAnnex: "/personBasicInfo/updateAnnex", // 鏇存柊闄勪欢 + getCNASFile: "/personBasicInfo/getCNASFile", // 鑾峰彇鍥剧墖 + getCNASInformation: "/personBasicInfo/getCNASInformation", // 鏌ヨCNAS浜哄憳淇℃伅 + updateCNASInformation: "/personBasicInfo/updateCNASInformation", // 鏇存柊CNAS浜哄憳淇℃伅 + getCNASPersonnelInfo: "/personBasicInfo/getCNASPersonnelInfo", // 浜哄憳鍩烘湰淇℃伅鏌ヨ + saveCNASPersonnelInfo: "/personBasicInfo/saveCNASPersonnelInfo", // 浜哄憳鍩烘湰淇℃伅淇濆瓨 + saveCNASFile: "/personBasicInfo/saveCNASFile", // 鍏叡鏂囦欢淇濆瓨鎺ュ彛 + deleteCNASFile: "/personBasicInfo/deleteCNASFile", // 鍒犻櫎鏂囦欢 + getBasicInfoFileList: "/personBasicInfo/getBasicInfoFileList", // 浜哄憳鍩硅鍩烘湰淇℃伅闄勪欢鍒楄〃 + uploadBasicInfoFile: "/personBasicInfo/uploadBasicInfoFile", // 浜哄憳鍩硅鍩烘湰淇℃伅闄勪欢鍒楄〃 + delBasicInfoFileList: "/personBasicInfo/delBasicInfoFileList", // 浜哄憳鍩硅鍩烘湰淇℃伅闄勪欢鍒楄〃 + addBasicInfoWork: "/personBasicInfo/addBasicInfoWork", // 浜哄憳鍩硅鍩烘湰淇℃伅宸ヤ綔缁忓巻鏂板 + updateBasicInfoWorkList: "/personBasicInfo/updateBasicInfoWorkList", // 浜哄憳鍩硅鍩烘湰淇℃伅宸ヤ綔缁忓巻淇敼 + getBasicInfoWorkList: "/personBasicInfo/getBasicInfoWorkList", // 浜哄憳鍩硅鍩烘湰淇℃伅宸ヤ綔缁忓巻鍒楄〃 + delBasicInfoWorkList: "/personBasicInfo/delBasicInfoWorkList", // 浜哄憳鍩硅鍩烘湰淇℃伅宸ヤ綔缁忓巻鍒犻櫎 + getThisYearTrainingDetailed: "/personTraining/getThisYearTrainingDetailed", // 鏌ヨ浠婂勾浜哄憳鍩硅淇℃伅 + personTrainingSelect: "/personTraining/personTrainingSelect", // 鏌ヨ浜哄憳鍩硅 + personTrainingDelete: "/personTraining/personTrainingDelete", // 鍒犻櫎浜哄憳鍩硅淇℃伅 + approveAnnualPersonnelTraining: + "/personTraining/approveAnnualPersonnelTraining", // 鎵瑰噯 骞村害浜哄憳鍩硅 + reviewAnnualPersonnelTraining: + "/personTraining/reviewAnnualPersonnelTraining", // 瀹℃牳 骞村害浜哄憳鍩硅 + personTrainingImport: "/personTraining/personTrainingImport", // 瀵煎叆 浜哄憳鍩硅 + exportPersonTraining: "/personTraining/exportPersonTraining", // 瀵煎嚭/浜哄憳鍩硅 + queryTheAnnualPlanDetailsTable: + "/personTraining/queryTheAnnualPlanDetailsTable", // 鏌ヨ鍩硅璁″垝骞村害璁″垝鏄庣粏琛� + addOrUpdatePersonTrainingDetailed: + "/personTraining/addOrUpdatePersonTrainingDetailed", // 鏂板鍩硅璁″垝骞村害璁″垝鏄庣粏琛� + deleteAnnualPlanDetailTable: "/personTraining/deleteAnnualPlanDetailTable", // 鎵归噺鍒犻櫎 骞村害璁″垝鏄庣粏琛� + trainingAndAssessmentRecordsPage: + "/personTraining/trainingAndAssessmentRecordsPage", // 鍩硅涓庤�冩牳璁板綍 鏌ヨ + deleteTrainingAndAssessmentRecords: + "/personTraining/deleteTrainingAndAssessmentRecords", // 鍩硅涓庤�冩牳璁板綍 鎵归噺鍒犻櫎 + trainingAndAssessmentRecordsAdded: + "/personTraining/trainingAndAssessmentRecordsAdded", // 鍩硅涓庤�冩牳璁板綍 鎻愪氦 + trainingAndAssessmentRecordsEvaluate: + "/personTraining/trainingAndAssessmentRecordsEvaluate", // 鍩硅涓庤�冩牳璁板綍 鎻愪氦璇勪环 + getTrainingDetailedFileList: "/personTraining/getTrainingDetailedFileList", // 浜哄憳鍩硅璇︽儏闄勪欢鍒楄〃 + delTrainingDetailedFileList: "/personTraining/delTrainingDetailedFileList", // 浜哄憳鍩硅璇︽儏闄勪欢鍒犻櫎 + uploadTrainingDetailedFile: "/personTraining/uploadTrainingDetailedFile", // 浜哄憳鍩硅璇︽儏闄勪欢鏂板 + personJobResponsibilitiesSave: + "/personJobResponsibilities/personJobResponsibilitiesSave", // 鏂板宀椾綅鑱岃矗 + personJobResponsibilitiesDelete: + "/personJobResponsibilities/personJobResponsibilitiesDelete", // 鍒犻櫎宀椾綅鑱岃矗 + personJobResponsibilitiesUpdate: + "/personJobResponsibilities/personJobResponsibilitiesUpdate", // 鏇存柊宀椾綅鑱岃矗 + personJobResponsibilitiesSelect: + "/personJobResponsibilities/personJobResponsibilitiesSelect", // 鍒嗛〉鏌ヨ宀椾綅鑱岃矗 + personJobResponsibilitiesExport: + "/personJobResponsibilities/personJobResponsibilitiesExport", // 瀵煎嚭宀椾綅鑱岃矗 + personTrackRecordSave: "/personTrackRecord/personTrackRecordSave", // 鏂板宸ヤ綔灞ュ巻 + personTrackRecordDelete: "/personTrackRecord/personTrackRecordDelete", // 鍒犻櫎宸ヤ綔灞ュ巻 + personTrackRecordUpdate: "/personTrackRecord/personTrackRecordUpdate", // 鏇存柊宸ヤ綔灞ュ巻 + personTrackRecordSelect: "/personTrackRecord/personTrackRecordSelect", // 鏌ヨ宸ヤ綔灞ュ巻 + personTrackRecordExport: "/personTrackRecord/personTrackRecordExport", // 瀵煎嚭宸ヤ綔灞ュ巻 + personTrainingRecordSelect: + "/personTrainingRecord/personTrainingRecordSelect", // 鏌ヨ鍩硅璁板綍 + personTrainingRecordExport: + "/personTrainingRecord/personTrainingRecordExport", // 宸ヤ綔鍩硅璁板綍 + personPersonnelCapacityPage: + "/personPersonnelCapacity/personPersonnelCapacityPage", // 鏌ヨ浜哄憳鑳藉姏 + deletePersonPersonnelCapacity: + "/personPersonnelCapacity/deletePersonPersonnelCapacity", // 鍒犻櫎浜哄憳鑳藉姏 + addOrUpdatePersonPersonnelCapacity: + "/personPersonnelCapacity/addOrUpdatePersonPersonnelCapacity", // 鏂板缂栬緫浜哄憳鑳藉姏 + submitConfirmPersonnelCapability: + "/personPersonnelCapacity/submitConfirmPersonnelCapability", // 鏂板缂栬緫浜哄憳鑳藉姏 + exportPersonnelCapacity: "/personPersonnelCapacity/exportPersonnelCapacity", // 瀵煎嚭浜哄憳鑳藉姏 + newPersonnelAddedToTrainingRecords: + "/personTraining/newPersonnelAddedToTrainingRecords", // 鍩硅涓庤�冩牳 鏂板浜哄憳 + outOfFocusPreservation: "/personTraining/outOfFocusPreservation", // 鍩硅涓庤�冩牳 澶辩劍鏇存柊 + trainingSelectTrainingRecord: + "/personTrainingRecord/trainingSelectTrainingRecord", // 鏌ヨ浜哄憳 鍩硅璁板綍 + queryPersonnelDetails: "/personTrainingRecord/queryPersonnelDetails", // 鏌ヨ浜哄憳鏄庣粏 鍩硅璁板綍 + claimOfTrainingAndAssessmentRecords: + "/personTraining/claimOfTrainingAndAssessmentRecords", // 璁ら/鍙栨秷璁ら + exportPersonTrainingRecord: "/personTraining/exportPersonTrainingRecord", // 瀵煎嚭浜哄憳鍩硅涓庤�冩牳璁板綍 + exportTrainingRecord: "/personTrainingRecord/exportTrainingRecord", // 瀵煎嚭鍩硅璁板綍 + confirmPersonnelCapability: + "/personPersonnelCapacity/confirmPersonnelCapability" // 纭浜哄憳鑳藉姏 }; // 8.3 瀹㈡埛婊℃剰搴﹁皟鏌� @@ -1041,6 +1130,17 @@ "/personJobResponsibilities/exportPersonJobResponsibilities" //瀵煎嚭浜哄憳鑱岃矗,浼犲弬id }; +// 鑾峰彇鐩稿叧鏂囨。鏁版嵁鐨刟pi +const getDocuments = { + list: "/documents", + get: "/documents/getListByDId", + updateDocument: "/documents/updateDocument" +}; +// 浜у搧鐩稿簲鐨勬帴鍙� +const product = { + list: "/api/products" +}; + //璁惧鏁呴殰鐩稿簲鐨勬帴鍙� const deviceFault = { list: "/api/device-faults", @@ -1308,3 +1408,13 @@ updateTraceabilityManagement: "/deviceTraceabilityManagement/updateTraceabilityManagement" // 淇敼閲忓�兼函婧愯鍒� }; + +// 6.4 璁惧 +const deviceBorrow = { + deviceBorrowPage: "/deviceBorrow/deviceBorrowPage", // 璁惧鍊熷嚭list + deleteDeviceBorrow: "/deviceBorrow/deleteDeviceBorrow", //鍒犻櫎 + saveDeviceBorrow: "/deviceBorrow/saveDeviceBorrow", //淇濆瓨 + getDeviceBorrow: "/deviceBorrow/getDeviceBorrow", //鏌ョ湅 + deviceBorrowExport: "/deviceBorrow/deviceBorrowExport", //瀵煎嚭 + directoryListing: "/procurementSuppliesContents/directoryListing" // 閲囪喘鐗╄祫鐩綍鍒楄〃 +}; diff --git a/src/components/do/a6-device/borrow.vue b/src/components/do/a6-device/borrow.vue index c2ad921..95f75ac 100644 --- a/src/components/do/a6-device/borrow.vue +++ b/src/components/do/a6-device/borrow.vue @@ -4,27 +4,50 @@ <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> + <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> + <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> + <!-- <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"/> + <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-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"> @@ -33,31 +56,62 @@ <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-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-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-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-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 + 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"> @@ -65,14 +119,22 @@ <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"> + 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-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> @@ -82,23 +144,56 @@ </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 + 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 + 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-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> @@ -106,41 +201,75 @@ </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-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-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-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-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"> + 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-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> @@ -149,67 +278,87 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="璁惧璐熻矗浜猴細" prop="deviceUser" :rules="[{ required: currentStep === 1, message: '璇烽�夋嫨璁惧璐熻矗浜�', trigger: 'change' }]"> + <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-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-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-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> + <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-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="operator" - label="鎿嶄綔浜�" - width="180"> + <el-table-column prop="operationTime" label="鎿嶄綔鏃ユ湡" width="180"> </el-table-column> - <el-table-column - prop="operationTime" - label="鎿嶄綔鏃ユ湡" - width="180"> + <el-table-column prop="operationType" label="鎻愪氦绫诲瀷"> </el-table-column> - <el-table-column - prop="operationType" - label="鎻愪氦绫诲瀷"> - </el-table-column> - <el-table-column - prop="operationContent" - label="鎿嶄綔鍐呭"> + <el-table-column prop="operationContent" label="鎿嶄綔鍐呭"> </el-table-column> </el-table> </el-dialog> @@ -217,8 +366,8 @@ </template> <script> -import ValueTable from '../../tool/value-table.vue' -import { dateFormat } from '../../../util/date' +import ValueTable from "../../tool/value-table.vue"; +import { dateFormat } from "../../../util/date"; export default { props: { clickNodeVal: { @@ -234,337 +383,382 @@ data() { return { dialogVisible: false, - dialogVisible0:false, + dialogVisible0: false, //琛ㄥご鏄剧ず - componentData:{ + componentData: { entity: { processNumber: null, - deviceId:null, + deviceId: null, orderBy: { - field: 'id', - order: 'asc' + field: "id", + order: "asc" } - }, - isIndex: true, - showSelect: false, - select: false, - do: [ + }, + isIndex: true, + showSelect: false, + select: false, + do: [ { - id: 'show', - font: '鏌ョ湅', - type: 'text', - method: 'lookDetail' - }, - { - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy' + id: "show", + font: "鏌ョ湅", + type: "text", + method: "lookDetail" }, { - 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: '鎶ュ簾' - }] - } + id: "delete", + font: "鍒犻櫎", + type: "text", + method: "doDiy" }, - selectField: {}, - requiredAdd: [], - requiredUp: [], + { + 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, + upIndex: 0, + entityCopy: null, currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳 currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖� - steps: ['鍊熷嚭', '鍊熺敤'], + 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, + 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' }], + 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 - } + deviceLogs: [], + outLoading: false + }; }, - watch:{ + watch: { // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 clickNodeVal(newVal) { if (newVal.value) { - this.componentData.entity.deviceId = this.clickNodeVal.value - this.entityCopy = this.HaveJson(this.componentData.entity) - this.refreshTable() + 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() + this.form = {}; + this.currentStep = 0; // 姝ラ鏉℃樉绀虹鍑犳 + this.currentStepClick = 0; // 鐐瑰嚮姝ラ鏉″彉鍖� + this.$refs["form"].clearValidate(); } } }, computed: { action() { - return this.javaApi + this.$api.personnel.saveCNASFile + return this.javaApi + this.$api.personnel.saveCNASFile; } }, mounted() { - this.componentData.entity.deviceId = this.clickNodeVal.value - this.entityCopy = this.HaveJson(this.componentData.entity) + this.componentData.entity.deviceId = this.clickNodeVal.value; + this.entityCopy = this.HaveJson(this.componentData.entity); // console.log(333,this.clickNodeVal) - this.getUserList() - this.refreshTable() + this.getUserList(); + this.refreshTable(); }, methods: { refreshTable(e) { - this.$refs['ValueTable'].selectList(e) + this.$refs["ValueTable"].selectList(e); }, refresh() { - this.componentData.entity = this.HaveJson(this.entityCopy) - this.refreshTable() + this.componentData.entity = this.HaveJson(this.entityCopy); + this.refreshTable(); // this.upIndex++ }, choiceStep(index) { - this.currentStepClick = index + this.currentStepClick = index; }, //鎻愪氦琛ㄥ崟 async submitForm(saveState) { - this.$refs.form.validate((valid) => { - if (valid === true || saveState !== '1submit') { + this.$refs.form.validate(valid => { + if (valid === true || saveState !== "1submit") { // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂� - let user = JSON.parse(localStorage.getItem('user')) - const dateTime = dateFormat(new Date()) + 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 + this.form.submitOperationUser = user.name; + this.form.submitOperationTime = dateTime; + break; case 1: - this.form.receiveOperationUser = user.name - this.form.receiveOperationTime = dateTime - break + this.form.receiveOperationUser = user.name; + this.form.receiveOperationTime = dateTime; + break; default: - break + break; } // 鑾峰彇褰撳墠鐜妭璐熻矗浜� - switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) { + switch ( + saveState === "3reject" ? this.currentStep - 1 : this.currentStep + ) { case 0: - this.form.nowUser = this.form.nextUser - break + this.form.nowUser = this.form.nextUser; + break; default: - break + break; } let currentStepAction; // 璁剧疆璇ユ搷浣滃垽鏂槸鍚︿负鎻愪氦锛屼繚瀛橈紝椹冲洖锛岄�氳繃 switch (saveState) { // 鎻愪氦锛岄�氳繃 - case '1submit': - currentStepAction = this.currentStep + 1 - break + case "1submit": + currentStepAction = this.currentStep + 1; + break; // 淇濆瓨 - case '2save': - currentStepAction = this.currentStep - break + case "2save": + currentStepAction = this.currentStep; + break; // 椹冲洖 - case '3reject': - currentStepAction = this.currentStep - 1 - break + case "3reject": + currentStepAction = this.currentStep - 1; + break; default: - break + 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() - } - }) + 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 + ' 娴佺▼涓湁蹇呭~椤规湭濉紒'); + 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('鍒犻櫎鎴愬姛锛�') - } + 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: '宸插彇娑堝垹闄�' + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, onSuccess(response, file, fileList) { if (response.code == 200) { // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 - this.form.fileName = file.name - this.form.url= response.data + this.form.fileName = file.name; + this.form.url = response.data; } else { - this.$message.error(response.message) + this.$message.error(response.message); } }, // 鑾峰彇璐熻矗浜轰俊鎭帴鍙� getUserList() { this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { if (res.code == 200) { - this.responsibleOptions = res.data + 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 + 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; } - console.log(this.currentStepClick) - this.dialogVisible = true - } - }) + }); }, // 鏂板 - add(){ - 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 + 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 { + 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) + 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('瀵煎嚭鎴愬姛') + 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 - } - }) + 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> @@ -580,7 +774,7 @@ display: inline-block; width: 3px; height: 16px; - background: #3A7BFA; + background: #3a7bfa; margin-right: 4px; } @@ -630,10 +824,10 @@ .form .search_label { width: 120px; } -.el-radio{ +.el-radio { margin-right: 10px; } -.el-radio-group{ +.el-radio-group { width: 100%; display: flex; margin-top: 12px; diff --git a/src/components/do/a6-device/calibration.vue b/src/components/do/a6-device/calibration.vue index b1aa45b..bff1387 100644 --- a/src/components/do/a6-device/calibration.vue +++ b/src/components/do/a6-device/calibration.vue @@ -2,105 +2,246 @@ <template> <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> + <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: 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> + <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="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' ? '涓嶅悎鏍�' : '鍏朵粬' }} + {{ + 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"> + <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> + <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 + :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%"> + <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> + <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-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-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-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-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-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> + <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 + 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="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> + <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"> + <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;"> @@ -108,67 +249,117 @@ <span>娣诲姞璁惧鏍″噯璁板綍</span> </div> </h4> - <el-form ref="calibrationRecord" :model="calibrationRecord" - :rules="formRules" label-position="right" label-width="120px"> + <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-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 + 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 + 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-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-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 + 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-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-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-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> @@ -177,35 +368,68 @@ </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 + 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 + 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-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-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> @@ -216,17 +440,36 @@ </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="缂栧彿" + 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-group + v-model="scope.row.isCalibration" + :disabled="operationType === 'view'" + > <el-radio label="0yes">鏄�</el-radio> <el-radio label="1no">鍚�</el-radio> </el-radio-group> @@ -237,7 +480,11 @@ <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-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> @@ -246,8 +493,11 @@ </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> + <el-input + v-model="scope.row.singleResultStatement" + :disabled="operationType === 'view'" + size="small" + ></el-input> </template> </el-table-column> </el-table> @@ -267,16 +517,25 @@ <!-- </el-table>--> </div> <span slot="footer" class="dialog-footer"> - <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> + <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 file from '../../../util/file'; +import file from "../../../util/file"; import fileDownload from "../../../util/file"; export default { @@ -295,348 +554,427 @@ calibrateParamsLoading: false, addCalibrateLoading: false, calibrationRecord: { - unitOfMeasure: '', // 璁¢噺鍗曚綅 + unitOfMeasure: "", // 璁¢噺鍗曚綅 calibrationDate: null, // 鏍″噯鏃ユ湡 nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 - calculatingApparatus: '', // 璁$畻鍣ㄥ叿 + calculatingApparatus: "", // 璁$畻鍣ㄥ叿 confirmDate: null, // 纭鏃ユ湡 - standardRange: '', // 璁$畻鏍囧噯閲忕▼ - calibrationStandardUncertainty: '', // 璁¢噺鏍囧噯涓嶇‘瀹氬害 - byDocument: '', // 渚濇嵁鏂囦欢 - certificateSerialNumber: '', // 璇佷功缂栧彿 - status: '', // 鐘舵�� - remark: '', // 澶囨敞 - systemFileName: '', // - fileName: '', // + 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'}], + 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: '', + measurementParameter: "", // 璁¢噺鍙傛暟 + rangeOfMeasurement: "", + maxPermissibleError: "", + judgmentCriteria: "", + createdBy: "", + action: "", deviceId: null }, form0Rules: { measurementParameter: [ - {required: true, message: '璇疯緭鍏ヨ閲忓弬鏁�', trigger: 'blur'} + { required: true, message: "璇疯緭鍏ヨ閲忓弬鏁�", trigger: "blur" } ], rangeOfMeasurement: [ - {required: true, message: '璇疯緭鍏ラ噺绋嬭寖鍥�', trigger: 'blur'} + { required: true, message: "璇疯緭鍏ラ噺绋嬭寖鍥�", trigger: "blur" } ], maxPermissibleError: [ - {required: true, message: '璇疯緭鍏ユ渶澶у厑璁歌宸�', trigger: 'blur'} + { required: true, message: "璇疯緭鍏ユ渶澶у厑璁歌宸�", trigger: "blur" } ], judgmentCriteria: [ - {required: true, message: '璇疯緭鍏ュ垽瀹氭爣鍑�', trigger: 'blur'} - ], + { required: true, message: "璇疯緭鍏ュ垽瀹氭爣鍑�", trigger: "blur" } + ] }, addRecordLoading: false, tableDataOperate: [], // 鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織 upLoading: false, - operationType: '', + operationType: "", search: { size: 20, current: 1, total: 0 - }, - } + } + }; }, // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, action() { - return this.javaApi + this.$api.personnel.saveCNASFile + return this.javaApi + this.$api.personnel.saveCNASFile; } }, mounted() { //鑾峰彇鎿嶄綔璁板綍淇℃伅 this.getOperateMsg(); - this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + 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' + 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) + 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 + this.calibrationRecord.nextCalibrationDate = oneYearLaterDate; }, handleSizeChange(val) { - this.search.size = val + this.search.size = val; this.getTableList(this.clickNodeVal.value); }, handleCurrentChange(val) { - this.search.current = 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 - }) + 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 - }) + 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() + 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 + 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: '宸插彇娑堝垹闄�' - }); + 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) + let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName); if (state) { - let url = this.javaApi + '/img/' + row.systemFileName; - fileDownload.downloadIamge(url, row.systemFileName) + 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'); + const url = this.javaApi + "/word/" + row.systemFileName; + const link = document.createElement("a"); link.href = url; link.download = row.systemFileName; link.click(); - this.$message.success('涓嬭浇鎴愬姛') + 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('瀵煎嚭鎴愬姛') + 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('鍒犻櫎鎴愬姛锛�') - } + 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: '宸插彇娑堝垹闄�' + .catch(err => { + console.log("err----", err); + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, // 鏍″噯椤圭洰缁存姢 calibrationMaintenance() { - this.dialogVisible0 = true + this.dialogVisible0 = true; this.getXmsg(); }, // 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅 async getXmsg() { - this.calibrateParamsLoading = true + 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 - }) + 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 + 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('宸插彇娑堝垹闄�'); + 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) => { + this.$refs["form0"].validate(valid => { if (valid) { // 淇濆瓨 - this.calibrateParamsLoading = true - this.addCalibrateLoading = true + this.calibrateParamsLoading = true; + this.addCalibrateLoading = true; this.form0.deviceId = this.clickNodeVal.value; - const user = JSON.parse(localStorage.getItem('user')) + 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 - }) + 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('鏈夊繀濉」鏈~'); + this.addCalibrateLoading = false; + this.$message.warning("鏈夊繀濉」鏈~"); } - }) + }); }, addRecord() { - this.$refs['calibrationRecord'].validate((valid) => { + this.$refs["calibrationRecord"].validate(valid => { if (valid) { try { if (this.calibrateParams.some(m => m.isCalibration === undefined)) { - this.$message.error('璇烽�夋嫨鏄惁鏍″噯') - return + this.$message.error("璇烽�夋嫨鏄惁鏍″噯"); + return; } if (!this.calibrateParams.every(m => m.result !== undefined)) { - this.$message.error('璇烽�夋嫨鍒ゅ畾缁撴灉') - return + this.$message.error("璇烽�夋嫨鍒ゅ畾缁撴灉"); + return; } - this.addRecordLoading = true + 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 - }) + 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 + console.log("addRecord---", e); + this.addRecordLoading = false; } } else { - this.$message.warning('鏈夊繀濉」鏈~'); + this.$message.warning("鏈夊繀濉」鏈~"); } - }) + }); }, resetCalibrationRecord() { - this.$refs.calibrationRecord.resetFields() + this.$refs.calibrationRecord.resetFields(); }, // 涓婁紶闄勪欢 handleSuccessUp(response, file) { if (response.code == 200) { // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 - this.calibrationRecord.fileName = file.name - this.calibrationRecord.systemFileName = response.data + this.calibrationRecord.fileName = file.name; + this.calibrationRecord.systemFileName = response.data; this.upLoading = false; } else { this.upLoading = false; - this.$message.error(response.message) + this.$message.error(response.message); } }, beforeUpload(file) { if (file.size > 1024 * 1024 * 10) { - this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); - this.$refs.upload.clearFiles() + this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M"); + this.$refs.upload.clearFiles(); return false; } else { this.upLoading = true; @@ -644,9 +982,9 @@ } }, onError(err, file, fileList) { - this.$message.error('涓婁紶澶辫触') - this.$refs.upload.clearFiles() - }, + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); + } // end }, watch: { @@ -658,34 +996,33 @@ }, dialogVisible1(newVal) { if (newVal === false) { - this.calibrateParams = [] + this.calibrateParams = []; this.calibrationRecord = { - unitOfMeasure: '', // 璁¢噺鍗曚綅 + unitOfMeasure: "", // 璁¢噺鍗曚綅 calibrationDate: null, // 鏍″噯鏃ユ湡 nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 - calculatingApparatus: '', // 璁$畻鍣ㄥ叿 - standardRange: '', // 璁$畻鏍囧噯閲忕▼ - calibrationStandardUncertainty: '', // 璁¢噺鏍囧噯涓嶇‘瀹氬害 - byDocument: '', // 渚濇嵁鏂囦欢 - certificateSerialNumber: '', // 璇佷功缂栧彿 - status: '', // 鐘舵�� - remark: '', // 澶囨敞 - } + calculatingApparatus: "", // 璁$畻鍣ㄥ叿 + standardRange: "", // 璁$畻鏍囧噯閲忕▼ + calibrationStandardUncertainty: "", // 璁¢噺鏍囧噯涓嶇‘瀹氬害 + byDocument: "", // 渚濇嵁鏂囦欢 + certificateSerialNumber: "", // 璇佷功缂栧彿 + status: "", // 鐘舵�� + remark: "" // 澶囨敞 + }; } } } -} +}; function downloadImage(url) { - const link = document.createElement('a'); + const link = document.createElement("a"); link.href = url; - link.target="_blank" - link.download = 'attachment.jpg'; // 鏂囦欢鍚� + link.target = "_blank"; + link.download = "attachment.jpg"; // 鏂囦欢鍚� document.body.appendChild(link); link.click(); document.body.removeChild(link); } - </script> <style scoped> .tables { @@ -735,7 +1072,7 @@ display: inline-block; width: 3px; height: 16px; - background: #3A7BFA; + background: #3a7bfa; margin-right: 4px; } @@ -772,7 +1109,3 @@ background-color: #f5f5f5; } </style> - - - - diff --git a/src/components/do/a6-device/files.vue b/src/components/do/a6-device/files.vue index bd95c1b..3cd3a43 100644 --- a/src/components/do/a6-device/files.vue +++ b/src/components/do/a6-device/files.vue @@ -5,13 +5,21 @@ <h4><span class="line"></span><span>璁惧妗f</span></h4> <div class="btns"> <el-button type="primary" size="small" @click="openEditForm" - style="">淇妗f</el-button> + >淇妗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 + > + <el-button + type="primary" + v-if="isPermission('showDeviceQrCodeButton')" + size="small" + @click="deviceDialog = true" + >鏌ョ湅璁惧浜岀淮鐮�</el-button + > <el-button type="primary" size="small" @click="handleDownOne" - style="">瀵煎嚭</el-button> + >瀵煎嚭</el-button + > </div> </div> <el-divider></el-divider> @@ -19,8 +27,12 @@ <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;"> + <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> @@ -30,11 +42,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 class="item" :content="Mdata.deviceName"> + <span class="text-ellipsis">{{ Mdata.deviceName }}</span> </el-tooltip> </div> <div class="form-item"> @@ -53,16 +62,13 @@ <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 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> + <p class="text-ellipsis">{{ Mdata.assetCode }}</p> </div> <div class="form-item"> @@ -70,7 +76,7 @@ <p>{{ Mdata.acquisitionDate | formaterDateTime }}</p> </div> <div class="form-item"> - <label>鍚敤鏃ユ湡</label> + <label>鏍″噯鏈夋晥鏈�</label> <p>{{ Mdata.activationDate | formaterDateTime }}</p> </div> <div class="form-item"> @@ -84,10 +90,7 @@ </div> <div class="form-item"> <label>鍑嗙‘搴﹂噺鍊�</label> - <el-tooltip - class="item" - :content="Mdata.technicalIndicators" - > + <el-tooltip class="item" :content="Mdata.technicalIndicators"> <span class="text-ellipsis">{{ Mdata.technicalIndicators }}</span> </el-tooltip> <!-- <p>{{ Mdata.technicalIndicators }}</p> --> @@ -100,7 +103,6 @@ <label>琚巿鏉冧汉</label> <p>{{ Mdata.authorizedPersonName }}</p> </div> - </el-col> <el-col :span="10"> <div class="form-item"> @@ -116,13 +118,24 @@ <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> + <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> @@ -140,7 +153,7 @@ :content="Mdata.insProductItem" placement="top" > - <span class="text-ellipsis" >{{ Mdata.insProductItem }}</span> + <span class="text-ellipsis">{{ Mdata.insProductItem }}</span> </el-tooltip> </div> <div class="form-item"> @@ -149,16 +162,16 @@ </div> <div class="form-item"> - <label>鏈�杩戞函婧愭棩鏈�</label> + <label>鏈�杩戞牎鍑嗘棩鏈�</label> <p>{{ Mdata.lastCalibrationDate | formaterDateTime }}</p> + </div> + <div class="form-item"> + <label>涓嬫鏍″噯鏃ユ湡</label> + <p>{{ Mdata.nextCalibrationDate | 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> @@ -174,12 +187,27 @@ </div> </el-col> </el-row> - <h4 style="margin-bottom: 10px;margin-top: 10px;"><span class="line"></span><span>闄勪欢鍜岀浉鍏虫枃妗�</span></h4> + <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 + 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' ? '鏂囨。' : '' }} + {{ + scope.row.documentType === "0" + ? "闄勪欢" + : scope.row.documentType === "1" + ? "鏂囨。" + : "" + }} </template> </el-table-column> <el-table-column prop="name" label="鍚嶇О" min-width="150" /> @@ -192,55 +220,110 @@ <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> + <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" top="5vh" :visible.sync="dialogVisible" width="70%" @open="openFileRevisionDialog" - :before-close="handleClose"> - <el-row style="display:flex;justify-content: space-around;"> + <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;max-height: 75vh;overflow-y: auto;" + > <!-- 宸﹁竟甯冨眬 --> <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); + <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> + border: 1px solid #EEEEEE;" + > + <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 + :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-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-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-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 + :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-input + v-model="editData.calibrationServices" + size="small" + ></el-input> </el-form-item> <el-form-item label="璧勪骇缂栫爜:"> <el-input v-model="editData.assetCode" size="small"></el-input> @@ -252,21 +335,48 @@ <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-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 + 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-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-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> @@ -274,39 +384,92 @@ <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-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 + :model="editData" + label-width="140px" + ref="ruleForm" + :rules="rules1" + > <!-- 瀹為獙瀹ゅ垪琛� --> <el-form-item label="鎵�灞為儴闂�:"> - <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-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="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-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="Mdata.latestTraceability" format="yyyy-MM-dd" - value-format="yyyy-MM-dd" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"> + <el-form-item label="鏈�杩戞牎鍑嗘棩鏈�:"> + <el-date-picker + style="width:100%" + v-model="editData.lastCalibrationDate" + 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-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-form-item> + <el-form-item label="涓嬫鏍″噯鏃ユ湡:"> + <el-date-picker + style="width:100%" + v-model="editData.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> <el-form-item label="璁惧绫诲瀷:"> - <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-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> @@ -314,17 +477,41 @@ <el-input v-model="editData.unitPrice" size="small"></el-input> </el-form-item> <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-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="鏍″噯鍛ㄦ湡锛堟湀锛�:" prop="calibrationDate"> - <el-input v-model="editData.calibrationDate" size="small"></el-input> + <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-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> @@ -340,12 +527,25 @@ </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"> + <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> @@ -356,11 +556,19 @@ <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-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-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"> @@ -373,52 +581,107 @@ </el-col> <el-col :span="12"> <el-form-item label="妗f鍚嶇О锛�"> - <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addFile.name"></el-input> + <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-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-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-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-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-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-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-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-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> @@ -427,36 +690,56 @@ </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-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%"> + 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> + <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-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> + <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> + <span class="device-text">{{ Mdata.managementNumber }}</span> </div> <div class="device-name"> <span class="device-text">璁惧鍨嬪彿:</span> - <span class="device-text">{{Mdata.specificationModel}}</span> + <span class="device-text">{{ Mdata.specificationModel }}</span> </div> </div> </div> @@ -466,20 +749,20 @@ </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' +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 { - filters:{ - formaterDateTime(dateTime){ - if(dateTime === undefined || dateTime === null || dateTime === ''){ - return dateTime + filters: { + formaterDateTime(dateTime) { + if (dateTime === undefined || dateTime === null || dateTime === "") { + return dateTime; } - return dateTime.split(" ")[0] + return dateTime.split(" ")[0]; } }, props: { @@ -496,40 +779,40 @@ }, data() { return { - isPermission:isPermission, - deviceDialog: false,//鏌ョ湅璁惧浜岀淮鐮佸脊妗� + 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' }, - ], + { 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" } + ] }, // dateForm: { // }, fileList: [], // 娣诲姞闄勪欢涓婁紶鏂囦欢鍒楄〃 - timeStamp: '', // 缁欏浘鐗囨坊鍔爇ey锛屽湪姣忔鍔犺浇椤甸潰鐨勬椂鍊欐柊寤烘椂闂存埑 + timeStamp: "", // 缁欏浘鐗囨坊鍔爇ey锛屽湪姣忔鍔犺浇椤甸潰鐨勬椂鍊欐柊寤烘椂闂存埑 equipmentManager: [], - formLabelWidth: '100px', + formLabelWidth: "100px", dialogVisible1: false, - recordNumber: '', + recordNumber: "", inLoading: false, // 鎺у埗涓婁紶鎸夐挳鍔犺浇鐘舵�� isLoading: false, // 鎺у埗纭畾鎸夐挳鍔犺浇鐘舵�� formData: {}, @@ -537,17 +820,17 @@ num: 1, //娣诲姞闄勪欢鏁版嵁鏀堕泦 addFile: { - documentType: '', // 缁存姢绫诲瀷 + documentType: "", // 缁存姢绫诲瀷 archiveDate: null, // 褰掓。鏃ユ湡 - name: '', // 妗f鍚嶇О - number: '', // 搴撳彿/璧勪骇缂栧彿 - version: '', // 鐗堟湰 + name: "", // 妗f鍚嶇О + number: "", // 搴撳彿/璧勪骇缂栧彿 + version: "", // 鐗堟湰 quantity: 1, // 浠芥暟 pageCount: 1, // 椤电爜 - provider: '', // 鎻愪緵鑰� + provider: "", // 鎻愪緵鑰� comments: "", // 澶囨敞 fileName: "", // 鏂囦欢鍘熷悕绉� - systemFileName: "", // 绯荤粺鐢熸垚鍚嶇О + systemFileName: "" // 绯荤粺鐢熸垚鍚嶇О }, componentData: { entity: { name: "", orderBy: { field: "id", order: "asc" } }, @@ -555,361 +838,397 @@ }, upIndex: 0, dialogVisible: false, - dialogVisible1: false, - inLoading: false, upLoad: false, responsiblePersonList: [], subordinateDepartmentsList: [], options: [], equipmentList: [], deviceStatusList: [], - props: { multiple: true, emitPath: false, value: 'id', label: 'name' }, + props: { multiple: true, emitPath: false, value: "id", label: "name" }, // 鏀堕泦璁惧妗f鏁版嵁 Mdata: { deviceName: null }, isAddFileUpdate: false, editData: { - authorizedPerson: [], - }, - } + authorizedPerson: [] + } + }; }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, action() { - return this.javaApi + this.$api.deviceScope.uploadFile + return this.javaApi + this.$api.deviceScope.uploadFile; } }, mounted() { // 鏀堕泦鏁版嵁 - this.getList(this.clickNodeVal.value) + this.getList(this.clickNodeVal.value); // 鑾峰彇鐩稿叧鏂囨。鐨勬暟鎹� - this.getPage() - this.timeStamp = Date.now() + this.getPage(); + this.timeStamp = Date.now(); }, methods: { - /** + /** * 灏嗛〉闈㈡寚瀹氳妭鐐瑰唴瀹硅浆涓哄浘鐗� * 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) - }); + 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(){ + labelPrint() { PrintJS({ - printable: 'deviceCode',//椤甸潰 - type: "html",//鏂囨。绫诲瀷 - maxWidth:360, - css: ['/static/css/device-print.css'], - style: '@page { size: auto; margin: 0mm;}', - targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕� - }); + printable: "deviceCode", //椤甸潰 + type: "html", //鏂囨。绫诲瀷 + maxWidth: 360, + css: ["/static/css/device-print.css"], + style: "@page { size: auto; margin: 0mm;}", + targetStyles: ["*"] // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕� + }); }, openFileRevisionDialog() { // 鑾峰彇妗f淇璐熻矗浜轰笅鎷夋鏁版嵁 - this.selectDevicePrincipal() + this.selectDevicePrincipal(); // 鑾峰彇妗f淇鎵�灞為儴闂ㄤ笅鎷夋鏁版嵁 - this.obtainItemParameterList() + this.obtainItemParameterList(); // 鑾峰彇妗f淇璁惧鐘舵�佷笅鎷夋鏁版嵁 - this.selectEnumByCategory() + this.selectEnumByCategory(); // 鑾峰彇妗f淇妫�楠岄」鐩骇鑱斿脊妗嗘暟鎹� - this.getInsProductIds() + 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('涓嬭浇鎴愬姛') + console.log(row); + if (row.fileName) { + let state = /\.(jpg|jpeg|png|gif)$/i.test(row.fileName); + if (state) { + let url = this.javaApi + "/img/" + row.fileName; + fileDownload.downloadIamge(url, row.fileName); + } else { + 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('鏈笂浼犳枃浠讹紒') + this.$message.warning("鏈笂浼犳枃浠讹紒"); } }, handleViewClick(row) { - this.isAddFileUpdate = true - this.addFile = { ...row } - this.dialogVisible1 = true + 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) + 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('宸插彇娑堝垹闄�') + 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 + 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() - } - }) + 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() - } - }) + 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 + this.addFile.systemFileName = response.data; + this.addFile.fileName = file.name; } else { - this.$refs.uploadFile.clearFiles() - this.$message.error('涓婁紶澶辫触锛�' + response.message) + this.$refs.uploadFile.clearFiles(); + this.$message.error("涓婁紶澶辫触锛�" + response.message); } }, handleRemove(file, fileList) { - this.deleteFile(this.addFile.systemFileName) + this.deleteFile(this.addFile.systemFileName); }, deleteFile(fileName) { - this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + fileName).then(res => { - this.$message.success('鍒犻櫎鎴愬姛锛�') - }) + 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} 涓枃浠禶); + 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 - }) + 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) + .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) + this.Mdata.insProductIds = this.Mdata.insProductIds.split(","); + if (this.Mdata.authorizedPerson) { + this.Mdata.authorizedPerson = JSON.parse( + this.Mdata.authorizedPerson + ); + } } }); }, handleData(m) { if (m) { - return m + return m; } else { - return '-' + return "-"; } }, handleClose() { - this.dialogVisible = false + this.dialogVisible = false; }, //鎵撳紑淇妗f寮规 - openEditForm(){ - this.editData = JSON.parse(JSON.stringify(this.Mdata)) - this.$nextTick(()=>{ - this.dialogVisible = true - }) + openEditForm() { + this.editData = JSON.parse(JSON.stringify(this.Mdata)); + this.$nextTick(() => { + this.dialogVisible = true; + }); }, //淇妗f submitForm() { - let flag = true - this.$refs['rules1'].validate((valid) => { + let flag = true; + this.$refs["rules1"].validate(valid => { if (!valid) { flag = false; return false; } }); - this.$refs['rules2'].validate((valid) => { + this.$refs["rules2"].validate(valid => { if (!valid) { flag = false; return false; } }); - this.$refs['ruleForm'].validate((valid) => { + this.$refs["ruleForm"].validate(valid => { if (!valid) { flag = false; return false; } }); - if(!flag) { + 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(',') - : ''; + delete this.editData.createTime; + delete this.editData.updateTime; + delete this.editData.createUser; + delete this.editData.updateUser; + delete this.editData.orderBy; + const formData = this.HaveJson(this.editData); + formData.userAllow = this.equipmentManager.toString(); + formData.insProductIds = Array.isArray(formData.insProductIds) + ? formData.insProductIds.join(",") + : ""; + if (formData.authorizedPerson.length === 0) { + formData.authorizedPerson = ""; + } else { + formData.authorizedPerson = JSON.stringify(formData.authorizedPerson); + } 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 - } - 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 - }) + this.$axios + .post(this.$api.deviceScope.upDeviceParameter, formData, { + headers: { + "Content-Type": "application/json" + } + }) + .then(res => { + if (res.code === 201) { + this.upLoad = false; + 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('瀵煎嚭鎴愬姛') + 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("瀵煎嚭鎴愬姛"); + } + }; + }); }, handleSuccessUpImg2(response) { if (response.code == 200) { this.$nextTick(() => { this.editData.imageUpload = response.data.url; this.editData.imageName = response.data.name; - console.log(this.javaApi + 'img/' + this.editData.imageUpload); - - }) + console.log(this.javaApi + "img/" + this.editData.imageUpload); + }); } }, beforeUpload(file) { if (file.size > 1024 * 1024 * 10) { - this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); - this.$refs.upload.clearFiles() + this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M"); + this.$refs.upload.clearFiles(); return false; } else { return true; } }, onError(err, file, fileList) { - this.$message.error('涓婁紶澶辫触') - this.$refs.upload.clearFiles() + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); }, // 鑾峰彇璐熻矗浜哄垪琛� selectDevicePrincipal() { - this.$axios.post(this.$api.user.selectUserList, this.componentData, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { - this.responsiblePersonList = res.data.body.records; - }) + 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 => { - data.push({ - label: a.laboratoryName, - value: a.id - }) - }) - this.subordinateDepartmentsList = data - }) + 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; + }); }, getInsProductIds() { this.$axios.post(this.$api.capacityScope.getInsProduction).then(res => { this.options = res.data.map((m, i) => { m.id = m.name; - return m - }) + return m; + }); this.options.forEach(item => { if (item.children.length == 0) { item.children = null; @@ -922,49 +1241,53 @@ if (n.children && n.children.length == 0) { n.children = null; } - }) + }); } - }) + }); } - }) - }) + }); + }); }, // 鑾峰彇瀛楀吀 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.$axios + .post(this.$api.enums.selectEnumByCategory, { + category: "璁惧鐘舵��" }) - }) - this.$axios.post(this.$api.enums.selectEnumByCategory, { - category: "璁惧鍒嗙被" - }).then(res => { - this.equipmentList = res.data - }) - }, + .then(res => { + this.deviceStatusList = res.data; + this.deviceStatusList.forEach(a => { + if (!isNaN(a.value)) { + a.value = parseInt(a.value); + } + }); + }); + this.$axios + .post(this.$api.enums.selectEnumByCategory, { + category: "璁惧鍒嗙被" + }) + .then(res => { + this.equipmentList = res.data; + }); + } }, watch: { // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 clickNodeVal(newVal) { if (newVal.value) { - this.getList(newVal.value) - this.getPage() + this.getList(newVal.value); + this.getPage(); } }, dialogVisible1(newVal) { if (newVal == false) { - this.isAddFileUpdate = false - this.addFile = {} - this.fileList = [] + this.isAddFileUpdate = false; + this.addFile = {}; + this.fileList = []; } } } -} +}; </script> <style scoped> @@ -994,7 +1317,7 @@ display: inline-block; width: 3px; height: 16px; - background: #3A7BFA; + background: #3a7bfa; margin-right: 4px; } @@ -1022,21 +1345,20 @@ .text-ellipsis { display: inline-block; - width: 200px; /* 鎴栬�呮偍鍙互璁剧疆涓�涓叿浣撶殑瀹藉害鍊� */ - box-sizing: border-box; /* 纭繚padding鍜宐order涓嶅奖鍝嶅厓绱犵殑鎬诲搴� */ - white-space: nowrap; /* 绂佹鏂囨湰鎹㈣ */ - text-overflow: ellipsis; /* 浣跨敤鐪佺暐鍙疯〃绀鸿鎴柇鐨勬枃鏈� */ - overflow: hidden; /* 闅愯棌瓒呭嚭瀹瑰櫒鐨勫唴瀹� */ + width: 200px; /* 鎴栬�呮偍鍙互璁剧疆涓�涓叿浣撶殑瀹藉害鍊� */ + box-sizing: border-box; /* 纭繚padding鍜宐order涓嶅奖鍝嶅厓绱犵殑鎬诲搴� */ + white-space: nowrap; /* 绂佹鏂囨湰鎹㈣ */ + text-overflow: ellipsis; /* 浣跨敤鐪佺暐鍙疯〃绀鸿鎴柇鐨勬枃鏈� */ + overflow: hidden; /* 闅愯棌瓒呭嚭瀹瑰櫒鐨勫唴瀹� */ } .form-items { line-height: 34px; - /* display: flex; */ + /* display: flex; */ /* align-items: center; */ margin-left: 15%; font-size: 14px; } - .form-item label { min-width: 130px; @@ -1080,98 +1402,98 @@ } .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; - } + 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; +.device-main { + width: 90%; + margin: 0px 5%; + height: 460px; + padding: 25px 0px; background-color: #fff; } -.device-center{ - width:90%; - height:460px; - margin:0px 5%; +.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)) + filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.3)); } -.device-title{ +.device-title { position: relative; - top:20px; + top: 20px; z-index: 2; font-size: clamp(1rem, 0.582rem + 1.59vw, 1.475rem); font-weight: bold; color: #4f6ab2; width: 100%; - height:90px; + height: 90px; line-height: 100px; text-align: center; } -.device-footer{ - width:100%; - height:420px; +.device-footer { + width: 100%; + height: 420px; background-color: #3361d0; - position: relative + position: relative; } -.device-footer::after{ +.device-footer::after { content: ""; width: 100%; - height: 70px; - position: absolute; - top:-30px; + height: 70px; + position: absolute; + top: -30px; border-radius: 0 0 50% 50%; background-color: #fff; } -.device-footer .qr-code{ +.device-footer .qr-code { width: 55%; height: 200px; position: relative; top: 60px; - left:22.5%; + left: 22.5%; background-color: #fff; border-radius: 15px; overflow: hidden; } -.device-number{ - width:80%; +.device-number { + width: 80%; height: 20px; - margin-left:20%; + margin-left: 20%; position: relative; top: 80px; } -.device-text{ - color:#fff; +.device-text { + color: #fff; font-weight: bold; - font-size:100%; + font-size: 100%; } -.device-name{ - width:80%; - margin-left:20%; +.device-name { + width: 80%; + margin-left: 20%; height: 20px; position: relative; top: 90px; diff --git a/src/components/do/a6-device/operation-instruction.vue b/src/components/do/a6-device/operation-instruction.vue index 969c3b4..29757ae 100644 --- a/src/components/do/a6-device/operation-instruction.vue +++ b/src/components/do/a6-device/operation-instruction.vue @@ -7,46 +7,125 @@ <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-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> + <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="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 ? '涓嶉�氳繃' : '鏈鏍�'}} + {{ + 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> + <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 + @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;"> @@ -54,133 +133,317 @@ <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-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-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-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-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 + 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" type="primary" @click="openAddDia" + >娣诲姞鍙楁帶鏂囦欢</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 + :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 v-slot="scope"> + <el-button + type="text" + size="small" + @click="downloadFile(scope.row.fileSystemName)" + >涓嬭浇</el-button + > + <el-button type="text" @click="editFun(scope.row, scope.$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> + <el-button size="small" type="primary" @click="submitFun" + >鎻愪氦</el-button + > </span> </el-dialog> - <el-dialog :visible.sync="dialogVisible1" title="娣诲姞璁惧浣滀笟鎸囧涔�" width="40%"> + <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 + 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-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 + 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-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 + 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 + 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-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 + 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-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> @@ -189,8 +452,10 @@ </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> + <el-button @click="closeDia" size="small">鍙� 娑�</el-button> + <el-button type="primary" @click="addFile" size="small" + >纭� 瀹�</el-button + > </span> </el-dialog> </div> @@ -208,7 +473,7 @@ } } }, - name: '', + name: "", components: {}, data() { return { @@ -219,19 +484,20 @@ }, dialogVisible: false, dialogVisible1: false, - value: '', + value: "", selectRow: null, device: null, + tableDataIndex: "", form: { - documentType: '', - documentNumber: '', - deviceName: '', - deviceModel: '', - deviceNumber: '', - fileName: '', - fileSystemName: '', - submitDate: '', - documentNote: '', + documentType: "", + documentNumber: "", + deviceName: "", + deviceModel: "", + deviceNumber: "", + fileName: "", + fileSystemName: "", + submitDate: "", + documentNote: "" }, tableData: [], documentTableData: [], @@ -243,228 +509,279 @@ deviceNameOption: [], //璁惧鍚嶇О涓嬫媺妗嗘暟鎹� entity: { deviceName: null, - laboratoryName: '', - storagePoint: '' + laboratoryName: "", + storagePoint: "" }, selectedRow: [], instructionForm: { - applicationNumber: '', // 鐢宠缂栧彿 - applicationDepartment: '', // 鐢宠閮ㄩ棬 - personLiable: '', // 璐d换浜� - controlledApplicationDescription: '', // 鍙楁帶鐢宠璇存槑 + applicationNumber: "", // 鐢宠缂栧彿 + applicationDepartment: "", // 鐢宠閮ㄩ棬 + personLiable: "", // 璐d换浜� + controlledApplicationDescription: "" // 鍙楁帶鐢宠璇存槑 } - } + }; }, mounted() { this.getAllDevice(); - this.getList() + 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 = [] + this.getList(); + this.clickSidebar(newVal); } }, dialogVisible(newVal) { if (newVal === false) { - this.instructionForm = {} - this.documentTableData = [] - this.fileList1 = [] + 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) - }); + 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.$axios + .get( + this.$api.deviceCheck.approvalOfHomeworkInstructionManual + + "?id=" + + id + + "&status=" + + status + ) + .then(res => { + this.getList(); + }); this.$message({ - type: 'success', - message: '鎿嶄綔鎴愬姛!' + type: "success", + message: "鎿嶄綔鎴愬姛!" }); }, - getRowKey (row) { - return row.index + 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() + 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: '宸插彇娑堝垹闄�' + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, downloadFile(fileName) { - let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName) + let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName); if (state) { - let url = this.javaApi + '/img/' + fileName; - fileDownload.downloadIamge(url, fileName) + let url = this.javaApi + "/img/" + fileName; + fileDownload.downloadIamge(url, fileName); } else { - const url = this.javaApi+'/word/'+ fileName - const link = document.createElement('a'); + const url = this.javaApi + "/word/" + fileName; + const link = document.createElement("a"); link.href = url; link.download = fileName; link.click(); - this.$message.success('涓嬭浇鎴愬姛') + 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.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; + }); } - this.documentTableData = res.data.list; - // 鍒犻櫎鐢� - this.documentTableData.forEach((v, k) => { - v.index = k - }) - } - }) + }); }, handleSizeChange(val) { - this.search.size = val - this.getList() + this.search.size = val; + this.getList(); }, handleCurrentChange(val) { - this.search.current = val - this.getList() + this.search.current = val; + this.getList(); }, submitFun() { - this.$refs.form1.validate((valid) => { + 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() - } - }) + 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 + this.laboratoryNameIsNull = false; // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� if (!clickNodeVal.value) { this.list = []; - this.entity.laboratoryName = null - this.entity.storagePoint = null + this.entity.laboratoryName = null; + this.entity.storagePoint = null; // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� - if (clickNodeVal.label === '鍏朵粬') { - this.laboratoryNameIsNull = true - this.getAllDevice() - return + if (clickNodeVal.label === "鍏朵粬") { + this.laboratoryNameIsNull = true; + this.getAllDevice(); + return; } if (clickNodeVal.level === 1) { - this.entity.laboratoryName = clickNodeVal.label + this.entity.laboratoryName = clickNodeVal.label; // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� } else if (clickNodeVal.level === 2) { // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 - if (clickNodeVal.parent.label === '鍏朵粬') { - this.laboratoryNameIsNull = true + if (clickNodeVal.parent.label === "鍏朵粬") { + this.laboratoryNameIsNull = true; } else { - this.entity.laboratoryName = clickNodeVal.parent.label + this.entity.laboratoryName = clickNodeVal.parent.label; } - this.entity.storagePoint = clickNodeVal.label + this.entity.storagePoint = clickNodeVal.label; } - this.getAllDevice() + this.getAllDevice(); } }, - //鏂板 + // 鏂板 addFile() { - this.$refs.form.validate((valid) => { + this.$refs.form.validate(valid => { if (valid) { - if (this.form.index !== undefined) { - this.$set(this.documentTableData, this.form.index, this.form) + if (this.tableDataIndex !== undefined) { + this.$set(this.documentTableData, this.tableDataIndex, this.form); this.dialogVisible1 = false; - this.$message.success('淇敼鎴愬姛'); + this.$message.success("淇敼鎴愬姛"); + console.log( + "this.documentTableData---edit", + this.documentTableData[this.tableDataIndex] + ); } else { this.documentTableData.push(this.form); - // 鍒犻櫎鐢� - this.documentTableData.forEach((v, k) => { - v.index = k - }) this.dialogVisible1 = false; - this.$message.success('娣诲姞鎴愬姛'); + this.$message.success("娣诲姞鎴愬姛"); } } else { return false; } }); }, + openAddDia() { + this.dialogVisible1 = true; + this.tableDataIndex = undefined; + this.form = { + documentType: "", + documentNumber: "", + deviceName: "", + deviceModel: "", + deviceNumber: "", + fileName: "", + fileSystemName: "", + submitDate: "", + documentNote: "" + }; + this.form.deviceName = this.clickNodeVal.label; + this.onDeviceNameChange(); + this.fileList = []; + }, editFun(row, index) { - this.form = {...row} - // 鏇存柊鐢� - this.form.index = index; + this.form = { ...row }; + this.tableDataIndex = index; + console.log("this.tableDataIndex", this.tableDataIndex); // 鍥炴樉鍒楄〃 if (this.form.fileSystemName) { - this.fileList.push({name: this.form.fileName}) + this.fileList.push({ name: this.form.fileName }); } - this.dialogVisible1 = true + this.dialogVisible1 = true; + }, + closeDia() { + this.dialogVisible1 = false; + this.$refs["form"].resetFields(); + this.fileList = []; }, handleSelectionChange(selected) { - this.selectedRow = selected + this.selectedRow = selected; }, async delFile() { if (this.selectedRow.length === 0) { - this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑閫夐」'); + this.$message.error("璇烽�夋嫨瑕佸垹闄ょ殑閫夐」"); return; } // 鍒犻櫎淇濆瓨濂界殑鏁版嵁 let ids = this.selectedRow - .filter(item => item.id!== undefined) - .map(item => item.id).join(','); + .filter(item => item.id !== undefined) + .map(item => item.id) + .join(","); //鏈夐敊璇� - const res = await this.$axios.get(this.$api.deviceCheck.deleteHomeworkGuidebook + '?ids=' + ids); + 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.documentTableData = this.documentTableData.filter( + item => item.index === this.selectedRow[resKey].index + ); } this.$message.success({ - message: '鍒犻櫎鎴愬姛', - type: 'success' + message: "鍒犻櫎鎴愬姛", + type: "success" }); } }, @@ -477,47 +794,65 @@ this.instructionForm.fileSystemName = response.data; }, onError(error, file, fileList) { - this.$message.error('涓婁紶澶辫触:', error, file, fileList); + this.$message.error("涓婁紶澶辫触:", error, file, fileList); }, handleRemove(file, fileList) { - this.form.fileName = '' - this.form.fileSystemName = '' + this.form.fileName = ""; + this.form.fileSystemName = ""; }, handleRemove1(file, fileList) { - this.form.fileName = '' - this.form.fileSystemName = '' + this.form.fileName = ""; + this.form.fileSystemName = ""; }, beforeRemove(file) { - return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋) + return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋); }, handleExceed(files, fileList) { - this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙); + 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 - } - }) + 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(); - } - }) + 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() { @@ -529,29 +864,30 @@ // 璁惧鍚嶇О鏀瑰彉鏃惰Е鍙� onDeviceNameChange() { // 鏍规嵁閫変腑鐨勮澶囧悕绉帮紝鏇存柊绠$悊缂栧彿涓嬫媺妗嗙殑閫夐」 - const selectedDevice = this.devices.find(device => device.deviceName === this.form.deviceName); + 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 + this.form.deviceId = selectedDevice.id; } - }, + } }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, action() { - return this.javaApi + this.$api.personnel.saveCNASFile + return this.javaApi + this.$api.personnel.saveCNASFile; } - }, -} + } +}; </script> <style scoped> - h4 { font-weight: 400; font-size: 16px; diff --git a/src/components/equipment/equipment-acceptance.vue b/src/components/equipment/equipment-acceptance.vue index 8bda75d..1f2ec01 100644 --- a/src/components/equipment/equipment-acceptance.vue +++ b/src/components/equipment/equipment-acceptance.vue @@ -2,48 +2,117 @@ <div> <div> <div style="margin: 10px 0;text-align: right"> - <el-button size="small" type="primary" @click="handleForm('add')">鏂板</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 + 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" + 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> + <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 + :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> + <acceptance-form + v-if="applicationForm" + ref="applicationForm" + @closeDialog="closeDialog" + ></acceptance-form> <!--涓婁紶鎶ュ憡--> - <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢" width="80%" @closed="closeFilesLook"> + <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 + 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> @@ -54,16 +123,24 @@ :highlightCurrentRow="true" :table-data="tableData" :table-loading="tableLoading" - style="margin-top: 0.5em;"> + 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;"/> + title="鏌ョ湅闄勪欢" + top="5vh" + width="800px" + > + <filePreview + v-if="lookDialogVisible" + :currentFile="{}" + :fileUrl="fileUrl" + style="height: 90vh;overflow-y: auto;" + /> </el-dialog> </div> </template> @@ -72,16 +149,16 @@ import AcceptanceForm from "./acceptance-form.vue"; import ZTTable from "../caorui/ZTTable/index.vue"; import filePreview from "../tool/file-preview.vue"; +import file from "../../util/file"; export default { name: "equipment-acceptance", // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� - components: {filePreview, ZTTable, AcceptanceForm}, + components: { filePreview, ZTTable, AcceptanceForm }, props: { clickNodeVal: { type: Object, - default: () => { - } + default: () => {} } }, data() { @@ -90,7 +167,7 @@ pagination1: { size: 10, current: 1, - total: 0, + total: 0 }, yearTableDetailDataLoading: false, yearTableDetailData: [], @@ -98,36 +175,36 @@ filesDialogVisible: false, columnData: [ { - label: '鏂囦欢鍚嶇О', - prop: 'fileName', - minWidth: '150px' + label: "鏂囦欢鍚嶇О", + prop: "fileName", + minWidth: "150px" }, { - dataType: 'action', - minWidth: '100', - label: '鎿嶄綔', - fixed: 'right', + dataType: "action", + minWidth: "100", + label: "鎿嶄綔", + fixed: "right", operation: [ { - name: '棰勮', - type: 'text', - clickFun: (row) => { - this.handleLook(row) + name: "棰勮", + type: "text", + clickFun: row => { + this.handleLook(row); } }, { - name: '涓嬭浇', - type: 'text', - clickFun: (row) => { - this.upload(row) + name: "涓嬭浇", + type: "text", + clickFun: row => { + this.upload(row); } }, { - name: '鍒犻櫎', - type: 'text', - color: '#f56c6c', - clickFun: (row) => { - this.delete(row) + name: "鍒犻櫎", + type: "text", + color: "#f56c6c", + clickFun: row => { + this.delete(row); } } ] @@ -135,210 +212,252 @@ ], tableData: [], tableLoading: false, - acceptanceId: '', // 涓婁紶闄勪欢褰撳墠琛岀殑id - currentInfo:{}, + acceptanceId: "", // 涓婁紶闄勪欢褰撳墠琛岀殑id + currentInfo: {}, lookDialogVisible: false, - fileUrl: '' - } + fileUrl: "" + }; }, mounted() { - this.getYearTableDetailData(this.clickNodeVal.value) + 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 - }) + 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.applicationForm = true; this.$nextTick(() => { - this.$refs.applicationForm.openDialog(type, id, this.clickNodeVal.value) - }) + this.$refs.applicationForm.openDialog( + type, + id, + this.clickNodeVal.value + ); + }); }, closeDialog() { - this.applicationForm = false - this.getYearTableDetailData(this.clickNodeVal.value) + this.applicationForm = false; + this.getYearTableDetailData(this.clickNodeVal.value); }, // 鎵撳紑鎶ュ憡寮规 - record (row) { - this.filesDialogVisible = true - this.acceptanceId = row.acceptanceId - this.searchTableList() + 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); - }) + 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) + 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 + this.fileUrl = this.javaApi + "/img/" + this.currentInfo.fileUrl; } else { - this.fileUrl = this.javaApi+'/word/'+ this.currentInfo.fileUrl + 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'); + 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); + 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: '宸插彇娑堝垹闄�' + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, // 涓婁紶闄勪欢 fileBeforeUpload(file) { - let flag = true + let flag = true; if (file.size > 1024 * 1024 * 10) { - this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); - this.$refs.upload.clearFiles() - flag = false + 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() + onError(err, file, fileList, type) { + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); }, - handleSuccessUp(response, ) { + handleSuccessUp(response) { this.upLoading = false; if (response.code == 200) { - this.$message.success('涓婁紶鎴愬姛'); - this.searchTableList() + this.$message.success("涓婁紶鎴愬姛"); + this.searchTableList(); } }, - closeFilesLook () { - this.filesDialogVisible = false + closeFilesLook() { + this.filesDialogVisible = false; }, // 鍒嗛〉 handleSizeChange1(val) { - this.pagination1.size = val - this.getYearTableDetailData(this.clickNodeVal.value) + this.pagination1.size = val; + this.getYearTableDetailData(this.clickNodeVal.value); }, // 鍒嗛〉 handleCurrentChange1(val) { - this.pagination1.current = val - this.getYearTableDetailData(this.clickNodeVal.value) + 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('瀵煎嚭鎴愬姛') + 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); + 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: "宸插彇娑堝垹闄�" + }); }); - }).catch(() => { - this.$message({ - type: 'info', - message: '宸插彇娑堝垹闄�' - }); - }); - }, + } }, watch: { // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 @@ -346,20 +465,21 @@ if (newVal.value) { this.getYearTableDetailData(newVal.value); } - }, + } }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, fileAction() { - return this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile - + return ( + this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile + ); } - }, -} + } +}; </script> <style scoped> diff --git a/src/components/equipment/quantity-value-traceability-plan.vue b/src/components/equipment/quantity-value-traceability-plan.vue index 8e78d1c..845a295 100644 --- a/src/components/equipment/quantity-value-traceability-plan.vue +++ b/src/components/equipment/quantity-value-traceability-plan.vue @@ -2,130 +2,352 @@ <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> + <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 + 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 + 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> + <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 + label="鎵瑰噯鏃堕棿" + min-width="180" + prop="auditDate" + ></el-table-column> <!-- 鎿嶄綔鎸夐挳 --> - <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="180"> + <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> + <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 + :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"> + <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> + <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" + :disabled="operationType === 'check'" clearable size="small" format="yyyy" - placeholder="閫夋嫨骞�"> + 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 + 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> + <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"> + <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> + <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"> + <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> + <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"> + <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> + <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"> + <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> + <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"> + <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> + <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"> + <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> + <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> + <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> + <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> + <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-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-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> + <el-button + v-if="operationType !== 'check'" + :loading="submitFormLoading" + type="primary" + @click="changeMachineName" + >纭� 璁�</el-button + > </span> </el-dialog> </div> @@ -141,8 +363,7 @@ props: { clickNodeVal: { type: Object, - default: () => { - } + default: () => {} } }, data() { @@ -151,7 +372,7 @@ pagination1: { size: 10, current: 1, - total: 0, + total: 0 }, yearTableDetailDataLoading: false, yearTableDetailData: [], @@ -160,146 +381,190 @@ deviceIds: [], applicationForm: false, submitFormLoading: false, - operationType: '', + operationType: "", equipOptions: [], form: { - planYear: '', + planYear: "", deviceTraceabilityManagementDetails: [] }, - addEquipDia: false, - } + addEquipDia: false + }; }, mounted() { - this.getYearTableDetailData() + 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 - }) + 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 = [] + 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) - }) + 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() + addTableRow() { + this.addEquipDia = true; + this.getEquipOptions(); }, - handleSelectionChange (selection) { - this.selectionRows = selection + handleSelectionChange(selection) { + this.selectionRows = selection; }, // 璧嬪�间华鍣ㄧ紪鍙� changeMachineName() { - this.deviceTraceabilityManagementDetails = [] + 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() + 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 that = this; const tbody = document.querySelector( - '#templateParamTable .el-table__body-wrapper tbody' - ) + "#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] //琚嫋鎷界殑鏂版暟鎹� + 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); + const curRow = that.deviceTraceabilityManagementDetails.splice( + evt.oldIndex, + 1 + )[0]; + that.deviceTraceabilityManagementDetails.splice( + evt.newIndex, + 0, + curRow + ); } - }) + }); } }, // 鍒犻櫎琛ㄦ牸琛� - deleteRow (index) { - this.deviceTraceabilityManagementDetails.splice(index, 1) + 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 - }) + 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 - }) + 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; + }); } }, // 鎻愪氦瀹℃牳 @@ -307,106 +572,133 @@ 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 - }) + }; + 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() + this.applicationForm = false; + this.getYearTableDetailData(); }, // 鍒嗛〉 handleSizeChange1(val) { - this.pagination1.size = val - this.getYearTableDetailData() + this.pagination1.size = val; + this.getYearTableDetailData(); }, // 鍒嗛〉 handleCurrentChange1(val) { - this.pagination1.current = val - this.getYearTableDetailData() + 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('瀵煎嚭鎴愬姛') + 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(); + 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: "宸插彇娑堝垹闄�" + }); }); - }).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) - }) - }, + 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鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 @@ -414,9 +706,9 @@ if (newVal.value) { this.getYearTableDetailData(); } - }, + } } -} +}; </script> <style scoped> -- Gitblit v1.9.3