| 123456789101112131415161718192021222324252627282930313233343536 |
- /** SOP 内容类别:语音 / APP语音 */
- export const SOP_VOICE_TYPES = ['7', '16']
- /**
- * 是否允许新增/编辑 SOP 语音、APP语音。
- * 在对应环境 .env 中配置 VUE_APP_SOP_VOICE_ENABLE=false 即可关闭;恢复时改为 true 或删除该配置。
- * 未配置时默认开启,不影响其它客户。
- */
- export function isSopVoiceEnabled() {
- return process.env.VUE_APP_SOP_VOICE_ENABLE !== 'false'
- }
- export function isSopVoiceType(contentType) {
- return SOP_VOICE_TYPES.includes(String(contentType))
- }
- /** 新增场景:从字典中去掉语音、APP语音选项 */
- export function filterSopContentTypes(list) {
- if (isSopVoiceEnabled()) {
- return list || []
- }
- return (list || []).filter(item => !isSopVoiceType(item.dictValue))
- }
- /** 已有语音/APP语音内容:关闭开关后仅可删除,不可改 */
- export function isSopVoiceLocked(contentType) {
- return !isSopVoiceEnabled() && isSopVoiceType(contentType)
- }
- /** 内容类别 radio:关闭开关时隐藏语音类;当前已是该类则仍展示(便于识别后删除) */
- export function showSopContentTypeOption(dictValue, currentType) {
- if (isSopVoiceEnabled() || !isSopVoiceType(dictValue)) {
- return true
- }
- return String(currentType) === String(dictValue)
- }
|