xw před 3 týdny
rodič
revize
260884b83a
1 změnil soubory, kde provedl 73 přidání a 21 odebrání
  1. 73 21
      src/views/qw/sop/sop.vue

+ 73 - 21
src/views/qw/sop/sop.vue

@@ -891,6 +891,22 @@
                         </el-form-item>
                       </el-card>
                     </div>
+                    <div v-if="isFeishuContentType(item.contentType)">
+                      <el-card class="box-card">
+                        <el-form-item label="消息标题" label-width="100px">
+                          <el-input v-model="item.linkTitle" placeholder="飞书链接卡片标题" style="width: 90%;"/>
+                        </el-form-item>
+                        <el-form-item label="描述" label-width="100px">
+                          <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入描述" style="width: 90%;margin-top: 1%;"/>
+                        </el-form-item>
+                        <el-form-item label="封面" label-width="100px">
+                          <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150" :height="150" style="margin-top: 1%;" />
+                        </el-form-item>
+                        <el-form-item label="链接说明" label-width="100px">
+                          <el-tag type="info">飞书看课链接由服务端根据上方所选课程、课节自动生成</el-tag>
+                        </el-form-item>
+                      </el-card>
+                    </div>
                     <div v-if="item.contentType == 4">
                       <el-card class="box-card">
                         <el-form-item label="标题" prop="miniprogramTitle">
@@ -1868,6 +1884,12 @@ export default {
       }
       return String(ct).trim() === '9';
     },
+    isFeishuContentType(ct) {
+      if (ct === undefined || ct === null || ct === '') {
+        return false;
+      }
+      return String(ct).trim() === '17';
+    },
     isLinkH5ContentType(ct) {
       if (ct === undefined || ct === null || ct === '') {
         return false;
@@ -1885,6 +1907,9 @@ export default {
             delete o.expiresDays;
           }
         }
+        if (this.isFeishuContentType(row.contentType)) {
+          o.contentType = '17';
+        }
         return o;
       });
     },
@@ -1899,7 +1924,7 @@ export default {
             this.$set(this.setting[i], 'voiceInputMode', 'dropdown');
           }
           //响应式直接给链接的标题/封面上值
-          if (selectedCourse && (this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && this.msgForm.courseId != null) {
+          if (selectedCourse && (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 || this.isFeishuContentType(this.setting[i].contentType)) && this.msgForm.courseId != null) {
             this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
             this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
           }
@@ -1918,7 +1943,7 @@ export default {
           //响应式直接给链接的描述上值
           if (selectedVideo && this.msgForm.videoId != null) {
             console.log(2, this.setting[i].contentType)
-            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9) {
+            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 || this.isFeishuContentType(this.setting[i].contentType)) {
               this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
             }
             if (this.setting[i].contentType == 4) {
@@ -1939,7 +1964,7 @@ export default {
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的描述上值
           if (selectedVideo && this.msgForm.videoId != null) {
-            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9) {
+            if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 || this.isFeishuContentType(this.setting[i].contentType)) {
               this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
             }
 
@@ -2316,6 +2341,43 @@ export default {
       this.sendMsgOpen.id = row.id;
       this.sendMsgOpen.row = row;
       this.msgForm.chatIds = row.chatId.split(",");
+      this.msgForm.sendType = 1;
+      this.msgForm.filterMode = row.filterMode;
+      this.msgForm.corpId = row.corpId;
+      this.msgForm.sopId = row.id;
+      if (!this.setting || this.setting.length === 0) {
+        this.setting = [{
+          contentType: '1',
+          value: '',
+          voiceInputMode: 'dropdown'
+        }];
+      }
+    },
+    resetSendMsgSop() {
+      this.setting = [{
+        contentType: '1',
+        value: '',
+        voiceInputMode: 'dropdown'
+      }];
+      this.msgForm = {
+        videoId: null,
+        courseId: null,
+        courseType: null,
+        userIdParam: null,
+        sendType: 1,
+        setting: null,
+        ids: null,
+        sopId: null,
+        startTime: null,
+        chatIds: [],
+        isRegister: 2,
+        filterMode: 2,
+        corpId: null
+      };
+      this.videoList = [];
+      if (this.$refs.msgForm) {
+        this.resetForm("msgForm");
+      }
     },
     submitMsgForm(){
       this.$refs["msgForm"].validate(valid => {
@@ -2367,14 +2429,14 @@ export default {
             if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
               return this.$message.error("图片不能为空")
             }
-            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType)) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
-              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 消息标题不能为空" : "链接标题不能为空")
+            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType) || this.isFeishuContentType(this.setting[i].contentType)) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
+              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 消息标题不能为空" : (this.isFeishuContentType(this.setting[i].contentType) ? "飞书消息标题不能为空" : "链接标题不能为空"))
             }
-            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType)) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
-              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 描述不能为空" : "链接描述不能为空")
+            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType) || this.isFeishuContentType(this.setting[i].contentType)) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
+              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 描述不能为空" : (this.isFeishuContentType(this.setting[i].contentType) ? "飞书描述不能为空" : "链接描述不能为空"))
             }
-            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType)) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
-              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 封面不能为空" : "链接图片不能为空")
+            if ((this.isLinkH5ContentType(this.setting[i].contentType) || this.isAppContentType(this.setting[i].contentType) || this.isFeishuContentType(this.setting[i].contentType)) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
+              return this.$message.error(this.isAppContentType(this.setting[i].contentType) ? "APP 封面不能为空" : (this.isFeishuContentType(this.setting[i].contentType) ? "飞书封面不能为空" : "链接图片不能为空"))
             }
             if (this.isLinkH5ContentType(this.setting[i].contentType) && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
               return this.$message.error("链接地址不能为空")
@@ -2416,17 +2478,7 @@ export default {
           sendMsgSop(this.msgForm).then(response => {
             this.msgSuccess("一键群发成功");
             loading.close();
-            this.setting=[];
-            this.msgForm = {
-              videoId:null,
-              courseId:null,
-              courseType:null,
-              setting:null,
-              isRegister:2,
-              sendType:1,
-              filterMode:2,
-
-            }
+            this.resetSendMsgSop();
             this.getList();
           }).finally(()=>{
             loading.close();
@@ -2440,7 +2492,7 @@ export default {
         const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
         for (let i = 0; i < this.setting.length; i++) {
           //响应式直接给链接的标题/封面上值
-          if (selectedCourse && (this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && this.msgForm.courseId != null) {
+          if (selectedCourse && (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 || this.isFeishuContentType(this.setting[i].contentType)) && this.msgForm.courseId != null) {
             this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
             this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
           }