Browse Source

报警接收人显示字段全部用真实姓名

like 5 months ago
parent
commit
f4985931c4

+ 1 - 1
snowy-admin-web/.env.development

@@ -1,5 +1,5 @@
 # 接口地址
-VITE_API_BASEURL = http://192.168.25.125:58889
+VITE_API_BASEURL = http://39o63230o1.qicp.vip
 
 # 本地端口
 VITE_PORT = 81

+ 30 - 13
snowy-admin-web/src/views/biz/alarmuser/index.vue

@@ -39,9 +39,9 @@
 				<!-- 其他操作区域 -->
 				<div class="table-head-btn">
 					<div class="btn-left" style="display: flex">
-						<a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('alarmUserAdd')">
+						<!-- <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('alarmUserAdd')">
 							<template #icon><plus-outlined /></template>新增
-						</a-button>
+						</a-button> -->
 						<xn-batch-button
 							class="xn-mg08"
 							v-if="hasPerm('alarmUserBatchDelete')"
@@ -58,7 +58,11 @@
 
 				<template v-if="column.dataIndex === 'action'">
 					<a-space>
-						<a @click="formRef.onOpen(record)" v-if="hasPerm('alarmUserEdit')">编辑</a>
+						<!-- <a @click="formRef.onOpen(record)" v-if="hasPerm('alarmUserEdit')">编辑</a>
+						<a-divider type="vertical" v-if="hasPerm(['alarmUserEdit', 'alarmUserDelete'], 'and')" /> -->
+
+						<a @click="perfectformRef.onOpen(record)">完善信息</a>
+
 						<a-divider type="vertical" v-if="hasPerm(['alarmUserEdit', 'alarmUserDelete'], 'and')" />
 						<a-popconfirm title="确定要删除吗?" @confirm="deleteAlarmUser(record)">
 							<a-button type="link" danger size="small" v-if="hasPerm('alarmUserDelete')">删除</a-button>
@@ -69,17 +73,23 @@
 		</s-table>
 
 		<Form ref="formRef" @successful="tableRef.refresh()" />
+
+		<perfectForm ref="perfectformRef" @successful="tableRef.refresh()" />
 	</div>
 </template>
 
 <script setup name="alarmuser">
 	import { cloneDeep } from 'lodash-es'
 	import Form from './form.vue'
+	import perfectForm from './perfectForm.vue'
+
 	import alarmUserApi from '@/api/coldchain/alarmUserApi'
 	const searchFormState = ref({})
 	const searchFormRef = ref()
 	const tableRef = ref()
 	const formRef = ref()
+	const perfectformRef = ref()
+
 	const columns = [
 		{
 			title: '序号',
@@ -88,15 +98,8 @@
 			width: 50
 		},
 		{
-			title: '系统用户id',
-			dataIndex: 'userId',
-			align: 'center',
-			ellipsis: true,
-			resizable: true
-		},
-		{
-			title: 'AccessToken',
-			dataIndex: 'accessToken',
+			title: '真实姓名',
+			dataIndex: 'name',
 			align: 'center',
 			ellipsis: true,
 			resizable: true
@@ -119,6 +122,13 @@
 				return value == '1' ? '男' : '女'
 			}
 		},
+		{
+			title: '组织',
+			dataIndex: 'createOrgName',
+			align: 'center',
+			ellipsis: true,
+			resizable: true
+		},
 
 		{
 			title: '用户头像',
@@ -126,6 +136,13 @@
 			align: 'center',
 			ellipsis: true,
 			resizable: true
+		},
+		{
+			title: '创建时间',
+			dataIndex: 'createTime',
+			align: 'center',
+			ellipsis: true,
+			resizable: true
 		}
 	]
 	// 操作栏通过权限判断是否显示
@@ -134,7 +151,7 @@
 			title: '操作',
 			dataIndex: 'action',
 			align: 'center',
-			width: 150
+			width: 250
 		})
 	}
 	const selectedRowKeys = ref([])

+ 111 - 0
snowy-admin-web/src/views/biz/alarmuser/perfectForm.vue

@@ -0,0 +1,111 @@
+<template>
+	<xn-form-container title="完善用户信息" :width="500" v-model:open="open" :destroy-on-close="true" @close="onClose">
+		<a-form
+			ref="formRef"
+			:model="formData"
+			:rules="formRules"
+			layout="inline"
+			:label-col="{ style: { width: '80px', justifyContent: 'end' } }"
+		>
+			<a-form-item label="真实姓名" name="name">
+				<a-input v-model:value="formData.name" placeholder="请输入真实姓名" allow-clear />
+			</a-form-item>
+			<a-form-item label="用户昵称" name="nickName">
+				<a-input v-model:value="formData.nickName" disabled allow-clear />
+			</a-form-item>
+
+			<a-form-item label="选择组织" name="name">
+				<a-select
+					ref="select"
+					v-model:value="formData.createOrg"
+					:options="options"
+					allowClear
+					style="width: 100%"
+					placeholder="请选择您要绑定的组织"
+					:field-names="{ label: 'name', value: 'id' }"
+				/>
+			</a-form-item>
+		</a-form>
+		<template #footer>
+			<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
+			<a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
+		</template>
+	</xn-form-container>
+</template>
+
+<script setup>
+	import { cloneDeep } from 'lodash-es'
+
+	import { required } from '@/utils/formRules'
+	import orgApi from '@/api/sys/orgApi.js'
+	import alarmUserApi from '@/api/coldchain/alarmUserApi'
+	const options = ref([]) //机构数据
+	// 抽屉状态
+	const open = ref(false)
+	const emit = defineEmits({ successful: null })
+	const formRef = ref()
+	// 表单数据
+	const formData = ref({})
+	const submitLoading = ref(false)
+
+	// 打开抽屉
+	const onOpen = (record) => {
+		getOrg()
+		open.value = true
+		if (record) {
+			let recordData = cloneDeep(record)
+			formData.value = Object.assign({}, recordData)
+		}
+	}
+
+	// 获取机构信息
+	const getOrg = () => {
+		orgApi.orgList().then((res) => {
+			options.value = res || []
+		})
+	}
+
+	// 关闭抽屉
+	const onClose = () => {
+		formRef.value.resetFields()
+		formData.value = {}
+		open.value = false
+	}
+	// 默认要校验的
+	const formRules = {
+		name: [required('请输入真实姓名')]
+	}
+	// 验证并提交数据
+	const onSubmit = () => {
+		formRef.value
+			.validate()
+			.then(() => {
+				submitLoading.value = true
+				const formDataParam = cloneDeep(formData.value)
+				alarmUserApi
+					.alarmUserSubmitForm(formDataParam, formDataParam.id)
+					.then(() => {
+						onClose()
+						emit('successful')
+					})
+					.finally(() => {
+						submitLoading.value = false
+					})
+			})
+			.catch(() => {})
+	}
+	// 抛出函数
+	defineExpose({
+		onOpen
+	})
+</script>
+
+<style lang="less" scoped>
+	:deep(.ant-form-item) {
+		width: 100%;
+		margin-bottom: 10px;
+		.ant-form-item-control {
+			flex: 1;
+		}
+	}
+</style>

+ 9 - 3
snowy-admin-web/src/views/biz/monitor/mem/index.vue

@@ -17,17 +17,23 @@
 								ref="searchFormRef"
 								name="advanced_search"
 								layout="inline"
-								:label-col="{ style: { width: '70px', justifyContent: 'end' } }"
+								:label-col="{ style: { width: '100px', justifyContent: 'end' } }"
 								:model="searchFormState"
 								class="ant-advanced-search-form"
 							>
 								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
 									><a-form-item label="冷链设备名称" name="deviceName">
-										<a-input v-model:value="searchFormState.deviceName" placeholder="请输入冷链设备名称" /> </a-form-item
+										<a-input
+											v-model:value="searchFormState.deviceName"
+											placeholder="请输入冷链设备名称"
+										/> </a-form-item
 								></a-col>
 								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
 									<a-form-item label="冷链设备编号" name="deviceCode">
-										<a-input v-model:value="searchFormState.deviceCode" placeholder="请输入冷链设备编号" /> </a-form-item
+										<a-input
+											v-model:value="searchFormState.deviceCode"
+											placeholder="请输入冷链设备编号"
+										/> </a-form-item
 								></a-col>
 							</a-form>
 						</a-row>

+ 1 - 1
snowy-admin-web/src/views/biz/monitor/object/form.vue

@@ -29,7 +29,7 @@
 					style="width: 100%"
 					placeholder="请选择报警接收人"
 					:options="alarmUsersOptions"
-					:field-names="{ label: 'nickName', value: 'openId' }"
+					:field-names="{ label: 'name', value: 'openId' }"
 				></a-select>
 			</a-form-item>
 			<a-form-item label="冰箱位置区域">

+ 4 - 4
snowy-admin-web/src/views/biz/monitor/object/index.vue

@@ -62,7 +62,7 @@
 					</span>
 				</template>
 				<template v-if="column.dataIndex === 'alarmUsers'">
-					<span v-for="(e, i) in record.alarmUsers" :key="i">{{ e.nickName + ',' }} </span>
+					<span v-for="(e, i) in record.alarmUsers" :key="i">{{ e.name + ',' }} </span>
 				</template>
 				<template v-if="column.dataIndex === 'sensorType'">
 					{{ $TOOL.dictTypeData('SENSORTYPE', record.sensorType) }}
@@ -100,11 +100,11 @@
 								<a-descriptions-item label="传感器类型" :span="2">{{
 									$TOOL.dictTypeData('SENSORTYPE', item.sensorType)
 								}}</a-descriptions-item>
-								<a-descriptions-item label="监测设备" :span="2">{{ item.deviceName }}</a-descriptions-item>
-								<a-descriptions-item label="传感器编号" :span="2">{{ item.sensorCode }}</a-descriptions-item>
+								<a-descriptions-item label="冷链设备" :span="2">{{ item.deviceName }}</a-descriptions-item>
+								<a-descriptions-item label="冷链设备编号" :span="2">{{ item.sensorCode }}</a-descriptions-item>
 								<a-descriptions-item label="传感器路数" :span="2">{{ item.sensorRoute + '路' }}</a-descriptions-item>
 								<a-descriptions-item label="报警接收人">
-									<span v-for="(e, i) in item.alarmUsers" :key="i">{{ e.nickName + ',' }} </span>
+									<span v-for="(e, i) in item.alarmUsers" :key="i">{{ e.name + ',' }} </span>
 								</a-descriptions-item>
 								<a-descriptions-item
 									v-if="item.sensorType == 'W' || item.sensorType == 'WS' || item.sensorType == 'WSC'"

+ 2 - 2
snowy-admin-web/src/views/biz/monitor/point/form.vue

@@ -92,9 +92,9 @@
 								v-for="option in alarmUsersOptions"
 								:key="option.openId"
 								:value="option.openId"
-								:label="option.nickName"
+								:label="option.name"
 							>
-								{{ option.nickName }}
+								{{ option.name }}
 							</a-checkbox>
 						</a-checkbox-group>
 					</a-form-item>

+ 2 - 2
snowy-admin-web/src/views/biz/monitor/point/index.vue

@@ -105,14 +105,14 @@
 			resizable: true
 		},
 		{
-			title: '冷链设备',
+			title: '冷链设备名称',
 			dataIndex: 'deviceName',
 			align: 'center',
 			ellipsis: true,
 			resizable: true
 		},
 		{
-			title: '传感器编号',
+			title: '冷链设备编号',
 			dataIndex: 'sensorCode',
 			align: 'center',
 			ellipsis: true,