From 4b1898aa7f82e400b5958293c6c0a5dce5da6d6c Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期二, 18 二月 2025 14:44:26 +0800 Subject: [PATCH] 在线预览调整 --- src/components/do/a6-device/calibration.vue | 1279 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 1,045 insertions(+), 234 deletions(-) diff --git a/src/components/do/a6-device/calibration.vue b/src/components/do/a6-device/calibration.vue index f7b4d46..b9e66c3 100644 --- a/src/components/do/a6-device/calibration.vue +++ b/src/components/do/a6-device/calibration.vue @@ -1,259 +1,1035 @@ +<!-- 璁惧鏍″噯 --> <template> <div> - <div class="search"> - <div class="search_thing"> - <el-button size="small" type="primary" @click="dialogVisible0=true">鏍″噯椤圭洰缁存姢</el-button> - </div> - <div class="btns"> - <el-button size="small" type="primary">娣诲姞鏍″噯璁板綍</el-button> - <el-button size="small" type="primary">瀵煎嚭</el-button> - </div> + <div class="btnS"> + <el-button size="small" type="primary" @click="calibrationMaintenance()" + >鏍″噯椤圭洰缁存姢</el-button + > + <el-button size="small" type="primary" @click="add('add')" + >娣诲姞鏍″噯璁板綍</el-button + > + <!-- <el-button size="small" type="primary" @click="handleDown" + >瀵煎嚭Excel</el-button + > --> </div> - <div class="tables" style="margin-top: 16px;"> - <ValueTable ref="ValueTable" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> + <div class="tables" style="margin-top: 10px;"> + <el-table :data="tableData" height="calc(100vh - 20em)"> + <el-table-column label="搴忓彿" type="index" width="120"> + <template v-slot="scope"> + <span>{{ + (search.current - 1) * search.size + scope.$index + 1 + }}</span> + </template> + </el-table-column> + <el-table-column + label="璁板綍缂栧彿" + min-width="150" + prop="processNumber" + ></el-table-column> + <el-table-column + label="鏍″噯鏈烘瀯" + min-width="150" + prop="unitOfMeasure" + show-overflow-tooltip + ></el-table-column> + <el-table-column label="鏍″噯缁撹" min-width="150" prop="status"> + <template v-slot="scope"> + {{ + scope.row.status === "0yes" + ? "鍚堟牸" + : scope.row.status === "1no" + ? "涓嶅悎鏍�" + : "鍏朵粬" + }} + </template> + </el-table-column> + <el-table-column + label="鏍″噯璇佷功缂栧彿" + min-width="150" + prop="certificateSerialNumber" + ></el-table-column> + <el-table-column + label="璇存槑" + min-width="150" + prop="remark" + show-overflow-tooltip + ></el-table-column> + <el-table-column + label="鏍″噯鏃ユ湡" + min-width="150" + prop="calibrationDate" + ></el-table-column> + <el-table-column + label="涓嬫鏍″噯鏃ユ湡" + min-width="150" + prop="nextCalibrationDate" + ></el-table-column> + <el-table-column + label="纭鏃ユ湡" + min-width="150" + prop="confirmDate" + ></el-table-column> + <el-table-column + label="鐧昏浜�" + min-width="150" + prop="createUser" + ></el-table-column> + <el-table-column + label="鐧昏鏃ユ湡" + min-width="150" + prop="createTime" + ></el-table-column> + <el-table-column + fixed="right" + label="鎿嶄綔" + min-width="180" + align="center" + > + <template #default="{ row }"> + <el-button + size="small" + type="text" + @click="handleAttachmentClick(row)" + >涓嬭浇闄勪欢</el-button + > + <el-button + size="small" + type="text" + @click="handleViewClick('view', row)" + >鏌ョ湅</el-button + > + <el-button size="small" type="text" @click="handleDeleteClick(row)" + >鍒犻櫎</el-button + > + </template> + </el-table-column> + </el-table> + <el-pagination + :current-page="1" + :page-size="search.size" + :page-sizes="[10, 20, 30, 50, 100]" + :total="search.total" + layout="->,total, sizes, prev, pager, next, jumper" + style="margin-right: 5%;" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + > + </el-pagination> </div> + <!-- 鏍″噯椤圭洰缁存姢 --> <el-dialog - title="鏍″噯椤圭洰缁存姢" - :visible.sync="dialogVisible0" - width="60%" - style="max-height: 80vh;margin-top: 10vh;" :close-on-click-modal="false" - :close-on-press-escape="false"> + :close-on-press-escape="false" + :visible.sync="dialogVisible0" + title="鏍″噯椤圭洰缁存姢" + top="5vh" + width="70%" + > <h4> - <div style="display: flex; - align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟缁存姢</span></div> - <el-button type="primary" size="small" @click="addCalibrate">娣� 鍔�</el-button> + <span style="display: flex;align-items: center;" + ><span class="line"></span><span>璁惧鏍″噯鍙傛暟缁存姢</span></span + > + <el-button + :loading="addCalibrateLoading" + size="small" + type="primary" + @click="addCalibrate" + >娣� 鍔�</el-button + > </h4> - <div class="search"> - <div class="search_thing"> - <div class="search_label">璁¢噺鍙傛暟锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">閲忕▼鑼冨洿锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label" style="width: 100px;">鏈�澶у厑璁歌宸細</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">鍒ゅ畾鏍囧噯锛�</div> - <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="form0.value"></el-input></div> - </div> + <div> + <el-form + ref="form0" + :model="form0" + :rules="form0Rules" + label-position="right" + label-width="120px" + > + <el-row> + <el-col :span="12"> + <el-form-item label="璁¢噺鍙傛暟:" prop="measurementParameter"> + <el-input + v-model="form0.measurementParameter" + clearable + placeholder="璇疯緭鍏�" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閲忕▼鑼冨洿:" prop="rangeOfMeasurement"> + <el-input + v-model="form0.rangeOfMeasurement" + clearable + placeholder="璇疯緭鍏�" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈�澶у厑璁歌宸�:" prop="maxPermissibleError"> + <el-input + v-model="form0.maxPermissibleError" + clearable + placeholder="璇疯緭鍏�" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍒ゅ畾鏍囧噯:" prop="judgmentCriteria"> + <el-input + v-model="form0.judgmentCriteria" + clearable + placeholder="璇疯緭鍏�" + size="small" + ></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> </div> <h4> - <div style="display: flex; - align-items: center;"><span class="line"></span><span>璁惧鏍″噯鍙傛暟</span></div> + <span style="display: flex;align-items: center;" + ><span class="line"></span><span>璁惧鏍″噯鍙傛暟</span></span + > </h4> - <ValueTable ref="ValueTable0" - :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" - :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData0" :key="upIndex0"/> + <!-- 璁惧鏍″噯鍙傛暟琛ㄦ牸 --> + <el-table + ref="calibrateTable" + v-loading="calibrateParamsLoading" + :data="calibrateParams" + max-height="450" + stripe + style="width: 100%" + > + <el-table-column label="缂栧彿" type="index" width="80"></el-table-column> + <el-table-column + label="璁¢噺鍙傛暟" + prop="measurementParameter" + ></el-table-column> + <el-table-column + label="閲忕▼鑼冨洿" + prop="rangeOfMeasurement" + ></el-table-column> + <el-table-column + label="鏈�澶у厑璁歌宸�" + prop="maxPermissibleError" + ></el-table-column> + <el-table-column + label="鍒ゅ畾鏍囧噯" + prop="judgmentCriteria" + ></el-table-column> + <el-table-column label="鍒涘缓浜�" prop="createdBy"></el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" prop="creationTime"></el-table-column> + <el-table-column fixed="right" label="鎿嶄綔"> + <template slot-scope="scope"> + <el-button size="small" type="text" @click="handleDelete(scope.row)" + >鍒犻櫎</el-button + > + </template> + </el-table-column> + </el-table> + </el-dialog> + + <!-- 娣诲姞鏍″噯璁板綍 --> + <el-dialog + :close-on-click-modal="false" + :close-on-press-escape="false" + :visible.sync="dialogVisible1" + title="娣诲姞鏍″噯璁板綍" + top="5vh" + width="80%" + @close="resetCalibrationRecord" + > + <div style="height: 70vh;overflow-y: auto;overflow-x: hidden;"> + <h4> + <div style="display: flex;align-items: center;"> + <span class="line"></span> + <span>娣诲姞璁惧鏍″噯璁板綍</span> + </div> + </h4> + <el-form + ref="calibrationRecord" + :model="calibrationRecord" + :rules="formRules" + label-position="right" + label-width="120px" + > + <el-row> + <el-col :span="6"> + <el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:" prop="unitOfMeasure"> + <el-input + v-model="calibrationRecord.unitOfMeasure" + :disabled="operationType === 'view'" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏍″噯鏃ユ湡:" prop="calibrationDate"> + <el-date-picker + v-model="calibrationRecord.calibrationDate" + :disabled="operationType === 'view'" + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 90%" + type="date" + value-format="yyyy-MM-dd" + @change="getNextCalibrationDate" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="涓嬫鏍″噯鏃ユ湡:" label-width="140px"> + <el-date-picker + v-model="calibrationRecord.nextCalibrationDate" + disabled + format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 90%" + type="date" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="璁$畻鍣ㄥ叿:" prop="calculatingApparatus"> + <el-input + v-model="calibrationRecord.calculatingApparatus" + :disabled="operationType === 'view'" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="璁$畻鏍囧噯閲忕▼:" prop="standardRange"> + <el-input + v-model="calibrationRecord.standardRange" + :disabled="operationType === 'view'" + size="small" + style="width: 90%" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item + label="璁¢噺鏍囧噯涓嶇‘瀹氬害:" + label-width="140px" + prop="calibrationStandardUncertainty" + > + <el-input + v-model="calibrationRecord.calibrationStandardUncertainty" + :disabled="operationType === 'view'" + size="small" + style="width: 90%" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鎵�渚濇嵁鏂囦欢:" prop="byDocument"> + <el-input + v-model="calibrationRecord.byDocument" + :disabled="operationType === 'view'" + size="small" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="璇佷功缂栧彿:" prop="certificateSerialNumber"> + <el-input + v-model="calibrationRecord.certificateSerialNumber" + :disabled="operationType === 'view'" + size="small" + style="width: 90%" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item + label="鐘舵��:" + label-width="140px" + prop="status" + required + > + <el-radio-group + v-model="calibrationRecord.status" + :disabled="operationType === 'view'" + > + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="纭鏃ユ湡:"> + <el-date-picker + v-model="calibrationRecord.confirmDate" + :disabled="operationType === 'view'" + format="yyyy-MM-dd HH:mm:ss" + placeholder="閫夋嫨鏃ユ湡" + size="small" + style="width: 100%" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="17"> + <el-form-item label="闄勪欢锛�" prop="fileName"> + <el-input + v-model="calibrationRecord.fileName" + :style=" + `width: ${operationType === 'add' ? '85%' : '100%'};}` + " + disabled + size="small" + > + <el-button + v-if="operationType === 'add'" + slot="append" + icon="el-icon-delete-solid" + @click="deleteFile" + ></el-button> + </el-input> + <el-upload + v-if="operationType === 'add'" + ref="upload" + :action="action" + :before-upload="beforeUpload" + :headers="headers" + :limit="1" + :on-error="onError" + :on-success="handleSuccessUp" + :show-file-list="false" + style="float: right;" + > + <el-button + :loading="upLoading" + size="small" + style="position: relative; top: -4px;" + type="primary" + >闄勪欢涓婁紶 + </el-button> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞:"> + <el-input + v-model="calibrationRecord.remark" + :disabled="operationType === 'view'" + :rows="3" + size="small" + style="width: 96%" + type="textarea" + ></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <h4> + <span style="display: flex;align-items: center;"> + <span class="line"></span><span>鏍″噯鏉$洰纭缁撴灉</span> + </span> + </h4> + <el-table ref="calibrateTable" :data="calibrateParams" border> + <el-table-column + label="缂栧彿" + type="index" + width="60" + ></el-table-column> + <el-table-column + label="璁¢噺鍙傛暟" + prop="measurementParameter" + ></el-table-column> + <el-table-column + label="閲忕▼鑼冨洿" + prop="rangeOfMeasurement" + ></el-table-column> + <el-table-column + label="鏈�澶у厑璁歌宸�" + prop="maxPermissibleError" + ></el-table-column> + <el-table-column + label="鍒ゅ畾鏍囧噯" + prop="judgmentCriteria" + ></el-table-column> + <el-table-column label="鏄惁鏍″噯" prop="isCalibration"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鏄惁鏍″噯 + </template> + <template slot-scope="scope"> + <el-radio-group + v-model="scope.row.isCalibration" + :disabled="operationType === 'view'" + > + <el-radio label="0yes">鏄�</el-radio> + <el-radio label="1no">鍚�</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍒ゅ畾缁撴灉" min-width="140" prop="result"> + <template slot="header" slot-scope="scope"> + <span class="required-span">* </span>鍒ゅ畾缁撴灉 + </template> + <template slot-scope="scope"> + <el-radio-group + v-model="scope.row.result" + :disabled="operationType === 'view'" + @input="checkRadio()" + > + <el-radio label="0yes">鍚堟牸</el-radio> + <el-radio label="1no">涓嶅悎鏍�</el-radio> + <el-radio label="2other">鍏朵粬</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column label="鍗曢」缁撴灉璇存槑" prop="singleResultStatement"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.singleResultStatement" + :disabled="operationType === 'view'" + size="small" + ></el-input> + </template> + </el-table-column> + </el-table> + <!-- 鎿嶄綔鏃ュ織 --> + <!-- <h4>--> + <!-- <div style="display: flex;--> + <!-- align-items: center;">--> + <!-- <span class="line"></span><span>鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織</span>--> + <!-- </div>--> + <!-- </h4>--> + <!-- <el-table :data="tableDataOperate" style="width: 100%">--> + <!-- <el-table-column type="index" label="搴忓彿" width="100"></el-table-column>--> + <!-- <el-table-column prop="operator" label="鎿嶄綔浜�" width="120"></el-table-column>--> + <!-- <el-table-column prop="operationTime" label="鎿嶄綔鏃堕棿" width="180"></el-table-column>--> + <!-- <el-table-column prop="operationType" label="鎿嶄綔绫诲瀷" width="120"></el-table-column>--> + <!-- <el-table-column prop="operationContent" label="鎿嶄綔鍐呭"></el-table-column>--> + <!-- </el-table>--> + </div> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible0 = false">鍙� 娑�</el-button> - <el-button type="primary" @click="dialogVisible0 = false">纭� 瀹�</el-button> + <el-button + v-if="operationType === 'add'" + @click="dialogVisible1 = false" + >鍙� 娑�</el-button + > + <el-button + v-if="operationType === 'add'" + :loading="addRecordLoading" + type="primary" + @click="addRecord" + >纭� 瀹�</el-button + > </span> </el-dialog> </div> </template> <script> -import ValueTable from '../../tool/value-table.vue' +import file from "../../../util/file"; +import fileDownload from "../../../util/file"; + export default { - components: { - ValueTable - }, - data(){ - return { - componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'handleLook', - font: '鏌ョ湅璇︽儏', - type: 'text', - method: 'handleLook' - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex:0, - componentData0: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - isPage:false, - do: [{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy', - }], - tagField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - select:[] - } - }, - requiredAdd: [], - requiredUp: [] - }, - upIndex0:0, - dialogVisible0:false, - form0:{ - value:'' + props: { + clickNodeVal: { + type: Object, + default: () => { + return {}; } } }, - methods:{ - addCalibrate(){ - if(!this.form0.value){ - this.$message.error('璇疯緭鍏ヨ閲忓弬鏁�') - return + data() { + return { + value: "", + calibrateParams: [], + calibrateParamsLoading: false, + addCalibrateLoading: false, + calibrationRecord: { + unitOfMeasure: "", // 璁¢噺鍗曚綅 + calibrationDate: null, // 鏍″噯鏃ユ湡 + nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 + calculatingApparatus: "", // 璁$畻鍣ㄥ叿 + confirmDate: null, // 纭鏃ユ湡 + standardRange: "", // 璁$畻鏍囧噯閲忕▼ + calibrationStandardUncertainty: "", // 璁¢噺鏍囧噯涓嶇‘瀹氬害 + byDocument: "", // 渚濇嵁鏂囦欢 + certificateSerialNumber: "", // 璇佷功缂栧彿 + status: "", // 鐘舵�� + remark: "", // 澶囨敞 + systemFileName: "", // + fileName: "" // + }, + formRules: { + unitOfMeasure: [ + { required: true, message: "璇疯緭鍏ユ牎鍑嗘湇鍔℃満鏋�", trigger: "blur" } + ], + calibrationDate: [ + { required: true, message: "璇烽�夋嫨鏍″噯鏃ユ湡", trigger: "change" } + ], + calculatingApparatus: [ + { required: true, message: "璇疯緭鍏ヨ绠楀櫒鍏�", trigger: "blur" } + ], + standardRange: [ + { required: true, message: "璇疯緭鍏ヨ绠楁爣鍑嗛噺绋�", trigger: "blur" } + ], + calibrationStandardUncertainty: [ + { required: true, message: "璇疯緭鍏ヨ閲忔爣鍑嗕笉纭畾搴�", trigger: "blur" } + ], + byDocument: [ + { required: true, message: "璇疯緭鍏ユ墍渚濇嵁鏂囦欢", trigger: "blur" } + ], + status: [{ required: true, message: "璇烽�夋嫨鐘舵��", trigger: "change" }] + }, + tableData: [], + dialogVisible0: false, + dialogVisible1: false, + form0: { + measurementParameter: "", // 璁¢噺鍙傛暟 + rangeOfMeasurement: "", + maxPermissibleError: "", + judgmentCriteria: "", + createdBy: "", + action: "", + deviceId: null + }, + form0Rules: { + measurementParameter: [ + { required: true, message: "璇疯緭鍏ヨ閲忓弬鏁�", trigger: "blur" } + ], + rangeOfMeasurement: [ + { required: true, message: "璇疯緭鍏ラ噺绋嬭寖鍥�", trigger: "blur" } + ], + maxPermissibleError: [ + { required: true, message: "璇疯緭鍏ユ渶澶у厑璁歌宸�", trigger: "blur" } + ], + judgmentCriteria: [ + { required: true, message: "璇疯緭鍏ュ垽瀹氭爣鍑�", trigger: "blur" } + ] + }, + addRecordLoading: false, + tableDataOperate: [], // 鏈褰曠姸鎬佸拰鎿嶄綔鏃ュ織 + upLoading: false, + operationType: "", + search: { + size: 20, + current: 1, + total: 0 } - // 淇濆瓨 - // 鏇存柊鍒楄〃 + }; + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + token: sessionStorage.getItem("token") + }; + }, + action() { + return this.javaApi + this.$api.personnel.saveCNASFile; + } + }, + mounted() { + //鑾峰彇鎿嶄綔璁板綍淇℃伅 + this.getOperateMsg(); + this.getTableList(this.clickNodeVal.value); // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + }, + methods: { + //鐘舵�佸垽瀹� + checkRadio() { + let resultList = this.calibrateParams.map(ele => ele.result); + if (resultList && resultList.filter(ele => ele == "1no").length > 0) { + this.calibrationRecord.status = "1no"; + } else if ( + resultList && + resultList.filter(ele => ele == "2other").length == resultList.length + ) { + this.calibrationRecord.status = "2other"; + } else if ( + resultList && + resultList.filter(ele => ele == "0yes").length == resultList.length + ) { + this.calibrationRecord.status = "0yes"; + } + }, + getNextCalibrationDate(val) { + let oneYearLaterDate = new Date(val); + oneYearLaterDate.setFullYear(oneYearLaterDate.getFullYear() + 1); + oneYearLaterDate.setDate(oneYearLaterDate.getDate() - 1); + // let obj = oneYearLaterDate.toISOString().split('T')[0]; + this.calibrationRecord.nextCalibrationDate = oneYearLaterDate; + }, + handleSizeChange(val) { + this.search.size = val; + this.getTableList(this.clickNodeVal.value); + }, + handleCurrentChange(val) { + this.search.current = val; + this.getTableList(this.clickNodeVal.value); + }, + getTableList(deviceId) { + this.$axios + .get( + this.$api.deviceCheck.deviceMetricRecordPage + + "?deviceId=" + + deviceId + + "&size=" + + this.search.size + + "¤t=" + + this.search.current + + "&type=calibrate" + ) + .then(res => { + this.tableData = res.data.records; + this.search.total = res.data.total; + }); + }, + getOperateMsg() { + this.$axios + .get(this.$api.deviceOperate.list + "/" + this.clickNodeVal.value) + .then(res => { + this.tableDataOperate = res.data; + }); + }, + // 娣诲姞鏍告煡璁板綍 + add(type) { + this.operationType = type; + this.dialogVisible1 = true; + this.getXmsg(); + }, + // 鏌ョ湅璇︽儏 + handleViewClick(type, row) { + this.$axios + .get( + this.$api.deviceCheck.showDeviceMetricsCopy + + "?id=" + + row.id + + "&type=calibrate" + ) + .then(res => { + this.calibrateParams = res.data; + }); + this.calibrationRecord = { ...row }; + this.operationType = type; + this.dialogVisible1 = true; + }, + // 琛ㄦ牸鍒犻櫎鎿嶄綔 + handleDeleteClick(row) { + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$axios + .delete( + this.$api.deviceCheck.deleteDeviceMetricRecord + "?id=" + row.id + ) + .then(res => { + this.getTableList(this.clickNodeVal.value); // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁 + this.$message.success("鍒犻櫎鎴愬姛锛�"); + }); + }) + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); + }); + }, + handleAttachmentClick(row) { + let state = /\.(jpg|jpeg|png|gif)$/i.test(row.systemFileName); + if (state) { + let url = this.javaApi + "/img/" + row.systemFileName; + fileDownload.downloadIamge(url, row.systemFileName); + } else { + const url = this.javaApi + "/word/" + row.systemFileName; + const link = document.createElement("a"); + link.href = url; + link.download = row.systemFileName; + link.click(); + this.$message.success("涓嬭浇鎴愬姛"); + } + }, + //瀵煎嚭 + handleDown() { + this.outLoading = true; + this.$axios + .get( + this.$api.deviceCheck.deviceMetricRecordExport + + "?deviceId=" + + this.clickNodeVal.value + + "&type=calibrate", + { + responseType: "blob" + } + ) + .then(res => { + this.outLoading = false; + const blob = new Blob([res], { type: "application/octet-stream" }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, "utf-8"); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = "璁惧鏍″噯.xlsx"; + link.click(); + this.$message.success("瀵煎嚭鎴愬姛"); + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = "璁惧鏍″噯.xlsx"; + link.click(); + this.$message.success("瀵煎嚭鎴愬姛"); + } + }; + }); + }, + deleteFile() { + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎鏂囦欢, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$axios + .delete( + this.$api.personnel.deleteCNASFile + + "?fileName=" + + this.calibrationRecord.systemFileName + ) + .then(res => { + this.calibrationRecord.fileName = ""; + this.$refs.upload.clearFiles(); + if (res.code == 200) { + this.$message.success("鍒犻櫎鎴愬姛锛�"); + } + }); + }) + .catch(err => { + console.log("err----", err); + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); + }); + }, + // 鏍″噯椤圭洰缁存姢 + calibrationMaintenance() { + this.dialogVisible0 = true; + this.getXmsg(); + }, + // 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅 + async getXmsg() { + this.calibrateParamsLoading = true; + try { + await this.$axios + .get( + this.$api.deviceCheck.selectDeviceMetric + + "?deviceId=" + + this.clickNodeVal.value + + "&type=calibrate" + ) + .then(res => { + if (res.code == 200) { + this.calibrateParams = res.data; + } + this.calibrateParamsLoading = false; + }); + } catch (e) { + console.log("getXmsg---", e); + this.calibrateParamsLoading = false; + } + }, + // 鏍″噯椤圭洰缁存姢-鍒犻櫎璁惧鏍″噯鍙傛暟 + handleDelete(row) { + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$axios + .delete(this.$api.deviceCheck.deleteDeviceMetrics + "?id=" + row.id) + .then(res => { + if (res.code === 200) { + this.$message.success("鍒犻櫎鎴愬姛!"); + this.getXmsg(); + } + }); + }) + .catch(() => { + this.$message.info("宸插彇娑堝垹闄�"); + }); + }, + addCalibrate() { + this.$refs["form0"].validate(valid => { + if (valid) { + // 淇濆瓨 + this.calibrateParamsLoading = true; + this.addCalibrateLoading = true; + this.form0.deviceId = this.clickNodeVal.value; + const user = JSON.parse(localStorage.getItem("user")); + this.form0.createdBy = user.name; + this.form0.type = "calibrate"; + this.$axios + .post(this.$api.deviceCheck.saveOrUpdateDeviceMetric, this.form0, { + headers: { + "Content-Type": "application/json" + } + }) + .then(res => { + if (res.code == 200) { + this.$message.success("淇濆瓨鎴愬姛"); + this.$refs["form0"].resetFields(); + this.getXmsg(); // 鍒锋柊璁惧鏍″噯鍙傛暟琛ㄦ牸 + } + this.calibrateParamsLoading = false; + this.addCalibrateLoading = false; + }); + } else { + this.addCalibrateLoading = false; + this.$message.warning("鏈夊繀濉」鏈~"); + } + }); + }, + addRecord() { + this.$refs["calibrationRecord"].validate(valid => { + if (valid) { + try { + if (this.calibrateParams.some(m => m.isCalibration === undefined)) { + this.$message.error("璇烽�夋嫨鏄惁鏍″噯"); + return; + } + if (!this.calibrateParams.every(m => m.result !== undefined)) { + this.$message.error("璇烽�夋嫨鍒ゅ畾缁撴灉"); + return; + } + this.addRecordLoading = true; + this.calibrationRecord.deviceId = this.clickNodeVal.value; + let user = JSON.parse(localStorage.getItem("user")); + this.calibrationRecord.createUser = user.name; + this.calibrationRecord.type = "calibrate"; + this.calibrationRecord.deviceMetricsCopyList = this.calibrateParams; + this.$axios + .post( + this.$api.deviceCheck.addOrUpdateDeviceMetricRecord, + this.calibrationRecord, + { + headers: { + "Content-Type": "application/json" + } + } + ) + .then(res => { + if (res.code == 200) { + this.$message.success("娣诲姞鎴愬姛"); + this.dialogVisible1 = false; + this.getTableList(this.clickNodeVal.value); + } + this.addRecordLoading = false; + }); + } catch (e) { + console.log("addRecord---", e); + this.addRecordLoading = false; + } + } else { + this.$message.warning("鏈夊繀濉」鏈~"); + } + }); + }, + resetCalibrationRecord() { + this.$refs.calibrationRecord.resetFields(); + }, + // 涓婁紶闄勪欢 + handleSuccessUp(response, file) { + if (response.code == 200) { + // 鍦ㄤ繚瀛樿祴鍊兼柊鏂囦欢 + this.calibrationRecord.fileName = file.name; + this.calibrationRecord.systemFileName = response.data; + this.upLoading = false; + } else { + this.upLoading = false; + this.$message.error(response.message); + } + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M"); + this.$refs.upload.clearFiles(); + return false; + } else { + this.upLoading = true; + return true; + } + }, + onError(err, file, fileList) { + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); + } + // end + }, + watch: { + // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 + clickNodeVal(newVal) { + if (newVal.value) { + this.getTableList(newVal.value); + } + }, + dialogVisible1(newVal) { + if (newVal === false) { + this.calibrateParams = []; + this.calibrationRecord = { + unitOfMeasure: "", // 璁¢噺鍗曚綅 + calibrationDate: null, // 鏍″噯鏃ユ湡 + nextCalibrationDate: null, // 涓嬫鏍″噯鏃ユ湡 + calculatingApparatus: "", // 璁$畻鍣ㄥ叿 + standardRange: "", // 璁$畻鏍囧噯閲忕▼ + calibrationStandardUncertainty: "", // 璁¢噺鏍囧噯涓嶇‘瀹氬害 + byDocument: "", // 渚濇嵁鏂囦欢 + certificateSerialNumber: "", // 璇佷功缂栧彿 + status: "", // 鐘舵�� + remark: "" // 澶囨敞 + }; + } } } +}; + +function downloadImage(url) { + const link = document.createElement("a"); + link.href = url; + link.target = "_blank"; + link.download = "attachment.jpg"; // 鏂囦欢鍚� + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); } </script> - <style scoped> -.tables{ - width: calc(100vw - 390px); +.tables { + width: 100%; height: calc(100vh - 230px); } + .search { background-color: #fff; height: 40px; @@ -272,29 +1048,64 @@ width: 70px; font-size: 14px; text-align: right; + margin-right: 10px; } .search_input { width: calc(100% - 110px); } -.btns{ - position: absolute; - right: 40px; - top: 50%; - transform: translate(0,-50%); + +.btnS { + text-align: right; + margin-top: 10px; } -h4{ + +h4 { font-weight: 400; font-size: 16px; display: flex; justify-content: space-between; margin: 10px 0; } -h4 .line{ + +h4 .line { display: inline-block; width: 3px; height: 16px; - background: #3A7BFA; + background: #3a7bfa; margin-right: 4px; } + +.check { + background-color: #fff; + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.check_thing { + flex: 0 0 calc(20% - 10px); + margin-bottom: 20px; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.check_label { + font-size: 14px; + margin-bottom: 5px; +} + +.check_data .check_input { + width: 100%; +} + +.el-table { + font-size: 14px; + color: #333; +} + +.el-table thead { + background-color: #f5f5f5; +} </style> -- Gitblit v1.9.3