瀏覽代碼

新增通知配置新增修改删除列表

yukai 2 年之前
父節點
當前提交
59b871e42d

+ 18 - 0
src/api/notice/index.ts

@@ -0,0 +1,18 @@
+import { get, post, del, put } from "/@/utils/request";
+
+export default {
+  config: {
+    getList: (params: object) => get("/notice/config/list", params),
+    add: (data: object) => post("/notice/config/add", data),
+    delete: (ids: number) => del("/notice/config/delete", { ids }),
+    edit: (data: object) => put("/notice/config/edit", data),
+    detail: (id: number) => get("/notice/config/get", { id }),
+  },
+  template: {
+    getList: (params: object) => get("/notice/template/list", params),
+    add: (data: object) => post("/notice/template/add", data),
+    delete: (ids: number) => del("/notice/template/del", { ids }),
+    edit: (data: object) => put("/notice/template/edit", data),
+    detail: (id: number) => get("/notice/template/get", { id }),
+  },
+};

+ 0 - 1
src/views/iot/alarm/setting/component/edit.vue

@@ -272,7 +272,6 @@ export default defineComponent({
 			formWrap.validate((valid: boolean) => {
 				if (valid) {
 					state.ruleForm.triggerCondition = state.requestParams;
-					1
 					if (state.ruleForm.id !== 0) {
 						//修改
 						alarm.common.edit(state.ruleForm).then(() => {

+ 193 - 0
src/views/iot/noticeservices/config/component/setEdit.vue

@@ -0,0 +1,193 @@
+<template>
+	<div class="system-edit-dic-container">
+		<el-dialog :title="(ruleForm.id !== 0 ? '修改' : '添加') + '配置'" v-model="isShowDialog" width="50%">
+			<el-form :model="ruleForm" ref="formRef" :rules="rules" size="default" label-width="110px">
+				<el-form-item label="名称" prop="title">
+					<el-input v-model="ruleForm.title" placeholder="请输入名称" />
+				</el-form-item>
+
+				<el-form-item label="配置类型" prop="types">
+					<el-radio-group v-model="ruleForm.types">
+						<el-radio label="1"  value="1">即时发送</el-radio>
+						<el-radio label="2" value="2">预约发送</el-radio>
+					</el-radio-group>
+				</el-form-item>
+
+			
+
+				
+
+			</el-form>
+			<template #footer>
+				<span class="dialog-footer">
+					<el-button @click="onCancel" size="default">取 消</el-button>
+					<el-button type="primary" @click="onSubmit" size="default">{{ ruleForm.id !== 0 ? '修 改' : '添 加' }}</el-button>
+				</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script lang="ts">
+import { reactive, toRefs, defineComponent, ref, unref } from 'vue';
+import api from '/@/api/notice';
+
+
+import { ElMessage } from 'element-plus';
+import { Delete, Plus, CircleClose, Top, Bottom, Minus, Right } from '@element-plus/icons-vue';
+
+interface RuleFormState {
+	id: number;
+	name: string;
+	type: string;
+	sendGateway:string;
+	
+	
+}
+interface DicState {
+	isShowDialog: boolean;
+	ruleForm: RuleFormState;
+	rules: {};
+
+}
+
+export default defineComponent({
+	name: 'Edit',
+	components: { Delete, Plus, CircleClose, Minus, Right, Top, Bottom },
+
+	setup(prop, { emit }) {
+		const myRef = ref<HTMLElement | null>(null);
+		const formRef = ref<HTMLElement | null>(null);
+		const state = reactive<DicState>({
+			id: 0,
+			isShowDialog: false,
+		
+			
+			ruleForm: {
+				id: 0,
+				title: '',
+				types: "1",
+				sendGateway:'',
+				
+			},
+			rules: {
+				title: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
+				type: [{ required: true, message: '配置类型不能为空', trigger: 'blur' }],
+				
+			},
+		});
+
+		// 打开弹窗
+		const openDialog = (row: RuleFormState | null,type) => {
+			resetForm();
+			if (row) {
+				state.ruleForm = row;
+			}
+			state.ruleForm.sendGateway=type
+			state.isShowDialog = true;
+		};
+
+		
+
+		const resetForm = () => {
+		
+			state.ruleForm = {
+				id: 0,
+				title: '',
+				types: "1",
+				sendGateway:'',
+			
+			};
+		};
+		// 关闭弹窗
+		const closeDialog = () => {
+			state.isShowDialog = false;
+		};
+		// 取消
+		const onCancel = () => {
+			closeDialog();
+		};
+
+		// 新增
+		const onSubmit = () => {
+			const formWrap = unref(formRef) as any;
+			if (!formWrap) return;
+			formWrap.validate((valid: boolean) => {
+				if (valid) {
+					
+					if (state.ruleForm.id !== 0) {
+						//修改
+						
+						api.config.edit(state.ruleForm).then(() => {
+							ElMessage.success('配置修改成功');
+							closeDialog(); // 关闭弹窗
+							emit('typeList');
+						});
+					} else {
+						//添加
+						api.config.add(state.ruleForm).then(() => {
+							ElMessage.success('配置添加成功');
+							closeDialog(); // 关闭弹窗
+							emit('dataList');
+						});
+					}
+				}
+			});
+		};
+
+	
+
+
+		return {
+		
+			openDialog,
+			closeDialog,
+			onCancel,
+			onSubmit,
+			formRef,
+			myRef,
+			...toRefs(state),
+		};
+	},
+});
+</script>
+<style>
+.inline {
+	display: inline-flex;
+}
+.el-input__wrapper {
+	width: 98%;
+}
+
+.box-content {
+	border: 1px solid #e8e8e8;
+	margin: 10px;
+	padding: 10px;
+}
+
+.content-f {
+	display: flex;
+	margin-bottom: 10px;
+}
+.content-f .el-input__wrapper {
+	margin-right: 5px;
+}
+.addbutton {
+	width: 100%;
+	margin-top: 10px;
+	background: #fff;
+	border: 1px solid #d1d1d1;
+	color: #8d8b8b;
+}
+.conicon {
+	width: 55px;
+	height: 25px;
+
+	font-size: 28px;
+	line-height: 28px;
+	cursor: pointer;
+}
+.jv-node {
+	margin-left: 25px;
+}
+</style>

+ 193 - 0
src/views/iot/noticeservices/config/component/temEdit.vue

@@ -0,0 +1,193 @@
+<template>
+	<div class="system-edit-dic-container">
+		<el-dialog :title="(ruleForm.id !== 0 ? '修改' : '添加') + '配置'" v-model="isShowDialog" width="50%">
+			<el-form :model="ruleForm" ref="formRef" :rules="rules" size="default" label-width="110px">
+				<el-form-item label="名称" prop="title">
+					<el-input v-model="ruleForm.title" placeholder="请输入名称" />
+				</el-form-item>
+
+				<el-form-item label="配置类型" prop="types">
+					<el-radio-group v-model="ruleForm.types">
+						<el-radio label="1"  value="1">即时发送</el-radio>
+						<el-radio label="2" value="2">预约发送</el-radio>
+					</el-radio-group>
+				</el-form-item>
+
+			
+
+				
+
+			</el-form>
+			<template #footer>
+				<span class="dialog-footer">
+					<el-button @click="onCancel" size="default">取 消</el-button>
+					<el-button type="primary" @click="onSubmit" size="default">{{ ruleForm.id !== 0 ? '修 改' : '添 加' }}</el-button>
+				</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script lang="ts">
+import { reactive, toRefs, defineComponent, ref, unref } from 'vue';
+import api from '/@/api/notice';
+
+
+import { ElMessage } from 'element-plus';
+import { Delete, Plus, CircleClose, Top, Bottom, Minus, Right } from '@element-plus/icons-vue';
+
+interface RuleFormState {
+	id: number;
+	name: string;
+	type: string;
+	sendGateway:string;
+	
+	
+}
+interface DicState {
+	isShowDialog: boolean;
+	ruleForm: RuleFormState;
+	rules: {};
+
+}
+
+export default defineComponent({
+	name: 'Edit',
+	components: { Delete, Plus, CircleClose, Minus, Right, Top, Bottom },
+
+	setup(prop, { emit }) {
+		const myRef = ref<HTMLElement | null>(null);
+		const formRef = ref<HTMLElement | null>(null);
+		const state = reactive<DicState>({
+			id: 0,
+			isShowDialog: false,
+		
+			
+			ruleForm: {
+				id: 0,
+				title: '',
+				types: "1",
+				sendGateway:'',
+				
+			},
+			rules: {
+				title: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
+				type: [{ required: true, message: '配置类型不能为空', trigger: 'blur' }],
+				
+			},
+		});
+
+		// 打开弹窗
+		const openDialog = (row: RuleFormState | null,type) => {
+			resetForm();
+			if (row) {
+				state.ruleForm = row;
+			}
+			state.ruleForm.sendGateway=type
+			state.isShowDialog = true;
+		};
+
+		
+
+		const resetForm = () => {
+		
+			state.ruleForm = {
+				id: 0,
+				title: '',
+				types: "1",
+				sendGateway:'',
+			
+			};
+		};
+		// 关闭弹窗
+		const closeDialog = () => {
+			state.isShowDialog = false;
+		};
+		// 取消
+		const onCancel = () => {
+			closeDialog();
+		};
+
+		// 新增
+		const onSubmit = () => {
+			const formWrap = unref(formRef) as any;
+			if (!formWrap) return;
+			formWrap.validate((valid: boolean) => {
+				if (valid) {
+					
+					if (state.ruleForm.id !== 0) {
+						//修改
+						
+						api.template.edit(state.ruleForm).then(() => {
+							ElMessage.success('配置修改成功');
+							closeDialog(); // 关闭弹窗
+							emit('typeList');
+						});
+					} else {
+						//添加
+						api.template.add(state.ruleForm).then(() => {
+							ElMessage.success('配置添加成功');
+							closeDialog(); // 关闭弹窗
+							emit('dataList');
+						});
+					}
+				}
+			});
+		};
+
+	
+
+
+		return {
+		
+			openDialog,
+			closeDialog,
+			onCancel,
+			onSubmit,
+			formRef,
+			myRef,
+			...toRefs(state),
+		};
+	},
+});
+</script>
+<style>
+.inline {
+	display: inline-flex;
+}
+.el-input__wrapper {
+	width: 98%;
+}
+
+.box-content {
+	border: 1px solid #e8e8e8;
+	margin: 10px;
+	padding: 10px;
+}
+
+.content-f {
+	display: flex;
+	margin-bottom: 10px;
+}
+.content-f .el-input__wrapper {
+	margin-right: 5px;
+}
+.addbutton {
+	width: 100%;
+	margin-top: 10px;
+	background: #fff;
+	border: 1px solid #d1d1d1;
+	color: #8d8b8b;
+}
+.conicon {
+	width: 55px;
+	height: 25px;
+
+	font-size: 28px;
+	line-height: 28px;
+	cursor: pointer;
+}
+.jv-node {
+	margin-left: 25px;
+}
+</style>

文件差異過大導致無法顯示
+ 0 - 0
src/views/iot/noticeservices/config/setting.vue


文件差異過大導致無法顯示
+ 3 - 3
src/views/iot/noticeservices/config/template.vue


部分文件因文件數量過多而無法顯示