Merge branch 'dev1.0' of http://42.193.1.25:9521/r/sccg_ui into dev1.0
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <main> |
| | | <div class="mainContent"> |
| | | <el-form |
| | | ref="user" |
| | | label-width="140px" |
| | | autoComplete="on" |
| | | :model="role" |
| | | :rules="createRoleRules" |
| | | label-position="right" |
| | | :disabled="type === 'view'" |
| | | > |
| | | <!-- 提醒方式 --> |
| | | <el-form-item class="optionItem" label="提醒方式:" prop="channelCode" > |
| | | <el-radio-group v-model="role.channelCode"> |
| | | <el-radio label="01">站内信</el-radio> |
| | | <el-radio label="03">邮件</el-radio> |
| | | </el-radio-group> |
| | | <span class="message-tip">(短信可用数: 1000条)</span> |
| | | </el-form-item> |
| | | <!-- 消息栏目 --> |
| | | <el-form-item |
| | | v-if="role.channelCode === '01'" |
| | | class="optionItem" |
| | | label="消息栏目:" |
| | | prop="messageType" |
| | | > |
| | | <div class="message-item"> |
| | | <div class="message-item__left"> |
| | | <el-select |
| | | v-model="role.messageType" |
| | | placeholder="请选择消息栏目" |
| | | > |
| | | <el-option |
| | | v-for="item in colList" |
| | | :key="item.id" |
| | | :label="item.columnName" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <span class="message-add" @click="dialogCreate = true"> |
| | | 添加栏目</span |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息标题 --> |
| | | <el-form-item class="optionItems" label="消息标题:" prop="head"> |
| | | <div class="message-item__left"> |
| | | <el-input |
| | | v-model="role.head" |
| | | placeholder="请选择消息标题" |
| | | ></el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 接收对象 --> |
| | | <el-form-item class="optionItem" label="接收对象:" prop="targetTo"> |
| | | <div class="message-item__left"> |
| | | <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 |
| | | :default-checked-keys="checkedList" |
| | | node-key="id" |
| | | > |
| | | </el-tree> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息内容 --> |
| | | <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(0)" |
| | | class="btn save" |
| | | v-if="type !== 'view'" |
| | | >保存 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click.native.prevent="handleSubmit(1)" |
| | | class="btn submit" |
| | | v-if="type !== 'view'" |
| | | >发布 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click.native.prevent="handleView" |
| | | class="btn submit" |
| | | v-if="type !== 'view'" |
| | | >预览 |
| | | </el-button> |
| | | <el-button class="btn cancel" @click.native.prevent="handleReset" v-if="type !== 'view'" |
| | | >重置</el-button |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 新增栏目 --> |
| | | <el-dialog |
| | | title="添加栏目" |
| | | :visible.sync="dialogCreate" |
| | | v-if="dialogCreate" |
| | | width="60%" |
| | | :before-close="handleConfirmClose" |
| | | append-to-body |
| | | > |
| | | <MyColumnAdd @closeDialog="closeDialog"></MyColumnAdd> |
| | | </el-dialog> |
| | | <!-- 预览消息 --> |
| | | <el-dialog |
| | | title="消息预览" |
| | | :visible.sync="dialogView" |
| | | v-if="dialogView" |
| | | width="60%" |
| | | :before-close="handleConfirmClose" |
| | | append-to-body |
| | | > |
| | | <MyColView :info="info" @closeDialog="closeDialog"></MyColView> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import MyEditor from "@/components/edit"; |
| | | import MyColumnAdd from "@/views/operate/message/mycontrol/createUser"; |
| | | import MyColView from "../messageView"; |
| | | import { sendMessage, updateMessage, getMessageById,saveMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | | props: ["type", "myDataRow"], |
| | | data() { |
| | | const validateEditor = (rule, value, callback) => { |
| | | if (value) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请输入')); |
| | | } |
| | | }; |
| | | return { |
| | | role: { |
| | | messageType: null, |
| | | head: "", |
| | | targetTo: "", |
| | | body: "", |
| | | channelCode: null, |
| | | }, |
| | | createRoleRules: { |
| | | messageType: [ |
| | | { |
| | | required: true, |
| | | trigger: ["blur", "change"], |
| | | message: "请输入消息栏目", |
| | | }, |
| | | ], |
| | | head: [{ required: true, trigger: "blur", message: "请选择消息标题" }], |
| | | targetTo: [ |
| | | { required: true, trigger: "blur", message: "请选择接受对象" }, |
| | | ], |
| | | body: [ |
| | | { |
| | | required: true, |
| | | validator: validateEditor |
| | | }, |
| | | ], |
| | | }, |
| | | colList: [], |
| | | departList: [], |
| | | typeList: [], |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "departName", |
| | | }, |
| | | checkedList: [], |
| | | tempNameArr: [], |
| | | info: {}, |
| | | sendUser: "", |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getColumnList(); |
| | | this.getDepartList(); |
| | | this.getLoginUserInfo(); |
| | | if (this.type !== "create" && this.myDataRow) { |
| | | getMessageById(this.myDataRow.id) |
| | | .then(res => { |
| | | this.role = res; |
| | | if (res.targetTo) { |
| | | this.checkedList = res.targetTo.split(','); |
| | | this.role.targetTo = `${this.checkedList.length}人`; |
| | | } |
| | | }) |
| | | .catch(err => this.$message.error(`${err}`)) |
| | | } |
| | | }, |
| | | mounted() { |
| | | if (this.type !== 'create') { |
| | | this.$refs.edit.editor.txt.append(this.myDataRow.body); |
| | | } |
| | | |
| | | }, |
| | | methods: { |
| | | // 关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm("确认关闭?").then((_) => { |
| | | done(); |
| | | }); |
| | | }, |
| | | |
| | | // 获取栏目 |
| | | async getColumnList() { |
| | | await this.$axios({ |
| | | method: "get", |
| | | url: "sccg/message_column/show", |
| | | }).then((res) => { |
| | | this.colList = res.data; |
| | | }); |
| | | }, |
| | | // 关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | if (index === 1) { |
| | | // 重新设置栏目 |
| | | this.getColumnList(); |
| | | } |
| | | }, |
| | | getType(){ |
| | | return this.type; |
| | | }, |
| | | // 获取部门树 |
| | | async getDepartList() { |
| | | await this.$axios({ |
| | | method: "get", |
| | | url: "sccg/depart/tree", |
| | | }).then((res) => { |
| | | res.data.forEach((item) => { |
| | | this.departList.push(this.setChildren(item)); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 递归children |
| | | setChildren(obj) { |
| | | if (obj.children !== null) { |
| | | if (obj.children.length !== 0) { |
| | | obj.children.forEach((item) => { |
| | | return this.setChildren(item); |
| | | }); |
| | | } |
| | | } else { |
| | | if (obj.userInfoDTOS.length !== 0) { |
| | | obj.children = []; |
| | | obj.userInfoDTOS.forEach((item) => { |
| | | obj.children.push({ id: item.userId, departName: item.username }); |
| | | }); |
| | | } |
| | | } |
| | | return obj; |
| | | }, |
| | | |
| | | // 选中id |
| | | handleCheck(data, node) { |
| | | const checkedNodes = node.checkedNodes.filter(item => !item.children); |
| | | this.checkedList = checkedNodes.map(item => item.id); |
| | | this.tempNameArr = checkedNodes.map(item => item.departName); |
| | | this.role.targetTo = this.checkedList.length ? this.checkedList.length + "人" : null; |
| | | }, |
| | | |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | if(mystatus==1){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | | messageType, |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | status: mystatus, |
| | | }; |
| | | if (this.role.channelCode === '03') { |
| | | delete params.messageType; |
| | | } |
| | | if (this.type === "create") { |
| | | sendMessage(params) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | if(mystatus==0){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | | messageType, |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | status: mystatus, |
| | | }; |
| | | if (this.role.channelCode === '03') { |
| | | delete params.messageType; |
| | | } |
| | | if (this.type === "create") { |
| | | saveMessage(params) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | this.$message.error({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | | |
| | | // 获取当前登录用户信息 |
| | | getLoginUserInfo() { |
| | | const name = sessionStorage.getItem("name"); |
| | | this.$axios({ |
| | | method: "get", |
| | | url: "sccg/admin/info?name=" + name, |
| | | }).then((res) => { |
| | | this.role.targetFrom = res.data.userId; |
| | | this.sendUser = res.data.username; |
| | | }); |
| | | }, |
| | | |
| | | // 消息预览 |
| | | handleView() { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { body, head, channelCode } = this.role; |
| | | this.dialogView = true; |
| | | this.info = { |
| | | body, |
| | | head, |
| | | channelCode: |
| | | channelCode === "01" |
| | | ? "站内信" |
| | | : channelCode === "03" |
| | | ? "邮件" |
| | | : "短信", |
| | | messageType: this.role.messageType, |
| | | targetTo: this.tempNameArr, |
| | | targetFrom: this.sendUser |
| | | }; |
| | | } else { |
| | | this.$message({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | background-color: white; |
| | | |
| | | main { |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | background-color: white; |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | padding-top: 50px; |
| | | &:deep(.el-dialog__title) { |
| | | //color: #4b9bb7; |
| | | } |
| | | &::v-deep .el-form-item__label { |
| | | //color: #4b9bb7; |
| | | } |
| | | |
| | | &::v-deep .el-input__inner { |
| | | width: 400px; |
| | | //background-color: #09152f; |
| | | //border: 1px solid #17324c; |
| | | } |
| | | |
| | | .message-item__left { |
| | | width: 400px; |
| | | } |
| | | |
| | | .message-add { |
| | | &:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .el-form-item__content :deep(.el-select) { |
| | | width: 400px; |
| | | } |
| | | |
| | | :deep(.el-input) { |
| | | width: 400px; |
| | | } |
| | | |
| | | .message-item { |
| | | display: flex; |
| | | |
| | | span { |
| | | margin-left: 20px; |
| | | color: #606266; |
| | | } |
| | | } |
| | | |
| | | .message-tip { |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | :deep(.el-input--suffix) { |
| | | width: 400px; |
| | | } |
| | | |
| | | // &::v-deep .el-textarea__inner { |
| | | // //background-color: #09152f; |
| | | // //border: 1px solid #17324c; |
| | | // } |
| | | |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .optionHandleSp { |
| | | display: flex; |
| | | |
| | | .areaNumber, |
| | | .moreNumber { |
| | | flex: 1; |
| | | } |
| | | |
| | | .telNumber { |
| | | flex: 2; |
| | | } |
| | | } |
| | | |
| | | .optionBtn { |
| | | display: flex; |
| | | margin-top: 20px; |
| | | |
| | | .btn { |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <main> |
| | | <div class="mainContent"> |
| | | <el-form |
| | | ref="user" |
| | | label-width="140px" |
| | | autoComplete="on" |
| | | :model="role" |
| | | :rules="createRoleRules" |
| | | label-position="right" |
| | | :disabled="type === 'view'" |
| | | > |
| | | <!-- 提醒方式 --> |
| | | <el-form-item class="optionItem" label="提醒方式:" prop="channelCode" > |
| | | <el-radio-group v-model="role.channelCode"> |
| | | <el-radio label="01">站内信</el-radio> |
| | | <el-radio label="03">邮件</el-radio> |
| | | </el-radio-group> |
| | | <span class="message-tip">(短信可用数: 1000条)</span> |
| | | </el-form-item> |
| | | <!-- 消息栏目 --> |
| | | <el-form-item |
| | | v-if="role.channelCode === '01'" |
| | | class="optionItem" |
| | | label="消息栏目:" |
| | | prop="messageType" |
| | | > |
| | | <div class="message-item"> |
| | | <div class="message-item__left"> |
| | | <el-select |
| | | v-model="role.messageType" |
| | | placeholder="请选择消息栏目" |
| | | > |
| | | <el-option |
| | | v-for="item in colList" |
| | | :key="item.id" |
| | | :label="item.columnName" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <span class="message-add" @click="dialogCreate = true"> |
| | | 添加栏目</span |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息标题 --> |
| | | <el-form-item class="optionItems" label="消息标题:" prop="head"> |
| | | <div class="message-item__left"> |
| | | <el-input |
| | | v-model="role.head" |
| | | placeholder="请选择消息标题" |
| | | ></el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 接收对象 --> |
| | | <el-form-item class="optionItem" label="接收对象:" prop="targetTo"> |
| | | <div class="message-item__left"> |
| | | <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 |
| | | :default-checked-keys="checkedList" |
| | | node-key="id" |
| | | > |
| | | </el-tree> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 消息内容 --> |
| | | <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(0)" |
| | | class="btn save" |
| | | v-if="type !== 'view'" |
| | | >保存 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click.native.prevent="handleSubmit(1)" |
| | | class="btn submit" |
| | | v-if="type !== 'view'" |
| | | >发布 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click.native.prevent="handleView" |
| | | class="btn submit" |
| | | v-if="type !== 'view'" |
| | | >预览 |
| | | </el-button> |
| | | <el-button class="btn cancel" @click.native.prevent="handleReset" v-if="type !== 'view'" |
| | | >重置</el-button |
| | | > |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 新增栏目 --> |
| | | <el-dialog |
| | | title="添加栏目" |
| | | :visible.sync="dialogCreate" |
| | | v-if="dialogCreate" |
| | | width="60%" |
| | | :before-close="handleConfirmClose" |
| | | append-to-body |
| | | > |
| | | <MyColumnAdd @closeDialog="closeDialog"></MyColumnAdd> |
| | | </el-dialog> |
| | | <!-- 预览消息 --> |
| | | <el-dialog |
| | | title="消息预览" |
| | | :visible.sync="dialogView" |
| | | v-if="dialogView" |
| | | width="60%" |
| | | :before-close="handleConfirmClose" |
| | | append-to-body |
| | | > |
| | | <MyColView :info="info" @closeDialog="closeDialog"></MyColView> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import MyEditor from "@/components/edit"; |
| | | import MyColumnAdd from "@/views/operate/message/mycontrol/createUser"; |
| | | import MyColView from "../messageView"; |
| | | import { sendMessage, updateMessage, getMessageById,saveMessage } from "@/api/operate/messageManagement"; |
| | | |
| | | export default { |
| | | components: { MyEditor, MyColumnAdd, MyColView }, |
| | | props: ["type", "myDataRow"], |
| | | data() { |
| | | const validateEditor = (rule, value, callback) => { |
| | | if (value) { |
| | | callback(); |
| | | } else { |
| | | callback(new Error('请输入')); |
| | | } |
| | | }; |
| | | return { |
| | | role: { |
| | | messageType: null, |
| | | head: "", |
| | | targetTo: "", |
| | | body: "", |
| | | channelCode: null, |
| | | }, |
| | | createRoleRules: { |
| | | messageType: [ |
| | | { |
| | | required: true, |
| | | trigger: ["blur", "change"], |
| | | message: "请输入消息栏目", |
| | | }, |
| | | ], |
| | | head: [{ required: true, trigger: "blur", message: "请选择消息标题" }], |
| | | targetTo: [ |
| | | { required: true, trigger: "blur", message: "请选择接受对象" }, |
| | | ], |
| | | body: [ |
| | | { |
| | | required: true, |
| | | validator: validateEditor |
| | | }, |
| | | ], |
| | | }, |
| | | colList: [], |
| | | departList: [], |
| | | typeList: [], |
| | | dialogCreate: false, |
| | | dialogView: false, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "departName", |
| | | }, |
| | | checkedList: [], |
| | | tempNameArr: [], |
| | | info: {}, |
| | | sendUser: "", |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getColumnList(); |
| | | this.getDepartList(); |
| | | this.getLoginUserInfo(); |
| | | if (this.type !== "create" && this.myDataRow) { |
| | | getMessageById(this.myDataRow.id) |
| | | .then(res => { |
| | | this.role = res; |
| | | if (res.targetTo) { |
| | | this.checkedList = res.targetTo.split(','); |
| | | this.role.targetTo = `${this.checkedList.length}人`; |
| | | } |
| | | }) |
| | | .catch(err => this.$message.error(`${err}`)) |
| | | } |
| | | }, |
| | | mounted() { |
| | | if (this.type !== 'create') { |
| | | this.$refs.edit.editor.txt.append(this.myDataRow.body); |
| | | } |
| | | |
| | | }, |
| | | methods: { |
| | | // 关闭弹窗 |
| | | handleConfirmClose(done) { |
| | | this.$confirm("确认关闭?").then((_) => { |
| | | done(); |
| | | }); |
| | | }, |
| | | |
| | | // 获取栏目 |
| | | async getColumnList() { |
| | | await this.$axios({ |
| | | method: "get", |
| | | url: "sccg/message_column/show ", |
| | | }).then((res) => { |
| | | this.colList = res.data; |
| | | }); |
| | | }, |
| | | // 关闭弹窗 |
| | | closeDialog({ flag, index }) { |
| | | this.dialogCreate = flag; |
| | | if (index === 1) { |
| | | // 重新设置栏目 |
| | | this.getColumnList(); |
| | | } |
| | | }, |
| | | getType(){ |
| | | return this.type; |
| | | }, |
| | | // 获取部门树 |
| | | async getDepartList() { |
| | | await this.$axios({ |
| | | method: "get", |
| | | url: "sccg/depart/tree", |
| | | }).then((res) => { |
| | | res.data.forEach((item) => { |
| | | this.departList.push(this.setChildren(item)); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 递归children |
| | | setChildren(obj) { |
| | | if (obj.children !== null) { |
| | | if (obj.children.length !== 0) { |
| | | obj.children.forEach((item) => { |
| | | return this.setChildren(item); |
| | | }); |
| | | } |
| | | } else { |
| | | if (obj.userInfoDTOS.length !== 0) { |
| | | obj.children = []; |
| | | obj.userInfoDTOS.forEach((item) => { |
| | | obj.children.push({ id: item.userId, departName: item.username }); |
| | | }); |
| | | } |
| | | } |
| | | return obj; |
| | | }, |
| | | |
| | | // 选中id |
| | | handleCheck(data, node) { |
| | | const checkedNodes = node.checkedNodes.filter(item => !item.children); |
| | | this.checkedList = checkedNodes.map(item => item.id); |
| | | this.tempNameArr = checkedNodes.map(item => item.departName); |
| | | this.role.targetTo = this.checkedList.length ? this.checkedList.length + "人" : null; |
| | | }, |
| | | |
| | | // 新建/保存消息(1:新建,0保存消息) |
| | | handleSubmit(mystatus) { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | if(mystatus==1){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | | messageType, |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | status: mystatus, |
| | | }; |
| | | if (this.role.channelCode === '03') { |
| | | delete params.messageType; |
| | | } |
| | | if (this.type === "create") { |
| | | sendMessage(params) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | if(mystatus==0){ |
| | | const { body, head, messageType, channelCode } = this.role; |
| | | const params = { |
| | | body, |
| | | head, |
| | | messageType, |
| | | channelCode: `${channelCode}`, |
| | | sendTime: new Date(), |
| | | targetTo: this.checkedList.join(","), |
| | | status: mystatus, |
| | | }; |
| | | if (this.role.channelCode === '03') { |
| | | delete params.messageType; |
| | | } |
| | | if (this.type === "create") { |
| | | saveMessage(params) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } else { |
| | | updateMessage({ id: this.myDataRow.id, ...params }) |
| | | .then(() => { |
| | | this.$emit("closeMyDialog"); |
| | | this.$message({ type: "success", message: "操作成功" }); |
| | | }) |
| | | .catch((err) => |
| | | this.$message({ |
| | | type: "error", |
| | | message: err.data || err.message, |
| | | }) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | this.$message.error({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 重置表单 |
| | | handleReset() { |
| | | this.$refs.edit.editor.txt.clear(); |
| | | this.$refs.user.resetFields(); |
| | | }, |
| | | |
| | | // 获取当前登录用户信息 |
| | | getLoginUserInfo() { |
| | | const name = sessionStorage.getItem("name"); |
| | | this.$axios({ |
| | | method: "get", |
| | | url: "sccg/admin/info?name=" + name, |
| | | }).then((res) => { |
| | | this.role.targetFrom = res.data.userId; |
| | | this.sendUser = res.data.username; |
| | | }); |
| | | }, |
| | | |
| | | // 消息预览 |
| | | handleView() { |
| | | this.role.body = this.$refs.edit.editor.txt.html(); |
| | | this.$refs.user.validate((valid) => { |
| | | if (valid) { |
| | | const { body, head, channelCode } = this.role; |
| | | this.dialogView = true; |
| | | this.info = { |
| | | body, |
| | | head, |
| | | channelCode: |
| | | channelCode === "01" |
| | | ? "站内信" |
| | | : channelCode === "03" |
| | | ? "邮件" |
| | | : "短信", |
| | | messageType: this.role.messageType, |
| | | targetTo: this.tempNameArr, |
| | | targetFrom: this.sendUser |
| | | }; |
| | | } else { |
| | | this.$message({ type: "warning", message: "请检查必填项" }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | background-color: white; |
| | | |
| | | main { |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | background-color: white; |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | padding-top: 50px; |
| | | &:deep(.el-dialog__title) { |
| | | //color: #4b9bb7; |
| | | } |
| | | &::v-deep .el-form-item__label { |
| | | //color: #4b9bb7; |
| | | } |
| | | |
| | | &::v-deep .el-input__inner { |
| | | width: 400px; |
| | | //background-color: #09152f; |
| | | //border: 1px solid #17324c; |
| | | } |
| | | |
| | | .message-item__left { |
| | | width: 400px; |
| | | } |
| | | |
| | | .message-add { |
| | | &:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .el-form-item__content :deep(.el-select) { |
| | | width: 400px; |
| | | } |
| | | |
| | | :deep(.el-input) { |
| | | width: 400px; |
| | | } |
| | | |
| | | .message-item { |
| | | display: flex; |
| | | |
| | | span { |
| | | margin-left: 20px; |
| | | color: #606266; |
| | | } |
| | | } |
| | | |
| | | .message-tip { |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | :deep(.el-input--suffix) { |
| | | width: 400px; |
| | | } |
| | | |
| | | // &::v-deep .el-textarea__inner { |
| | | // //background-color: #09152f; |
| | | // //border: 1px solid #17324c; |
| | | // } |
| | | |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .optionHandleSp { |
| | | display: flex; |
| | | |
| | | .areaNumber, |
| | | .moreNumber { |
| | | flex: 1; |
| | | } |
| | | |
| | | .telNumber { |
| | | flex: 2; |
| | | } |
| | | } |
| | | |
| | | .optionBtn { |
| | | display: flex; |
| | | margin-top: 20px; |
| | | |
| | | .btn { |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | async getColumnList() { |
| | | await this.$axios({ |
| | | method: "get", |
| | | url: "sccg/message_column/getShowColumn", |
| | | url: "sccg/message_column/show ", |
| | | }).then((res) => { |
| | | this.colList = res.data; |
| | | }); |