123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- var httpData=GetRequest();
- (function(){
- top.xgLabel=new Vue({
- el:"#app",
- data:{
- patient:httpData['patient'],
- isEdit:false,//团队标签是够可编辑
- fwlx:[],//服务类型
- serverTypes:[],//已选择服务code
- jkqk:[],//健康情况
- jkqkSelect:[],//已选择健康情况
- jblx:[],//疾病类型
- jblxSelect:[],//疾病类型
- tdbq:[],//团队标签
- tdbqSelect:[],//团队标签
- teamCode:httpData['teamCode'],//医生团队code
- signCode:httpData['signCode'],//签约code
- newLabel:'',//新团队label
- catchArr:{}
- },
- mounted:function(){
- this.getSigndict()
- this.getAllLabels()
- top.vvm = this
- },
- methods:{
- initPage:function(){
- this.serverTypes=JSON.parse(JSON.stringify(this.catchArr.server||{}));
- this.jkqkSelect=JSON.parse(JSON.stringify(this.catchArr.heath||{}));
- this.jblxSelect=JSON.parse(JSON.stringify(this.catchArr.disease||{}));
- this.tdbqSelect=JSON.parse(JSON.stringify(this.catchArr.team||{}));
- },
- determine:function(){
- var vm=this
- if(this.serverTypes==''){
- layer.msg('请选择服务类型', {icon: 5})
- return ;
- }
- if(this.jkqkSelect==''){
- layer.msg('请选择健康情况', {icon: 5})
- return ;
- }
- var fwlx=[];
- var checkRule=['active','luck'];
- _.map(vm.fwlx,function(item){
- for(var i in checkRule){
- if(item.className.indexOf(checkRule[i])!==-1){
- fwlx.push(item.code);
- }
- }
- })
- var jkqk=[];
- var checkRule=['active','luck'];
- _.map(vm.jkqk,function(item){
- for(var i in checkRule){
- if(item.className.indexOf(checkRule[i])!==-1){
- jkqk.push(item.labelCode);
- }
- }
- })
- var jblx=[];
- var checkRule=['active','luck'];
- _.map(vm.jblx,function(item){
- for(var i in checkRule){
- if(item.className.indexOf(checkRule[i])!==-1){
- jblx.push(item.labelCode);
- }
- }
- })
- var res={
- server:fwlx,
- heath:jkqk,
- disease:jblx,
- team:this.tdbqSelect
- }
- vm.catchArr=JSON.parse(JSON.stringify(res||{}));
- top.handleVue.acceptanceRes(res);
- this.closeSelect()
- },
- close:function(){
- console.log(this.catchArr)
- console.log('我进来了')
- this.serverTypes=JSON.parse(JSON.stringify(this.catchArr.server||{}))
- this.jkqkSelect=JSON.parse(JSON.stringify(this.catchArr.heath||{}))
- this.jblxSelect=JSON.parse(JSON.stringify(this.catchArr.disease||{}))
- this.tdbqSelect=JSON.parse(JSON.stringify(this.catchArr.team||{}))
- this.closeSelect()
- },
- closeSelect:function(){
- top.$('#layui-layer-shade'+top.changeTypeIndex).hide()
- top.$('#layui-layer'+top.changeTypeIndex).hide()
- },
- findPatientSignServerBySignCode:function(){
- var vm=this
- var params={
- signCode:vm.signCode
- }
- signAPI.findPatientSignServerBySignCode(params).then(function(res){
- if(res.status==200){
- var _typss=_.pluck(res.data || [],'serverType')
- vm.serverTypes=JSON.stringify(_typss)=='[]'?['1']:_typss
- vm.catchArr.server= [].concat(_typss)
- }
- })
- },
- // 添加团队label
- addTeamLabel:function(){
- var vm=this
- if(!vm.newLabel) return layer.msg('请输入标签命名', {icon: 5})
- var params={
- labelName:vm.newLabel,
- teamCode:vm.teamCode
- }
- var loadding = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
- signAPI.addTeamLabel(params).then(function(res){
- layer.close(loadding);
- if(res.status==200){
- res.data[0] && ((res.data[0].className='optional'),vm.tdbq=vm.tdbq.concat(res.data));
- vm.isEdit=false;
- vm.newLabel='';
- }else{
- layer.msg(res.msg, {icon: 5})
- }
- })
- },
- // 服务类型改变
- changeFW:function(cls,code,idx){
- var vm=this
- if(!cls || cls.indexOf('luck')!==-1) return ;
- var types=JSON.parse(JSON.stringify(vm.serverTypes||{}));
- var _index=types.indexOf(code)
- console.log(code)
- if(_index===-1){
- vm.serverTypes.push(code);
- vm.fwlx[idx].className='active';
- }else{
- vm.serverTypes.splice(_index,1);
- var __index=-1
- if (code == 4) {
- vm.jblx[0].className='optional';
- (__index=vm.jblxSelect.indexOf('1'))!==-1 && vm.jblxSelect.splice(__index,1)
- }
- if (code == 5) {
- vm.jblx[1].className='optional';
- (__index=vm.jblxSelect.indexOf('2'))!==-1 && vm.jblxSelect.splice(__index,1)
- }
- if (code == 10) {
- vm.jblx[10].className='optional';
- (__index=vm.jblxSelect.indexOf('10'))!==-1 && vm.jblxSelect.splice(__index,1)
- }
- if (code == 11) {
- vm.jblx[9].className='optional';
- (__index=vm.jblxSelect.indexOf('9'))!==-1 && vm.jblxSelect.splice(__index,1)
- }
- if (code == 12) {
- vm.jblx[8].className='optional';
- (__index=vm.jblxSelect.indexOf('8'))!==-1 && vm.jblxSelect.splice(__index,1)
- }
- vm.fwlx[idx].className='optional';
- }
- },
- // 健康状况改变
- changeJK:function(cls,code,idx){
- var vm=this
- if(vm.serverTypes=='') return layer.msg('请先选择服务类型', {icon: 5})
- if(!cls || cls.indexOf('luck')!==-1) return ;
- var types=JSON.parse(JSON.stringify(vm.jkqkSelect||{}));
- var _index=types.indexOf(code)
- if(_index===-1){
- for(var i in vm.jkqk){
- if(vm.jkqk[i].labelCode==vm.jkqkSelect[0]){
- vm.jkqk[i].className='optional';
- break
- }
- }
- vm.jkqkSelect=new Array(code);
- vm.jkqk[idx].className='active';
- }else{
- vm.jkqkSelect.splice(_index,1);
- vm.jkqk[idx].className='optional';
- }
- },
- // 疾病类型改变
- changeJB:function(cls,code,idx){
- var vm=this
- if(vm.jkqkSelect=='') return layer.msg('请先选择健康情况', {icon: 5})
- if(!cls || cls.indexOf('luck')!==-1) return ;
- var types=JSON.parse(JSON.stringify(vm.jblxSelect||{}));
- var _index=types.indexOf(code)
- console.log(types)
- console.log(_index)
- if(_index===-1){
- vm.jblxSelect.push(code);
- vm.jblx[idx].className='active';
- }else{
- vm.jblxSelect.splice(_index,1);
- vm.jblx[idx].className='optional';
- }
- },
- // 团队标签选择取消
- changeTD:function(cls,code,idx){3
- var vm=this
- var types=JSON.parse(JSON.stringify(vm.tdbqSelect||{}));
- var _index=types.indexOf(code)
- if(_index===-1){
- vm.tdbqSelect.push(code);
- vm.tdbq[idx].className='active';
- }else{
- vm.tdbqSelect.splice(_index,1);
- vm.tdbq[idx].className='optional';
- }
- },
- getAllLabels:function(){
- var vm=this
- signAPI.allLabels({teamCode:vm.teamCode}).then(function(res){
- if(res.status==200){
- _.map(res.data || {},function(item,index){
- if(item.labelType==2){
- vm.jkqk.push(item)
- }else if(item.labelType==3){
- vm.jblx.push(item)
- }else if(item.labelType==4){
- item.className='optional'
- vm.tdbq.push(item)
- }
- })
- vm.getPatientLabel();//获取已选择类型(非服务类型)
- }
- })
- },
- getSigndict:function(){
- var vm=this
- signAPI.getSigndict({teamCode:vm.teamCode}).then(function(res){
- if(res.status==200){
- vm.fwlx=res.data
- }
- })
- },
- getPatient:function(){
- var vm=this;
- var data={
- patient:vm.patient
- }
- signAPI.getPatient(data).then(function(res){
- if(res.status==200){
- // res.data && (vm.teamCode=res.data.jtAdminTeam);
- vm.getAllLabels()
- }else{
- layer.msg(res.msg, {icon: 5})
- }
- })
- },
- getPatientLabel:function(){
- var vm=this
- var data={
- patient:vm.patient
- }
- signAPI.patientLabel(data).then(function(res){
- if(res.status==200){
- var data=res.data
- if(data.length){
- var jkqkSelect=[],jblxSelect=[],tdbqSelect=[]
- _.map(data||{},function(item,index){
- if(item.labelType==2){
- jkqkSelect.push(item)
- }else if(item.labelType==3){
- jblxSelect.push(item)
- }else if(item.labelType==4){
- tdbqSelect.push(item)
- }
- })
- vm.jkqkSelect=_.pluck(jkqkSelect,'label')
- vm.jblxSelect=_.pluck(jblxSelect,'label')
- vm.tdbqSelect=_.pluck(tdbqSelect,'label')
- vm.catchArr.heath=JSON.parse(JSON.stringify(vm.jkqkSelect||{}));
- vm.catchArr.disease=JSON.parse(JSON.stringify(vm.jblxSelect||{}));
- vm.catchArr.team=JSON.parse(JSON.stringify(vm.tdbqSelect||{}));
- }
- vm.findPatientSignServerBySignCode();
- }else{
- layer.msg(res.msg, {icon: 5})
- }
- })
- },
- // 普通1 老年3 高血4 糖尿5 孕妇6 儿童7 贫困8 计生9 重性10 残疾11 结核12
- filterSer() {
- var vm=this
- var fwlx=JSON.parse(JSON.stringify(vm.fwlx||{}))
- vm.jkqk[0] && (vm.jkqk[0].className='optional');
- for(var i in fwlx){
- for(var j in vm.serverTypes){
- if(fwlx[i].code==vm.serverTypes[j]){
- fwlx[i].className='active'
- }
- }
- if(fwlx[i].className=='') fwlx[i].className='optional'
- if(fwlx[i].className==undefined) fwlx[i].className='optional'
- }
- _.map(vm.serverTypes, function(item, index) {
- var code = item | 0;
- var arr=[];
- if (code === 1) {
- arr = [2, 3, 6, 8,9, 10]
- }
- if (code === 3) {
- arr = [4, 5]
- }
- if (code === 4 || code === 5 || code === 10 || code === 11 || code === 12) {
- arr = [0]
- vm.jkqk[0] && (vm.jkqk[0].className='');
- }
- if (code === 7) {
- arr = [1, 4]
- }
- if (code === 8) {
- arr = [0]
- }
- if (code === 6) {
- arr = [1, 5]
- }
- _.map(arr, function(it) {
- fwlx[it].className=''
- })
- })
- vm.fwlx=fwlx;
- vm.filterHea()
- },
- // 健康1 患病2 高危3 恢复4 未标注0
- filterHea() {
- var vm=this
- var jkqk=JSON.parse(JSON.stringify(vm.jkqk||{}))
- _.map(vm.jkqkSelect, function(item, index) {
- var code = item | 0
- if (code === 1) {
- _.map(vm.fwlx, function(it, idx) {
- var arr1 = [1,3, 6, 7,8,9]
- var icode=it.code | 0
- if(arr1.indexOf(icode)===-1){
- vm.fwlx[idx].className='';
- }
- })
- vm.jblxSelect=[]
- vm.jblx=_.map(vm.jblx,function(it, idx){
- it.className='';
- return it;
- })
- }else{
- for(var i in vm.jblx){
- vm.jblx[i].className=vm.jblx[i].className || 'optional'
- }
- }
- })
- for(var i in jkqk){
- for(var j in vm.jkqkSelect){
- if(jkqk[i].labelCode==vm.jkqkSelect[j]){
- if(jkqk[i].className=='luck'){
- jkqk[i].className='luck active'
- }else{
- jkqk[i].className='active'
- }
- }
- }
- if(jkqk[i].className==undefined) jkqk[i].className='optional'
- }
- vm.jkqk=jkqk
- vm.filterDea()
- },
- // 疾病类型
- filterDea() {
- var vm=this
- var jblx=JSON.parse(JSON.stringify(vm.jblx||{}))
- _.map(vm.serverTypes, function(item, index) {
- var code = item | 0;
- if (code === 4) {
- jblx[0].className='luck active';
- vm.jblxSelect.indexOf('1')===-1 && vm.jblxSelect.push('1')
- }
- if (code === 5) {
- jblx[1].className='luck active';
- vm.jblxSelect.indexOf('2')===-1 && vm.jblxSelect.push('2')
- }
- if (code === 10) {
- jblx[10].className='luck active';
- vm.jblxSelect.indexOf('10')===-1 && vm.jblxSelect.push('10')
- }
- if (code === 11) {
- jblx[9].className='luck active';
- vm.jblxSelect.indexOf('9')===-1 && vm.jblxSelect.push('9')
- }
- if (code === 12) {
- jblx[8].className='luck active';
- vm.jblxSelect.indexOf('8')===-1 && vm.jblxSelect.push('8')
- }
- })
- if(vm.jblxSelect && vm.jblxSelect.length){
- for(var i in jblx){
- for(var j in vm.jblxSelect){
- if(jblx[i].labelCode==vm.jblxSelect[j]){
- jblx[i].className=(jblx[i].className && jblx[i].className!='optional')?jblx[i].className:'active'
- }else{
- if(vm.jblxSelect.indexOf(jblx[i].labelCode)===-1)
- jblx[i].className && (jblx[i].className.indexOf('luck')!==-1) && jblx[i].className!='optional' && (jblx[i].className='');
- }
- }
- !vm.jblxSelect.length && (jblx[i].className='optional');
- jblx[i].className==undefined && (jblx[i].className='optional');
- }
- }
- vm.jblx=jblx
- },
- filterTea:function(){
- var vm=this
- var jblx=vm.tdbq
- for(var i in jblx){
- for(var j in vm.tdbqSelect){
- if(jblx[i].labelCode==vm.tdbqSelect[j]){
- jblx[i].className=(jblx[i].className && jblx[i].className!='optional')?jblx[i].className:'active'
- }else{
- if(vm.tdbqSelect.indexOf(jblx[i].labelCode)===-1)
- jblx[i].className && (jblx[i].className.indexOf('luck')!==-1) && jblx[i].className!='optional' && (jblx[i].className='');
- }
- }
- !vm.tdbqSelect.length && (jblx[i].className='optional');
- jblx[i].className==undefined && (jblx[i].className='optional');
- }
- vm.tdbq=jblx
- },
- },
- watch:{
- serverTypes:function(val){
- this.filterSer()
- },
- jkqkSelect:function(){
- this.filterHea()
- },
- tdbqSelect:function(){
- this.filterTea()
- },
- catchArr:{
- handler(val, oldVal){
- console.log(val);//但是这两个值打印出来却都是一样的
- },
- deep:true
- }
- }
- })
- })();
|