提交 f373e86b 编写于 作者: guangjun.yang's avatar guangjun.yang

views

上级 7ebe0123
......@@ -2,15 +2,15 @@
<html>
<head>
<meta charset="utf-8">
<meta content="云鹊医,云鹊健康,消息中心,项目管理,教培项目,学情报告,随访管理,预约随访" name="keywords">
<meta content="消息中心。" name="description">
<meta content="云鹊医,云鹊健康,协议管理,项目管理,教培项目,学情报告,随访管理,预约随访" name="keywords">
<meta content="协议管理" name="description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
<meta name="screen-orientation" content="portrait"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<title>消息中心</title>
<title>协议管理</title>
</head>
<body id="appBody">
<div id="app">
......@@ -18,7 +18,7 @@
</div>
<script src="https://unpkg.com/qiniu-js@2.2.0/dist/qiniu.min.js"></script>
<!-- <script src="https://cdn.ckeditor.com/ckeditor5/12.4.0/standard/ckeditor.js"></script> -->
<!-- <script src="https://cdn.ckeditor.com/4.13.0/standard/ckeditor.js"></script> -->
<script src="https://cdn.ckeditor.com/4.13.0/full/ckeditor.js"></script>
<script src="https://cdn.ckeditor.com/4.13.0/standard/ckeditor.js"></script>
<!-- <script src="https://cdn.ckeditor.com/4.13.0/full/ckeditor.js"></script> -->
</body>
</html>
......@@ -154,6 +154,15 @@ module.exports = {
})
},
// 通用GET请求
PUT(api, para, callback,str) {
return fetch({
url: getBaseUrl(api),
method: 'put',
data: para
})
},
// 通用DELETE请求
DELETE(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
......
......@@ -2,7 +2,7 @@
<div class="header-container">
<div class="logo">
<img src="../../assets/image/index_logoicon.png"/>
<p>消息中心</p>
<p>协议管理</p>
</div>
<div class="user-info">
<el-dropdown trigger="click" @command="handleCommand">
......
......@@ -90,20 +90,20 @@ export default {
vm = this;
},
watch: {
authList(newVal, oldVal) {
if (!newVal.P001) {
// 项目管理
vm.items[1].subs[1].index = "blank";
}
if (!newVal.P002) {
// 组件管理
vm.items[1].subs[0].index = "blank";
}
if (!newVal.P003) {
// 角色管理
vm.items[2].subs[0].index = "blank";
}
}
// authList(newVal, oldVal) {
// if (!newVal.P001) {
// // 项目管理
// vm.items[1].subs[1].index = "blank";
// }
// if (!newVal.P002) {
// // 组件管理
// vm.items[1].subs[0].index = "blank";
// }
// if (!newVal.P003) {
// // 角色管理
// vm.items[2].subs[0].index = "blank";
// }
// }
},
methods: {}
};
......
<template>
<div class="create-push">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<div class="header-title"></div>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="ruleForm"
>
<el-form-item label="协议标题" prop="title">
<el-input v-model="ruleForm.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
</el-form>
<!-- <el-dialog title="推送预览" :visible.sync="dialogFormVisible">
<div>
<span>主题: {{ ruleForm.title }} </span>
<p style="display: inline-block; float: right;">
<span style="margin-left: 0px">目标对象:</span>
<span v-if="ruleForm.isAll == 2" style="color: #449284"> {{ objNum }} </span>
<span v-if="ruleForm.isAll == 3" style="color: #449284"> {{ userChooseCount }} </span>
<span v-else>全部</span>
</p>
</div>
<hr>
<el-form :model="ruleForm" class="rule-form">
<el-form-item label="APP推送:" >
云鹊医
</el-form-item>
<el-form-item label="推送标题:" >
{{ ruleForm.title }}
</el-form-item>
<el-form-item label="推送介绍:" >
<p style="white-space: pre-line">{{ ruleForm.content }}</p>
</el-form-item>
<el-form-item label="页面去向:" >
{{ ruleForm.url }}
</el-form-item>
<el-form-item label="系统通知:" >
{{ ruleForm.noticeFlag | getNotice }}
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="pushSend()">确 定</el-button>
</div>
</el-dialog> -->
</div>
</div>
</template>
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
let vm = null;
export default {
components: {
BreadCrumb
},
data() {
return {
curmbFirst: "创建APP推送",
ruleForm: {
title: "",
content: "",
},
};
},
computed: {
// ...mapGetters(["_token"])
},
created() {
vm = this;
// vm.idType = localStorage.getItem("storageIdType");
// console.log("idType:", vm.idType);
},
// 挂载到Dom完成时
mounted: function() {
// commonUtil.resizeHeight();
},
methods: {
submitForm(formName) {
if(this.ruleForm.isAll == 3 && this.userChooseCount == 0){
vm.$message('请先选择用户');
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
// vm.pushSend();
if(vm.ruleForm.isAll == 2) {
if(vm.fileName == '') {
vm.$message('请先导入名单');
} else {
vm.dialogFormVisible = true;
}
} else {
vm.dialogFormVisible = true;
}
} else {
console.log('error submit!!');
return false;
}
});
},
pushSend() {
let req = {};
req = this.ruleForm;
if(req.isAll == 2 || req.isAll == 3) {
req.key = vm.sendKey;
}
req.createdName = localStorage.getItem('user_name');
// openLoading(vm);
vm.POST("raytheon/push/send", req).then(res => {
// closeLoading(vm);
vm.$message(res.message);
if(res.code == '000000') {
vm.ruleForm = {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
};
}
});
vm.dialogFormVisible = false;
vm.fileName = '';
vm.sendKey = '';
},
download() {
let xlsxUrl = getExcel();
console.log('下载模板'+xlsxUrl);
setTimeout(() => {
window.open(xlsxUrl);
}, 500);
},
beforeUpload(file) {
// console.log(file);
let self = this;
const isLt = file.size / 1024 / 1024 < 10;
if(!isLt) {
this.$message.error("文件大小不能超过10M");
return;
} else {
vm.fileName = file.name;
}
},
httpRequest (options) {
// console.log(options,options.file)
let file = options.file
let reader = new FileReader()
if (file) {
reader.readAsDataURL(file)
}
reader.onload = (e) => {
let base64Str = e.target.result.split(',')[1]
// console.log('e的值',e);
// let base64Str = e.target.result.substr(e.target.result.indexOf("base64,") + 7)
// vm.POST("raytheon/excel/upload", base64Str).then(res => {
// console.log(res);
// })
openLoading(vm);
axios({
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
'content-type': 'text/html'
},
url: getBaseUrl('raytheon/excel/upload'),
method: 'post',
data: base64Str,
}).then(function (response) {
// console.log(response);
closeLoading(vm);
vm.objNum = response.data.data.count;
vm.sendKey = response.data.data.key;
console.log('vm.objNum ',vm.objNum);
})
}
},
handleTargetChoose() {
if( this.ruleForm.isAll == 3 ){
// 初始化
this.isSeeUserNumBtnClicked = false;
this.userChooseCount = 0;
this.allUserCount = 0;
this.userChooseForm = {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
};
this.finalChooseData = {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
};
// 获取总数量
this.getCurrentUserCount({ getAll: true });
}
},
getCurrentUserCount(params) {
if(!(params && params.getAll)){
if(this.finalChooseData.provinceId == ''
&& this.finalChooseData.cityId == ''
&& this.finalChooseData.countyId == ''
&& this.finalChooseData.doctorTitle.length == 0
&& this.finalChooseData.hospitalLevel.length == 0
){
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = 0;
return;
}
}
openLoading(vm, 'topIndex');
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUserCount", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
if(params && params.getAll){
this.allUserCount = res.data;
}else{
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = res.data;
}
}else{
vm.$message.info(res.message)
}
});
},
showUserChooseModal() {
this.isUserChooseModalShow = true;
this.getProvinceList();
this.getTechTitleList();
this.getHospitalLevelList();
},
getProvinceList() {
let req = {};
openLoading(vm);
vm.GET("raytheon/constants/region", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.provinceList = res.data.provinceList;
}else{
vm.$message.info(res.message)
}
});
},
getCityList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.cityList = res.data.cityList;
}else{
vm.$message.info(res.message)
}
});
},
getCountyList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.countyList = res.data.countyList;
}else{
vm.$message.info(res.message)
}
});
},
handleProvinceChange(id) {
this.finalChooseData.cityId = '';
this.finalChooseData.countyId = '';
// 清空省,则移除市、区列表
if( id == '' ){
this.userChooseForm.address.cityList = [];
this.userChooseForm.address.countyList = [];
return;
}
let params = { provinceId: id };
this.getCityList(params);
// this.getCurrentUserCount();
},
handleCityChange(id) {
this.finalChooseData.countyId = '';
// 清空市,则移除区列表
if( id == '' ){
this.userChooseForm.address.countyList = [];
return;
}
let params = { cityId: id };
this.getCountyList(params);
// this.getCurrentUserCount();
},
handleCountyChange() {
// this.getCurrentUserCount();
},
handleDoctorTitleChange() {
// this.getCurrentUserCount();
},
handleHospitalLevelChange() {
// this.getCurrentUserCount();
},
getTechTitleList() {
openLoading(vm);
vm.GET("raytheon/constants/doctor/title", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.techTitleList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
getHospitalLevelList() {
openLoading(vm);
vm.GET("raytheon/constants/hospital/level", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.hospitalLevelList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
// 确认筛选
handleChooseSubmit() {
this.getCurrentUserCount();
openLoading(vm);
vm.sendKey = '';
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUser", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
vm.isUserChooseModalShow = false;
vm.sendKey = res.data;
}else{
vm.$message.info(res.message)
}
});
},
}
};
</script>
<style lang="scss">
.topIndex{
z-index: 10000 !important;
}
.create-push {
.component-content {
margin-top: 20px;
padding: 10px;
background: #fff;
.header-title {
padding: 10px 12px;
font-size: 12px;
color: #449284;
border-bottom: 1px solid #efefef;
}
.ruleForm {
width: 70%;
margin-left: 50px;
}
.rule-form {
margin-top: 20px;
margin-left: 30px;
.el-form-item__content {
font-size: 12px;
}
}
.update-input {
width: 200px;
}
.update-item {
/* float: left; */
margin-right: 5px;
}
.el-upload__tip {
// margin-top: -10px;
// margin-left: 205px;
margin-top: -40px;
margin-left: 290px;
cursor: pointer;
width: 60px;
color: #449284;
}
.tip-text {
margin-top: -40px;
margin-left: 380px;
width: 260px;
color: red;
}
.el-upload-list {
display: none;
}
.table-empty {
img {
width: 100px;
}
p {
margin-top: -50px;
}
}
.user-select{
display: inline-block;
height: auto;
padding: 5px 10px;
border: 1px solid #ccc;
border-radius: 4px;
.select-btn{
display: inline-block;
font-size: 14px;
padding: 5px;
border-radius: 4px;
background: #449284 !important;
border: 1px solid #449284 !important;
color: #FFF;
cursor: pointer;
}
.numbers{
font-size: 14px;
margin-left: 10px;
display: inline-block;
.choosed{
color: #449284;
}
}
}
.user-choose-modal{
.el-form-item__label{
width: 120px;
font-size: 14px;
}
.select-choose{
width: 150px;
}
.block-item{
display: block;
}
.user-number{
margin: 40px auto 0;
text-align: center;
width: 70%;
height:34px;
line-height: 34px;
border-radius: 4px;
border: 1px solid #DCDFE6;
.title{
display: inline-block;
}
.number{
display: inline-block;
margin-left: 50px;
.target-num{
padding: 7px;
}
.choosed{
color: #449284;
}
}
}
.click-refresh-tips{
text-align: center;
margin: 5px auto 20px;
height: 20px;
color: #e6a23c;
}
.user-choose-submit{
margin: 0 auto;
display: block;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="create-push">
<div class="create-protocol">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<div class="header-title"></div>
<!-- <div class="header-title"></div> -->
<el-form
:model="ruleForm"
:rules="rules"
......@@ -10,90 +10,23 @@
label-width="100px"
class="ruleForm"
>
<el-form-item label="推送应用" prop="resource">
<el-radio-group v-model="ruleForm.appId">
<el-radio label="yunqueyi">云鹊医app</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="目标人群" prop="people">
<el-col :span="24">
<el-radio-group v-model="ruleForm.isAll" @change="handleTargetChoose">
<el-radio :label="1">全部</el-radio>
<el-radio :label="2">导入推送名单</el-radio>
<el-radio :label="3">用户筛选</el-radio>
<div class="user-select" v-if="ruleForm.isAll == 3">
<div class="select-btn" @click="showUserChooseModal">选择用户名单</div>
<div class="numbers"><span class="choosed">{{userChooseCount}}</span> | {{allUserCount}}</div>
</div>
</el-radio-group>
</el-col>
<!-- <el-col :span="14">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-col> -->
</el-form-item>
<el-form-item label="">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-form-item>
<el-form-item label="推送标题" prop="title">
<el-input v-model="ruleForm.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="推送介绍" prop="content">
<el-input type="textarea" maxlength="60" :rows="3" v-model="ruleForm.content" show-word-limit></el-input>
</el-form-item>
<el-form-item label="页面去向" prop="url">
<el-input type="textarea" :rows="3" v-model="ruleForm.url" maxlength="250" placeholder="H5链接" show-word-limit></el-input>
</el-form-item>
<el-form-item label="系统通知" prop="noticeFlag">
<el-radio-group v-model="ruleForm.noticeFlag">
<el-radio :label="2"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
<el-form-item>
<el-button size="small" class="user-choose-submit right" style="margin-left:20px;" type="default" @click="goBack">取消</el-button>
<el-button size="small" class="user-choose-submit right" type="primary" @click="submitForm('ruleForm')">{{btnText}}</el-button>
</el-form-item>
<el-form-item label="APP接收窗口" prop="pushType">
<el-radio-group v-model="ruleForm.pushType">
<el-radio label="03">活动提醒</el-radio>
<el-radio label="04">内容提醒</el-radio>
<el-radio label="02">居民管理</el-radio>
<el-radio label="01">系统消息</el-radio>
<el-radio label="05">直播</el-radio>
</el-radio-group>
<el-form-item label="协议标题" prop="protocolName">
<el-input size="small" v-model="ruleForm.protocolName" maxlength="50" style="widht:200px;" show-word-limit></el-input>
<!-- <el-input v-model="ruleForm.protocolName" maxlength="30" show-word-limit></el-input> -->
</el-form-item>
<el-form-item label="协议内容" class="editor-required">
<textarea v-model="ruleForm.content" id="editor">
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">提交预览</el-button>
</textarea>
<p v-show="needShowValidTips" class="valid-content">请输入协议内容</p>
</el-form-item>
</el-form>
<el-dialog title="推送预览" :visible.sync="dialogFormVisible">
<!-- <el-dialog title="推送预览" :visible.sync="dialogFormVisible">
<div>
<span>主题: {{ ruleForm.title }} </span>
<p style="display: inline-block; float: right;">
......@@ -115,7 +48,6 @@
<el-form-item label="推送介绍:" >
<p style="white-space: pre-line">{{ ruleForm.content }}</p>
</el-form-item>
<!-- <p style="white-space: pre-line">{{ ruleForm.content }}</p> -->
<el-form-item label="页面去向:" >
{{ ruleForm.url }}
</el-form-item>
......@@ -127,96 +59,15 @@
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="pushSend()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="用户筛选" :visible.sync="isUserChooseModalShow" class="user-choose-modal">
<el-form :inline="true" :model="userChooseForm">
<el-form-item label="行政区划:">
<el-select
class="select-choose"
v-model="finalChooseData.provinceId" placeholder="省"
@change="handleProvinceChange(finalChooseData.provinceId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.provinceList"
:key="item.provinceId"
:label="item.provinceName"
:value="item.provinceId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.cityId" placeholder="市"
@change="handleCityChange(finalChooseData.cityId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.cityList"
:key="item.cityId"
:label="item.cityName"
:value="item.cityId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.countyId" placeholder="区"
@change="handleCountyChange"
clearable
>
<el-option
v-for="item in userChooseForm.address.countyList"
:key="item.countyId"
:label="item.countyName"
:value="item.countyId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="技术职称:" class="block-item">
<el-select v-model="finalChooseData.doctorTitle" multiple placeholder="不限" @change="handleDoctorTitleChange">
<el-option
v-for="item in userChooseForm.techTitleList"
:key="item.titleId"
:label="item.name"
:value="item.titleId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属机构等级:" class="block-item">
<el-select v-model="finalChooseData.hospitalLevel" multiple placeholder="不限" @change="handleHospitalLevelChange">
<el-option
v-for="item in userChooseForm.hospitalLevelList"
:key="item.no"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
<div class="user-number">
<p class="title">目标用户 | 用户总量</p>
<p class="number">
<el-button v-if="!isSeeUserNumBtnClicked" class="target-num" type="primary" @click="getCurrentUserCount" size="mini">查看目标数</el-button>
<template v-else>
<span class="choosed">{{userChooseCount}}</span> <el-button class="target-num" type="primary" @click="getCurrentUserCount" size="mini">刷新目标数</el-button>
</template>
| {{allUserCount}}
</p>
</div>
<p class="click-refresh-tips" >
<template v-if="isSeeUserNumBtnClicked">筛选条件变更后,需重新点击"刷新目标数"按钮获取最新数据</template></p>
<el-button class="user-choose-submit" type="primary" @click="handleChooseSubmit">确认筛选</el-button>
</el-form>
</el-dialog>
</el-dialog> -->
</div>
</div>
</template>
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain";
import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import axios from 'axios';
import { getBaseUrl , getExcel } from '@/utils/index';
let editor = null;
let vm = null;
export default {
components: {
......@@ -224,357 +75,145 @@ export default {
},
data() {
return {
// curmbFirst: "APP推送",
// curmbSecond: "创建APP推送",
curmbFirst: "创建APP推送",
curmbFirst: "新建协议",
btnText: "创建完成",
ruleForm: {
appId: "yunqueyi",
isAll: 1,
title: "",
protocolName: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
},
actionUrl: getBaseUrl('raytheon/excel/upload'),
fileName: '',
objNum: 0,
sendKey: '',
dialogFormVisible: false,
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
rules: {
appId: [
{ required: true, message: "请选择推送应用", trigger: "change" }
],
title: [
{ required: true, message: "请输入推送标题", trigger: "blur" },
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" }
protocolName: [
{ required: true, message: "请输入协议标题", trigger: "blur" },
{ min: 1, max: 50, message: "长度在 1 到 50 个字符", trigger: "blur" }
],
content: [
{ required: true, message: "请输入推送介绍", trigger: "blur" },
{ min: 0, max: 250, message: "长度在 0 到 250 个字符", trigger: "blur" }
]
},
isUserChooseModalShow: false,
userChooseCount: 0, // 用户筛选的最终num
allUserCount: 0, // 总num
userChooseForm: {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
},
finalChooseData: {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
},
isSeeUserNumBtnClicked: false,
// content: [
// { required: true, message: "请输入推送介绍", trigger: "blur" },
// { min: 0, max: 250, message: "长度在 0 到 250 个字符", trigger: "blur" }
// ]
},
needShowValidTips: false,
isUpdate: false,
protocolId: 0
};
},
computed: {
...mapGetters(["_token"])
// ...mapGetters(["_token"])
},
created() {
vm = this;
vm.idType = localStorage.getItem("storageIdType");
console.log("idType:", vm.idType);
this.isUpdate = this.$route.query && this.$route.query.isUpdate || this.isUpdate;
this.protocolId = this.$route.query && this.$route.query.protocolId || 0;
this.btnText = this.isUpdate ? '更新版本' : '创建完成';
this.curmbFirst = this.isUpdate ? '更新协议' : '新建协议';
// vm.idType = localStorage.getItem("storageIdType");
// console.log("idType:", vm.idType);
},
// 挂载到Dom完成时
mounted: function() {
// commonUtil.resizeHeight();
CKEDITOR.replace( 'editor' );
if(this.isUpdate) { // 只在修改时监听富文本的Ready事件
CKEDITOR.on('instanceReady', function (event) {
editor = event.editor;
// editor.execCommand("toolbarCollapse");
// editor.setReadOnly(true); //只读
// 获取数据
vm.getProtocolDetailById(vm.protocolId);
});
}
},
methods: {
// 返回到列表页面
goBack() {
this.$router.push({
path: '/protocol-list'
})
},
submitForm(formName) {
if(this.ruleForm.isAll == 3 && this.userChooseCount == 0){
vm.$message('请先选择用户');
return;
}
// if(this.ruleForm.isAll == 3 && this.userChooseCount == 0){
// vm.$message('请先选择用户');
// return;
// }
editor = editor || CKEDITOR.instances.editor;
this.$refs[formName].validate((valid) => {
if (valid) {
// vm.pushSend();
if(vm.ruleForm.isAll == 2) {
if(vm.fileName == '') {
vm.$message('请先导入名单');
// let val = CKEDITOR.instances.editor.getData();
let val = editor.getData();
if(!val) {
valid = false
this.needShowValidTips = true;
setTimeout(() => {
this.needShowValidTips = false;
}, 10000);
// return;
} else {
vm.dialogFormVisible = true;
this.needShowValidTips = false;
}
} else {
vm.dialogFormVisible = true;
if (valid) {
this.ruleForm.content = val;
if(this.isUpdate) { // 修改协议时传协议ID(protocolId)
this.ruleForm.protocolId = this.protocolId
}
this.addOrUpdateProtocol(this.ruleForm)
} else {
console.log('error submit!!');
return false;
}
});
},
pushSend() {
let req = {};
req = this.ruleForm;
if(req.isAll == 2 || req.isAll == 3) {
req.key = vm.sendKey;
}
req.createdName = localStorage.getItem('user_name');
// openLoading(vm);
vm.POST("raytheon/push/send", req).then(res => {
// closeLoading(vm);
vm.$message(res.message);
if(res.code == '000000') {
vm.ruleForm = {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
};
}
});
vm.dialogFormVisible = false;
vm.fileName = '';
vm.sendKey = '';
},
download() {
let xlsxUrl = getExcel();
console.log('下载模板'+xlsxUrl);
setTimeout(() => {
window.open(xlsxUrl);
}, 500);
},
beforeUpload(file) {
// console.log(file);
let self = this;
const isLt = file.size / 1024 / 1024 < 10;
if(!isLt) {
this.$message.error("文件大小不能超过10M");
return;
} else {
vm.fileName = file.name;
}
},
httpRequest (options) {
// console.log(options,options.file)
let file = options.file
let reader = new FileReader()
if (file) {
reader.readAsDataURL(file)
}
reader.onload = (e) => {
let base64Str = e.target.result.split(',')[1]
// console.log('e的值',e);
// let base64Str = e.target.result.substr(e.target.result.indexOf("base64,") + 7)
// vm.POST("raytheon/excel/upload", base64Str).then(res => {
// console.log(res);
// })
openLoading(vm);
axios({
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
'content-type': 'text/html'
},
url: getBaseUrl('raytheon/excel/upload'),
method: 'post',
data: base64Str,
}).then(function (response) {
// console.log(response);
closeLoading(vm);
vm.objNum = response.data.data.count;
vm.sendKey = response.data.data.key;
console.log('vm.objNum ',vm.objNum);
})
}
},
handleTargetChoose() {
if( this.ruleForm.isAll == 3 ){
// 初始化
this.isSeeUserNumBtnClicked = false;
this.userChooseCount = 0;
this.allUserCount = 0;
this.userChooseForm = {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
};
this.finalChooseData = {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
};
// 获取总数量
this.getCurrentUserCount({ getAll: true });
}
},
getCurrentUserCount(params) {
if(!(params && params.getAll)){
if(this.finalChooseData.provinceId == ''
&& this.finalChooseData.cityId == ''
&& this.finalChooseData.countyId == ''
&& this.finalChooseData.doctorTitle.length == 0
&& this.finalChooseData.hospitalLevel.length == 0
){
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = 0;
return;
}
}
openLoading(vm, 'topIndex');
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUserCount", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
if(params && params.getAll){
this.allUserCount = res.data;
}else{
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = res.data;
}
}else{
vm.$message.info(res.message)
}
// 新增或修改协议
addOrUpdateProtocol(params) {
openLoading(this);
vm.PUT("/smartcontract/protocolManage/protocol", params).then(res => {
closeLoading(this);
if(res && res.code && res.code == '000000'){
// if( res && res.data ){
// // this.tableData = res.data;
// }
this.$message({
message: '操作成功',
type: 'success'
});
},
showUserChooseModal() {
this.isUserChooseModalShow = true;
this.getProvinceList();
this.getTechTitleList();
this.getHospitalLevelList();
},
getProvinceList() {
let req = {};
openLoading(vm);
vm.GET("raytheon/constants/region", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.provinceList = res.data.provinceList;
this.$router.push({
path: '/protocol-list'
})
}else{
vm.$message.info(res.message)
}
this.$message({
message: '接口请求失败',
type: 'warning'
});
},
getCityList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.cityList = res.data.cityList;
}else{
vm.$message.info(res.message)
}
});
},
getCountyList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.countyList = res.data.countyList;
}else{
vm.$message.info(res.message)
// 根据协议ID获取协议详情
getProtocolDetailById(protocolId) {
vm.GET("/smartcontract/protocolManage/protocol", {protocolId: protocolId}).then(res => {
if(res && res.code && res.code == '000000'){
if( res && res.data ){
vm.ruleForm.protocolName = res.data.protocolName;
vm.ruleForm.content = res.data.contents;
editor.setData(res.data.contents);
}
});
},
handleProvinceChange(id) {
this.finalChooseData.cityId = '';
this.finalChooseData.countyId = '';
// 清空省,则移除市、区列表
if( id == '' ){
this.userChooseForm.address.cityList = [];
this.userChooseForm.address.countyList = [];
return;
}
let params = { provinceId: id };
this.getCityList(params);
// this.getCurrentUserCount();
},
handleCityChange(id) {
this.finalChooseData.countyId = '';
// 清空市,则移除区列表
if( id == '' ){
this.userChooseForm.address.countyList = [];
return;
}
let params = { cityId: id };
this.getCountyList(params);
// this.getCurrentUserCount();
},
handleCountyChange() {
// this.getCurrentUserCount();
},
handleDoctorTitleChange() {
// this.getCurrentUserCount();
},
handleHospitalLevelChange() {
// this.getCurrentUserCount();
},
getTechTitleList() {
openLoading(vm);
vm.GET("raytheon/constants/doctor/title", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.techTitleList = res.data;
}else{
vm.$message.info(res.message)
}
vm.$message({
message: '接口请求失败',
type: 'warning'
});
},
getHospitalLevelList() {
openLoading(vm);
vm.GET("raytheon/constants/hospital/level", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.hospitalLevelList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
// 确认筛选
handleChooseSubmit() {
this.getCurrentUserCount();
openLoading(vm);
vm.sendKey = '';
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUser", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
vm.isUserChooseModalShow = false;
vm.sendKey = res.data;
}else{
vm.$message.info(res.message)
}
});
},
}
};
</script>
<style lang="scss">
.topIndex{
z-index: 10000 !important;
}
.create-push {
.create-protocol {
.component-content {
margin-top: 20px;
margin-top: 80px;
padding: 10px;
background: #fff;
.header-title {
......@@ -699,4 +338,16 @@ export default {
}
}
.valid-content {
color:#F56C6C;
font-size: 12px;
line-height: 26px;
}
.editor-required {
label::before {
content: '*';
color: #F56C6C;
margin-right: 4px;
}
}
</style>
\ No newline at end of file
<template>
<div class="create-protocol">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<!-- <div class="header-title"></div> -->
<el-form
:model="ruleForm"
ref="ruleForm"
label-width="100px"
class="ruleForm"
>
<el-form-item>
<el-button size="small" class="user-choose-submit right" style="margin-left:20px;" type="default" @click="goBack()">返回</el-button>
</el-form-item>
<el-form-item label="协议标题" >
{{ruleForm.protocolName}}
</el-form-item>
<el-form-item label="协议内容">
<div v-html="ruleForm.content"></div>
<!-- <textarea v-model="ruleForm.content" id="detailEditor">
</textarea> -->
</el-form-item>
<el-form-item label="签署居民数量">
{{ruleForm.signNum}}
</el-form-item>
<el-form-item label="创建人">
{{ruleForm.createdName}}
</el-form-item>
<el-form-item label="创建时间">
{{ruleForm.createTime}}
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import { openLoading, closeLoading } from "../../utils/utils";
let detailEditor = null;
let vm = null;
export default {
components: {
BreadCrumb
},
data() {
return {
curmbFirst: '查看协议',
ruleForm: {
protocolName: '',
content: '',
signNum: '',
createdName: '',
createTime: '',
},
isUpdate: false,
protocolId: 0
};
},
computed: {
// ...mapGetters(['_token'])
},
created() {
vm = this;
this.isUpdate = this.$route.query && this.$route.query.isUpdate || this.isUpdate;
this.protocolId = this.$route.query && this.$route.query.protocolId || 0;
// vm.idType = localStorage.getItem("storageIdType");
// console.log("idType:", vm.idType);
},
// 挂载到Dom完成时
mounted: function() {
vm.getProtocolDetailById(vm.protocolId);
// commonUtil.resizeHeight();
// CKEDITOR.replace( 'detailEditor' );
// if(this.isUpdate) { // 只在修改时监听富文本的Ready事件
// CKEDITOR.on('instanceReady', function (event) {
// detailEditor = event.editor;
// detailEditor.execCommand("toolbarCollapse");
// detailEditor.setReadOnly(true); //只读
// // 获取数据
// vm.getProtocolDetailById(vm.protocolId);
// });
// }
},
methods: {
// 根据协议ID获取协议详情
getProtocolDetailById(protocolId) {
vm.GET("/smartcontract/protocolManage/protocol", {protocolId: protocolId}).then(res => {
if(res && res.code && res.code == '000000'){
if( res && res.data ){
vm.ruleForm.protocolName = res.data.protocolName;
vm.ruleForm.content = res.data.contents;
vm.ruleForm.signNum = res.data.signNum;
vm.ruleForm.createdName = res.data.createdName;
vm.ruleForm.createTime = res.data.createTime;
detailEditor.setData(res.data.contents);
}
}else{
vm.$message({
message: '接口请求失败',
type: 'warning'
});
}
});
},
goBack() {
this.$router.push({
path: '/protocol-list'
})
}
},
};
</script>
<style lang="scss">
.topIndex{
z-index: 10000 !important;
}
.create-protocol {
.component-content {
margin-top: 80px;
padding: 10px;
background: #fff;
.header-title {
padding: 10px 12px;
font-size: 12px;
color: #449284;
border-bottom: 1px solid #efefef;
}
.ruleForm {
width: 70%;
margin-left: 50px;
}
.rule-form {
margin-top: 20px;
margin-left: 30px;
.el-form-item__content {
font-size: 12px;
}
}
.update-input {
width: 200px;
}
.update-item {
/* float: left; */
margin-right: 5px;
}
.el-upload__tip {
// margin-top: -10px;
// margin-left: 205px;
margin-top: -40px;
margin-left: 290px;
cursor: pointer;
width: 60px;
color: #449284;
}
.tip-text {
margin-top: -40px;
margin-left: 380px;
width: 260px;
color: red;
}
.el-upload-list {
display: none;
}
.table-empty {
img {
width: 100px;
}
p {
margin-top: -50px;
}
}
.user-select{
display: inline-block;
height: auto;
padding: 5px 10px;
border: 1px solid #ccc;
border-radius: 4px;
.select-btn{
display: inline-block;
font-size: 14px;
padding: 5px;
border-radius: 4px;
background: #449284 !important;
border: 1px solid #449284 !important;
color: #FFF;
cursor: pointer;
}
.numbers{
font-size: 14px;
margin-left: 10px;
display: inline-block;
.choosed{
color: #449284;
}
}
}
.user-choose-modal{
.el-form-item__label{
width: 120px;
font-size: 14px;
}
.select-choose{
width: 150px;
}
.block-item{
display: block;
}
.user-number{
margin: 40px auto 0;
text-align: center;
width: 70%;
height:34px;
line-height: 34px;
border-radius: 4px;
border: 1px solid #DCDFE6;
.title{
display: inline-block;
}
.number{
display: inline-block;
margin-left: 50px;
.target-num{
padding: 7px;
}
.choosed{
color: #449284;
}
}
}
.click-refresh-tips{
text-align: center;
margin: 5px auto 20px;
height: 20px;
color: #e6a23c;
}
.user-choose-submit{
margin: 0 auto;
display: block;
}
}
}
}
.valid-content {
color:#F56C6C;
font-size: 12px;
line-height: 26px;
}
</style>
\ No newline at end of file
<template>
<div class="create-push">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<div class="header-title"></div>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="ruleForm"
>
<el-form-item label="推送应用" prop="resource">
<el-radio-group v-model="ruleForm.appId">
<el-radio label="yunqueyi">云鹊医app</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="目标人群" prop="people">
<el-col :span="24">
<el-radio-group v-model="ruleForm.isAll" @change="handleTargetChoose">
<el-radio :label="1">全部</el-radio>
<el-radio :label="2">导入推送名单</el-radio>
<el-radio :label="3">用户筛选</el-radio>
<div class="user-select" v-if="ruleForm.isAll == 3">
<div class="select-btn" @click="showUserChooseModal">选择用户名单</div>
<div class="numbers"><span class="choosed">{{userChooseCount}}</span> | {{allUserCount}}</div>
</div>
</el-radio-group>
</el-col>
<!-- <el-col :span="14">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-col> -->
</el-form-item>
<el-form-item label="">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-form-item>
<el-form-item label="推送标题" prop="title">
<el-input v-model="ruleForm.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="推送介绍" prop="content">
<el-input type="textarea" maxlength="60" :rows="3" v-model="ruleForm.content" show-word-limit></el-input>
</el-form-item>
<el-form-item label="页面去向" prop="url">
<el-input type="textarea" :rows="3" v-model="ruleForm.url" maxlength="250" placeholder="H5链接" show-word-limit></el-input>
</el-form-item>
<el-form-item label="系统通知" prop="noticeFlag">
<el-radio-group v-model="ruleForm.noticeFlag">
<el-radio :label="2"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="APP接收窗口" prop="pushType">
<el-radio-group v-model="ruleForm.pushType">
<el-radio label="03">活动提醒</el-radio>
<el-radio label="04">内容提醒</el-radio>
<el-radio label="02">居民管理</el-radio>
<el-radio label="01">系统消息</el-radio>
<el-radio label="05">直播</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">提交预览</el-button>
</el-form-item>
</el-form>
<el-dialog title="推送预览" :visible.sync="dialogFormVisible">
<div>
<span>主题: {{ ruleForm.title }} </span>
<p style="display: inline-block; float: right;">
<span style="margin-left: 0px">目标对象:</span>
<span v-if="ruleForm.isAll == 2" style="color: #449284"> {{ objNum }} </span>
<span v-if="ruleForm.isAll == 3" style="color: #449284"> {{ userChooseCount }} </span>
<span v-else>全部</span>
</p>
</div>
<hr>
<el-form :model="ruleForm" class="rule-form">
<el-form-item label="APP推送:" >
云鹊医
</el-form-item>
<el-form-item label="推送标题:" >
{{ ruleForm.title }}
</el-form-item>
<el-form-item label="推送介绍:" >
<p style="white-space: pre-line">{{ ruleForm.content }}</p>
</el-form-item>
<!-- <p style="white-space: pre-line">{{ ruleForm.content }}</p> -->
<el-form-item label="页面去向:" >
{{ ruleForm.url }}
</el-form-item>
<el-form-item label="系统通知:" >
{{ ruleForm.noticeFlag | getNotice }}
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="pushSend()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="用户筛选" :visible.sync="isUserChooseModalShow" class="user-choose-modal">
<el-form :inline="true" :model="userChooseForm">
<el-form-item label="行政区划:">
<el-select
class="select-choose"
v-model="finalChooseData.provinceId" placeholder="省"
@change="handleProvinceChange(finalChooseData.provinceId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.provinceList"
:key="item.provinceId"
:label="item.provinceName"
:value="item.provinceId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.cityId" placeholder="市"
@change="handleCityChange(finalChooseData.cityId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.cityList"
:key="item.cityId"
:label="item.cityName"
:value="item.cityId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.countyId" placeholder="区"
@change="handleCountyChange"
clearable
>
<el-option
v-for="item in userChooseForm.address.countyList"
:key="item.countyId"
:label="item.countyName"
:value="item.countyId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="技术职称:" class="block-item">
<el-select v-model="finalChooseData.doctorTitle" multiple placeholder="不限" @change="handleDoctorTitleChange">
<el-option
v-for="item in userChooseForm.techTitleList"
:key="item.titleId"
:label="item.name"
:value="item.titleId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属机构等级:" class="block-item">
<el-select v-model="finalChooseData.hospitalLevel" multiple placeholder="不限" @change="handleHospitalLevelChange">
<el-option
v-for="item in userChooseForm.hospitalLevelList"
:key="item.no"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
<div class="user-number">
<p class="title">目标用户 | 用户总量</p>
<p class="number">
<el-button v-if="!isSeeUserNumBtnClicked" class="target-num" type="primary" @click="getCurrentUserCount" size="mini">查看目标数</el-button>
<template v-else>
<span class="choosed">{{userChooseCount}}</span> <el-button class="target-num" type="primary" @click="getCurrentUserCount" size="mini">刷新目标数</el-button>
</template>
| {{allUserCount}}
</p>
</div>
<p class="click-refresh-tips" >
<template v-if="isSeeUserNumBtnClicked">筛选条件变更后,需重新点击"刷新目标数"按钮获取最新数据</template></p>
<el-button class="user-choose-submit" type="primary" @click="handleChooseSubmit">确认筛选</el-button>
</el-form>
</el-dialog>
</div>
</div>
</template>
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain";
import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import axios from 'axios';
import { getBaseUrl , getExcel } from '@/utils/index';
let vm = null;
export default {
components: {
BreadCrumb
},
data() {
return {
// curmbFirst: "APP推送",
// curmbSecond: "创建APP推送",
curmbFirst: "创建APP推送",
ruleForm: {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
},
actionUrl: getBaseUrl('raytheon/excel/upload'),
fileName: '',
objNum: 0,
sendKey: '',
dialogFormVisible: false,
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
rules: {
appId: [
{ required: true, message: "请选择推送应用", trigger: "change" }
],
title: [
{ required: true, message: "请输入推送标题", trigger: "blur" },
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" }
],
content: [
{ required: true, message: "请输入推送介绍", trigger: "blur" },
{ min: 0, max: 250, message: "长度在 0 到 250 个字符", trigger: "blur" }
]
},
isUserChooseModalShow: false,
userChooseCount: 0, // 用户筛选的最终num
allUserCount: 0, // 总num
userChooseForm: {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
},
finalChooseData: {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
},
isSeeUserNumBtnClicked: false,
};
},
computed: {
...mapGetters(["_token"])
},
created() {
vm = this;
vm.idType = localStorage.getItem("storageIdType");
console.log("idType:", vm.idType);
},
// 挂载到Dom完成时
mounted: function() {
// commonUtil.resizeHeight();
},
methods: {
submitForm(formName) {
if(this.ruleForm.isAll == 3 && this.userChooseCount == 0){
vm.$message('请先选择用户');
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
// vm.pushSend();
if(vm.ruleForm.isAll == 2) {
if(vm.fileName == '') {
vm.$message('请先导入名单');
} else {
vm.dialogFormVisible = true;
}
} else {
vm.dialogFormVisible = true;
}
} else {
console.log('error submit!!');
return false;
}
});
},
pushSend() {
let req = {};
req = this.ruleForm;
if(req.isAll == 2 || req.isAll == 3) {
req.key = vm.sendKey;
}
req.createdName = localStorage.getItem('user_name');
// openLoading(vm);
vm.POST("raytheon/push/send", req).then(res => {
// closeLoading(vm);
vm.$message(res.message);
if(res.code == '000000') {
vm.ruleForm = {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
};
}
});
vm.dialogFormVisible = false;
vm.fileName = '';
vm.sendKey = '';
},
download() {
let xlsxUrl = getExcel();
console.log('下载模板'+xlsxUrl);
setTimeout(() => {
window.open(xlsxUrl);
}, 500);
},
beforeUpload(file) {
// console.log(file);
let self = this;
const isLt = file.size / 1024 / 1024 < 10;
if(!isLt) {
this.$message.error("文件大小不能超过10M");
return;
} else {
vm.fileName = file.name;
}
},
httpRequest (options) {
// console.log(options,options.file)
let file = options.file
let reader = new FileReader()
if (file) {
reader.readAsDataURL(file)
}
reader.onload = (e) => {
let base64Str = e.target.result.split(',')[1]
// console.log('e的值',e);
// let base64Str = e.target.result.substr(e.target.result.indexOf("base64,") + 7)
// vm.POST("raytheon/excel/upload", base64Str).then(res => {
// console.log(res);
// })
openLoading(vm);
axios({
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
'content-type': 'text/html'
},
url: getBaseUrl('raytheon/excel/upload'),
method: 'post',
data: base64Str,
}).then(function (response) {
// console.log(response);
closeLoading(vm);
vm.objNum = response.data.data.count;
vm.sendKey = response.data.data.key;
console.log('vm.objNum ',vm.objNum);
})
}
},
handleTargetChoose() {
if( this.ruleForm.isAll == 3 ){
// 初始化
this.isSeeUserNumBtnClicked = false;
this.userChooseCount = 0;
this.allUserCount = 0;
this.userChooseForm = {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
};
this.finalChooseData = {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
};
// 获取总数量
this.getCurrentUserCount({ getAll: true });
}
},
getCurrentUserCount(params) {
if(!(params && params.getAll)){
if(this.finalChooseData.provinceId == ''
&& this.finalChooseData.cityId == ''
&& this.finalChooseData.countyId == ''
&& this.finalChooseData.doctorTitle.length == 0
&& this.finalChooseData.hospitalLevel.length == 0
){
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = 0;
return;
}
}
openLoading(vm, 'topIndex');
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUserCount", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
if(params && params.getAll){
this.allUserCount = res.data;
}else{
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = res.data;
}
}else{
vm.$message.info(res.message)
}
});
},
showUserChooseModal() {
this.isUserChooseModalShow = true;
this.getProvinceList();
this.getTechTitleList();
this.getHospitalLevelList();
},
getProvinceList() {
let req = {};
openLoading(vm);
vm.GET("raytheon/constants/region", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.provinceList = res.data.provinceList;
}else{
vm.$message.info(res.message)
}
});
},
getCityList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.cityList = res.data.cityList;
}else{
vm.$message.info(res.message)
}
});
},
getCountyList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.countyList = res.data.countyList;
}else{
vm.$message.info(res.message)
}
});
},
handleProvinceChange(id) {
this.finalChooseData.cityId = '';
this.finalChooseData.countyId = '';
// 清空省,则移除市、区列表
if( id == '' ){
this.userChooseForm.address.cityList = [];
this.userChooseForm.address.countyList = [];
return;
}
let params = { provinceId: id };
this.getCityList(params);
// this.getCurrentUserCount();
},
handleCityChange(id) {
this.finalChooseData.countyId = '';
// 清空市,则移除区列表
if( id == '' ){
this.userChooseForm.address.countyList = [];
return;
}
let params = { cityId: id };
this.getCountyList(params);
// this.getCurrentUserCount();
},
handleCountyChange() {
// this.getCurrentUserCount();
},
handleDoctorTitleChange() {
// this.getCurrentUserCount();
},
handleHospitalLevelChange() {
// this.getCurrentUserCount();
},
getTechTitleList() {
openLoading(vm);
vm.GET("raytheon/constants/doctor/title", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.techTitleList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
getHospitalLevelList() {
openLoading(vm);
vm.GET("raytheon/constants/hospital/level", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.hospitalLevelList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
// 确认筛选
handleChooseSubmit() {
this.getCurrentUserCount();
openLoading(vm);
vm.sendKey = '';
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUser", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
vm.isUserChooseModalShow = false;
vm.sendKey = res.data;
}else{
vm.$message.info(res.message)
}
});
},
}
};
</script>
<style lang="scss">
.topIndex{
z-index: 10000 !important;
}
.create-push {
.component-content {
margin-top: 20px;
padding: 10px;
background: #fff;
.header-title {
padding: 10px 12px;
font-size: 12px;
color: #449284;
border-bottom: 1px solid #efefef;
}
.ruleForm {
width: 70%;
margin-left: 50px;
}
.rule-form {
margin-top: 20px;
margin-left: 30px;
.el-form-item__content {
font-size: 12px;
}
}
.update-input {
width: 200px;
}
.update-item {
/* float: left; */
margin-right: 5px;
}
.el-upload__tip {
// margin-top: -10px;
// margin-left: 205px;
margin-top: -40px;
margin-left: 290px;
cursor: pointer;
width: 60px;
color: #449284;
}
.tip-text {
margin-top: -40px;
margin-left: 380px;
width: 260px;
color: red;
}
.el-upload-list {
display: none;
}
.table-empty {
img {
width: 100px;
}
p {
margin-top: -50px;
}
}
.user-select{
display: inline-block;
height: auto;
padding: 5px 10px;
border: 1px solid #ccc;
border-radius: 4px;
.select-btn{
display: inline-block;
font-size: 14px;
padding: 5px;
border-radius: 4px;
background: #449284 !important;
border: 1px solid #449284 !important;
color: #FFF;
cursor: pointer;
}
.numbers{
font-size: 14px;
margin-left: 10px;
display: inline-block;
.choosed{
color: #449284;
}
}
}
.user-choose-modal{
.el-form-item__label{
width: 120px;
font-size: 14px;
}
.select-choose{
width: 150px;
}
.block-item{
display: block;
}
.user-number{
margin: 40px auto 0;
text-align: center;
width: 70%;
height:34px;
line-height: 34px;
border-radius: 4px;
border: 1px solid #DCDFE6;
.title{
display: inline-block;
}
.number{
display: inline-block;
margin-left: 50px;
.target-num{
padding: 7px;
}
.choosed{
color: #449284;
}
}
}
.click-refresh-tips{
text-align: center;
margin: 5px auto 20px;
height: 20px;
color: #e6a23c;
}
.user-choose-submit{
margin: 0 auto;
display: block;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="create-push">
<div class="create-protocol">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<div class="header-title"></div>
<!-- <div class="header-title"></div> -->
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="ruleForm"
>
<el-form-item label="推送应用" prop="resource">
<el-radio-group v-model="ruleForm.appId">
<el-radio label="yunqueyi">云鹊医app</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="目标人群" prop="people">
<el-col :span="24">
<el-radio-group v-model="ruleForm.isAll" @change="handleTargetChoose">
<el-radio :label="1">全部</el-radio>
<el-radio :label="2">导入推送名单</el-radio>
<el-radio :label="3">用户筛选</el-radio>
<div class="user-select" v-if="ruleForm.isAll == 3">
<div class="select-btn" @click="showUserChooseModal">选择用户名单</div>
<div class="numbers"><span class="choosed">{{userChooseCount}}</span> | {{allUserCount}}</div>
</div>
</el-radio-group>
</el-col>
<!-- <el-col :span="14">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-col> -->
</el-form-item>
<el-form-item label="">
<el-upload
v-if="ruleForm.isAll == 2"
class="upload-demo"
accept=".xlsx"
:action="actionUrl"
:headers = "headers"
v-model="fileName"
:http-request="httpRequest"
:before-upload="beforeUpload"
:disabled="ruleForm.isAll == 1"
>
<el-input class="update-input" placeholder="文件大小不能超过10M" :disabled="true" v-model="fileName" autocomplete="off"></el-input>
<el-button class="update-item" size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip" @click="download">模板.xlsx</div>
<div slot="tip" class="tip-text" >备注:单次任务建议不要超过10w行</div>
</el-upload>
</el-form-item>
<el-form-item label="推送标题" prop="title">
<el-input v-model="ruleForm.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="推送介绍" prop="content">
<el-input type="textarea" maxlength="60" :rows="3" v-model="ruleForm.content" show-word-limit></el-input>
</el-form-item>
<el-form-item label="页面去向" prop="url">
<el-input type="textarea" :rows="3" v-model="ruleForm.url" maxlength="250" placeholder="H5链接" show-word-limit></el-input>
</el-form-item>
<el-form-item label="系统通知" prop="noticeFlag">
<el-radio-group v-model="ruleForm.noticeFlag">
<el-radio :label="2"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="APP接收窗口" prop="pushType">
<el-radio-group v-model="ruleForm.pushType">
<el-radio label="03">活动提醒</el-radio>
<el-radio label="04">内容提醒</el-radio>
<el-radio label="02">居民管理</el-radio>
<el-radio label="01">系统消息</el-radio>
<el-radio label="05">直播</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">提交预览</el-button>
<el-button size="small" class="user-choose-submit right" style="margin-left:20px;" type="default" @click="goBack()">返回</el-button>
</el-form-item>
</el-form>
<el-dialog title="推送预览" :visible.sync="dialogFormVisible">
<div>
<span>主题: {{ ruleForm.title }} </span>
<p style="display: inline-block; float: right;">
<span style="margin-left: 0px">目标对象:</span>
<span v-if="ruleForm.isAll == 2" style="color: #449284"> {{ objNum }} </span>
<span v-if="ruleForm.isAll == 3" style="color: #449284"> {{ userChooseCount }} </span>
<span v-else>全部</span>
</p>
</div>
<hr>
<el-form :model="ruleForm" class="rule-form">
<el-form-item label="APP推送:" >
云鹊医
<el-form-item label="协议标题" >
<el-input size="small" v-model="ruleForm.protocolName" maxlength="50" disabled style="widht:200px;" show-word-limit></el-input>
<!-- <el-input v-model="ruleForm.protocolName" maxlength="30" show-word-limit></el-input> -->
</el-form-item>
<el-form-item label="推送标题:" >
{{ ruleForm.title }}
<el-form-item label="协议内容">
<textarea v-model="ruleForm.content" id="detailEditor">
</textarea>
</el-form-item>
<el-form-item label="推送介绍:" >
<p style="white-space: pre-line">{{ ruleForm.content }}</p>
<el-form-item label="签署居民数量">
<el-input size="small" v-model="ruleForm.signNum" maxlength="50" disabled style="widht:200px;" show-word-limit></el-input>
</el-form-item>
<!-- <p style="white-space: pre-line">{{ ruleForm.content }}</p> -->
<el-form-item label="页面去向:" >
{{ ruleForm.url }}
<el-form-item label="创建人">
<el-input size="small" v-model="ruleForm.createdName" maxlength="50" disabled style="widht:200px;" show-word-limit></el-input>
</el-form-item>
<el-form-item label="系统通知:" >
{{ ruleForm.noticeFlag | getNotice }}
<el-form-item label="创建时间">
<el-input size="small" v-model="ruleForm.createTime" maxlength="50" disabled style="widht:200px;" show-word-limit></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="pushSend()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="用户筛选" :visible.sync="isUserChooseModalShow" class="user-choose-modal">
<el-form :inline="true" :model="userChooseForm">
<el-form-item label="行政区划:">
<el-select
class="select-choose"
v-model="finalChooseData.provinceId" placeholder="省"
@change="handleProvinceChange(finalChooseData.provinceId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.provinceList"
:key="item.provinceId"
:label="item.provinceName"
:value="item.provinceId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.cityId" placeholder="市"
@change="handleCityChange(finalChooseData.cityId)"
clearable
>
<el-option
v-for="item in userChooseForm.address.cityList"
:key="item.cityId"
:label="item.cityName"
:value="item.cityId">
</el-option>
</el-select>
<el-select
class="select-choose"
v-model="finalChooseData.countyId" placeholder="区"
@change="handleCountyChange"
clearable
>
<el-option
v-for="item in userChooseForm.address.countyList"
:key="item.countyId"
:label="item.countyName"
:value="item.countyId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="技术职称:" class="block-item">
<el-select v-model="finalChooseData.doctorTitle" multiple placeholder="不限" @change="handleDoctorTitleChange">
<el-option
v-for="item in userChooseForm.techTitleList"
:key="item.titleId"
:label="item.name"
:value="item.titleId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属机构等级:" class="block-item">
<el-select v-model="finalChooseData.hospitalLevel" multiple placeholder="不限" @change="handleHospitalLevelChange">
<el-option
v-for="item in userChooseForm.hospitalLevelList"
:key="item.no"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
<div class="user-number">
<p class="title">目标用户 | 用户总量</p>
<p class="number">
<el-button v-if="!isSeeUserNumBtnClicked" class="target-num" type="primary" @click="getCurrentUserCount" size="mini">查看目标数</el-button>
<template v-else>
<span class="choosed">{{userChooseCount}}</span> <el-button class="target-num" type="primary" @click="getCurrentUserCount" size="mini">刷新目标数</el-button>
</template>
| {{allUserCount}}
</p>
</div>
<p class="click-refresh-tips" >
<template v-if="isSeeUserNumBtnClicked">筛选条件变更后,需重新点击"刷新目标数"按钮获取最新数据</template></p>
<el-button class="user-choose-submit" type="primary" @click="handleChooseSubmit">确认筛选</el-button>
</el-form>
</el-dialog>
</div>
</div>
</template>
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain";
import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import axios from 'axios';
import { getBaseUrl , getExcel } from '@/utils/index';
let detailEditor = null;
let vm = null;
export default {
components: {
......@@ -224,357 +45,78 @@ export default {
},
data() {
return {
// curmbFirst: "APP推送",
// curmbSecond: "创建APP推送",
curmbFirst: "创建APP推送",
curmbFirst: '查看协议',
ruleForm: {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
},
actionUrl: getBaseUrl('raytheon/excel/upload'),
fileName: '',
objNum: 0,
sendKey: '',
dialogFormVisible: false,
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
rules: {
appId: [
{ required: true, message: "请选择推送应用", trigger: "change" }
],
title: [
{ required: true, message: "请输入推送标题", trigger: "blur" },
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" }
],
content: [
{ required: true, message: "请输入推送介绍", trigger: "blur" },
{ min: 0, max: 250, message: "长度在 0 到 250 个字符", trigger: "blur" }
]
},
isUserChooseModalShow: false,
userChooseCount: 0, // 用户筛选的最终num
allUserCount: 0, // 总num
userChooseForm: {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
},
finalChooseData: {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
},
isSeeUserNumBtnClicked: false,
protocolName: '',
content: '',
signNum: '',
createdName: '',
createTime: '',
},
isUpdate: false,
protocolId: 0
};
},
computed: {
...mapGetters(["_token"])
// ...mapGetters(['_token'])
},
created() {
vm = this;
vm.idType = localStorage.getItem("storageIdType");
console.log("idType:", vm.idType);
this.isUpdate = this.$route.query && this.$route.query.isUpdate || this.isUpdate;
this.protocolId = this.$route.query && this.$route.query.protocolId || 0;
// vm.idType = localStorage.getItem("storageIdType");
// console.log("idType:", vm.idType);
},
// 挂载到Dom完成时
mounted: function() {
// commonUtil.resizeHeight();
},
methods: {
submitForm(formName) {
if(this.ruleForm.isAll == 3 && this.userChooseCount == 0){
vm.$message('请先选择用户');
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
// vm.pushSend();
if(vm.ruleForm.isAll == 2) {
if(vm.fileName == '') {
vm.$message('请先导入名单');
} else {
vm.dialogFormVisible = true;
}
} else {
vm.dialogFormVisible = true;
}
} else {
console.log('error submit!!');
return false;
}
});
},
pushSend() {
let req = {};
req = this.ruleForm;
if(req.isAll == 2 || req.isAll == 3) {
req.key = vm.sendKey;
}
req.createdName = localStorage.getItem('user_name');
// openLoading(vm);
vm.POST("raytheon/push/send", req).then(res => {
// closeLoading(vm);
vm.$message(res.message);
if(res.code == '000000') {
vm.ruleForm = {
appId: "yunqueyi",
isAll: 1,
title: "",
content: "",
url: "",
noticeFlag: 2,
pushType: '03',
};
}
});
vm.dialogFormVisible = false;
vm.fileName = '';
vm.sendKey = '';
},
download() {
let xlsxUrl = getExcel();
console.log('下载模板'+xlsxUrl);
setTimeout(() => {
window.open(xlsxUrl);
}, 500);
},
beforeUpload(file) {
// console.log(file);
let self = this;
const isLt = file.size / 1024 / 1024 < 10;
if(!isLt) {
this.$message.error("文件大小不能超过10M");
return;
} else {
vm.fileName = file.name;
}
},
httpRequest (options) {
// console.log(options,options.file)
let file = options.file
let reader = new FileReader()
if (file) {
reader.readAsDataURL(file)
}
reader.onload = (e) => {
let base64Str = e.target.result.split(',')[1]
// console.log('e的值',e);
// let base64Str = e.target.result.substr(e.target.result.indexOf("base64,") + 7)
// vm.POST("raytheon/excel/upload", base64Str).then(res => {
// console.log(res);
// })
openLoading(vm);
axios({
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
'content-type': 'text/html'
},
url: getBaseUrl('raytheon/excel/upload'),
method: 'post',
data: base64Str,
}).then(function (response) {
// console.log(response);
closeLoading(vm);
vm.objNum = response.data.data.count;
vm.sendKey = response.data.data.key;
console.log('vm.objNum ',vm.objNum);
})
}
},
handleTargetChoose() {
if( this.ruleForm.isAll == 3 ){
// 初始化
this.isSeeUserNumBtnClicked = false;
this.userChooseCount = 0;
this.allUserCount = 0;
this.userChooseForm = {
address: {
provinceList: [],
cityList: [],
countyList: [],
},
techTitleList: [],
hospitalLevelList: [],
};
this.finalChooseData = {
provinceId: '',
cityId: '',
countyId: '',
doctorTitle: [],
hospitalLevel: [],
};
// 获取总数量
this.getCurrentUserCount({ getAll: true });
}
},
getCurrentUserCount(params) {
if(!(params && params.getAll)){
if(this.finalChooseData.provinceId == ''
&& this.finalChooseData.cityId == ''
&& this.finalChooseData.countyId == ''
&& this.finalChooseData.doctorTitle.length == 0
&& this.finalChooseData.hospitalLevel.length == 0
){
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = 0;
return;
}
}
openLoading(vm, 'topIndex');
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUserCount", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
if(params && params.getAll){
this.allUserCount = res.data;
}else{
this.isSeeUserNumBtnClicked = true;
this.userChooseCount = res.data;
}
}else{
vm.$message.info(res.message)
}
CKEDITOR.replace( 'detailEditor' );
if(this.isUpdate) { // 只在修改时监听富文本的Ready事件
CKEDITOR.on('instanceReady', function (event) {
detailEditor = event.editor;
detailEditor.execCommand("toolbarCollapse");
detailEditor.setReadOnly(true); //只读
// 获取数据
vm.getProtocolDetailById(vm.protocolId);
});
},
showUserChooseModal() {
this.isUserChooseModalShow = true;
this.getProvinceList();
this.getTechTitleList();
this.getHospitalLevelList();
},
getProvinceList() {
let req = {};
openLoading(vm);
vm.GET("raytheon/constants/region", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.provinceList = res.data.provinceList;
}else{
vm.$message.info(res.message)
}
});
},
getCityList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.cityList = res.data.cityList;
}else{
vm.$message.info(res.message)
}
});
},
getCountyList(params) {
openLoading(vm);
vm.GET("raytheon/constants/region", params).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.address.countyList = res.data.countyList;
}else{
vm.$message.info(res.message)
methods: {
// 根据协议ID获取协议详情
getProtocolDetailById(protocolId) {
vm.GET("/smartcontract/protocolManage/protocol", {protocolId: protocolId}).then(res => {
if(res && res.code && res.code == '000000'){
if( res && res.data ){
vm.ruleForm.protocolName = res.data.protocolName;
vm.ruleForm.content = res.data.contents;
vm.ruleForm.signNum = res.data.signNum;
vm.ruleForm.createdName = res.data.createdName;
vm.ruleForm.createTime = res.data.createTime;
detailEditor.setData(res.data.contents);
}
});
},
handleProvinceChange(id) {
this.finalChooseData.cityId = '';
this.finalChooseData.countyId = '';
// 清空省,则移除市、区列表
if( id == '' ){
this.userChooseForm.address.cityList = [];
this.userChooseForm.address.countyList = [];
return;
}
let params = { provinceId: id };
this.getCityList(params);
// this.getCurrentUserCount();
},
handleCityChange(id) {
this.finalChooseData.countyId = '';
// 清空市,则移除区列表
if( id == '' ){
this.userChooseForm.address.countyList = [];
return;
}
let params = { cityId: id };
this.getCountyList(params);
// this.getCurrentUserCount();
},
handleCountyChange() {
// this.getCurrentUserCount();
},
handleDoctorTitleChange() {
// this.getCurrentUserCount();
},
handleHospitalLevelChange() {
// this.getCurrentUserCount();
},
getTechTitleList() {
openLoading(vm);
vm.GET("raytheon/constants/doctor/title", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.techTitleList = res.data;
}else{
vm.$message.info(res.message)
}
vm.$message({
message: '接口请求失败',
type: 'warning'
});
},
getHospitalLevelList() {
openLoading(vm);
vm.GET("raytheon/constants/hospital/level", {}).then(res => {
closeLoading(vm);
if(res.code == '000000'){
this.userChooseForm.hospitalLevelList = res.data;
}else{
vm.$message.info(res.message)
}
});
},
// 确认筛选
handleChooseSubmit() {
this.getCurrentUserCount();
openLoading(vm);
vm.sendKey = '';
let req = this.finalChooseData;
vm.POST("raytheon/push/screenUser", req).then(res => {
closeLoading(vm);
if(res.code == '000000'){
vm.isUserChooseModalShow = false;
vm.sendKey = res.data;
}else{
vm.$message.info(res.message)
goBack() {
this.$router.push({
path: '/protocol-list'
})
}
});
},
}
};
</script>
<style lang="scss">
.topIndex{
z-index: 10000 !important;
}
.create-push {
.create-protocol {
.component-content {
margin-top: 20px;
margin-top: 80px;
padding: 10px;
background: #fff;
.header-title {
......@@ -699,4 +241,9 @@ export default {
}
}
.valid-content {
color:#F56C6C;
font-size: 12px;
line-height: 26px;
}
</style>
\ No newline at end of file
<template>
<div class="msg-history-wrap">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<el-form ref="formData" :model="formData" label-width="100px" style="margin-bottom: 20px;margin-left: 7px;">
<input type="hidden" v-model="formData.all" value=5>
<el-row>
<el-col style="width:290px;">
<el-form-item label="协议名称" prop="protocolName">
<el-input size="small" v-model="formData.protocolName" placeholder="请输入协议名称" ></el-input>
</el-form-item>
</el-col>
<el-col style="position:relative; top: 4px; width: 200px; margin-left: 20px;">
<el-button type="primary" size="small" @click="handleSearchClick()">查询</el-button>
</el-col>
</el-row>
</el-form>
<div style="padding: 0 40px;">
<el-table
:data="tableData"
border
style="width: 100%;">
<!-- <el-table-column
align="center"
prop="mobile"
label="编号"
width="60"
>
</el-table-column> -->
<el-table-column
align="center"
type="index"
label="编号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="protocolName"
label="协议名称"
width="400"
>
</el-table-column>
<el-table-column
align="center"
prop="signNum"
label="签署数量"
width="120"
>
</el-table-column>
<!-- <el-table-column
align="center"
prop="protocolType"
label="协议类型"
>
</el-table-column> -->
<!-- <el-table-column
align="center"
prop="versionNo"
label="协议版本"
>
</el-table-column> -->
<el-table-column
align="center"
prop="createdName"
label="创建人姓名"
width="120"
>
</el-table-column>
<!-- <el-table-column
align="center"
prop="creatTime"
label="创建时间"
>
<template slot-scope="scope">
{{ returnSendTime(scope.row.creatTime) }}
</template>
</el-table-column> -->
<el-table-column
align="center"
label="最近更新时间"
prop="updateTime"
width="160"
>
<!-- <template slot-scope="scope">
{{ returnSendTime(scope.row.updateTime) }}
</template> -->
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="200" align="center">
<template slot-scope="scope">
<el-button
@click="gotoDetail(scope.row, 0)"
type="primary"
size="small"
>查看详情</el-button>
<el-button
@click="gotoUpdate(scope.row, 0)"
type="primary"
size="small"
>更新版本</el-button>
<el-button
@click="gotoHistoryList(scope.row, 0)"
type="primary"
size="small"
>历史版本</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="formData.pageNo"
:page-sizes="[10, 30, 50, 100]"
:page-size="formData.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script>
import { openLoading, closeLoading } from "../../utils/utils";
import BreadCrumb from "../../components/breadcrumb.vue";
export default {
components: {
BreadCrumb,
},
data() {
return {
curmbFirst: "协议管理",
formData: {
all: 1,
protocolName: '',
protocolType: 5,
pageNo: 1,
pageSize: 10,
},
totalRows: 0,
tableData: [{}],
}
},
created() {
this.getProtocolList({
all: 1,
protocolType: 5
});
},
methods: {
// 跳转到详情页面(预览页面)
gotoDetail(row) {
this.$router.push({
path: '/protocol-detail',
query: {
protocolId: row.protocolId
}
})
},
// 跳转到添加或修改页面
gotoUpdate(row) {
this.$router.push({
path: '/create-protocol',
query: {
protocolId: row.protocolId
}
})
},
// 跳转到历史版本页面
gotoHistoryList(row) {
this.$router.push({
path: '/protocol-history',
query: {
protocolId: row.protocolId
}
})
},
// 获取协议列表
getProtocolList(params) {
openLoading(this);
this.GET("/smartcontract/protocolManage/protocols", params).then(res => {
closeLoading(this);
if(res && res.code && res.code == '000000'){
if( res && res.data ){
this.tableData = res.data;
// this.totalRows = res.data.total || 0;
// this.tableData = res.data.list || [];
}
}else{
this.$message({
message: '接口请求失败',
type: 'warning'
});
}
});
},
handleSearchClick() {
console.log(this.formData);
this.getProtocolList(this.formData);
},
handleSizeChange(val){
this.formData.pageSize = val;
this.getSMSList();
},
handleCurrentChange(val) {
this.formData.pageNo = val;
this.getSMSList();
},
returnSendTime(creatTime){
if( creatTime ){
return creatTime.year + '-' + creatTime.monthValue + '-' + creatTime.dayOfMonth + ' ' + creatTime.hour + ':' + creatTime.minute ;
}else{
return '-';
}
}
},
}
</script>
<style lang="scss">
.msg-history-wrap{
.el-form-item .el-form-item__label{
font-size: 14px;
}
.component-content{
margin-top: 60px;
padding: 10px;
background: #fff;
}
.pagination{
margin: 20px 0;
text-align: right;
}
.status-tj{
&.success{
color: #409EFF;
}
}
}
</style>
......@@ -2,7 +2,7 @@
<div class="msg-history-wrap">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<el-form ref="formData" :model="formData" label-width="100px" style="margin-bottom: 20px;margin-left: 7px;">
<!-- <el-form ref="formData" :model="formData" label-width="100px" style="margin-bottom: 20px;margin-left: 7px;">
<input type="hidden" v-model="formData.all" value=5>
<el-row>
<el-col style="width:290px;">
......@@ -12,8 +12,21 @@
</el-col>
<el-col style="position:relative; top: 4px; width: 200px; margin-left: 20px;">
<el-button type="primary" size="small" @click="handleSearchClick()">查询</el-button>
<el-button class="right" type="primary" size="small" @click="goBack">返回</el-button>
</el-col>
</el-row>
</el-form> -->
<el-form ref="formData" :inline="true" :model="formData" class="demo-form-inline" style="padding: 10px 30px 10px 40px;">
<el-form-item label="协议名称" prop="protocolName">
<el-input size="small" v-model="formData.protocolName" placeholder="请输入协议名称"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleSearchClick">查询</el-button>
</el-form-item>
<el-form-item class="right" >
<el-button type="primary" size="small" @click="goBack()">返回</el-button>
</el-form-item>
</el-form>
<div style="padding: 0 40px;">
......@@ -21,16 +34,15 @@
:data="tableData"
border
style="width: 100%;">
<!-- <el-table-column
align="center"
prop="mobile"
label="编号"
width="60"
>
</el-table-column> -->
<el-table-column
align="center"
type="index"
label="序号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="protocolType"
label="编号"
width="50">
</el-table-column>
......@@ -67,25 +79,19 @@
width="120"
>
</el-table-column>
<!-- <el-table-column
<el-table-column
align="center"
prop="creatTime"
prop="createTime"
label="创建时间"
>
<template slot-scope="scope">
{{ returnSendTime(scope.row.creatTime) }}
</template>
</el-table-column> -->
<el-table-column
</el-table-column>
<!-- <el-table-column
align="center"
label="最近更新时间"
prop="updateTime"
width="160"
>
<!-- <template slot-scope="scope">
{{ returnSendTime(scope.row.updateTime) }}
</template> -->
</el-table-column>
</el-table-column> -->
<el-table-column fixed="right" label="操作" min-width="200" align="center">
<template slot-scope="scope">
......@@ -94,16 +100,6 @@
type="primary"
size="small"
>查看详情</el-button>
<el-button
@click="gotoUpdate(scope.row, 0)"
type="primary"
size="small"
>更新版本</el-button>
<el-button
@click="gotoHistoryList(scope.row, 0)"
type="primary"
size="small"
>历史版本</el-button>
</template>
</el-table-column>
......@@ -120,7 +116,6 @@
</el-pagination>
</div>
</div>
</div>
</div>
</template>
......@@ -137,7 +132,7 @@
formData: {
all: 1,
protocolName: '',
protocolType: 5,
protocolType: '5',
pageNo: 1,
pageSize: 10,
},
......@@ -146,27 +141,52 @@
}
},
created() {
this.getProtocolList({
all: 1,
protocolType: 5
});
this.formData.protocolType = this.$route.query.protocolType || 1;
this.getProtocolList(this.formData);
},
mounted() {
// StandardEditor
// .create( document.querySelector( '#editor' ) )
// .catch( error => {
// console.error( error );
// });
// https://cdn.ckeditor.com/
},
methods: {
// 返回到列表页面
goBack() {
this.$router.push({
path: '/protocol-list'
})
},
// 跳转到详情页面(预览页面)
gotoDetail(row) {
this.$router.push({
path: '/protocol-detail',
query: {
isUpdate: true,
protocolId: row.protocolId
}
})
},
// 跳转到添加或修改页面
gotoAdd() {
this.$router.push({
path: '/create-protocol',
query: {
isUpdate: false
}
})
},
// 跳转到添加或修改页面
gotoUpdate(row) {
this.$router.push({
path: '/create-protocol',
query: {
isUpdate: true,
protocolId: row.protocolId
}
})
......@@ -207,11 +227,11 @@
},
handleSizeChange(val){
this.formData.pageSize = val;
this.getSMSList();
this.getProtocolList(this.formData);
},
handleCurrentChange(val) {
this.formData.pageNo = val;
this.getSMSList();
this.getProtocolList(this.formData);
},
returnSendTime(creatTime){
if( creatTime ){
......@@ -219,9 +239,9 @@
}else{
return '-';
}
}
},
}
}
</script>
<style lang="scss">
.msg-history-wrap{
......
......@@ -2,7 +2,7 @@
<div class="msg-history-wrap">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<el-form ref="formData" :model="formData" label-width="100px" style="margin-bottom: 20px;margin-left: 7px;">
<!-- <el-form ref="formData" :model="formData" label-width="100px" style="margin-bottom: 20px;margin-left: 7px;">
<input type="hidden" v-model="formData.all" value=5>
<el-row>
<el-col style="width:290px;">
......@@ -12,10 +12,23 @@
</el-col>
<el-col style="position:relative; top: 4px; width: 200px; margin-left: 20px;">
<el-button type="primary" size="small" @click="handleSearchClick()">查询</el-button>
<el-button class="right" type="primary" size="small" @click="gotoAdd()">新建协议</el-button>
</el-col>
</el-row>
</el-form>
</el-form> -->
<el-form ref="formData" :inline="true" :model="formData" class="demo-form-inline" style="padding: 10px 30px 10px 40px;">
<el-form-item label="协议名称" prop="protocolName">
<el-input size="small" v-model="formData.protocolName" placeholder="请输入协议名称"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleSearchClick">查询</el-button>
</el-form-item>
<el-form-item class="right" >
<el-button type="primary" size="small" @click="gotoAdd()">新建协议</el-button>
</el-form-item>
</el-form>
<div style="padding: 0 40px;">
<el-table
:data="tableData"
......@@ -23,14 +36,13 @@
style="width: 100%;">
<!-- <el-table-column
align="center"
prop="mobile"
type="index"
label="编号"
width="60"
>
width="50">
</el-table-column> -->
<el-table-column
align="center"
type="index"
prop="protocolType"
label="编号"
width="50">
</el-table-column>
......@@ -120,9 +132,6 @@
</el-pagination>
</div>
</div>
<textarea name="content" id="editor">
&lt;p&gt;This is some sample content.&lt;/p&gt;
</textarea>
</div>
</div>
</template>
......@@ -137,9 +146,8 @@
return {
curmbFirst: "协议管理",
formData: {
all: 1,
all: 2,
protocolName: '',
protocolType: 5,
pageNo: 1,
pageSize: 10,
},
......@@ -148,10 +156,7 @@
}
},
created() {
this.getProtocolList({
all: 1,
protocolType: 5
});
this.getProtocolList(this.formData);
},
mounted() {
// StandardEditor
......@@ -159,7 +164,6 @@
// .catch( error => {
// console.error( error );
// });
CKEDITOR.replace( 'editor' );
// https://cdn.ckeditor.com/
},
......@@ -169,16 +173,28 @@
this.$router.push({
path: '/protocol-detail',
query: {
isUpdate: true,
protocolId: row.protocolId
}
})
},
// 跳转到添加或修改页面
gotoAdd() {
this.$router.push({
path: '/create-protocol',
query: {
isUpdate: false
}
})
},
// 跳转到添加或修改页面
gotoUpdate(row) {
this.$router.push({
path: '/create-protocol',
query: {
isUpdate: true,
protocolId: row.protocolId
}
})
......@@ -189,7 +205,8 @@
this.$router.push({
path: '/protocol-history',
query: {
protocolId: row.protocolId
protocolId: row.protocolId,
protocolType: row.protocolType
}
})
},
......@@ -219,11 +236,11 @@
},
handleSizeChange(val){
this.formData.pageSize = val;
this.getSMSList();
this.getProtocolList(this.formData);
},
handleCurrentChange(val) {
this.formData.pageNo = val;
this.getSMSList();
this.getProtocolList(this.formData);
},
returnSendTime(creatTime){
if( creatTime ){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册