|
|
@@ -292,6 +292,16 @@
|
|
|
</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="是否开启app看课" v-if="showAppCourseToggle && form.sendType == 11 && (form.id === null || form.id === undefined)">
|
|
|
+ <el-radio-group v-model="form.openAppCourse">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in openOfficialOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictValue"
|
|
|
+ >{{ dict.dictLabel }}
|
|
|
+ </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">
|
|
|
@@ -360,7 +370,6 @@
|
|
|
<el-button type="primary" @click="updateRedData" :disabled="redData.loading">保 存</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
<el-dialog title="批量编辑官方群发" :visible.sync="official.open" width="500px" append-to-body>
|
|
|
<el-form :model="officialForm" ref="officialForm" :inline="true">
|
|
|
<el-form-item label="官方群发" prop="isOfficial">
|
|
|
@@ -452,7 +461,8 @@ import {
|
|
|
shareSopTemp,
|
|
|
updateRedPackage,
|
|
|
updateTemp,
|
|
|
- batchOpenOrCloseOfficial
|
|
|
+ batchOpenOrCloseOfficial,
|
|
|
+ getConfigByKey
|
|
|
} from "@/api/qw/sopTemp";
|
|
|
import { getCompanyList, listCompany } from '@/api/company/company'
|
|
|
import {courseList, getRoles} from "@/api/qw/sop";
|
|
|
@@ -509,6 +519,8 @@ export default {
|
|
|
// 状态字典
|
|
|
statusOptions: [],
|
|
|
openOfficialOptions: [],
|
|
|
+ // 控制“是否开启app看课”是否显示
|
|
|
+ showAppCourseToggle: false,
|
|
|
openIsAtAllOptions: [],
|
|
|
shareOptions: {
|
|
|
title: '分享模板',
|
|
|
@@ -626,6 +638,21 @@ export default {
|
|
|
getCompanyList().then(response => {
|
|
|
this.companys = response.data;
|
|
|
});
|
|
|
+ //获取 app 看课配置
|
|
|
+ this.getOpenAppCourseStatus();
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ //监听 openOfficial 和 openAppCourse 的变化,实现选项互斥
|
|
|
+ 'form.openOfficial'(newVal) {
|
|
|
+ if (this.showAppCourseToggle && newVal === '1') {
|
|
|
+ this.$set(this.form, 'openAppCourse', '0');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'form.openAppCourse'(newVal) {
|
|
|
+ if (this.showAppCourseToggle && newVal === '1') {
|
|
|
+ this.$set(this.form, 'openOfficial', '0');
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
@@ -744,6 +771,7 @@ export default {
|
|
|
sendType: this.sendType,
|
|
|
sort: 0,
|
|
|
openOfficial: "1",
|
|
|
+ openAppCourse: "0", //默认 app 看课为关
|
|
|
openIsAtAll: "1",
|
|
|
time: "",
|
|
|
num: 1,
|
|
|
@@ -882,6 +910,12 @@ export default {
|
|
|
if (!this.form.IsAtAll) {
|
|
|
this.form.IsAtAll = "1"; // 默认值
|
|
|
}
|
|
|
+ if (this.showAppCourseToggle && this.form.sendType === 11) {
|
|
|
+ // 如果两个都是 "1",强制修正(理论上不会发生)
|
|
|
+ if (this.form.openOfficial === '1' && this.form.openAppCourse === '1') {
|
|
|
+ this.form.openAppCourse = '0';
|
|
|
+ }
|
|
|
+ }
|
|
|
this.open = true;
|
|
|
});
|
|
|
},
|
|
|
@@ -890,7 +924,23 @@ export default {
|
|
|
delete this.form.rules
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ // 【新增校验】当 view_course_app=1 时,openOfficial 和 openAppCourse 必须二选一
|
|
|
+ if (this.showAppCourseToggle && this.form.sendType === 11 && !this.form.id) {
|
|
|
+ const official = this.form.openOfficial;
|
|
|
+ const appCourse = this.form.openAppCourse;
|
|
|
+
|
|
|
+ // 至少一个为 "1"
|
|
|
+ if (official !== '1' && appCourse !== '1') {
|
|
|
+ this.$message.error("请至少开启【官方群发】或【APP看课】中的一项!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
+ // 不能同时为 "1"(虽然 watch 已处理,但以防绕过)
|
|
|
+ if (official === '1' && appCourse === '1') {
|
|
|
+ this.$message.error("【官方群发】与【APP看课】不能同时开启,请选择其一!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (this.command != 2 && this.form.id == null && this.form.sendType == 11){
|
|
|
|
|
|
const hasEmptyFields = this.form.timeList.some(item => {
|
|
|
@@ -1023,7 +1073,24 @@ export default {
|
|
|
}).catch(res=>{
|
|
|
this.official.loading = false;
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ getOpenAppCourseStatus(){
|
|
|
+ getConfigByKey("courseAppConfig.config").then(res => {
|
|
|
+ if (res.code === 200 && res.data?.configValue) {
|
|
|
+ try {
|
|
|
+ const config = JSON.parse(res.data.configValue);
|
|
|
+ this.showAppCourseToggle = config.view_course_app === 1;
|
|
|
+ } catch (e) {
|
|
|
+ console.error("解析 courseAppConfig.config 失败", e);
|
|
|
+ this.showAppCourseToggle = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.showAppCourseToggle = false;
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.showAppCourseToggle = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|