Parcourir la source

寝室管理

master
wwp il y a 4 mois
Parent
révision
deb679d23d
7 fichiers modifiés avec 151 ajouts et 27 suppressions
  1. +2
    -0
      SafeCampus.WEB/src/api/interface/sys/warn/zjrq.ts
  2. +1
    -1
      SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts
  3. +4
    -0
      SafeCampus.WEB/src/api/modules/warn/zjrq.ts
  4. +9
    -8
      SafeCampus.WEB/src/components/Selectors/ClassUserselector/index.vue
  5. +6
    -7
      SafeCampus.WEB/src/views/userManage/dormitory/index.vue
  6. +101
    -0
      SafeCampus.WEB/src/views/warn/zjrq/components/handleForm.vue
  7. +28
    -11
      SafeCampus.WEB/src/views/warn/zjrq/index.vue

+ 2
- 0
SafeCampus.WEB/src/api/interface/sys/warn/zjrq.ts Voir le fichier

@@ -41,5 +41,7 @@ export namespace ZJRQ {
rects: string;
/** 扩展字段 */
extend: string;
// 处理意见
remark: string;
}
}

+ 1
- 1
SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts Voir le fichier

@@ -53,7 +53,7 @@ const userManageDormitoryApi = {
},
/** 删除寝室 */
delete(params: ReqId) {
return httpChamber.delete("delete", params);
return httpChamber.post("delete", params);
},
/**寝室分配人员*/
setAssignPerson(params: SysDormitory.ChamberPersonnel) {


+ 4
- 0
SafeCampus.WEB/src/api/modules/warn/zjrq.ts Voir le fichier

@@ -42,6 +42,10 @@ const warnZJRQApi = {
warnType(params: ReqId) {
return http.get("getAlarmType", params);
},
/** 处理告警 */
handWarn(params: ReqId) {
return http.post("handWarn", params);
}
};

export { warnZJRQApi };

+ 9
- 8
SafeCampus.WEB/src/components/Selectors/ClassUserselector/index.vue Voir le fichier

@@ -149,7 +149,16 @@ const chooseTable = ref<ProTableInstance>();
const columns: ColumnProps<SysUser.SysUserInfo>[] = [
{ type: "selection", fixed: "left", width: 50 },
{ prop: "operation", label: "操作", width: 80, fixed: "left" },
{
prop: "personName",
label: "姓名",
render: row => {
return row.row.name;
},
search: { el: "input", span: 2 }
},
{ prop: "personSetName", label: "班级" },
{ prop: "dormitoryName", label: "寝室" },
{
prop: "faceUrl",
label: "人脸",
@@ -159,14 +168,6 @@ const columns: ColumnProps<SysUser.SysUserInfo>[] = [
);
}
},
{
prop: "personName",
label: "姓名",
render: row => {
return row.row.name;
},
search: { el: "input", span: 2 }
}
];

/** 显示选择器 */


+ 6
- 7
SafeCampus.WEB/src/views/userManage/dormitory/index.vue Voir le fichier

@@ -128,7 +128,6 @@ import { useHandleData } from "@/hooks/useHandleData";
import { FormOptEnum } from "@/enums";
import Form from "./components/form/index.vue";
import FormDormitory from "./components/formDormitory/index.vue";
import formUser from "./components/formUser/index.vue";
import { ArrowDown,More } from "@element-plus/icons-vue";
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
import TreeFilter from "@/components/TreeFilter/index.vue";
@@ -235,8 +234,7 @@ const onTimeSubmit = () => {
const formRef = ref<InstanceType<typeof Form> | null>(null);
// 宿舍楼表单引用
const formRefD = ref<InstanceType<typeof FormDormitory> | null>(null);
// 人员引用
const formRefU = ref<InstanceType<typeof formUser> | null>(null);


/**
* 打开表单
@@ -244,13 +242,14 @@ const formRefU = ref<InstanceType<typeof formUser> | null>(null);
* @param record 记录
*/
function onOpen(opt: FormOptEnum, record: {} | SysDormitory.ChamberInfo = {}) {
if(buildId.value) {
formRef.value?.onOpen({ opt: opt, record: record, successful: RefreshTable });
} else {
if(!buildId.value && opt == '新增') {
ElMessage({
message: '请选择宿舍楼',
type: 'warning'
});
} else {
formRef.value?.onOpen({ opt: opt, record: record, successful: RefreshTable });
}
}
@@ -287,7 +286,7 @@ function onOpen(opt: FormOptEnum, record: {} | SysDormitory.ChamberInfo = {}) {
return
}
// 二次确认 => 请求api => 刷新表格
await useHandleData(userManageDormitoryApi.delete, {id: ids.join(",") }, msg);
await useHandleData(userManageDormitoryApi.delete, {ids: ids }, msg);
RefreshTable(); //刷新表格
}



+ 101
- 0
SafeCampus.WEB/src/views/warn/zjrq/components/handleForm.vue Voir le fichier

@@ -0,0 +1,101 @@
<!--
* @Description: 表单
* @Author: syy
* @Date: 2023-12-15 15:45:59
-->
<template>
<div>
<form-container v-model="visibleChamber" title="处理" form-size="600px" @close="onClose">
<el-form
ref="SysDormitoryFormRef"
:rules="rules"
:disabled="warnHandleProps.disabled"
:model="warnHandleProps.record"
:hide-required-asterisk="warnHandleProps.disabled"
label-width="auto"
label-suffix=" :"
>
<div>
<el-row :gutter="16">
<el-col :span="22">
<s-form-item label="处理意见" prop="remark">
<el-input v-model="warnHandleProps.record.remark" :autosize="{ minRows: 4 }" type="textarea" placeholder="请输入处理意见" />
</s-form-item>
</el-col>
</el-row>
</div>
</el-form>
<template #footer>
<el-button @click="onClose"> 取消 </el-button>
<el-button v-show="!warnHandleProps.disabled" type="primary" @click="handleSubmit"> 确定 </el-button>
</template>
</form-container>
</div>
</template>

<script setup lang="ts" name="warnHandleForm">
import { ref } from "vue";
import { ZJRQ, warnZJRQApi } from "@/api";
import { FormOptEnum } from "@/enums";
import { required } from "@/utils/formRules";
import { FormInstance } from "element-plus";

const visibleChamber = ref(false); //是否显示表单
// 表单参数
const warnHandleProps = reactive<FormProps.Base<ZJRQ.WarnInfo>>({
opt: FormOptEnum.ADD,
record: {},
disabled: false
});
// 表单验证规则
const rules = reactive({
remark: [required("请输入处理意见")]
});

/**
* 打开表单
* @param props 表单参数
*/
function onOpen(props: FormProps.Base<ZJRQ.WarnInfo>) {
Object.assign(warnHandleProps, props); //合并参数
visibleChamber.value = true; //显示表单
warnHandleProps.record = props.record;
}

// 提交数据(新增/编辑)
const SysDormitoryFormRef = ref<FormInstance>();
/** 提交表单 */
async function handleSubmit() {
SysDormitoryFormRef.value?.validate(async valid => {
if (!valid) return; //表单验证失败
let params: any = {
id: warnHandleProps.record.id,
remark: warnHandleProps.record.remark
};
await warnZJRQApi
.handWarn(params)
.then((res: any) => {
ElMessage({
message: res.msg,
type: "success"
});
warnHandleProps.successful!(); //调用父组件的successful方法
})
.finally(() => {
onClose();
});
});
}

/** 关闭表单*/
function onClose() {
visibleChamber.value = false;
}

// 暴露给父组件的方法
defineExpose({
onOpen
});
</script>

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

+ 28
- 11
SafeCampus.WEB/src/views/warn/zjrq/index.vue Voir le fichier

@@ -34,7 +34,7 @@
<!-- 操作 -->
<template #operation="scope">
<s-button link :opt="FormOptEnum.VIEW" @click="onDetail(scope.row)"> 详情 </s-button>
<s-button link :opt="FormOptEnum.EDIT" @click="onOpen(FormOptEnum.EDIT, scope.row)">处理</s-button>
<s-button v-if="scope.row.warnHand == 0" link :opt="FormOptEnum.EDIT" @click="toHandle(FormOptEnum.EDIT, scope.row)">处理</s-button>
<s-button link :opt="FormOptEnum.DELETE" @click="onDelete([scope.row.id], `确定删除该预警吗?`)" />
</template>
</ProTable>
@@ -77,6 +77,16 @@
<!-- {{ detailData.videoUrl }} -->
</div>
</el-col>
<el-col :span="24">
<div class="linebox">
处理意见:
<span style="cursor: pointer" v-if="detailData.remark">
{{ detailData.remark }}
</span>
<span v-else>暂无数据</span>
<!-- {{ detailData.videoUrl }} -->
</div>
</el-col>
</el-row>
</div>
<template #footer>
@@ -111,6 +121,8 @@
<img class="detailpic" :src="faceUrl" alt="" />
</div>
</el-dialog>
<!-- 处理告警 -->
<handleForm ref="formRefH" />
</div>
</template>

@@ -120,6 +132,7 @@ import { warnZJRQApi } from "@/api";
import { ZJRQ } from "@/api/interface";
import { useHandleData } from "@/hooks/useHandleData";
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
import handleForm from "./components/handleForm.vue";
import { useDictStore } from "@/stores/modules";
import { FormOptEnum, SysDictEnum, MenuTypeDictEnum } from "@/enums";
const faceUrl = ref('');
@@ -136,14 +149,18 @@ const visible = ref(false); //是否显示表单
onMounted(() => {
getWarnTypeList();
});
const formRefH = ref<InstanceType<typeof handleForm> | null>(null);
function toHandle(opt: FormOptEnum, record: {} | ZJRQ.WarnInfo= {}) {
formRefH.value?.onOpen({ opt: opt, record: JSON.parse(JSON.stringify(record)), successful: RefreshTable });
}
let warnOptions = ref([]);
function getWarnTypeList() {
setTimeout(async ()=> {
await warnZJRQApi.warnType({}).then(res => {
await warnZJRQApi.warnType({}).then((res:any) => {
let { code, data } = res;
if (code == 200) {
warnOptions.value = data.map(item => {
warnOptions.value = data.map((item:any) => {
return {
label: item.name,
value: item.code
@@ -299,14 +316,14 @@ let detailData = ref({});
function onDetail(row: any) {
visible.value = true;
setTimeout(async ()=> {
await warnZJRQApi.detail({ id: row.id }).then(res => {
let { code, data } = res;
if (code == 200) {
detailData.value = data
}
});
await warnZJRQApi.detail({ id: row.id }).then((res:any) => {
let { code, data } = res;
if (code == 200) {
detailData.value = data
}
});
})
}


Chargement…
Annuler
Enregistrer