Pārlūkot izejas kodu

群发消息@所有人功能开发

luolinsong 5 dienas atpakaļ
vecāks
revīzija
3314533020

+ 21 - 1
src/views/qw/sopTemp/index.vue

@@ -283,6 +283,18 @@
             </el-radio>
           </el-radio-group>
         </el-form-item>
+
+        <el-form-item label="是否开启@所有人" v-if="form.sendType == 11 && (form.id === null || form.id === undefined)">
+          <el-radio-group v-model="form.openIsAtAll">
+            <el-radio
+              v-for="dict in openIsAtAllOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{ dict.dictLabel }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
+
         <el-form-item label="内容" prop="modeContent">
           <el-input v-model="form.modeContent" placeholder="请输入文字内容"  type="textarea" :rows="3"/>
         </el-form-item>
@@ -465,7 +477,7 @@ export default {
       // 状态字典
       statusOptions: [],
       openOfficialOptions: [],
-
+      openIsAtAllOptions: [],
       shareOptions: {
         title: '分享模板',
         open: false,
@@ -558,6 +570,10 @@ export default {
       this.openOfficialOptions = response.data;
     });
 
+    this.getDicts("sys_company_or").then(response => {
+      this.openIsAtAllOptions = response.data;
+    });
+
     getSelectableRange().then(e => {
       this.startTimeRange = e.data;
     })
@@ -696,6 +712,7 @@ export default {
         sendType: this.sendType,
         sort: 0,
         openOfficial: "1",
+        openIsAtAll: "1",
         time: "",
         num: 1,
         timeList: [{value: "",desc:""}],
@@ -816,6 +833,9 @@ export default {
           this.title = "修改";
         }
         this.form = response.data;
+        if (!this.form.IsAtAll) {
+        this.form.IsAtAll = "1"; // 默认值
+    }
         this.open = true;
       });
     },

+ 26 - 2
src/views/qw/sopTemp/updateSopTemp.vue

@@ -122,6 +122,22 @@
                                     请注意:官方群发 【第1天】 只能设置1点-1点30 的时间,【其他天数时间】 只能设置0点-0点30。此处仅为生成发送记录时间,实际发送可由 销售在公司规定的 【暂早上8点(前!!)】,在企业微信的【群发助手】处点击发送
                                   </div>
                                 </el-form-item>
+
+                                <el-form-item label="是否@所有人" v-if="form.sendType != 4">
+                                  <el-switch
+                                    v-model="content.isAtAll"
+                                    active-color="#13ce66"
+                                    inactive-color="#DCDFE6"
+                                    :active-value="1"
+                                    :inactive-value="0">
+                                  </el-switch>
+                                  <div
+                                    style="color: #999;font-size: 14px;display: flex;align-items: center;margin-bottom: 5px">
+                                    <i class="el-icon-info"></i>
+                                    开启后将在群发消息时@所有人(默认关闭)
+                                  </div>
+                                </el-form-item>
+
                                 <el-form-item label="消息类型" v-if="form.sendType != 4">
                                   <el-select :disabled="formType == 3" v-model="content.courseType"
                                              placeholder="请选择消息类型" size="mini"
@@ -1468,7 +1484,8 @@ export default {
           // 复制课程相关字段,如 courseId、videoId,根据实际数据结构补充
           courseId: sourceContent.courseId,
           videoId: sourceContent.videoId,
-          courseType: sourceContent.courseType
+          courseType: sourceContent.courseType,
+          isAtAll: '0',
         };
         this.setting[index].content.push(newContent);
         this.videoList.push([]);
@@ -1492,7 +1509,7 @@ export default {
       this.addTag.splice(contentIndex, 1)
     },
     addSetting() {
-      let content = [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: "",}]}];
+      let content = [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: "",}],isAtAll: '0'}];
       if (this.form.sendType == 4) {
         content = [{type: 2, contentType: '1', setting: [{contentType: '1', value: "",}]}];
         content[0].setting[0].intervalTime = 5;
@@ -1975,6 +1992,13 @@ export default {
           this.setting.forEach(item => {
             if (item && Array.isArray(item.content)) {
               item.content.forEach(content => {
+                if (content.isAtAll === undefined || content.isAtAll === null) {
+                  this.$set(content, 'isAtAll', '0') // 默认关闭
+                }
+                // 如果后端返回的是数字,转换为字符串
+                if (typeof content.isAtAll === 'number') {
+                  this.$set(content, 'isAtAll', content.isAtAll.toString())
+                }
                 if (content && Array.isArray(content.setting)) {
                   content.setting.forEach(setList => {
                     if (setList && !Object.hasOwn(setList, 'isSalesCallAdded')) {