| | |
| | | <div class="createUser"> |
| | | <main> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="rules" |
| | | label-position="right"> |
| | | <el-form |
| | | ref="user" |
| | | label-width="140px" |
| | | autoComplete="on" |
| | | :model="role" |
| | | :rules="rules" |
| | | label-position="right" |
| | | > |
| | | <!-- 消息栏目 --> |
| | | <el-form-item class="optionItem" label="短信模板:" prop="messageType"> |
| | | <el-form-item |
| | | class="optionItem" |
| | | label="短信模板:" |
| | | prop="messageType" |
| | | > |
| | | <div class="message-item"> |
| | | <div class="message-item__left"> |
| | | <el-select v-model="role.messageType" placeholder="请选择短信模板" @change="setTemplateValue"> |
| | | <el-option v-for="item in colList" :key="item.id" :label="item.title" |
| | | :value="item.id"> |
| | | <el-select |
| | | v-model="role.messageType" |
| | | placeholder="请选择短信模板" |
| | | @change="setTemplateValue" |
| | | > |
| | | <el-option |
| | | v-for="item in colList" |
| | | :key="item.id" |
| | | :label="item.title" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息标题 --> |
| | | <el-form-item class="optionItems" label="短信标题:" prop="head"> |
| | | <el-form-item |
| | | class="optionItems" |
| | | label="短信标题:" |
| | | prop="head" |
| | | > |
| | | <div class="message-item__left"> |
| | | <el-input v-model="role.head" placeholder="请选择短信标题"></el-input> |
| | | <el-input |
| | | v-model="role.head" |
| | | placeholder="请选择短信标题" |
| | | ></el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 接收对象 --> |
| | | <el-form-item class="optionItem" label="接收手机号:" prop="targetTo"> |
| | | <el-form-item |
| | | class="optionItem" |
| | | label="接收手机号:" |
| | | prop="targetTo" |
| | | > |
| | | <div class="message-item__left"> |
| | | <el-select v-model="role.targetTo" placeholder="请选择接收接收手机号" > |
| | | <el-input v-model="role.targetTo"></el-input> |
| | | <!-- <el-select v-model="role.targetTo" placeholder="请选择接收接收手机号" > |
| | | <el-option :value="role.targetTo"> |
| | | <el-tree ref="tree" :data="departList" :props="defaultProps" show-checkbox |
| | | @check="handleCheck" default-expand-all node-key="id"> |
| | | </el-tree> |
| | | </el-option> |
| | | </el-select> |
| | | </el-select> --> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息内容 --> |
| | | <el-form-item class="optionItem" label="消息内容:" prop="body"> |
| | | <el-form-item |
| | | class="optionItem" |
| | | label="消息内容:" |
| | | prop="body" |
| | | > |
| | | <MyEditor ref="edit"></MyEditor> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <div class="optionBtn"> |
| | | <el-button type="primary" @click.native.prevent="handleSubmit(1)" class="btn submit">发布</el-button> |
| | | <el-button class="btn cancel" @click.native.prevent="handleReset">重置</el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click.native.prevent="handleSubmit(1)" |
| | | class="btn submit" |
| | | >发布</el-button |
| | | > |
| | | <el-button |
| | | class="btn cancel" |
| | | @click.native.prevent="handleReset" |
| | | >重置</el-button |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | components: { MyEditor }, |
| | | data() { |
| | | const validateMessageContent = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error('请输入短信内容')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | if (!value) { |
| | | callback(new Error('请输入短信内容')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | return { |
| | | role: { |
| | | messageType: '', |
| | |
| | | { required: true, trigger: "blur", message: '请输入短信标题' }, |
| | | ], |
| | | targetTo: [ |
| | | { required: true , trigger: "blur", message: '请选择接收对象' }, |
| | | { required: true, trigger: "blur", message: '请选择接收对象' }, |
| | | ], |
| | | body: [ |
| | | { required: true, trigger: ['blur', 'change'], validator: validateMessageContent } |
| | | { required: true, trigger: ['blur', 'change'], validator: validateMessageContent } |
| | | ] |
| | | }, |
| | | colList: [], |
| | |
| | | typeList: [], |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'departName' |
| | | }, |
| | | // defaultProps: { |
| | | // children: 'children', |
| | | // label: 'departName' |
| | | // }, |
| | | checkedList: [], |
| | | tempNameArr:[], |
| | | tempNameArr: [], |
| | | info: {}, |
| | | sendUser:"" |
| | | sendUser: "" |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | |
| | | getSMSTemplateList() { |
| | | SMS.getSMSTemplateList({ current: 1, pageSize: 100 }) |
| | | .then(({ records }) => { |
| | | this.colList = records; |
| | | }) |
| | | .catch(err => this.$message.error(err)) |
| | | SMS.getSMSTemplateList({ current: 1, pageSize: 100 }) |
| | | .then(({ records }) => { |
| | | this.colList = records; |
| | | }) |
| | | .catch(err => this.$message.error(err)) |
| | | }, |
| | | |
| | | // 关闭弹窗 |
| | |
| | | handleCheck(data, node) { |
| | | this.checkedList = [] |
| | | node.checkedNodes.forEach(item => { |
| | | if(!item.hasOwnProperty('departType')){ |
| | | if (!item.hasOwnProperty('departType')) { |
| | | this.checkedList.push(item.id) |
| | | this.tempNameArr.push(item.departName) |
| | | } |
| | |
| | | }, |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.role); |
| | | params.targetTo = this.checkedList.join(','); |
| | | params.status = mystatus; |
| | | sendMessage(params) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.$emit('closeMyDialog'); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | const params = Object.assign({}, this.role); |
| | | // params.targetTo = this.checkedList.join(','); |
| | | params.status = mystatus; |
| | | sendMessage(params) |
| | | .then(() => { |
| | | this.$message({ type: 'success', message: '操作成功' }); |
| | | this.$emit('closeMyDialog'); |
| | | }) |
| | | .catch(err => this.$message({ type: 'error', message: err })); |
| | | } else { |
| | | this.$message.warning('请检查必填项'); |
| | | this.$message.warning('请检查必填项'); |
| | | } |
| | | }) |
| | | }, |
| | | setTemplateValue(obj){ |
| | | var _this=this |
| | | SMS.getSMSTemplateById(obj).then((result) =>{ |
| | | _this.role.head=result.title |
| | | _this.role.body=result.body |
| | | setTemplateValue(obj) { |
| | | var _this = this |
| | | SMS.getSMSTemplateById(obj).then((result) => { |
| | | _this.role.head = result.title |
| | | _this.role.body = result.body |
| | | _this.$refs.edit.editor.txt.html(result.body) |
| | | }) |
| | | }, |
| | |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |