|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <GlobalWindow | 
|---|
|  |  |  | :title="title" | 
|---|
|  |  |  | :visible.sync="visible" | 
|---|
|  |  |  | width="100%" | 
|---|
|  |  |  | @confirm="confirm"> | 
|---|
|  |  |  | <el-form :model="form" label-position="top" ref="paramRef" :rules="rules"> | 
|---|
|  |  |  | <el-form-item label="通知方式" prop="type"> | 
|---|
|  |  |  | :title="title" | 
|---|
|  |  |  | :visible.sync="visible" | 
|---|
|  |  |  | :isDownload="true" | 
|---|
|  |  |  | width="100%" | 
|---|
|  |  |  | @downloadFile="downloadFile" | 
|---|
|  |  |  | @confirm="confirm"> | 
|---|
|  |  |  | <el-form :model="form" label-position="top" ref="paramRef"> | 
|---|
|  |  |  | <el-form-item label="通知方式"> | 
|---|
|  |  |  | <el-checkbox-group v-model="form.type"> | 
|---|
|  |  |  | <el-checkbox label="短信"></el-checkbox> | 
|---|
|  |  |  | <el-checkbox label="邮件"></el-checkbox> | 
|---|
|  |  |  | </el-checkbox-group> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="通知接收人" prop="userId"> | 
|---|
|  |  |  | <el-select v-model="form.userId" placeholder="请选择"> | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="(item, index) in userList" | 
|---|
|  |  |  | :key="index" | 
|---|
|  |  |  | :label="item.realname" | 
|---|
|  |  |  | :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | <el-form-item label="通知接收人"> | 
|---|
|  |  |  | <div style="display: flex; align-items: center; margin-bottom: 10px;" v-for="(item, index) in userList" :key="index"> | 
|---|
|  |  |  | <span style="margin-right: 15px; font-size: 15px; color: #222222;">{{item.customerName}}</span> | 
|---|
|  |  |  | <el-select v-model="item.userId" placeholder="请选择"> | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="(item, index) in item.memberList" | 
|---|
|  |  |  | :key="index" | 
|---|
|  |  |  | :label="item.name" | 
|---|
|  |  |  | :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import { getUserList } from '@/api/system/user' | 
|---|
|  |  |  | import { getNoticeCustomerData, downloadCallFeeDoc, sendSmsEmail } from '@/api/ywContractBill' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: "call", | 
|---|
|  |  |  | components: { GlobalWindow }, | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | info: null, | 
|---|
|  |  |  | ids: null, | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | type: [], | 
|---|
|  |  |  | userId: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | rules: { | 
|---|
|  |  |  | type: [{ required: true, message: '请选择', trigger: 'blur' }], | 
|---|
|  |  |  | userId: [{ required: true, message: '请选择', trigger: 'blur' }] | 
|---|
|  |  |  | type: [] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | userList: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | this.getUser() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | open (title, target) { | 
|---|
|  |  |  | open (title, ids) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.info = target | 
|---|
|  |  |  | this.ids = ids | 
|---|
|  |  |  | this.form.type = [] | 
|---|
|  |  |  | this.userList = [] | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | this.getUser() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getUser() { | 
|---|
|  |  |  | getUserList({}) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.userList = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | downloadFile() { | 
|---|
|  |  |  | downloadCallFeeDoc(this.ids) | 
|---|
|  |  |  | .then(response => { | 
|---|
|  |  |  | this.download(response) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getUser() { | 
|---|
|  |  |  | getNoticeCustomerData(this.ids) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.userList = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | confirm() { | 
|---|
|  |  |  | this.$refs.paramRef.validate((valid) => { | 
|---|
|  |  |  | if (!valid) { | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if (this.form.type.length === 0) return this.$message.warning('通知方式不能为空') | 
|---|
|  |  |  | let arr = this.userList.map(item => { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | billId: item.billId, | 
|---|
|  |  |  | sendEmail: this.form.type.includes('邮件') ? 1 : 0, | 
|---|
|  |  |  | sendSms: this.form.type.includes('短信') ? 1 : 0, | 
|---|
|  |  |  | userId: item.userId | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | sendSmsEmail(arr).then(res => { | 
|---|
|  |  |  | this.$message.success('发送成功!') | 
|---|
|  |  |  | this.visible = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|