Bläddra i källkod

推送配置模块接口

master
wwp 3 månader sedan
förälder
incheckning
ddf054e34e
5 ändrade filer med 43 tillägg och 20 borttagningar
  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 Visa fil

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

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


+ 1
- 1
SafeCampus.WEB/src/components/TreeFilter/index.vue Visa fil

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

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

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


+ 1
- 1
SafeCampus.WEB/src/layouts/components/Header/ToolBarRight.vue Visa fil

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


+ 32
- 18
SafeCampus.WEB/src/views/sysconfig/push/index.vue Visa fil

@@ -15,14 +15,14 @@
:size="formSize"
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>

<div class="ruleTitle">推送规则</div>
<div class="ruleContent">
<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>
<div class="tips">当日预警数据每达到设置的条数后,会进行消息推送。</div>
</div>
@@ -35,32 +35,33 @@
</template>
<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 { ElMessage, ElMessageBox } from 'element-plus'
import { abilityApi, getPushInfo,userManageClassManageApi, monitorLIVEApi,SysOrg } from "@/api";
interface RuleForm {

resource: string,
num: number
pushState: string | boolean,
daySum: number
}

const formSize = ref<ComponentSize>('default')
const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive<RuleForm>({
resource: '0',
num: 1
pushState: false,
daySum: 1
})
const pushOptions = [{
label: '开启',
value: '1',
value: true,
},{
label: '关闭',
value: '0',
value: false,
}]

const rules = reactive<FormRules<RuleForm>>({

resource: [
pushState: [
{
required: true,
message: '请选择推送设置',
@@ -74,11 +75,20 @@ const handleChange = (value: number) => {
function isPositiveInteger(value:any) {
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) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
if(!isPositiveInteger(ruleForm.num)) {
if(!isPositiveInteger(ruleForm.daySum)) {
ElMessage({
message: '推送规则条数必须是大于零的整数',
@@ -86,10 +96,15 @@ const submitForm = async (formEl: FormInstance | undefined) => {
})
return
}
ElMessage({

abilityApi.pushConfig(ruleForm).then(() => {
ElMessage({
message: '操作成功',
type: 'success',
})
})
});
console.log('submit!')
} else {
console.log('error submit!', fields)
@@ -106,20 +121,19 @@ const resetForm = (formEl: FormInstance | undefined) => {
<style lang="scss" scoped>
.content-main {
height: 100%;

.ruleTitle {
margin: 30px 0 20px;
font-size: 14px;
font-weight: 600;
margin: 30px 0 20px 0;
}
.ruleContent {
margin: 20px 0;
font-size: 14px;
color: #666666;
margin: 20px 0;
.tips {
margin-top: 10px;
font-size: 14px;
color: red;
margin-top: 10px;
}
}
}


+ 1
- 0
SafeCampus.WEB/src/views/userManage/dormitory/index.vue Visa fil

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


Laddar…
Avbryt
Spara