|
@@ -15,14 +15,14 @@ |
|
|
:size="formSize" |
|
|
:size="formSize" |
|
|
status-icon |
|
|
status-icon |
|
|
> |
|
|
> |
|
|
<s-form-item label="推送设置:" prop="resource"> |
|
|
|
|
|
<s-radio-group v-model="ruleForm.resource" :options="pushOptions" /> |
|
|
|
|
|
|
|
|
<s-form-item label="推送设置:" prop="pushState"> |
|
|
|
|
|
<s-radio-group v-model="ruleForm.pushState" :options="pushOptions" /> |
|
|
</s-form-item> |
|
|
</s-form-item> |
|
|
|
|
|
|
|
|
<div class="ruleTitle">推送规则</div> |
|
|
<div class="ruleTitle">推送规则</div> |
|
|
<div class="ruleContent"> |
|
|
<div class="ruleContent"> |
|
|
<span>当日预警每达到</span> |
|
|
<span>当日预警每达到</span> |
|
|
<el-input-number v-model="ruleForm.num" class="mx-4" :min="1" controls-position="right" @change="handleChange" /> |
|
|
|
|
|
|
|
|
<el-input-number v-model="ruleForm.daySum" class="mx-4" :min="1" controls-position="right" @change="handleChange" /> |
|
|
<span>条时进行推送</span> |
|
|
<span>条时进行推送</span> |
|
|
<div class="tips">当日预警数据每达到设置的条数后,会进行消息推送。</div> |
|
|
<div class="tips">当日预警数据每达到设置的条数后,会进行消息推送。</div> |
|
|
</div> |
|
|
</div> |
|
@@ -35,32 +35,33 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="tsx" name="sysconfigPush"> |
|
|
<script setup lang="tsx" name="sysconfigPush"> |
|
|
import { reactive, ref } from 'vue' |
|
|
|
|
|
|
|
|
import { reactive, ref,onMounted } from 'vue' |
|
|
import type { ComponentSize, FormInstance, FormRules } from 'element-plus' |
|
|
import type { ComponentSize, FormInstance, FormRules } from 'element-plus' |
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
|
|
import { abilityApi, getPushInfo,userManageClassManageApi, monitorLIVEApi,SysOrg } from "@/api"; |
|
|
interface RuleForm { |
|
|
interface RuleForm { |
|
|
|
|
|
|
|
|
resource: string, |
|
|
|
|
|
num: number |
|
|
|
|
|
|
|
|
pushState: string | boolean, |
|
|
|
|
|
daySum: number |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const formSize = ref<ComponentSize>('default') |
|
|
const formSize = ref<ComponentSize>('default') |
|
|
const ruleFormRef = ref<FormInstance>() |
|
|
const ruleFormRef = ref<FormInstance>() |
|
|
const ruleForm = reactive<RuleForm>({ |
|
|
const ruleForm = reactive<RuleForm>({ |
|
|
resource: '0', |
|
|
|
|
|
num: 1 |
|
|
|
|
|
|
|
|
pushState: false, |
|
|
|
|
|
daySum: 1 |
|
|
}) |
|
|
}) |
|
|
const pushOptions = [{ |
|
|
const pushOptions = [{ |
|
|
label: '开启', |
|
|
label: '开启', |
|
|
value: '1', |
|
|
|
|
|
|
|
|
value: true, |
|
|
},{ |
|
|
},{ |
|
|
label: '关闭', |
|
|
label: '关闭', |
|
|
value: '0', |
|
|
|
|
|
|
|
|
value: false, |
|
|
}] |
|
|
}] |
|
|
|
|
|
|
|
|
const rules = reactive<FormRules<RuleForm>>({ |
|
|
const rules = reactive<FormRules<RuleForm>>({ |
|
|
|
|
|
|
|
|
resource: [ |
|
|
|
|
|
|
|
|
pushState: [ |
|
|
{ |
|
|
{ |
|
|
required: true, |
|
|
required: true, |
|
|
message: '请选择推送设置', |
|
|
message: '请选择推送设置', |
|
@@ -74,11 +75,20 @@ const handleChange = (value: number) => { |
|
|
function isPositiveInteger(value:any) { |
|
|
function isPositiveInteger(value:any) { |
|
|
return /^[1-9]\d*$/.test(value); |
|
|
return /^[1-9]\d*$/.test(value); |
|
|
} |
|
|
} |
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
getPushData() |
|
|
|
|
|
}); |
|
|
|
|
|
async function getPushData() { |
|
|
|
|
|
let {data} = await abilityApi.getPushInfo({}) |
|
|
|
|
|
ruleForm.daySum = data.daySum; |
|
|
|
|
|
ruleForm.pushState = data.pushState; |
|
|
|
|
|
console.log(data); |
|
|
|
|
|
} |
|
|
const submitForm = async (formEl: FormInstance | undefined) => { |
|
|
const submitForm = async (formEl: FormInstance | undefined) => { |
|
|
if (!formEl) return |
|
|
if (!formEl) return |
|
|
await formEl.validate((valid, fields) => { |
|
|
await formEl.validate((valid, fields) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
if(!isPositiveInteger(ruleForm.num)) { |
|
|
|
|
|
|
|
|
if(!isPositiveInteger(ruleForm.daySum)) { |
|
|
|
|
|
|
|
|
ElMessage({ |
|
|
ElMessage({ |
|
|
message: '推送规则条数必须是大于零的整数', |
|
|
message: '推送规则条数必须是大于零的整数', |
|
@@ -86,10 +96,15 @@ const submitForm = async (formEl: FormInstance | undefined) => { |
|
|
}) |
|
|
}) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
ElMessage({ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abilityApi.pushConfig(ruleForm).then(() => { |
|
|
|
|
|
ElMessage({ |
|
|
message: '操作成功', |
|
|
message: '操作成功', |
|
|
type: 'success', |
|
|
type: 'success', |
|
|
}) |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
console.log('submit!') |
|
|
console.log('submit!') |
|
|
} else { |
|
|
} else { |
|
|
console.log('error submit!', fields) |
|
|
console.log('error submit!', fields) |
|
@@ -106,20 +121,19 @@ const resetForm = (formEl: FormInstance | undefined) => { |
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.content-main { |
|
|
.content-main { |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
|
|
|
|
|
|
.ruleTitle { |
|
|
.ruleTitle { |
|
|
|
|
|
margin: 30px 0 20px; |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
font-weight: 600; |
|
|
font-weight: 600; |
|
|
margin: 30px 0 20px 0; |
|
|
|
|
|
} |
|
|
} |
|
|
.ruleContent { |
|
|
.ruleContent { |
|
|
|
|
|
margin: 20px 0; |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
color: #666666; |
|
|
color: #666666; |
|
|
margin: 20px 0; |
|
|
|
|
|
.tips { |
|
|
.tips { |
|
|
|
|
|
margin-top: 10px; |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
color: red; |
|
|
color: red; |
|
|
margin-top: 10px; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|