Browse Source

推送配置模块接口

master
wwp 3 months ago
parent
commit
ddf054e34e
5 changed files with 43 additions and 20 deletions
  1. +8
    -0
      SafeCampus.WEB/src/api/modules/sysconfig/ability.ts
  2. +1
    -1
      SafeCampus.WEB/src/components/TreeFilter/index.vue
  3. +1
    -1
      SafeCampus.WEB/src/layouts/components/Header/ToolBarRight.vue
  4. +32
    -18
      SafeCampus.WEB/src/views/sysconfig/push/index.vue
  5. +1
    -0
      SafeCampus.WEB/src/views/userManage/dormitory/index.vue

+ 8
- 0
SafeCampus.WEB/src/api/modules/sysconfig/ability.ts View File

@@ -18,6 +18,14 @@ const http = moduleRequest("/business/warn/");
const http1 = moduleRequest("/violation/analysis/"); const http1 = moduleRequest("/violation/analysis/");


const abilityApi = { const abilityApi = {
/* 推送配置保存 */
pushConfig(params: any) {
return http.post("setWarnPushSetting", params);
},
// 获取推送信息
getPushInfo(params: any) {
return http.get("getWarnPushSetting", params);
},
/** 获取告警分组 */ /** 获取告警分组 */
warnGroup(params: ReqId) { warnGroup(params: ReqId) {
return http.get("getWarnGroup", params); return http.get("getWarnGroup", params);


+ 1
- 1
SafeCampus.WEB/src/components/TreeFilter/index.vue View File

@@ -86,8 +86,8 @@ const setSelected = () => {
}; };


onBeforeMount(async () => { onBeforeMount(async () => {
await getRequestData();
setSelected(); setSelected();
await getRequestData();
}); });


// 使用 nextTick 防止打包后赋值不生效,开发环境是正常的 // 使用 nextTick 防止打包后赋值不生效,开发环境是正常的


+ 1
- 1
SafeCampus.WEB/src/layouts/components/Header/ToolBarRight.vue View File

@@ -33,7 +33,7 @@ import SearchMenu from "./components/SearchMenu.vue";
const userStore = useUserStore(); const userStore = useUserStore();
const username = computed(() => userStore.userInfo?.name); const username = computed(() => userStore.userInfo?.name);
function open() { function open() {
window.open("http://8.141.155.183:91/view/1808743138258845697");
window.open("/#/screen");
} }
function opens() { function opens() {
window.open("http://192.168.10.101:1234/"); window.open("http://192.168.10.101:1234/");


+ 32
- 18
SafeCampus.WEB/src/views/sysconfig/push/index.vue View File

@@ -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;
} }
} }
} }


+ 1
- 0
SafeCampus.WEB/src/views/userManage/dormitory/index.vue View File

@@ -141,6 +141,7 @@ const proTable = ref<ProTableInstance>();
const treeFilter = ref<InstanceType<typeof TreeFilter> | null>(null); const treeFilter = ref<InstanceType<typeof TreeFilter> | null>(null);
const userStore = useUserStore(); const userStore = useUserStore();
const { accessToken } = userStore; const { accessToken } = userStore;
const defaultValue = ref("");
// 表格配置项 // 表格配置项
const columns: ColumnProps<SysDormitory.ChamberInfo>[] = [ const columns: ColumnProps<SysDormitory.ChamberInfo>[] = [
{ type: "selection", fixed: "left", width: 50 }, { type: "selection", fixed: "left", width: 50 },


Loading…
Cancel
Save