From 085fa2fb257e9f11f8f6d34bf12e2dc281c36b4d Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 09 二月 2023 11:28:21 +0800
Subject: [PATCH] 2023/2/9 肖辉 修改部门管理

---
 src/views/operate/sms/smsIndex/createSms/index.vue |  149 +++++++++++++++++++------------------------------
 1 files changed, 58 insertions(+), 91 deletions(-)

diff --git a/src/views/operate/sms/smsIndex/createSms/index.vue b/src/views/operate/sms/smsIndex/createSms/index.vue
index 1c5fcce..5ca289d 100644
--- a/src/views/operate/sms/smsIndex/createSms/index.vue
+++ b/src/views/operate/sms/smsIndex/createSms/index.vue
@@ -8,8 +8,8 @@
                     <el-form-item class="optionItem" label="鐭俊妯℃澘:" prop="messageType">
                         <div class="message-item">
                             <div class="message-item__left">
-                                <el-select v-model="role.messageType" placeholder="璇烽�夋嫨鐭俊妯℃澘">
-                                    <el-option v-for="item in colList" :key="item.id" :label="item.columnName"
+                                <el-select v-model="role.messageType" placeholder="璇烽�夋嫨鐭俊妯℃澘" @change="setTemplateValue">
+                                    <el-option v-for="item in colList" :key="item.id" :label="item.title"
                                         :value="item.id">
                                     </el-option>
                                 </el-select>
@@ -36,12 +36,12 @@
                     </el-form-item>
                     <!-- 娑堟伅鍐呭 -->
                     <el-form-item class="optionItem" label="娑堟伅鍐呭:" prop="body">
-                        <MyEditor ref="edit" @getMyBody="getMyBody"></MyEditor>
+                        <MyEditor ref="edit"></MyEditor>
                     </el-form-item>
 
                     <el-form-item>
                         <div class="optionBtn">
-                            <el-button messageType="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">鍙戝竷</el-button>
+                            <el-button type="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">鍙戝竷</el-button>
                             <el-button class="btn cancel" @click.native.prevent="handleReset">閲嶇疆</el-button>
                         </div>
                     </el-form-item>
@@ -53,6 +53,7 @@
 <script>
 import MyEditor from '@/components/edit'
 import { sendMessage } from "@/api/operate/messageManagement";
+import SMS from "@/api/operate/SMS";
 
 export default {
     components: { MyEditor },
@@ -64,7 +65,6 @@
             callback();
           }
       }
-
         return {
             role: {
                 messageType: '',
@@ -72,7 +72,7 @@
                 targetTo: '',
                 targetFrom: null,
                 body: '',
-                channelCode: '03'
+                channelCode: '02'
             },
             rules: {
                 messageType: [
@@ -82,7 +82,7 @@
                     { required: true, trigger: "blur", message: '璇疯緭鍏ョ煭淇℃爣棰�' },
                 ],
                 targetTo: [
-                    { required: true  , trigger: "blur", message: '璇烽�夋嫨鎺ユ敹浜�' },
+                    { required: true  , trigger: "blur", message: '璇烽�夋嫨鎺ユ敹瀵硅薄' },
                 ],
                 body: [
                   { required: true, trigger: ['blur', 'change'], validator: validateMessageContent }
@@ -104,7 +104,7 @@
         }
     },
     created() {
-        this.setColumnList();
+        this.getSMSTemplateList();
         this.setDepartList();
         this.getLoginUserInfo();
     },
@@ -116,29 +116,18 @@
                     done();
                 })
         },
-        // 璁剧疆鏍忕洰
-        async setColumnList() {
-            this.colList = await this.getColumnList();
+
+        getSMSTemplateList() {
+          SMS.getSMSTemplateList({ current: 1, pageSize: 100 })
+              .then(({ records }) => {
+                this.colList = records;
+              })
+              .catch(err => this.$message.error(err))
         },
-        // 鑾峰彇鏍忕洰
-        async getColumnList() {
-            let arr;
-            await this.$axios({
-                method: 'get',
-                url: 'sccg/message_column/getAllColumn'
-            })
-                .then(res => {
-                    arr = res.data;
-                })
-            return arr;
-        },
+
         // 鍏抽棴寮圭獥
-        closeDialog({ flag, index }) {
+        closeDialog({ flag }) {
             this.dialogCreate = flag;
-            if (index === 1) {
-                // 閲嶆柊璁剧疆鏍忕洰
-                this.setColumnList();
-            }
         },
         // 鑾峰彇閮ㄩ棬鏍�
         async getDepartList() {
@@ -183,6 +172,7 @@
         },
         // 閫変腑id
         handleCheck(data, node) {
+            this.checkedList = []
             node.checkedNodes.forEach(item => {
                 if(!item.hasOwnProperty('departType')){
                     this.checkedList.push(item.id)
@@ -193,26 +183,30 @@
         },
         // 鏂板缓/淇濆瓨娑堟伅(1:鏂板缓,0淇濆瓨娑堟伅)
         handleSubmit(mystatus) {
-            this.$refs.user.validate((valid) => {
+          this.role.body = this.$refs.edit.editor.txt.html();
+          this.$refs.user.validate((valid) => {
                 if (valid) {
                   const params = Object.assign({}, this.role);
                   params.targetTo = this.checkedList.join(',');
-                  params.targetFrom = this.sendUser;
                   params.status = mystatus;
                   sendMessage(params)
                       .then(() => {
                         this.$message({ type: 'success', message: '鎿嶄綔鎴愬姛' });
-                        this.$emit('closeDialog');
+                        this.$emit('closeMyDialog');
                       })
                       .catch(err => this.$message({ type: 'error', message: err }));
                 } else {
-                    return false;
+                  this.$message.warning('璇锋鏌ュ繀濉」');
                 }
             })
         },
-        // 鑾峰緱娑堟伅浣�
-        getMyBody(obj) {
-            this.role.body = obj;
+        setTemplateValue(obj){
+            var _this=this
+            SMS.getSMSTemplateById(obj).then((result) =>{
+                _this.role.head=result.title
+                _this.role.body=result.body
+                _this.$refs.edit.editor.txt.html(result.body)
+            })
         },
         // 閲嶇疆琛ㄥ崟
         handleReset() {
@@ -228,66 +222,39 @@
                 url: 'sccg/admin/info?name=' + name,
             })
                 .then(res => {
-                    this.role.targetFrom = res.data.userId
-                    this.sendUser = res.data.username
+                    this.role.targetFrom = res.data.userId;
+                    this.sendUser = res.data.username;
                 })
-        },
-        // 娑堟伅棰勮
-        handleView() {
-            this.$refs.user.validate((valid) => {
-                if (valid) {
-                    this.dialogView = true;
-                    this.info = {
-                      messageType: this.getColText(role.messageType),
-                      body: this.role.body,
-                      head: this.role.head,
-                      targetTo: this.tempNameArr,
-                      targetFrom: this.sendUser
-                    };
-                } else {
-                    return false
-                }
-            })
-        },
-        // 鑾峰緱鏍忕洰娑堟伅
-        getColText(id){
-            const {colList} = this
-            let str = ''
-            colList.forEach(item=>{
-                item.id === id ? str = item.columnName : '' 
-            })
-            return str
         }
-    },
-    props: ['closeMyDialog']
+    }
 }
 </script>
 <style lang="scss" scoped>
 .createUser {
     border-radius: 1px;
-    background-color: #09152f;
+    background-color: white;
 
     main {
         text-align: left;
-        background-color: #09152f;
+        background-color: white;
         padding-bottom: 50px;
 
         .mainContent {
             display: flex;
             justify-content: center;
             padding-top: 50px;
-            &:deep(.el-dialog__title) {
-                color: #4b9bb7;
-            }
-            &::v-deep .el-form-item__label {
-                color: #4b9bb7;
-            }
-
-            &::v-deep .el-input__inner {
-                width: 400px;
-                background-color: #09152f;
-                border: 1px solid #17324c;
-            }
+            //&:deep(.el-dialog__title) {
+            //    color: #4b9bb7;
+            //}
+            //&::v-deep .el-form-item__label {
+            //    color: #4b9bb7;
+            //}
+            //
+            //&::v-deep .el-input__inner {
+            //    width: 400px;
+            //    background-color: #09152f;
+            //    border: 1px solid #17324c;
+            //}
 
             .message-item__left {
                 width: 400px;
@@ -303,9 +270,9 @@
                 width: 400px;
             }
 
-            :deep(.el-input) {
-                width: 400px;
-            }
+            //:deep(.el-input) {
+            //    width: 400px;
+            //}
 
             .message-item {
                 display: flex;
@@ -320,14 +287,14 @@
                 margin-left: 20px;
             }
 
-            :deep(.el-input--suffix) {
-                width: 400px;
-            }
-
-            &::v-deep .el-textarea__inner {
-                background-color: #09152f;
-                border: 1px solid #17324c;
-            }
+            //:deep(.el-input--suffix) {
+            //    width: 400px;
+            //}
+            //
+            //&::v-deep .el-textarea__inner {
+            //    background-color: #09152f;
+            //    border: 1px solid #17324c;
+            //}
 
             .el-form-item__content {
                 width: 400px;
@@ -362,4 +329,4 @@
         }
     }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0