|
@@ -3,6 +3,7 @@
|
|
|
<ele-modal
|
|
<ele-modal
|
|
|
width="30%"
|
|
width="30%"
|
|
|
:visible.sync="addOrEditDialogFlag"
|
|
:visible.sync="addOrEditDialogFlag"
|
|
|
|
|
+ v-if="addOrEditDialogFlag"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
|
:title="title"
|
|
:title="title"
|
|
|
:before-close="closeDialog"
|
|
:before-close="closeDialog"
|
|
@@ -53,10 +54,26 @@
|
|
|
label="接收人:"
|
|
label="接收人:"
|
|
|
prop="recipient"
|
|
prop="recipient"
|
|
|
>
|
|
>
|
|
|
- <role-select
|
|
|
|
|
|
|
+ <!-- <role-select
|
|
|
v-if="formData.recipientType == 2"
|
|
v-if="formData.recipientType == 2"
|
|
|
v-model="formData.recipient"
|
|
v-model="formData.recipient"
|
|
|
- />
|
|
|
|
|
|
|
+ /> -->
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-if="formData.recipientType == 2"
|
|
|
|
|
+ multiple
|
|
|
|
|
+ clearable
|
|
|
|
|
+ v-model="formData.recipient"
|
|
|
|
|
+ class="ele-block"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in data"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
<el-input
|
|
<el-input
|
|
|
v-if="formData.recipientType == 1"
|
|
v-if="formData.recipientType == 1"
|
|
|
clearable
|
|
clearable
|
|
@@ -122,6 +139,7 @@
|
|
|
} from '@/api/notifyManage';
|
|
} from '@/api/notifyManage';
|
|
|
import RoleSelect from '@/views/system/user/components/role-select.vue';
|
|
import RoleSelect from '@/views/system/user/components/role-select.vue';
|
|
|
import staffSelection from '@/views/enterpriseModel/dept/components/staffSelection.vue';
|
|
import staffSelection from '@/views/enterpriseModel/dept/components/staffSelection.vue';
|
|
|
|
|
+ import { getlistRole } from '@/api/system/role';
|
|
|
export default {
|
|
export default {
|
|
|
name: 'addOrEditDialog',
|
|
name: 'addOrEditDialog',
|
|
|
props: {
|
|
props: {
|
|
@@ -165,7 +183,8 @@
|
|
|
|
|
|
|
|
dialogType: '',
|
|
dialogType: '',
|
|
|
// 提交状态
|
|
// 提交状态
|
|
|
- loading: false
|
|
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ data: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -224,7 +243,17 @@
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- created() {},
|
|
|
|
|
|
|
+ created() {
|
|
|
|
|
+ getlistRole()
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ this.data = res;
|
|
|
|
|
+
|
|
|
|
|
+ console.log(this.data, '返回的数据');
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ // this.$message.error(e.message);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
handleRecipientTypeChange() {
|
|
handleRecipientTypeChange() {
|
|
|
this.formData.recipient = [];
|
|
this.formData.recipient = [];
|
|
@@ -248,6 +277,7 @@
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
this.formData.recipientName = data.map((item) => item.name).join(',');
|
|
this.formData.recipientName = data.map((item) => item.name).join(',');
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
},
|
|
},
|
|
|
init(type, row = {}) {
|
|
init(type, row = {}) {
|
|
|
this.title = type == 'add' ? '新增' : '修改';
|
|
this.title = type == 'add' ? '新增' : '修改';
|
|
@@ -259,9 +289,15 @@
|
|
|
async getNotifyTemplateInfo(row) {
|
|
async getNotifyTemplateInfo(row) {
|
|
|
this.formData = await notifyTemplateGetByIdAPI(row.id);
|
|
this.formData = await notifyTemplateGetByIdAPI(row.id);
|
|
|
|
|
|
|
|
- this.formData.recipientName = this.formData.recipient
|
|
|
|
|
- .map((item) => item.recipientName)
|
|
|
|
|
- .join(',');
|
|
|
|
|
|
|
+ if (this.formData.recipientType == 1) {
|
|
|
|
|
+ this.formData.recipientName = this.formData.recipient
|
|
|
|
|
+ .map((item) => item.recipientName)
|
|
|
|
|
+ .join(',');
|
|
|
|
|
+ } else if (this.formData.recipientType == 2) {
|
|
|
|
|
+ this.formData.recipient = this.formData.recipient.map(
|
|
|
|
|
+ (item) => item.recipientId
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
/* 保存编辑 */
|
|
/* 保存编辑 */
|
|
|
save() {
|
|
save() {
|
|
@@ -269,7 +305,27 @@
|
|
|
if (!valid) return this.$message.warning('有必填项未填写,请检查');
|
|
if (!valid) return this.$message.warning('有必填项未填写,请检查');
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
|
|
|
|
|
|
|
+ let dataList = [];
|
|
|
|
|
+ if (this.formData.recipientType == 2) {
|
|
|
|
|
+ for (let it of this.formData.recipient) {
|
|
|
|
|
+ const data = this.data.find((item) => item.id == it);
|
|
|
|
|
+
|
|
|
|
|
+ if (data) {
|
|
|
|
|
+ const userData = {
|
|
|
|
|
+ recipientId: data.id,
|
|
|
|
|
+ recipientName: data.name,
|
|
|
|
|
+ type: this.formData.recipientType
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ dataList.push(userData);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.formData.recipient = dataList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const params = { ...this.formData };
|
|
const params = { ...this.formData };
|
|
|
|
|
+
|
|
|
const API =
|
|
const API =
|
|
|
this.dialogType == 'add'
|
|
this.dialogType == 'add'
|
|
|
? notifyTemplateSaveAPI
|
|
? notifyTemplateSaveAPI
|