Ver a proveniência

告警处理

master
wwp há 4 meses
ascendente
cometimento
c066ba2b6b
6 ficheiros alterados com 39 adições e 167 eliminações
  1. +3
    -3
      SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts
  2. +10
    -9
      SafeCampus.WEB/src/components/Selectors/ClassUserselector/index.vue
  3. +2
    -1
      SafeCampus.WEB/src/main.ts
  4. +14
    -0
      SafeCampus.WEB/src/utils/browser_patch.ts
  5. +0
    -144
      SafeCampus.WEB/src/views/userManage/dormitory/components/formUser/index.vue
  6. +10
    -10
      SafeCampus.WEB/src/views/userManage/dormitory/index.vue

+ 3
- 3
SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts Ver ficheiro

@@ -68,7 +68,7 @@ const userManageDormitoryApi = {
return httpChamber.get("getReturnInfo", params);
},
/** 获取详情(带寝室人员) */
detail(params: ReqId) {
detail(params: any) {
return httpChamber.get("getInfo", params);
},
/** 设置归寝时间 */
@@ -76,8 +76,8 @@ const userManageDormitoryApi = {
return httpChamber.post("setReturnTime", params);
},
/** 获取归寝时间 */
getReturnTime(params: ReqId) {
return httpChamber.get("getReturnTime", params);
getReturnTime() {
return httpChamber.get("getReturnTime");
}
};



+ 10
- 9
SafeCampus.WEB/src/components/Selectors/ClassUserselector/index.vue Ver ficheiro

@@ -149,6 +149,15 @@ const chooseTable = ref<ProTableInstance>();
const columns: ColumnProps<SysUser.SysUserInfo>[] = [
{ type: "selection", fixed: "left", width: 50 },
{ prop: "operation", label: "操作", width: 80, fixed: "left" },
{
prop: "faceUrl",
label: "人脸",
render: scope => {
return (
<img src={scope.row.faces.length > 0 ? scope.row.faces[0].faceUrl : ''} onClick={() => viewHeadImage(scope)} style='width:30px;height:30px;' alt=''/>
);
}
},
{
prop: "personName",
label: "姓名",
@@ -159,15 +168,7 @@ const columns: ColumnProps<SysUser.SysUserInfo>[] = [
},
{ prop: "personSetName", label: "班级" },
{ prop: "dormitoryName", label: "寝室" },
{
prop: "faceUrl",
label: "人脸",
render: scope => {
return (
<img src={scope.row.faces.length > 0 ? scope.row.faces[0].faceUrl : ''} onClick={() => viewHeadImage(scope)} style='width:30px;height:30px;' alt=''/>
);
}
},
];

/** 显示选择器 */


+ 2
- 1
SafeCampus.WEB/src/main.ts Ver ficheiro

@@ -40,7 +40,8 @@ import hljsCommon from "highlight.js/lib/common";
import hljsVuePlugin from "@highlightjs/vue-plugin";

//解决谷歌浏览器 Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider markin...
import "default-passive-events";
// import "default-passive-events";
import "@/utils/browser_patch";

// import "vue3-video-play/dist/style.css"; // 引入css
const app = createApp(App);


+ 14
- 0
SafeCampus.WEB/src/utils/browser_patch.ts Ver ficheiro

@@ -0,0 +1,14 @@
//去除谷歌浏览器的scroll、wheel等事件警告
(function () {
if (typeof EventTarget !== "undefined") {
let func = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function (type, fn, capture) {
this.func = func;
if (typeof capture !== "boolean") {
capture = capture || {};
capture.passive = false;
}
this.func(type, fn, capture);
};
}
})();

+ 0
- 144
SafeCampus.WEB/src/views/userManage/dormitory/components/formUser/index.vue Ver ficheiro

@@ -1,144 +0,0 @@
<!--
* @Description: 表单
* @Author: huguodong
* @Date: 2023-12-15 15:45:28
!-->
<template>
<div>
<form-container v-model="visible" title="人员选择" form-size="600px">
<el-form
ref="userFormRef"
:rules="rules"
:disabled="liveUserProps.disabled"
:model="liveUserProps.record"
:hide-required-asterisk="liveUserProps.disabled"
label-width="auto"
label-suffix=" :"
>
<s-form-item label="分配人员" prop="userId">
<el-button link type="primary" @click="showSelector">选择</el-button>
<el-tag v-if="liveUserProps.record.userId" class="ml-3px" type="warning" closable @close="removeDirector">{{
liveUserProps.record.userInfo?.name
}}</el-tag>
</s-form-item>
</el-form>
<template #footer>
<el-button @click="onClose"> 取消 </el-button>
<el-button v-show="!liveUserProps.disabled" type="primary" @click="handleSubmit"> 确定 </el-button>
</template>
</form-container>
<user-selector
multiple
ref="userSelectorRef"
:org-tree-api="sysOrgApi.tree"
:user-selector-api="sysUserApi.selector"
@successful="handleChooseUser"
/>
</div>
</template>

<script setup lang="ts">
import { SysOrg, SysUser, sysOrgApi, sysPositionApi, sysRoleApi, sysUserApi, monitorLIVEApi } from "@/api";
import { FormOptEnum, SysDictEnum } from "@/enums";
import { required } from "@/utils/formRules";
import { FormInstance } from "element-plus";
import { useDictStore } from "@/stores/modules";
import { UserSelectorInstance } from "@/components/Selectors/UserSelector/interface";

const visible = ref(false); //是否显示表单
const dictStore = useDictStore(); //字典仓库

// 表单参数
const liveUserProps = reactive<FormProps.Base<any>>({
opt: FormOptEnum.ADD,
record: {},
disabled: false
});

// 表单验证规则
const rules = reactive({
userId: [required("请选择人员")]
});

/**
* 打开表单
* @param props 表单参数
*/
function onOpen(props: FormProps.Base<any>) {
Object.assign(liveUserProps, props); //合并参数
if (props.opt == FormOptEnum.ADD) {
//如果是新增,设置默认值
}
visible.value = true; //显示表单
if (props.record.pushUserId) {
//如果传了id,就去请求api获取record
liveUserProps.record.userId = props.record.pushUserId;
liveUserProps.record.userInfo = props.record.sysUserItem;
// sysOrgApi.detail({ id: props.record.id }).then(res => {
// liveUserProps.record.userId = res.data;
// });
}
}

// 提交数据(新增/编辑)
const userFormRef = ref<FormInstance>();
/** 提交表单 */
async function handleSubmit() {
userFormRef.value?.validate(async valid => {
if (!valid) return; //表单验证失败
let params: any = {
warnCode: "",
userId: ""
};
if (liveUserProps.opt == "预警推送人") {
params.warnCode = liveUserProps.record.warnCode;
params.userId = liveUserProps.record.userId;
//提交表单
await monitorLIVEApi
.setWarningPushPerson(params)
.then(() => {
liveUserProps.successful!(); //调用父组件的successful方法
})
.finally(() => {
onClose();
});
}
});
}

/** 关闭表单*/
function onClose() {
visible.value = false;
liveUserProps.record.userId = null;
liveUserProps.record.userInfo = null;
}

const userSelectorRef = ref<UserSelectorInstance>(); //用户选择器引用
/** 显示用户选择器 */
function showSelector() {
//将liveUserProps.record.userInfo转为 SysUser.SysUserInfo[]类型
const userInfo = liveUserProps.record.userInfo ? [liveUserProps.record.userInfo] : [];
userSelectorRef.value?.showSelector(userInfo);
}

/** 选择用户 */
function handleChooseUser(data: SysUser.SysUserInfo[]) {
// 选择用户后,将用户id赋值给liveUserProps.record.userId
if (data.length > 0) {
liveUserProps.record.userId = data[0].id;
liveUserProps.record.userInfo = data[0];
}
}

/** 移除主管 */
function removeDirector() {
liveUserProps.record.userId = null;
liveUserProps.record.userInfo = null;
}
// 暴露给父组件的方法
defineExpose({
onOpen
});
</script>

<style lang="scss" scoped></style>

+ 10
- 10
SafeCampus.WEB/src/views/userManage/dormitory/index.vue Ver ficheiro

@@ -123,7 +123,7 @@
</div>
</template>
<script setup lang="tsx" name="SysDormitory">
import { userManageDormitoryApi,dormitoryButtonCode,SysDormitory,sysOrgApi,sysPositionApi,sysUserApi,sysRoleApi,userManagePersonnelApi,userManageClassManageApi } from "@/api";
import { userManageDormitoryApi,dormitoryButtonCode,SysDormitory,userManagePersonnelApi,userManageClassManageApi,SysUser } from "@/api";
import { useHandleData } from "@/hooks/useHandleData";
import { FormOptEnum } from "@/enums";
import Form from "./components/form/index.vue";
@@ -177,8 +177,9 @@ const settingTime = () => {
};
const getTimeDetail = () => {
userManageDormitoryApi.getReturnTime().then((res:any) => {
timeForm.dateArr = [res.data.funcStart,res.data.funcEnd];
timeForm.timeArr = [res.data.timeBegin,res.data.timeEnd];
let {data} = res
timeForm.dateArr = [data.funcStart,data.funcEnd] as never[];
timeForm.timeArr = [data.timeBegin,data.timeEnd] as never[];
});
}
const closeTime = () => {
@@ -216,11 +217,11 @@ const onTimeSubmit = () => {
// 确定人员
function handleChooseUser(data: SysUser.SysUserInfo[]) {
//组装参数
const grantUser: SysRole.GrantUserReq = {
const grantUser: SysDormitory.ChamberPersonnel = {
// id: roleId.value,
// grantInfoList: data.map(item => item.id) as number[] | string[],
dormitoryId: chamberId.value,
personIds: data.map(item => item.personId) as number[] | string[],
personIds: data.map((item:any) => item.personId) as number[] | string[],
};
userManageDormitoryApi.setAssignPerson(grantUser).then(res => {
ElMessage({
@@ -331,17 +332,16 @@ function handleCommand(command: Command) {
switch (command.command) {
case cmdEnum.AddPerson:
// addPerson(FormOptEnum.add, command.row)
userManageDormitoryApi.detail({ id: command.row.id }).then(res => {
console.log(res)
userManageDormitoryApi.detail({ id: command.row.id }).then((res:any) => {
userSelectorRef.value?.showSelector(res.data.personInfos); //显示用户选择器
});
chamberId.value = command.row.id; //获取寝室id
break;
}
}
function addPerson(opt: FormOptEnum, record: {} | SysDormitory.DormitoryInfo = {}) {
formRefU.value?.onOpen({ opt: opt, record: record, successful: RefreshTable });
}
// function addPerson(opt: FormOptEnum, record: {} | SysDormitory.DormitoryInfo = {}) {
// formRefU.value?.onOpen({ opt: opt, record: record, successful: RefreshTable });
// }
/** 宿舍楼切换 */
const buildId = ref<number | string>()
const buildGender = ref<boolean>()


Carregando…
Cancelar
Guardar