merge dev-shenjianbin into master
订阅改为多选 Created-by: MaxShen Commit-by: MaxShen Merged-by: MaxShen Description: 订阅改为多选 See merge request: hk_openRepo/OpenRepo_Portal!61
This commit is contained in:
@@ -4,11 +4,7 @@
|
|||||||
<div class="subscribe-form">
|
<div class="subscribe-form">
|
||||||
<d-form ref="formRef" :data="formData" :rules="rules">
|
<d-form ref="formRef" :data="formData" :rules="rules">
|
||||||
<d-form-item field="subscribeType" label="通知方式">
|
<d-form-item field="subscribeType" label="通知方式">
|
||||||
<d-radio-group direction="row" v-model="formData.subscribeType">
|
<d-checkbox-group name="subscribeType" v-model="formData.subscribeType" :options="subscribeTypeOptions" direction="row"></d-checkbox-group>
|
||||||
<d-radio value="0">短信</d-radio>
|
|
||||||
<d-radio value="1">邮件</d-radio>
|
|
||||||
<d-radio value="2">站内通知</d-radio>
|
|
||||||
</d-radio-group>
|
|
||||||
</d-form-item>
|
</d-form-item>
|
||||||
</d-form>
|
</d-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,25 +19,29 @@
|
|||||||
import { subscribeSoftware } from '@/api/jyh';
|
import { subscribeSoftware } from '@/api/jyh';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { Message } from 'vue-devui';
|
import { Message } from 'vue-devui';
|
||||||
|
const subscribeTypeOptions = [
|
||||||
|
{ name: '短信', value: 'mobileSwitch', id: 1 },
|
||||||
|
{ name: '邮件', value: 'emailSwitch', id: 2 },
|
||||||
|
{ name: '站内通知', value: 'webSwitch', id: 3 },
|
||||||
|
];
|
||||||
const props = defineProps(['softwareData']);
|
const props = defineProps(['softwareData']);
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close']);
|
||||||
const formRef = ref(null);
|
const formRef = ref(null);
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
subscribeType: '',
|
subscribeType: [],
|
||||||
});
|
});
|
||||||
const rules = {
|
const rules = {
|
||||||
subscribeType: [{ required: true, message: '请选择', trigger: 'change' }],
|
subscribeType: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
};
|
};
|
||||||
const sendSubscribe = async () => {
|
const sendSubscribe = async () => {
|
||||||
|
let alertType = {};
|
||||||
|
formData.value.subscribeType.forEach(item => {
|
||||||
|
alertType[item.value] = true;
|
||||||
|
})
|
||||||
const data = await subscribeSoftware({
|
const data = await subscribeSoftware({
|
||||||
softwareId: props.softwareData.id,
|
softwareId: props.softwareData.id,
|
||||||
status: '1',
|
status: '1',
|
||||||
alertType: {
|
alertType,
|
||||||
mobileSwitch: formData.value.subscribeType === '0',
|
|
||||||
emailSwitch: formData.value.subscribeType === '1',
|
|
||||||
webSwitch: formData.value.subscribeType === '2',
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
Message({
|
Message({
|
||||||
message: err.error,
|
message: err.error,
|
||||||
|
|||||||
Reference in New Issue
Block a user