123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- var httpData = GetRequest()
- console.log('httpDatahttpDatahttpData', httpData)
- var previewLayerIndex;
- function closeGuidancePreview(){
- layer.close(previewLayerIndex)
- }
- var TempSendPanel = {
- template: '<div class="template-wrap">\
- <div style="height: 34px;" >\
- 指导模板\
- </div>\
- <div class="temp-info c-f14">\
- <div class="temp-name pl10 ptb10">\
- 模板名称:<input v-model="modelName" placeholder="请输入模板名称( 10字内 )" disabled class="c-f14" />\
- </div>\
- <div class="c-position-r">\
- <textarea @input="countWord" v-model="content" class="ptb10 plr10" disabled style="border: 0;width: 100%;box-sizing: border-box;height: 180px;"></textarea>\
- <div class="c-t-right mr10 mb5 c-909090">{{count}}/{{words}}</div>\
- </div>\
- </div>\
- <div v-if="imgs.length>0" class="img-wrap mt20 c-f14">\
- <div>插入图片<span class="c-909090">({{imgs.length}}/9)</span></div>\
- <div class="img-items mt10">\
- <img v-for="(v,i) in imgs" src="v" />\
- </div>\
- </div>\
- <div class="foot-btns mt20">\
- <a class="preview-btn c-t-center mr15" @click="preViewTemplate">\
- 预览\
- </a>\
- <a class="send-btn c-t-center" @click="sendTemplate">\
- 发送\
- </a>\
- </div>\
- </div>',
- props: [],
- data: function() {
- return {
- words: 1000,
- count: 0,
- modelName: '',
- content: '',
- modelCode: '',
- imgs: [],
- curTemplate: undefined,
- previewLayerIndex: undefined,
- planDetaiId: httpData['planDetaiId'],
- docInfo: JSON.parse(window.localStorage.getItem('wlyyAgent')),
- isRecordId: httpData['isRecordId']|| false,
- relationRecordId: null
- }
- },
- watch: {
- content: function(){
- this.countWord()
- }
- },
- mounted: function(){
- var vm = this
- EventBus.$on('active-template', function(o){
- vm.modelCode = o.code
- vm.selectGuidances()
- })
- },
- destroyed: function(){
- },
- methods: {
- countWord: function() {
- if(this.content.length <= this.words) {
- this.count = this.content.length
- } else {
- this.content = this.content.slice(0, this.words)
- }
- },
- selectGuidances: function(){
- var vm=this;
- var params={
- type: '',
- id: vm.modelCode,
- title: '',
- page: 1,
- pagesize: 1
- }
- rehaAPI.selectGuidances(params).then(function(res){
- if(res.status==200){
- if(res.data && res.data.length) {
- var data = res.data[0]
- vm.curTemplate = data
- vm.content = data.content
- vm.modelName = data.title
- }
- } else {
- layer.msg(res.msg,{icon:5});
- }
- })
- },
- preViewTemplate: function(){
- var vm = this
- previewLayerIndex = layer.open({
- type: 2,
- area: ['380px', '600px'],
- shade: 0.5,
- title: '预览',
- fixed: true, //不固定
- maxmin: true,
- closeBtn:1,
- shift: 5,
- shadeClose: false, //点击遮罩关闭层
- content: '../../rehabilitation/html/rehabilitation_guidance_preview.html?modelCode='+vm.modelCode
- });
- },
- sendTemplate: function() {
- var vm = this
- if(!vm.modelName) {
- toastr && toastr.error("模板名称不能为空")
- return
- }
- if(!vm.content) {
- toastr && toastr.error("模板内容不能为空")
- return
- }
- layer.confirm('发出后无法变更,是否确认发送给居民?', { btn: ['继续发送', '取消'], title: "提示" }, function () {
- if(vm.isRecordId){
- vm.saveRehabilitationOperateRecord()
- } else {
- vm.sendGuidance(vm.planDetaiId)
- }
- })
- },
- saveRehabilitationOperateRecord: function(){
- var vm=this
- var params={
- rehabilitationDetailId: vm.planDetaiId,
- node: '',
- patientCode: httpData['patient'],
- doctorCode: vm.docInfo.uid,
- relationRecordType: 5,
- relationRecordCode: '',
- relationRecordImg: '',
- status: 0, // 改记录的状态
- }
- rehaAPI.saveRehabilitationOperateRecord({dataJson:JSON.stringify(params)}).then(function(res){
- if(res.status==200){
- vm.relationRecordId = res.data.id
- vm.sendGuidance(res.data.id)
- }else {
- showErrorMessage(res.msg)
- }
- })
- },
- saveRehabilitationOperateRecord2: function(){
- var vm=this
- var params={
- rehabilitationDetailId: vm.planDetaiId,
- node: '',
- patientCode: httpData['patient'],
- doctorCode: vm.docInfo.uid,
- relationRecordType: 5,
- relationRecordCode: '',
- relationRecordImg: '',
- status: 1, // 改记录的状态
- id: vm.relationRecordId
- }
- rehaAPI.saveRehabilitationOperateRecord({dataJson:JSON.stringify(params)}).then(function(res){
- if(res.status==200){
- window.parent.closeKFZD(vm.planDetaiId)
- }else {
- showErrorMessage(res.msg)
- }
- })
- },
- sendGuidance: function(relationCode){
- var vm =this
- var loading = layer.load(0, {shade: false})
- var params = [{
- patient: httpData['patient'],
- article: vm.modelCode,
- doctor: vm.docInfo.uid,
- attachedContent: vm.content,
- attachedTitle: vm.modelName,
- relationCode: relationCode
- }]
- rehaAPI.sendGuidance({
- json: JSON.stringify(params),
- planId: httpData['planId']
- }).then(function(res) {
- layer.close(loading)
- if(res.status == 200){
- // 确认完成康复指导
- if(vm.isRecordId){
- vm.saveRehabilitationOperateRecord2()
- } else {
- window.parent.closeKFZDlayer(vm.planDetaiId)
- }
- layer.msg('发送成功', {
- icon: 1
- })
- } else {
- layer.msg(res.msg, {
- icon: 5
- })
- }
- }).catch(function(e) {
- console.error(e)
- })
- }
- }
- }
|