From 86886bf8d6dcdfd92c1423a112538cca78aabe05 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期四, 09 五月 2024 18:31:36 +0800
Subject: [PATCH] 1

---
 src/views/notification/editbusiness.vue |  147 ++++++++++++++++++++++++++++++++++++
 src/views/notification/business.vue     |   69 ++++++++++++++---
 2 files changed, 203 insertions(+), 13 deletions(-)

diff --git a/src/views/notification/business.vue b/src/views/notification/business.vue
index 532e799..773e449 100644
--- a/src/views/notification/business.vue
+++ b/src/views/notification/business.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-19 18:18:19
+ * @LastEditTime: 2024-05-09 18:06:28
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -26,13 +26,13 @@
 					<el-icon><Setting /></el-icon>
 				</div>
 				<el-row class="template-content-box">
-					<el-col :span="8" v-for="item in contentData">
-						<el-checkbox v-model="checked1" label="閫夋嫨" size="large" />
+					<el-col :span="8" v-for="(item,index) in contentData">
+						<el-checkbox v-model="item.checked" label="閫夋嫨" size="large" />
 						<div class="box-top">
-							<div>{{item.notifyName}}</div>
-							<div>{{item.notifyTemplateName}}</div>
-							<div>
-								<span><el-icon><EditPen /></el-icon>缂栬緫</span>
+							<div class="box-top-name">{{item.notifyName}}</div>
+							<div class="box-top-title">{{item.notifyTemplateName}}</div>
+							<div class="box-top-btn">
+								<span @click="table_edit(item, index)"><el-icon><EditPen /></el-icon>缂栬緫</span>
 								<span><el-icon><Delete /></el-icon>鍒犻櫎</span>
 							</div>
 						</div>
@@ -53,7 +53,7 @@
 			</div>
 		</div>
 	</div>
-<!-- 	<save-dialog v-if="dialog.save" ref="saveDialog" :feedBackStatusList="feedBackStatusList" :workstationId="lastLevelId" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog> -->
+	<save-dialog v-if="dialog.save" ref="saveDialog" @success="addbusinessSuccess" @closed="dialog.save=false"></save-dialog>
 </template>
 <script>
 	import * as ElementPlusIconsVue from '@element-plus/icons-vue'
@@ -61,7 +61,7 @@
 	for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
 	    icons.push(key)
 	}
-	// import saveDialog from './add-feedback'
+	import saveDialog from './editbusiness'
 	export default {
 		name: "business",
 		data(){
@@ -92,14 +92,28 @@
 			this.getbusiness();
 		},
 		components: {
-			...ElementPlusIconsVue
-			//saveDialog
+			...ElementPlusIconsVue,saveDialog
 	    },
 		methods: {
+			table_edit(row){
+				this.dialog.save = true
+				this.$HTTP.get(`/api/blade-notify/notifier/template/dingTalk/dingTalkMessage/config/metadata`).then(res=> {
+					if(res.code == 200) {
+						this.dialog.save = true;
+						this.$nextTick(() => {
+							this.$refs.saveDialog.open('edit').setData(res.data);
+						})
+					}
+				})
+			},
 			getbusiness() {
 				this.$HTTP.get("/api/blade-notify/business-notify?businessKey=maintenance").then(res=> {
 					if(res.code == 200) {
+						res.data.businessNotifyDTOList.forEach(item=> {
+							item.checked = (item.status == '0'?false: true);
+						})
 						this.contentData = res.data.businessNotifyDTOList;
+						console.log(this.contentData)
 					}
 				})
 			},
@@ -117,7 +131,6 @@
 				this.$HTTP.get("/api/blade-notify/business-notify/tree").then(res=> {
 					if(res.code == 200) {
 						this.tableData = res.data;
-						console.log(this.tableData,123)
 					}
 				})
 			},
@@ -136,7 +149,7 @@
 
 			// 	})
 			// },
-			addfeedbackSuccess() {
+			addbusinessSuccess() {
 				//this.getlist();
 			}
 		}
@@ -206,6 +219,7 @@
     background: #fff;
     margin-right: 20px;
     box-shadow: 0 1px 3px rgba(0,0,0,.16);
+	position: relative;
 }
 .content {
     padding: 10px;
@@ -214,4 +228,33 @@
     height: 200px;
     overflow: auto;
 }
+.box-top-name {
+	font-weight: 700;
+    font-size: 18px;
+    text-align: left;
+    color: #333;
+    display: block;
+    margin-top: -30px;
+    margin-left: 56px;
+}
+.box-top-title {
+    font-size: 14px;
+    text-align: left;
+    color: #333;
+    display: block;
+    margin-top: -30px;
+    margin-left: 56px;
+	padding: 0 20px 0 33px;
+    margin: 20px 0 10px 24px;
+}
+.box-top-btn {
+	position: absolute;
+	font-size: 14px;
+    right: 12px;
+    bottom: 12px;
+	cursor: pointer;
+}
+.box-top-btn span:nth-child(1) {
+	margin-right: 12px;
+}
 </style>
\ No newline at end of file
diff --git a/src/views/notification/editbusiness.vue b/src/views/notification/editbusiness.vue
new file mode 100644
index 0000000..b684540
--- /dev/null
+++ b/src/views/notification/editbusiness.vue
@@ -0,0 +1,147 @@
+<template>
+	<el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
+		<el-form :model="addDictForm" :rules="addDictRules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
+			<el-row>
+				<el-col :span="24">
+					<el-form-item label="瀛楀吀缂栧彿" prop="code">
+						<el-input v-model="addDictForm.code" placeholder="瀛楀吀缂栧彿" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="瀛楀吀鍚嶇О" prop="dictValue">
+						<el-input v-model="addDictForm.dictValue" placeholder="瀛楀吀鍚嶇О" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="瀛楀吀鎺掑簭" prop="sort">
+						<el-input v-model="addDictForm.sort" placeholder="瀛楀吀鎺掑簭" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="灏佸瓨">
+						<el-switch v-model="addDictForm.isSealed" />
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="瀛楀吀澶囨敞">
+						<el-input v-model="addDictForm.remark" placeholder="瀛楀吀澶囨敞" clearable></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+		</el-form>
+		<template #footer>
+			<el-button @click="visible=false" >鍙� 娑�</el-button>
+			<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="dictSubmit()">淇� 瀛�</el-button>
+		</template>
+	</el-dialog>
+</template>
+
+<script>
+	export default {
+		emits: ['success', 'closed'],
+		data() {
+			return {
+				value1: true,
+				mode: "add",
+				titleMap: {
+					add: '鏂板',
+					edit: '淇敼',
+					show: '鏌ョ湅'
+				},
+				visible: false,
+				isSaveing: false,
+				//琛ㄥ崟鏁版嵁
+				addDictForm: {
+					code: "",
+					dictValue: "",
+					sort: "",
+					isSealed: false,
+					remark: "",
+					dictKey: "-1",
+					$isSealed: "鍚�"
+				},
+				//楠岃瘉瑙勫垯
+				addDictRules: {
+					code:[{required: true, message: '璇疯緭鍏ュ瓧鍏哥紪鍙�'}],
+					dictValue:[{required: true, message: '璇疯緭鍏ュ瓧鍏稿悕绉�'}],
+					sort:[{required: true, message: '璇疯緭鍏ュ瓧鍏告帓搴�'}]
+				},
+				//鎵�闇�鏁版嵁閫夐」
+				groups: [],
+				groupsProps: {
+					value: "id",
+					multiple: true,
+					checkStrictly: true
+				},
+				depts: [],
+				deptsProps: {
+					value: "id",
+					checkStrictly: true
+				}
+			}
+		},
+		mounted() {
+			// this.getGroup()
+			// this.getDept()
+		},
+		methods: {
+			//鏄剧ず
+			open(mode='add'){
+				this.mode = mode;
+				this.visible = true;
+				return this
+			},
+			//鍔犺浇鏍戞暟鎹�
+			async getGroup(){
+				var res = await this.$API.system.role.list.get();
+				this.groups = res.data.rows;
+			},
+			async getDept(){
+				var res = await this.$API.system.dept.list.get();
+				this.depts = res.data;
+			},
+			//琛ㄥ崟鎻愪氦鏂规硶
+			dictSubmit(){
+				var obj = Object.assign({},this.addDictForm);
+				if(obj.isSealed === true) {
+					obj.$isSealed = "鏄�";
+					obj.isSealed = "1";
+				}else {
+					obj.$isSealed = "鍚�";
+					obj.isSealed = "0";
+				}
+				this.$refs.dialogForm.validate(async (valid) => {
+					if (valid) {
+						this.isSaveing = true;
+						this.$HTTP.post("/api/blade-system/dict/submit",obj).then(res=> {
+							this.isSaveing = false;
+							if(res.code == 200) {
+								this.$emit('success', this.addDictForm, this.mode);
+								this.visible = false;
+								this.$message.success("鎿嶄綔鎴愬姛");
+							}else {
+								this.$alert(res.message, "鎻愮ず", {type: 'error'});
+							}
+						})
+					}else{
+						return false;
+					}
+				})
+			},
+			//琛ㄥ崟娉ㄥ叆鏁版嵁
+			setData(data){
+				console.log(data)
+				//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
+				if(data.isSealed == "1") {
+					data.isSealed = true;
+				}else {
+					data.isSealed = false;
+				}
+				Object.assign(this.addDictForm, data);
+			}
+		}
+	}
+</script>
+
+<style>
+</style>

--
Gitblit v1.9.3