New file |
| | |
| | | import request from '@/utils/request'; |
| | | |
| | | /** |
| | | * 根据标准参数类型查询标准参数 |
| | | * @param powerType |
| | | * @returns {*} |
| | | */ |
| | | export function getPwrStandParamApi(powerType) { |
| | | return request({ |
| | | url: '/stand/getPwrStandParam', |
| | | method: 'GET', |
| | | params: { |
| | | powerType |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 设置标准参数 |
| | | * @param data 设置值 |
| | | * @returns {*} |
| | | */ |
| | | export function setPwrStandParamApi(data) { |
| | | return request({ |
| | | url: '/stand/setPwrStandParam', |
| | | method: 'POST', |
| | | data |
| | | }); |
| | | } |
| | |
| | | <script setup lang="ts"> |
| | | import {defaultProps} from "element-plus"; |
| | | import {computed} from "vue"; |
| | | |
| | | const props = defineProps({ |
| | | type: { |
| | |
| | | |
| | | <template> |
| | | <div class="hdw-button-wrapper" :class="{'warning': type==='warning'}"> |
| | | <svg-icon class="btn-icon" :icon-class="iconClass"></svg-icon> |
| | | <div class="btn-icon"> |
| | | <svg-icon :icon-class="iconClass"></svg-icon> |
| | | </div> |
| | | <slot></slot> |
| | | </div> |
| | | </template> |
| | |
| | | background-image: url("./images/warning-bg.png"); |
| | | } |
| | | .btn-icon { |
| | | display: inline-block; |
| | | font-size: 20px; |
| | | margin-right: 8px; |
| | | } |
| | |
| | | <div class="no-data-wrapper"> |
| | | <div class="no-data-content"> |
| | | <div class="no-data-icon"> |
| | | <svg-icon class="icon" icon-class="search-data"></svg-icon> |
| | | <svg-icon icon-class="search-data"></svg-icon> |
| | | </div> |
| | | <div class="no-data-text">{{ props.text }}</div> |
| | | </div> |
| | |
| | | color: #00feff; |
| | | .no-data-icon { |
| | | margin-bottom: 8px; |
| | | .icon { |
| | | color: #00feff; |
| | | font-size: 40px; |
| | | } |
| | | color: #00feff; |
| | | font-size: 40px; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <script setup> |
| | | import {ref, reactive, onMounted} from "vue"; |
| | | import {ElLoading, ElMessageBox, ElMessage} from "element-plus"; |
| | | import {setPwrStandParamApi} from "@/api/standardParams.js"; |
| | | import useElement from "@/hooks/useElement.js"; |
| | | const { $loading, $message, $confirm } = useElement(); |
| | | const formRef = ref(); |
| | | const props = defineProps({ |
| | | info: { |
| | | type: Object, |
| | | default() { |
| | | return { |
| | | num: 0, |
| | | standName: "", |
| | | powerType: 1, |
| | | paramType: 1, |
| | | basisVal: 0, |
| | | alarmLimith: 0, |
| | | alarmLimithUpeper: 0, |
| | | alarmLimitl: 0, |
| | | alarmLimitlLower: 0, |
| | | fileName: "", |
| | | standFilePath: "", |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | const emit = defineEmits(["update:close", "success"]); |
| | | const params = reactive({ |
| | | num: 0, |
| | | standName: "", |
| | | powerType: 1, |
| | | paramType: 1, |
| | | basisVal: 0, |
| | | alarmLimith: 0, |
| | | alarmLimithUpeper: 0, |
| | | alarmLimitl: 0, |
| | | alarmLimitlLower: 0, |
| | | fileName: "", |
| | | standFilePath: "", |
| | | }); |
| | | const rules = reactive({ |
| | | basisVal: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | ], |
| | | alarmLimithUpeper: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | { |
| | | validator: validatorHUpper, |
| | | trigger: ["blur", "change"], |
| | | } |
| | | ], |
| | | alarmLimith: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | { |
| | | validator: validatorH, |
| | | trigger: ["blur", "change"], |
| | | } |
| | | ], |
| | | alarmLimitl: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | { |
| | | validator: validatorL, |
| | | trigger: ["blur", "change"], |
| | | } |
| | | ], |
| | | alarmLimitlLower: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | { |
| | | validator: validatorLLower, |
| | | trigger: ["blur", "change"], |
| | | } |
| | | ], |
| | | }); |
| | | const layout = reactive({ |
| | | gutter: 16, |
| | | span: 12 |
| | | }); |
| | | |
| | | function close() { |
| | | emit('update:close', false); |
| | | } |
| | | |
| | | async function confirm() { |
| | | let valid = await formRef.value.validate(() => { }); |
| | | |
| | | if (!valid) { |
| | | $message.error("表单验证失败"); |
| | | return false; |
| | | } |
| | | ElMessageBox.confirm( |
| | | '确认设置标准参数?', |
| | | '系统提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'info', |
| | | } |
| | | ).then(() => { |
| | | setParams(); |
| | | }).catch(() => {}) |
| | | } |
| | | async function setParams() { |
| | | const info = JSON.parse(JSON.stringify(params)); |
| | | console.log(info); |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '数据加载中...', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }); |
| | | |
| | | try { |
| | | const rs = await setPwrStandParamApi(info); |
| | | loading.close(); |
| | | if(rs.code === 1) { |
| | | ElMessage({ |
| | | message: '设置标准参数成功', |
| | | type: 'success', |
| | | }); |
| | | emit('success', true); |
| | | close(); |
| | | }else{ |
| | | await ElMessageBox.alert("设置标准参数失败!", "系统提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | } |
| | | }catch (e) { |
| | | console.log(e); |
| | | loading.close(); |
| | | } |
| | | } |
| | | function validatorHUpper(rule, value, callback) { |
| | | if(value>params.alarmLimith) { |
| | | callback(); |
| | | }else { |
| | | callback(new Error('上上限值需大于上限值')); |
| | | } |
| | | } |
| | | |
| | | function validatorH(rule, value, callback) { |
| | | if(value<params.alarmLimithUpeper) { |
| | | callback(); |
| | | }else { |
| | | callback(new Error('上限值需小于上上限值')); |
| | | } |
| | | } |
| | | |
| | | function validatorL(rule, value, callback) { |
| | | if(value>params.alarmLimitlLower) { |
| | | callback(); |
| | | }else { |
| | | callback(new Error('下限值需大于下下限值')); |
| | | } |
| | | } |
| | | function validatorLLower(rule, value, callback) { |
| | | if(value<params.alarmLimitl) { |
| | | callback(); |
| | | }else { |
| | | callback(new Error('下下限值需小于下限值')); |
| | | } |
| | | } |
| | | onMounted(()=>{ |
| | | Object.assign(params, props.info); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="form-wrapper"> |
| | | <div class="form-content"> |
| | | <el-form ref="formRef" :model="params" label-width="6em" :rules="rules"> |
| | | <el-row :gutter="layout.gutter"> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="参数名称:"> |
| | | <el-input v-model="params.paramType"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="基准值:" prop="basisVal"> |
| | | <el-input v-model="params.basisVal"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="上上限:" prop="alarmLimithUpeper"> |
| | | <el-input v-model="params.alarmLimithUpeper"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="下下限:" prop="alarmLimitlLower"> |
| | | <el-input v-model="params.alarmLimitlLower"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="上限:" prop="alarmLimith"> |
| | | <el-input v-model="params.alarmLimith"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="layout.span"> |
| | | <el-form-item label="下限:" prop="alarmLimitl"> |
| | | <el-input v-model="params.alarmLimitl"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | <div class="form-footer"> |
| | | <el-button type="primary" @click="confirm">确定</el-button> |
| | | <el-button type="danger" @click="close">取消</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped lang="less"> |
| | | .form-wrapper { |
| | | width: 520px; |
| | | .form-footer { |
| | | text-align: right; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <script setup name="StandardParams"> |
| | | import {ref} from "vue"; |
| | | import {ref, onMounted, computed} from "vue"; |
| | | import {ElLoading} from "element-plus"; |
| | | import ycCard from "@/components/ycCard/index.vue"; |
| | | import PwButton from "@/components/pwButton.vue"; |
| | | import TabButton from "@/components/TabButton/index.vue"; |
| | | import HdwButton from "@/components/HdwButton/index.vue"; |
| | | import NoData from "@/components/noData.vue"; |
| | | import {getPwrStandParamApi} from "@/api/standardParams.js"; |
| | | import addEdit from "./dialog/addEdit.vue"; |
| | | |
| | | const headers = [ |
| | | { |
| | | prop: "standName", |
| | |
| | | { |
| | | prop: "basisVal", |
| | | label: "基准值", |
| | | width: "160", |
| | | width: "80", |
| | | }, |
| | | { |
| | | prop: "alarmLimith", |
| | | label: "上限", |
| | | width: "160", |
| | | width: "80", |
| | | }, |
| | | { |
| | | prop: "alarmLimithUpeper", |
| | | label: "上上限", |
| | | width: "160", |
| | | width: "80", |
| | | }, |
| | | { |
| | | prop: "alarmLimitl", |
| | | label: "下限", |
| | | width: "160", |
| | | width: "80", |
| | | }, |
| | | { |
| | | prop: "alarmLimitlLower", |
| | | label: "下下限", |
| | | width: "160", |
| | | width: "80", |
| | | }, |
| | | { |
| | | prop: "fileName", |
| | |
| | | const acButton = ref(1); |
| | | function changeAcButton(num) { |
| | | acButton.value = num; |
| | | searchData(); |
| | | } |
| | | |
| | | const searchText = ref(""); |
| | | const downloadText =ref(""); |
| | | const fileList = ref([]); |
| | | |
| | | async function searchData() { |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '数据加载中...', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }); |
| | | |
| | | try { |
| | | const rs = await getPwrStandParamApi(acButton.value); |
| | | loading.close(); |
| | | if(rs.code === 1 && rs.data) { |
| | | listRef.value = rs.data2; |
| | | }else { |
| | | listRef.value = []; |
| | | } |
| | | }catch (e) { |
| | | console.log(e); |
| | | loading.close(); |
| | | } |
| | | } |
| | | |
| | | const addEditVisible = ref(false); |
| | | const dialogTitle = computed(()=>{ |
| | | return "参数设定"; |
| | | }); |
| | | const selectInfo = ref(); |
| | | function setParams(info) { |
| | | selectInfo.value = info; |
| | | addEditVisible.value = true; |
| | | } |
| | | onMounted(()=>{ |
| | | changeAcButton(acButton.value); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="操作" fixed="right" width="180" align="center"> |
| | | <template #default="scope"> |
| | | <el-button type="primary" size="small">参数设定</el-button> |
| | | <el-button type="primary" size="small" @click="setParams(scope.row)">参数设定</el-button> |
| | | <el-button type="success" size="small">上传</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </div> |
| | | </yc-card> |
| | | </div> |
| | | <el-dialog |
| | | :title="dialogTitle" |
| | | v-model="addEditVisible" |
| | | :close-on-click-modal="false" |
| | | class="dialog-center" |
| | | align-center |
| | | width="auto" |
| | | draggable |
| | | destroy-on-close |
| | | center> |
| | | <add-edit |
| | | v-model:close="addEditVisible" |
| | | :info="selectInfo" @success="changeAcButton(acButton)"></add-edit> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |