| | |
| | | <el-button size="small" type="primary" @click="clickAdd">新 增</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table |
| | | :data="tableData" |
| | | height="calc(100vh - 18em)" |
| | | style="width: 100%"> |
| | | <el-table :data="tableData" height="calc(100vh - 18em)" style="width: 100%"> |
| | | <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> |
| | | <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" |
| | | :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange"> |
| | | <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" :total="search.total" |
| | | layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange"> |
| | | </el-pagination> |
| | | <el-dialog |
| | | :visible.sync="dialogVisible" |
| | | title="新增" |
| | | width="50%" |
| | | @open="openDialog"> |
| | | <el-dialog :visible.sync="dialogVisible" title="新增" width="50%" @open="openDialog"> |
| | | <div style="height: 50vh; overflow-y: auto"> |
| | | <el-form ref="form" :model="form" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item :rules="[{ required: true, message: '请输入测试地点', trigger: 'change' }]" label="测试日期" |
| | | prop="testDate"> |
| | | <el-date-picker |
| | | v-model="form.testDate" |
| | | format="yyyy-MM-dd" |
| | | placeholder="选择日期" |
| | | size="small" |
| | | style="width: 100%" |
| | | type="date" |
| | | value-format="yyyy-MM-dd"> |
| | | prop="testDate"> |
| | | <el-date-picker v-model="form.testDate" format="yyyy-MM-dd" placeholder="选择日期" size="small" |
| | | style="width: 100%" type="date" value-format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item :rules="[{ required: true, message: '请输入设备名称', trigger: 'change' }]" label="设备名称" |
| | | prop="deviceId"> |
| | | <el-select v-model="form.deviceId" |
| | | class="table_input" |
| | | clearable |
| | | filterable |
| | | placeholder="设备名称" |
| | | size="small" @change="getCalibrationDateFun"> |
| | | <el-option v-for="item in equipOptions" :key="item.id" :label="item.deviceName" :value="item.id"> |
| | | {{item.deviceName + item.managementNumber}} |
| | | prop="deviceId"> |
| | | <el-select v-model="form.deviceId" class="table_input" clearable filterable placeholder="设备名称" |
| | | size="small" @change="getCalibrationDateFun"> |
| | | <el-option v-for="item in equipOptions" :key="item.id" :label="item.deviceName" :value="item.id"> |
| | | {{ item.deviceName + item.managementNumber }} |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测者" prop="recipientUser"> |
| | | <el-select v-model="form.testerId" clearable filterable placeholder="请选择" |
| | | size="small" style="width: 100%;"> |
| | | <el-select v-model="form.testerId" clearable filterable placeholder="请选择" size="small" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="核查人" prop="recipientUser"> |
| | | <el-select v-model="form.checkerId" clearable filterable placeholder="请选择" |
| | | size="small" style="width: 100%;" > |
| | | <el-select v-model="form.checkerId" clearable filterable placeholder="请选择" size="small" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="结论"> |
| | | <el-input |
| | | v-model="form.conclusion" |
| | | :rows="2" |
| | | placeholder="请输入内容" |
| | | type="textarea"> |
| | | <el-input v-model="form.conclusion" :rows="2" placeholder="请输入内容" type="textarea"> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-button size="small" type="primary" @click="feMeasuredQuantityListAdd">新增</el-button> |
| | | </div> |
| | | <div> |
| | | <el-table |
| | | :data="form.illuminationDetectionAreaList" |
| | | height="40vh" |
| | | style="width: 100%; margin: auto"> |
| | | <el-table :data="form.illuminationDetectionAreaList" height="40vh" style="width: 100%; margin: auto"> |
| | | <el-table-column label="序号" type="index" width="80"></el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | label="检测区域名称" |
| | | min-width="180" |
| | | prop="detectionAreaLabel"> |
| | | <el-table-column align="center" label="检测区域名称" min-width="180" prop="detectionAreaLabel"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.detectionAreaLabel" :rows="1" type="textarea"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | label="检测值" |
| | | min-width="300" |
| | | prop="name"> |
| | | <el-table-column align="center" label="检测值" min-width="300" prop="name"> |
| | | <template> |
| | | <el-table-column align="center" label="第一次" min-width="100" prop="valueOne"> |
| | | <template #default="{ row }"> |
| | |
| | | </el-table-column> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | label="备注" |
| | | min-width="180" |
| | | prop="detectionAreaLabel"> |
| | | <el-table-column align="center" label="备注" min-width="180" prop="detectionAreaLabel"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.remark" :rows="1" type="textarea"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="操作" |
| | | width="100"> |
| | | <el-table-column fixed="right" label="操作" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="small" type="text" @click="feMeasuredQuantityListDelete(scope.row, scope.$index)"> |
| | | 删除 |
| | |
| | | </el-form> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">确 定</el-button> |
| | | </span> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getFeLightningProtection, |
| | | deviceScopeSearch, |
| | | selectUserCondition, |
| | | treeDevice, |
| | | addFeLightningProtection, |
| | | deleteFeLightningProtection, |
| | | getFeIlluminationDetectionArea, |
| | | deleteFeIlluminationDetectionArea, |
| | | exportFeIllumination |
| | | } from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | search: { |
| | | size: 20, |
| | | size: 10, |
| | | current: 1, |
| | | total: 0 |
| | | }, |
| | |
| | | if (!isNaN(row.valueOne) && !isNaN(row.valueTwo) && !isNaN(row.valueThree)) { |
| | | const avg = Number(row.valueOne) + Number(row.valueTwo) + Number(row.valueThree) |
| | | console.log(avg) |
| | | row.average = Math.round(avg/3); |
| | | row.average = Math.round(avg / 3); |
| | | } else { |
| | | this.$message.warning("必须为数字!") |
| | | } |
| | | } |
| | | }, |
| | | edit(row) { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.getFeIlluminationDetectionArea + "?intensityIlluminationId=" + row.intensityIlluminationId).then(res => { |
| | | this.form = {...row} |
| | | getFeIlluminationDetectionArea({ intensityIlluminationId: row.intensityIlluminationId }).then(res => { |
| | | this.form = { ...row } |
| | | this.form.illuminationDetectionAreaList = res.data; |
| | | this.dialogVisible = true |
| | | }); |
| | | }, |
| | | initData() { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.getFeLightningProtection + '?size=' + this.search.size + '¤t=' + this.search.current).then(res => { |
| | | if (res.code === 201) return; |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | getFeLightningProtection({ ...this.search }).then(res => { |
| | | if (res.code === 200) { |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeLightningProtection + '?intensityIlluminationId=' + row.intensityIlluminationId).then(res => { |
| | | deleteFeLightningProtection({ intensityIlluminationId: row.intensityIlluminationId }).then(res => { |
| | | this.$message.success('删除成功!') |
| | | this.initData() |
| | | }) |
| | |
| | | }, |
| | | feMeasuredQuantityListDelete(row, index) { |
| | | if (row.detectionAreaId) { |
| | | this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeIlluminationDetectionArea + '?detectionAreaId=' + row.detectionAreaId).then(res => { |
| | | if (res.code === 201) return |
| | | this.form.illuminationDetectionAreaList.splice(index, 1) |
| | | this.$message.success('删除成功!') |
| | | deleteFeIlluminationDetectionArea({ detectionAreaId: row.detectionAreaId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.form.illuminationDetectionAreaList.splice(index, 1) |
| | | this.$message.success('删除成功!') |
| | | } |
| | | }) |
| | | } else { |
| | | this.form.illuminationDetectionAreaList.splice(index, 1) |
| | |
| | | } |
| | | }, |
| | | openDialog() { |
| | | this.$axios.get(this.$api.deviceScope.treeDevice).then(res => { |
| | | treeDevice().then(res => { |
| | | this.cascaderList = res.data; |
| | | }); |
| | | this.$nextTick(() => { |
| | |
| | | // 获取所有设备 |
| | | getEquipOptions() { |
| | | this.equipOptions = [] |
| | | this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => { |
| | | deviceScopeSearch({ status: '0' }).then(res => { |
| | | if (res.code === 200 && res.data) { |
| | | this.equipOptions = res.data |
| | | } |
| | |
| | | this.submitLoading = true |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | this.$axios.post(this.$api.facilitiesAndEnvironment.addFeLightningProtection, this.form, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | addFeLightningProtection(this.form).then(res => { |
| | | this.submitLoading = false |
| | | if (res.code === 200) { |
| | | this.initData() |
| | |
| | | }, |
| | | // 获取负责人信息接口 |
| | | getUserList() { |
| | | this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { |
| | | selectUserCondition().then(res => { |
| | | if (res.code == 200) { |
| | | this.responsibleOptions = res.data |
| | | } |
| | |
| | | }, |
| | | // 导出 |
| | | downLoadPost(row) { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.exportFeIllumination + '?intensityIlluminationId=' + row.intensityIlluminationId,{responseType: "blob"}).then(res => { |
| | | exportFeIllumination({ intensityIlluminationId: row.intensityIlluminationId }).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res],{ type: 'application/msword' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '照度记录' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '照度记录' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | const blob = new Blob([res], { type: 'application/msword' }); |
| | | this.$download.saveAs(blob, '照度记录.docx') |
| | | }) |
| | | }, |
| | | } |