collectInfo.js 104 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509
  1. const util = require('../../utils/util.js');
  2. const tools = require('../../utils/tools.js');
  3. var QQMapWX = require('../../libs/qqmap-wx-jssdk.min.js');
  4. var isonShow;
  5. var isTwoOnshow;
  6. Page({
  7. data: {
  8. // isVisittimesnull: true,
  9. // visitWaysFromOther: true,
  10. activeIndex: 0,
  11. addOldname: '',
  12. addOldname1: '',
  13. showAdress: false,
  14. pleaseChoose: true,
  15. chooseAdressArr: [],
  16. currentIndex: 0,
  17. showBj: false,
  18. showBj1: false,
  19. src1: '../../images/mz/5.png',
  20. src2: '../../images/mz/1.png',
  21. src3: '../../images/mz/6.png',
  22. src4: '../../images/mz/2.png',
  23. src5: '../../images/mz/7.png',
  24. src6: '../../images/mz/3.png',
  25. src7: '../../images/mz/8.png',
  26. src8: '../../images/mz/4.png',
  27. sexArr: [{
  28. value: '男',
  29. name: '男'
  30. },
  31. {
  32. value: '女',
  33. name: '女',
  34. }
  35. ],
  36. nameArr: [],
  37. // tab1老人信息
  38. oldInfo: [{
  39. name: '',
  40. oldSex: [{
  41. name: '男'
  42. }, {
  43. name: '女'
  44. }],
  45. nation: '', //民族
  46. idNumber: '', //身份证号
  47. phone: '',
  48. oldMarry: [{
  49. name: "未婚"
  50. }, {
  51. name: "已婚"
  52. }, {
  53. name: "离异"
  54. }, {
  55. name: "丧偶"
  56. }],
  57. partnerName: '',
  58. partnerIdNumber: '',
  59. healthAyy: [{
  60. name: "健康",
  61. disabled: false
  62. }, {
  63. name: "残疾",
  64. disabled: false
  65. }, {
  66. name: "患重特大疾病",
  67. disabled: false
  68. }, {
  69. name: "老年人慢性病",
  70. disabled: false
  71. }],
  72. disabilityAyy: [{
  73. name: "视力残疾"
  74. }, {
  75. name: "听力残疾"
  76. }, {
  77. name: "言语残疾"
  78. }, {
  79. name: "肢体残疾"
  80. }, {
  81. name: "智力残疾"
  82. }, {
  83. name: "精神残疾"
  84. }, {
  85. name: "多重残疾"
  86. }],
  87. disabilityLevel: '', //残疾人类别
  88. sickType: [{
  89. name: "重大器官类疾病"
  90. }, {
  91. name: "心脑血管类疾病"
  92. }, {
  93. name: "神经与代谢类疾病"
  94. }, {
  95. name: "肢体与病毒类疾病"
  96. }, {
  97. name: "恶性肿瘤"
  98. }],
  99. ability: '', //老年人能力情况
  100. livingCondition: '', //生活经济情况
  101. moneyFromAyy: [{
  102. name: "家庭经营性收入"
  103. }, {
  104. name: "工资性收入"
  105. }, {
  106. name: "转移性收入"
  107. }, {
  108. name: "财产性收入"
  109. }, {
  110. name: "其它"
  111. }],
  112. income: '',
  113. sourceOfIncomeExt: '', //其他收入情况
  114. familyHelpArr: [{
  115. name: "低保"
  116. }, {
  117. name: "建档立卡贫困户"
  118. }, {
  119. name: "医疗救助"
  120. }, {
  121. name: "临时救助"
  122. }, {
  123. name: "老年人福利津贴"
  124. }, {
  125. name: "残疾人两项补贴(或一项补贴)"
  126. }, {
  127. name: "其他救助"
  128. }],
  129. rescueStateExt: '', //其他救助
  130. loneArr: [{
  131. name: "是"
  132. }, {
  133. name: "否"
  134. }],
  135. liveStatus: [{
  136. name: "无人陪伴居住",
  137. disabled: false
  138. }, {
  139. name: "配偶",
  140. disabled: false
  141. }, {
  142. name: "近亲属",
  143. disabled: false
  144. }, {
  145. name: "未成年孙子女",
  146. disabled: false
  147. }, {
  148. name: "其他情形",
  149. disabled: false
  150. }],
  151. accompanyExt: '', //陪伴居住其他
  152. oftenMan: [{
  153. name: "无人照料",
  154. disabled: false
  155. }, {
  156. name: "近亲属",
  157. disabled: false
  158. }, {
  159. name: "配偶",
  160. disabled: false
  161. }, {
  162. name: "邻里互助",
  163. disabled: false
  164. }, {
  165. name: "购买养老服务",
  166. disabled: false
  167. }, {
  168. name: "其他人员",
  169. disabled: false
  170. }],
  171. lookAfterExt: '', //其他日常生活照料人关系
  172. mainLookName: '', //日常生活照料人姓名
  173. mainLookSex: [{
  174. name: "男"
  175. }, {
  176. name: "女"
  177. }],
  178. mainLookPhone: '', //
  179. loveRequire: [{
  180. name: "生活照料"
  181. },
  182. {
  183. name: "生产帮助"
  184. },
  185. {
  186. name: "精神慰藉"
  187. },
  188. {
  189. name: "医疗保健"
  190. },
  191. {
  192. name: "权益维护"
  193. },
  194. {
  195. name: "安全监护"
  196. },
  197. {
  198. name: "文化娱乐"
  199. },
  200. {
  201. name: "紧急救助"
  202. },
  203. {
  204. name: "其它"
  205. },
  206. ],
  207. oldType: [{
  208. name: "农村留守老年人",
  209. disable: false,
  210. checked: false
  211. }, {
  212. name: "分散供养特困老年人",
  213. disable: false,
  214. checked: false
  215. }, {
  216. name: "计划生育特殊家庭老人",
  217. disable: false,
  218. checked: false
  219. }, {
  220. name: "空巢老年人",
  221. disable: false,
  222. checked: false
  223. }, {
  224. name: "独居老年人",
  225. disable: false,
  226. checked: false
  227. }, {
  228. name: "重残老年人",
  229. disable: false,
  230. checked: false
  231. }, {
  232. name: "高龄老年人",
  233. disable: false,
  234. checked: false
  235. }],
  236. isHavePhoto: false,
  237. imgPath: '',
  238. photoAndLocation: '',
  239. }],
  240. mzArr: ["汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族", "彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族", "白族", "哈尼族",
  241. "哈萨克族", "黎族", "傣族", "畲族", "傈僳族", "仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族", "羌族", "土族", "仫佬族", "锡伯族",
  242. "柯尔克孜族", "达斡尔族", "景颇族", "毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族", "怒族", "京族", "基诺族", "德昂族", "保安族",
  243. "俄罗斯族", "裕固族", "乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
  244. ],
  245. ableStatus: ["完全自理", "半失能(部分自理)", "完全失能"], //老年人能力情况
  246. chooseAdressArr: [],
  247. disableLeval: ["一级", "二级", "三级", "四级"],
  248. moneyStatus: ["建档立卡贫困户", "一般家庭", "低保", "特困供养人员"],
  249. payMoney: ["5000元以下", "5000-10000元", "10000元以上"],
  250. loveRequire: [{
  251. name: "生活照料"
  252. },
  253. {
  254. name: "生产帮助"
  255. },
  256. {
  257. name: "精神慰藉"
  258. },
  259. {
  260. name: "医疗保健"
  261. },
  262. {
  263. name: "权益维护"
  264. },
  265. {
  266. name: "安全监护"
  267. },
  268. {
  269. name: "文化娱乐"
  270. },
  271. {
  272. name: "紧急救助"
  273. },
  274. {
  275. name: "其它"
  276. },
  277. ],
  278. isHavePhoto: false,
  279. // tab2
  280. childInfo: [{
  281. childrenNum: ''
  282. }],
  283. childNumArr: [
  284. '0个', '1个', '2个', '3个', '3个以上'
  285. ],
  286. ischildName: [false, false, false],
  287. childSexArr: ['男', '女'],
  288. ischildPhone: [false, false, false],
  289. childIsout: ['是', '否'],
  290. showchildOut: [false, false, false],
  291. ischildOutReason: [false, false, false],
  292. region0: [
  293. ['', '', ''],
  294. ['', '', ''],
  295. ['', '', '']
  296. ],
  297. childLeaveDate: ['', '', ''],
  298. childIsMArry: ['是', '否'],
  299. ischildMarry: [false, false, false],
  300. ischildMarryName: [false, false, false],
  301. ischildMarryPhone: [false, false, false],
  302. childTfTimes: ['0次', '1次', '2次及以上'],
  303. // tab3
  304. otherInfo: [{
  305. isHasOther: '',
  306. Info: {
  307. name: '', // 其他赡养人姓名,
  308. sex: '', //其他赡养人性别
  309. phone: '', //其他赡养人电话,
  310. relation: '', //与被赡养人关系 如果选了其他也是必填 单选
  311. relationExt: '', //与被赡养人关系--其他
  312. isHasGoOut: '', //是否外出
  313. outgoingCause: '', //外出原因
  314. outgoingplace: '', // 外出地点
  315. outgoingTime: '', // 最后一次离家时间
  316. isHasPartner: '', //是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0:是 1:否
  317. name2: '',
  318. phone2: '',
  319. visit: '', //平均一年探望次数
  320. othersyrSexArr: [{
  321. name: '男',
  322. checked: false
  323. },
  324. {
  325. name: '女',
  326. checked: false
  327. },
  328. ]
  329. }
  330. }],
  331. othersyrArr: ['是', '否'],
  332. othersyrSexArr: ['男', '女'],
  333. othersyrRelation: [
  334. "近亲属", "孙子女", "兄弟姐妹", "其他"
  335. ],
  336. othersyrIsout: ['是', '否'],
  337. region: ['', '', ''],
  338. othersyrIsMarry: ['是', '否'],
  339. othersyrTfTimes: [
  340. '0次', '1次', '2次及以上'
  341. ],
  342. // tab4
  343. // regularsInfo: {
  344. // visitMode: '', //巡访方式 如果选了其他也是必填 多选
  345. // visitModeExt: '', //巡访方式--其它
  346. // visitCount: '', //巡访频次, 如果选了其他也是必填 单选
  347. // visitCountExt: '', //巡访频次--其它
  348. // },
  349. // visitWays: [{
  350. // name: '电话问候'
  351. // }, {
  352. // name: '上门巡访'
  353. // }, {
  354. // name: '其它'
  355. // }],
  356. // visitTimes: [{
  357. // name: '每天'
  358. // }, {
  359. // name: '每周'
  360. // }, {
  361. // name: '每月'
  362. // }, {
  363. // name: '每季'
  364. // }, {
  365. // name: '其它'
  366. // }],
  367. // syrIndex:
  368. regularsInfos: {
  369. visitMode: [{
  370. name: '电话问候',
  371. checked: false
  372. }, {
  373. name: '上门巡访',
  374. checked: false
  375. }, {
  376. name: '其它',
  377. checked: false
  378. }],
  379. visitModeExt: '', //巡访其他
  380. visitCount: [{
  381. name: '每天',
  382. checked: false
  383. }, {
  384. name: '每周',
  385. checked: false
  386. }, {
  387. name: '每月',
  388. checked: false
  389. }, {
  390. name: '每季',
  391. checked: false
  392. }, {
  393. name: '其它',
  394. checked: false
  395. }],
  396. visitCountExt: '', // 频次的其他
  397. },
  398. regularsInfo: [{
  399. visitMode: '',
  400. visitModeExt: '', //巡访其他
  401. visitCount: '',
  402. visitCountExt: '', // 频次的其他
  403. }],
  404. },
  405. // 左侧点击
  406. turn(e) {
  407. let index = e.currentTarget.dataset.index
  408. this.setData({
  409. currentIndex: index
  410. })
  411. },
  412. addOldName(e) {
  413. this.setData({
  414. addOldname: e.detail.value
  415. })
  416. },
  417. addOldName1(e) {
  418. this.setData({
  419. addOldname1: e.detail.value
  420. })
  421. },
  422. qx() {
  423. wx.switchTab({
  424. url: '/pages/index/index',
  425. })
  426. },
  427. qx1() {
  428. this.setData({
  429. showBj1: false
  430. })
  431. },
  432. switchNameTab(e) {
  433. console.log(this.data.childInfo, "$%^&%$#%^&^%$%^&")
  434. this.setData({
  435. activeIndex: e.currentTarget.dataset.index,
  436. currentIndex: 0
  437. })
  438. // wx.request({
  439. // url: util.globalData.publicUrl + '/wxinfo/one',
  440. // method: "get",
  441. // header: {
  442. // appletsId: wx.getStorageSync('openId')
  443. // },
  444. // data: {
  445. // id: e.currentTarget.dataset.item._id
  446. // },
  447. // success: (res) => {
  448. // if (res.data.code == 0) {
  449. // }
  450. // }
  451. // })
  452. },
  453. sure() {
  454. let han = /^[\u4e00-\u9fa5]+$/;
  455. if (this.data.addOldname == '' || this.data.addOldname == null) {
  456. wx.showModal({
  457. showCancel: false,
  458. content: '老人姓名不可以为空哦'
  459. })
  460. return false
  461. }
  462. if (!han.test(this.data.addOldname)) {
  463. wx.showModal({
  464. showCancel: false,
  465. content: '您输入的内容不是汉字哦'
  466. })
  467. return false;
  468. };
  469. if (this.data.addOldname.length < 2) {
  470. wx.showModal({
  471. showCancel: false,
  472. content: '老人姓名不可以少于两个字哦'
  473. })
  474. return false
  475. }
  476. this.setData({
  477. showBj: false
  478. })
  479. wx.request({
  480. url: util.globalData.publicUrl + '/wxinfo/add',
  481. method: "post",
  482. header: {
  483. appletsId: wx.getStorageSync('openId')
  484. },
  485. data: {
  486. name: this.data.addOldname
  487. },
  488. success: (res) => {
  489. if (res.data.code == 0) {
  490. let name = 'oldInfo[' + this.data.activeIndex + '].name'
  491. this.setData({
  492. nameArr: this.data.nameArr.concat(res.data.data),
  493. familyFid: res.data.data.fid,
  494. [name]: this.data.addOldname,
  495. oldInfo: this.data.oldInfo
  496. })
  497. this.getSelfLocation();
  498. console.log(this.data.nameArr)
  499. }
  500. }
  501. })
  502. },
  503. sure1() {
  504. let han = /^[\u4e00-\u9fa5]+$/;
  505. if (this.data.addOldname1 == '' || this.data.addOldname1 == null) {
  506. wx.showModal({
  507. showCancel: false,
  508. content: '老人姓名不可以为空哦'
  509. })
  510. return false
  511. }
  512. if (!han.test(this.data.addOldname1)) {
  513. wx.showModal({
  514. showCancel: false,
  515. content: '您输入的内容不是汉字哦'
  516. })
  517. return false;
  518. };
  519. if (this.data.addOldname1.length < 2) {
  520. wx.showModal({
  521. showCancel: false,
  522. content: '老人姓名不可以少于两个字哦'
  523. })
  524. return false
  525. }
  526. this.setData({
  527. showBj1: false,
  528. currentIndex: 0
  529. })
  530. wx.request({
  531. url: util.globalData.publicUrl + '/wxinfo/add',
  532. method: "post",
  533. header: {
  534. appletsId: wx.getStorageSync('openId')
  535. },
  536. data: {
  537. name: this.data.addOldname1,
  538. fid: this.data.familyFid
  539. },
  540. success: (res) => {
  541. if (res.data.code == 0) {
  542. this.data.oldInfo.push({
  543. name: this.data.addOldname1,
  544. oldSex: [{
  545. name: '男'
  546. }, {
  547. name: '女'
  548. }],
  549. nation: '',
  550. idNumber: '',
  551. phone: '',
  552. oldMarry: [{
  553. name: "未婚"
  554. }, {
  555. name: "已婚"
  556. }, {
  557. name: "离异"
  558. }, {
  559. name: "丧偶"
  560. }],
  561. partnerName: '',
  562. partnerIdNumber: '',
  563. healthAyy: [{
  564. name: "健康",
  565. disabled: false
  566. }, {
  567. name: "残疾",
  568. disabled: false
  569. }, {
  570. name: "患重特大疾病",
  571. disabled: false
  572. }, {
  573. name: "老年人慢性病",
  574. disabled: false
  575. }],
  576. disabilityAyy: [{
  577. name: "视力残疾"
  578. }, {
  579. name: "听力残疾"
  580. }, {
  581. name: "言语残疾"
  582. }, {
  583. name: "肢体残疾"
  584. }, {
  585. name: "智力残疾"
  586. }, {
  587. name: "精神残疾"
  588. }, {
  589. name: "多重残疾"
  590. }],
  591. disabilityLevel: '', //残疾人等级
  592. sickType: [{
  593. name: "重大器官类疾病"
  594. }, {
  595. name: "心脑血管类疾病"
  596. }, {
  597. name: "神经与代谢类疾病"
  598. }, {
  599. name: "肢体与病毒类疾病"
  600. }, {
  601. name: "恶性肿瘤"
  602. }],
  603. ability: '',
  604. moneyFromAyy: [{
  605. name: "家庭经营性收入"
  606. }, {
  607. name: "工资性收入"
  608. }, {
  609. name: "转移性收入"
  610. }, {
  611. name: "财产性收入"
  612. }, {
  613. name: "其它"
  614. }],
  615. income: '',
  616. sourceOfIncomeExt: '',
  617. familyHelpArr: [{
  618. name: "低保"
  619. }, {
  620. name: "建档立卡贫困户"
  621. }, {
  622. name: "医疗救助"
  623. }, {
  624. name: "临时救助"
  625. }, {
  626. name: "老年人福利津贴"
  627. }, {
  628. name: "残疾人两项补贴(或一项补贴)"
  629. }, {
  630. name: "其他救助"
  631. }],
  632. rescueStateExt: '', //其他救助
  633. loneArr: [{
  634. name: "是"
  635. }, {
  636. name: "否"
  637. }],
  638. liveStatus: [{
  639. name: "无人陪伴居住",
  640. disabled: false
  641. }, {
  642. name: "配偶",
  643. disabled: false
  644. }, {
  645. name: "近亲属",
  646. disabled: false
  647. }, {
  648. name: "未成年孙子女",
  649. disabled: false
  650. }, {
  651. name: "其他情形",
  652. disabled: false
  653. }],
  654. accompanyExt: '', //陪伴居住其他
  655. oftenMan: [{
  656. name: "无人照料",
  657. disabled: false
  658. }, {
  659. name: "近亲属",
  660. disabled: false
  661. }, {
  662. name: "配偶",
  663. disabled: false
  664. }, {
  665. name: "邻里互助",
  666. disabled: false
  667. }, {
  668. name: "购买养老服务",
  669. disabled: false
  670. }, {
  671. name: "其他人员",
  672. disabled: false
  673. }],
  674. lookAfterExt: '', //其他日常生活照料人
  675. mainLookName: '', //日常生活照料人姓名
  676. mainLookSex: [{
  677. name: "男"
  678. }, {
  679. name: "女"
  680. }],
  681. mainLookPhone: '', //日常生活照料人电话
  682. loveRequire: [{
  683. name: "生活照料"
  684. },
  685. {
  686. name: "生产帮助"
  687. },
  688. {
  689. name: "精神慰藉"
  690. },
  691. {
  692. name: "医疗保健"
  693. },
  694. {
  695. name: "权益维护"
  696. },
  697. {
  698. name: "安全监护"
  699. },
  700. {
  701. name: "文化娱乐"
  702. },
  703. {
  704. name: "紧急救助"
  705. },
  706. {
  707. name: "其它"
  708. },
  709. ],
  710. oldType: [{
  711. name: "农村留守老年人",
  712. disable: false,
  713. checked: false
  714. }, {
  715. name: "分散供养特困老年人",
  716. disable: false,
  717. checked: false
  718. }, {
  719. name: "计划生育特殊家庭老人",
  720. disable: false,
  721. checked: false
  722. }, {
  723. name: "空巢老年人",
  724. disable: false,
  725. checked: false
  726. }, {
  727. name: "独居老年人",
  728. disable: false,
  729. checked: false
  730. }, {
  731. name: "重残老年人",
  732. disable: false,
  733. checked: false
  734. }, {
  735. name: "高龄老年人",
  736. disable: false,
  737. checked: false
  738. }],
  739. regularsInfos: {
  740. visitMode: [{
  741. name: '电话问候'
  742. }, {
  743. name: '上门巡访'
  744. }, {
  745. name: '其它'
  746. }],
  747. visitModeExt: '', //巡访其他
  748. visitCount: [{
  749. name: '每天'
  750. }, {
  751. name: '每周'
  752. }, {
  753. name: '每月'
  754. }, {
  755. name: '每季'
  756. }, {
  757. name: '其它'
  758. }],
  759. visitCountExt: '', // 频次的其他
  760. },
  761. regularsInfo: {
  762. visitMode: '',
  763. visitModeExt: '', //巡访其他
  764. visitCount: '',
  765. visitCountExt: '', // 频次的其他
  766. },
  767. isHavePhoto: false,
  768. imgPath: '',
  769. photoAndLocation: '',
  770. })
  771. this.data.childInfo.push({
  772. childrenNum: '',
  773. Info: []
  774. })
  775. this.data.otherInfo.push({
  776. isHasOther: '',
  777. Info: {
  778. name: '', // 其他赡养人姓名,
  779. sex: '', //其他赡养人性别
  780. phone: '', //其他赡养人电话,
  781. relation: '', //与被赡养人关系 如果选了其他也是必填 单选
  782. relationExt: '', //与被赡养人关系--其他
  783. isHasGoOut: '', //是否外出
  784. outgoingCause: '', //外出原因
  785. outgoingplace: '', // 外出地点
  786. outgoingTime: '', // 最后一次离家时间
  787. isHasPartner: '', //是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0:是 1:否
  788. name2: '',
  789. phone2: '',
  790. visit: '', //平均一年探望次数
  791. othersyrSexArr: [{
  792. name: '男',
  793. checked: false
  794. },
  795. {
  796. name: '女',
  797. checked: false
  798. },
  799. ]
  800. }
  801. })
  802. console.log(this.data.childInfo)
  803. this.setData({
  804. activeIndex: this.data.nameArr.concat(res.data.data).length - 1,
  805. nameArr: this.data.nameArr.concat(res.data.data),
  806. oldInfo: this.data.oldInfo,
  807. childInfo: this.data.childInfo,
  808. otherInfo: this.data.otherInfo
  809. })
  810. this.getSelfLocation();
  811. }
  812. }
  813. })
  814. },
  815. // 删除上方名字
  816. deleteName(e) {
  817. let index = e.currentTarget.dataset.index
  818. console.log(index);
  819. wx.showModal({
  820. showCancel: true,
  821. content: '确认删除该条记录吗',
  822. success: (res) => {
  823. if (res.cancel) {
  824. //点击取消,默认隐藏弹框
  825. } else {
  826. wx.request({
  827. url: util.globalData.publicUrl + '/wxinfo/delete',
  828. method: "get",
  829. header: {
  830. appletsId: wx.getStorageSync('openId')
  831. },
  832. data: {
  833. id: e.currentTarget.dataset.item._id
  834. },
  835. success: (res) => {
  836. console.log(res)
  837. if (res.data.code == 0) {
  838. this.data.nameArr.splice(index, 1)
  839. this.data.oldInfo.splice(index, 1)
  840. this.data.otherInfo.splice(index, 1)
  841. this.data.childInfo.splice(index, 1)
  842. this.setData({
  843. oldInfo: this.data.oldInfo,
  844. nameArr: this.data.nameArr,
  845. otherInfo: this.data.otherInfo,
  846. childInfo: this.data.childInfo,
  847. })
  848. if ((this.data.activeIndex == index && this.data.activeIndex > 0) || (this.data.activeIndex > index && this.data.activeIndex > 0)) {
  849. this.setData({
  850. activeIndex: this.data.activeIndex - 1
  851. })
  852. }
  853. if (this.data.nameArr.length == 0) {
  854. wx.switchTab({
  855. url: '/pages/index/index',
  856. })
  857. }
  858. }
  859. }
  860. })
  861. }
  862. }
  863. })
  864. },
  865. // 添加带fid的老人
  866. addFamilyOldman() {
  867. this.setData({
  868. showBj1: true,
  869. addOldname1: ''
  870. })
  871. },
  872. goOcr() {
  873. console.log(this.data.nameArr)
  874. isonShow = true;
  875. wx.showLoading({
  876. title: '加载中',
  877. })
  878. let _this = this
  879. wx.request({
  880. url: util.globalData.publicUrl + '/applet/getToken',
  881. method: "GET",
  882. header: {
  883. appletsId: wx.getStorageSync('openId')
  884. },
  885. success: (res) => {
  886. console.log(res.data, "0000");
  887. if (res.data.data.status == 200) {
  888. let token = res.data.data.token;
  889. if (token) {
  890. wx.chooseImage({
  891. count: 1, // 默认9
  892. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  893. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  894. success: function (res) {
  895. // 拿文件转换base64
  896. wx.getFileSystemManager().readFile({
  897. filePath: res.tempFilePaths[0],
  898. encoding: 'base64',
  899. success: res1 => {
  900. //返回临时文件路径
  901. let img = 'data:image/png;base64,' + res1.data
  902. wx.request({
  903. url: 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=' + token,
  904. method: 'POST',
  905. header: {
  906. 'content-type': 'application/x-www-form-urlencoded'
  907. },
  908. data: {
  909. id_card_side: 'front',
  910. image: img
  911. },
  912. dataType: 'json',
  913. success: (e) => {
  914. // 扫描后赋值
  915. _this.setData({
  916. showBj: false,
  917. fid: _this.data.familyFid
  918. })
  919. if (e.data.idcard_number_type == 1) {
  920. console.log(e.data.words_result, '我是ocr识别出来的内容')
  921. console.log(_this.data.oldInfo[_this.data.activeIndex].name, "啊实打实大师多撒大所多撒");
  922. if (_this.data.oldInfo[_this.data.activeIndex].name == e.data.words_result['姓名'].words) {
  923. let idNumber = 'oldInfo[' + _this.data.activeIndex + '].idNumber'
  924. let name = 'oldInfo[' + _this.data.activeIndex + '].name'
  925. let nation = 'oldInfo[' + _this.data.activeIndex + '].nation'
  926. let data = _this.data.oldInfo[_this.data.activeIndex].oldSex.map(v => {
  927. if (v.name == e.data.words_result['性别'].words) {
  928. return {
  929. name: v.name,
  930. checked: true
  931. }
  932. }
  933. return {
  934. name: v.name,
  935. checked: false
  936. }
  937. })
  938. let oldSex = 'oldInfo[' + _this.data.activeIndex + '].oldSex'
  939. _this.setData({
  940. [idNumber]: e.data.words_result['公民身份号码'].words,
  941. [name]: e.data.words_result['姓名'].words,
  942. [nation]: e.data.words_result['民族'].words + '族',
  943. [oldSex]: data
  944. })
  945. _this.SubmitOldmanInfo({
  946. id: _this.data.nameArr[_this.data.activeIndex]._id,
  947. idNumber: e.data.words_result['公民身份号码'].words
  948. })
  949. _this.SubmitOldmanInfo({
  950. id: _this.data.nameArr[_this.data.activeIndex]._id,
  951. name: e.data.words_result['姓名'].words
  952. })
  953. _this.SubmitOldmanInfo({
  954. id: _this.data.nameArr[_this.data.activeIndex]._id,
  955. nation: e.data.words_result['民族'].words + '族'
  956. })
  957. _this.SubmitOldmanInfo({
  958. id: _this.data.nameArr[_this.data.activeIndex]._id,
  959. sex: e.data.words_result['性别'].words
  960. })
  961. } else {
  962. wx.showToast({
  963. title: "添加当前老人名字和扫描身份证名字不一致,请重新扫描",
  964. icon: 'none',
  965. duration: 2000,
  966. })
  967. }
  968. } else {
  969. wx.showToast({
  970. title: "身份证OCR识别失败",
  971. icon: 'none',
  972. duration: 2000,
  973. })
  974. }
  975. },
  976. complete: (e) => {
  977. wx.hideLoading();
  978. }
  979. })
  980. },
  981. // 错误信息
  982. fail: console.error
  983. })
  984. },
  985. fail: function () {
  986. wx.hideLoading();
  987. },
  988. complete: function () {
  989. _this.setData({
  990. showBj: false,
  991. })
  992. }
  993. })
  994. } else {
  995. wx.showToast({
  996. title: '身份证识别失败,token失效',
  997. icon: 'none',
  998. duration: 2000,
  999. })
  1000. }
  1001. }
  1002. },
  1003. })
  1004. },
  1005. // 老人姓名
  1006. tab1Change1: function (e) {
  1007. if (e.detail.value == null || e.detail.value == '') {
  1008. this.setData({
  1009. oldName: true
  1010. })
  1011. return
  1012. } else {
  1013. console.log(this.data.nameArr)
  1014. let name = 'nameArr[' + this.data.activeIndex + '].name'
  1015. this.setData({
  1016. oldName: false,
  1017. [name]: e.detail.value
  1018. })
  1019. console.log(this.data.nameArr)
  1020. }
  1021. this.SubmitOldmanInfo({
  1022. id: this.data.nameArr[this.data.activeIndex]._id,
  1023. name: e.detail.value
  1024. })
  1025. },
  1026. // 性别单选
  1027. tab1Change2(e) {
  1028. let data = this.data.oldInfo[this.data.activeIndex].oldSex.map(v => {
  1029. if (v.name == e.detail.value) {
  1030. return {
  1031. name: v.name,
  1032. checked: true
  1033. }
  1034. }
  1035. return {
  1036. name: v.name,
  1037. checked: false
  1038. }
  1039. })
  1040. let oldSex = 'oldInfo[' + this.data.activeIndex + '].oldSex'
  1041. this.setData({
  1042. [oldSex]: data
  1043. })
  1044. this.SubmitOldmanInfo({
  1045. id: this.data.nameArr[this.data.activeIndex]._id,
  1046. sex: e.detail.value
  1047. })
  1048. },
  1049. // 民族选择
  1050. tab1Change3: function (e) {
  1051. console.log('picker发送选择改变,携带值为', e.detail.value)
  1052. let nation = 'oldInfo[' + this.data.activeIndex + '].nation'
  1053. this.setData({
  1054. [nation]: this.data.mzArr[e.detail.value]
  1055. })
  1056. this.SubmitOldmanInfo({
  1057. id: this.data.nameArr[this.data.activeIndex]._id,
  1058. nation: this.data.mzArr[e.detail.value]
  1059. })
  1060. },
  1061. // 身份证号
  1062. tab1Change4: function (e) {
  1063. console.log('身份证变化了')
  1064. if (e.detail.value == null || e.detail.value == '') {
  1065. this.setData({
  1066. oldCard: true,
  1067. oldCard1: false
  1068. })
  1069. return
  1070. } else {
  1071. this.setData({
  1072. oldCard: false
  1073. })
  1074. }
  1075. if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e.detail.value)) && e.detail.value.length != 18) {
  1076. this.setData({
  1077. oldCard1: true
  1078. })
  1079. return
  1080. } else {
  1081. this.setData({
  1082. oldCard1: false
  1083. })
  1084. let idNumber = 'oldInfo[' + this.data.activeIndex + '].idNumber'
  1085. this.setData({
  1086. [idNumber]: e.detail.value
  1087. })
  1088. this.SubmitOldmanInfo({
  1089. id: this.data.nameArr[this.data.activeIndex]._id,
  1090. idNumber: e.detail.value
  1091. })
  1092. }
  1093. },
  1094. // 联系电话
  1095. tab1Change5: function (e) {
  1096. if (e.detail.value == null || e.detail.value == '') {
  1097. this.setData({
  1098. oldPhone: true
  1099. })
  1100. return
  1101. } else {
  1102. this.setData({
  1103. oldPhone: false
  1104. })
  1105. }
  1106. if (!(/^[0-9]*$/.test(e.detail.value))) {
  1107. this.setData({
  1108. oldPhone1: true
  1109. })
  1110. return
  1111. } else {
  1112. this.setData({
  1113. oldPhone1: false
  1114. })
  1115. this.SubmitOldmanInfo({
  1116. id: this.data.nameArr[this.data.activeIndex]._id,
  1117. phone: e.detail.value
  1118. })
  1119. }
  1120. },
  1121. // 婚姻以及配偶情况
  1122. tab1Change8: function (e) {
  1123. console.log(e.detail.value)
  1124. if (e.detail.value == '已婚') {
  1125. this.setData({
  1126. oldisMarry: true
  1127. })
  1128. } else {
  1129. this.setData({
  1130. oldisMarry: false,
  1131. oldisMarryName: false,
  1132. oldisMarryPhone: false
  1133. })
  1134. }
  1135. let data = this.data.oldInfo[this.data.activeIndex].oldMarry.map(v => {
  1136. if (v.name == e.detail.value) {
  1137. console.log("我选了")
  1138. return {
  1139. name: v.name,
  1140. checked: true
  1141. }
  1142. }
  1143. return {
  1144. name: v.name,
  1145. checked: false
  1146. }
  1147. })
  1148. console.log(data)
  1149. let oldMarry = 'oldInfo[' + this.data.activeIndex + '].oldMarry'
  1150. this.setData({
  1151. [oldMarry]: data
  1152. })
  1153. console.log(this.data.oldInfo)
  1154. this.SubmitOldmanInfo({
  1155. id: this.data.nameArr[this.data.activeIndex]._id,
  1156. partnerState: e.detail.value
  1157. })
  1158. },
  1159. //配偶的姓名
  1160. tab1Change8_1(e) {
  1161. if (e.detail.value == '' || e.detail.value == null) {
  1162. this.setData({
  1163. oldisMarryName: true
  1164. })
  1165. return
  1166. } else {
  1167. this.setData({
  1168. oldisMarryName: false
  1169. })
  1170. }
  1171. let partnerName = 'oldInfo[' + this.data.activeIndex + '].partnerName'
  1172. this.setData({
  1173. [partnerName]: e.detail.value
  1174. })
  1175. this.SubmitOldmanInfo({
  1176. id: this.data.nameArr[this.data.activeIndex]._id,
  1177. partnerName: e.detail.value
  1178. })
  1179. },
  1180. //配偶身份证号
  1181. tab1Change8_2(e) {
  1182. if (e.detail.value == '' || e.detail.value == null) {
  1183. this.setData({
  1184. oldisMarryPhone: true
  1185. })
  1186. return
  1187. } else {
  1188. this.setData({
  1189. oldisMarryPhone: false
  1190. })
  1191. }
  1192. if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e.detail.value)) && e.detail.value.length != 18) {
  1193. this.setData({
  1194. oldisMarryPhoneGs: true
  1195. })
  1196. return
  1197. } else {
  1198. let partnerIdNumber = 'oldInfo[' + this.data.activeIndex + '].partnerIdNumber'
  1199. this.setData({
  1200. oldisMarryPhoneGs: false,
  1201. [partnerIdNumber]: e.detail.value
  1202. })
  1203. this.SubmitOldmanInfo({
  1204. id: this.data.nameArr[this.data.activeIndex]._id,
  1205. partnerIdNumber: e.detail.value
  1206. })
  1207. }
  1208. },
  1209. //老人健康状况
  1210. tab1Change9: function (e) {
  1211. console.log(e.detail.value)
  1212. const items = this.data.oldInfo[this.data.activeIndex].healthAyy
  1213. const values = e.detail.value
  1214. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1215. items[i].checked = false
  1216. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1217. if (items[i].name === values[j]) {
  1218. items[i].checked = true
  1219. break
  1220. }
  1221. }
  1222. }
  1223. let healthAyy = 'oldInfo[' + this.data.activeIndex + '].healthAyy'
  1224. this.setData({
  1225. [healthAyy]: items
  1226. })
  1227. console.log(this.data.oldInfo)
  1228. let revise1 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[1].disabled'
  1229. let revise2 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[2].disabled'
  1230. let revise3 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[3].disabled'
  1231. let rev1 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[1].checked'
  1232. let rev2 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[2].checked'
  1233. let rev3 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[3].checked'
  1234. if (e.detail.value.length == 0) {
  1235. this.setData({
  1236. oldHealth1: true,
  1237. [revise1]: false,
  1238. [revise2]: false,
  1239. [revise3]: false,
  1240. })
  1241. return
  1242. } else {
  1243. this.setData({
  1244. oldHealth1: false
  1245. })
  1246. }
  1247. let index = e.detail.value.indexOf('健康');
  1248. let index1 = e.detail.value.indexOf('残疾');
  1249. let index2 = e.detail.value.indexOf('患重特大疾病');
  1250. if (index >= 0) {
  1251. this.setData({
  1252. [revise1]: true,
  1253. [revise2]: true,
  1254. [revise3]: true,
  1255. [rev1]: false,
  1256. [rev2]: false,
  1257. [rev3]: false
  1258. })
  1259. this.SubmitOldmanInfo({
  1260. id: this.data.nameArr[this.data.activeIndex]._id,
  1261. health: JSON.stringify(['健康'])
  1262. })
  1263. } else {
  1264. this.setData({
  1265. [revise1]: false,
  1266. [revise2]: false,
  1267. [revise3]: false,
  1268. })
  1269. }
  1270. // if (index1 >= 0 && index < 0) {
  1271. // this.setData({
  1272. // oldHealth2: true
  1273. // })
  1274. // } else {
  1275. // this.setData({
  1276. // oldHealth2: false,
  1277. // oldDisableType: false,
  1278. // issickTypeNull: false
  1279. // })
  1280. // }
  1281. if (index2 >= 0 && index < 0) {
  1282. this.setData({
  1283. isSick: true
  1284. })
  1285. } else {
  1286. this.setData({
  1287. isSick: false,
  1288. oldDisableType: false,
  1289. issickTypeNull: false
  1290. })
  1291. }
  1292. if (index < 0 && e.detail.value.length != 0) {
  1293. this.SubmitOldmanInfo({
  1294. id: this.data.nameArr[this.data.activeIndex]._id,
  1295. health: JSON.stringify(e.detail.value)
  1296. })
  1297. }
  1298. },
  1299. // 残疾类别
  1300. tab1Change10: function (e) {
  1301. console.log(e.detail.value)
  1302. const items = this.data.oldInfo[this.data.activeIndex].disabilityAyy
  1303. const values = e.detail.value
  1304. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1305. items[i].checked = false
  1306. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1307. if (items[i].name === values[j]) {
  1308. items[i].checked = true
  1309. break
  1310. }
  1311. }
  1312. }
  1313. let disabilityAyy = 'oldInfo[' + this.data.activeIndex + '].disabilityAyy'
  1314. this.setData({
  1315. [disabilityAyy]: items
  1316. })
  1317. if (e.detail.value == null || e.detail.value == '') {
  1318. this.setData({
  1319. oldDisableType: true
  1320. })
  1321. return
  1322. } else {
  1323. this.setData({
  1324. oldDisableType: false
  1325. })
  1326. }
  1327. this.SubmitOldmanInfo({
  1328. id: this.data.nameArr[this.data.activeIndex]._id,
  1329. disabilityCategory: JSON.stringify(e.detail.value)
  1330. })
  1331. },
  1332. // 重特大疾病类别
  1333. tab1Change10_1: function (e) {
  1334. console.log(e.detail.value)
  1335. const items = this.data.oldInfo[this.data.activeIndex].sickType
  1336. const values = e.detail.value
  1337. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1338. items[i].checked = false
  1339. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1340. if (items[i].name === values[j]) {
  1341. items[i].checked = true
  1342. break
  1343. }
  1344. }
  1345. }
  1346. let sickType = 'oldInfo[' + this.data.activeIndex + '].sickType'
  1347. this.setData({
  1348. [sickType]: items
  1349. })
  1350. console.log(this.data.sickType)
  1351. if (e.detail.value.length == 0) {
  1352. this.setData({
  1353. issickTypeNull: true
  1354. })
  1355. return
  1356. } else {
  1357. this.setData({
  1358. issickTypeNull: false
  1359. })
  1360. }
  1361. this.SubmitOldmanInfo({
  1362. id: this.data.nameArr[this.data.activeIndex]._id,
  1363. majorDiseases: JSON.stringify(e.detail.value)
  1364. })
  1365. },
  1366. // 残疾人等级
  1367. tab1Change11: function (e) {
  1368. // this.setData({
  1369. // levalIndex: e.detail.value
  1370. // })
  1371. let disabilityLevel = 'oldInfo[' + this.data.activeIndex + '].disabilityLevel'
  1372. this.setData({
  1373. [disabilityLevel]: this.data.disableLeval[e.detail.value]
  1374. })
  1375. this.SubmitOldmanInfo({
  1376. id: this.data.nameArr[this.data.activeIndex]._id,
  1377. disabilityLevel: this.data.oldInfo[this.data.activeIndex].disabilityLevel
  1378. })
  1379. },
  1380. // 老年人能力情况
  1381. tab1Change12: function (e) {
  1382. let ability = 'oldInfo[' + this.data.activeIndex + '].ability'
  1383. this.setData({
  1384. [ability]: this.data.ableStatus[e.detail.value]
  1385. })
  1386. // if (e.detail.value == 2) {
  1387. // this.setData({
  1388. // oldType: this.data.oldType.concat({
  1389. // name: "失能老人",
  1390. // disable: true,
  1391. // checked: true
  1392. // })
  1393. // })
  1394. // }
  1395. this.SubmitOldmanInfo({
  1396. id: this.data.nameArr[this.data.activeIndex]._id,
  1397. ability: this.data.disableLeval[e.detail.value]
  1398. })
  1399. },
  1400. // 生活经济情况
  1401. tab1Change13: function (e) {
  1402. let livingCondition = 'oldInfo[' + this.data.activeIndex + '].livingCondition'
  1403. this.setData({
  1404. [livingCondition]: this.data.moneyStatus[e.detail.value]
  1405. })
  1406. this.SubmitOldmanInfo({
  1407. id: this.data.nameArr[this.data.activeIndex]._id,
  1408. livingCondition: this.data.moneyStatus[e.detail.value]
  1409. })
  1410. },
  1411. // 收入来源
  1412. tab1Change14: function (e) {
  1413. console.log(e.detail.value)
  1414. const items = this.data.oldInfo[this.data.activeIndex].moneyFromAyy
  1415. const values = e.detail.value
  1416. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1417. items[i].checked = false
  1418. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1419. if (items[i].name === values[j]) {
  1420. items[i].checked = true
  1421. break
  1422. }
  1423. }
  1424. }
  1425. let moneyFromAyy = 'oldInfo[' + this.data.activeIndex + '].moneyFromAyy'
  1426. this.setData({
  1427. [moneyFromAyy]: items
  1428. })
  1429. if (e.detail.value.length == 0) {
  1430. this.setData({
  1431. moneyFromOther: true
  1432. })
  1433. return
  1434. } else {
  1435. this.setData({
  1436. moneyFromOther: false
  1437. })
  1438. }
  1439. this.SubmitOldmanInfo({
  1440. id: this.data.nameArr[this.data.activeIndex]._id,
  1441. sourceOfIncome: JSON.stringify(e.detail.value)
  1442. })
  1443. },
  1444. // 其他收入来源sourceOfIncomeExt
  1445. tab1Change14_1: function (e) {
  1446. if (e.detail.value == null || e.detail.value == '') {
  1447. this.setData({
  1448. moneyOtherQtnull: true
  1449. })
  1450. } else {
  1451. this.setData({
  1452. moneyOtherQtnull: false
  1453. })
  1454. this.SubmitOldmanInfo({
  1455. id: this.data.nameArr[this.data.activeIndex]._id,
  1456. sourceOfIncomeExt: e.detail.value
  1457. })
  1458. }
  1459. },
  1460. // 本人上年度可支配收入
  1461. tab1Change15: function (e) {
  1462. let income = 'oldInfo[' + this.data.activeIndex + '].income'
  1463. this.setData({
  1464. [income]: this.data.payMoney[e.detail.value]
  1465. })
  1466. this.SubmitOldmanInfo({
  1467. id: this.data.nameArr[this.data.activeIndex]._id,
  1468. income: this.data.payMoney[e.detail.value]
  1469. })
  1470. },
  1471. // 家庭救助帮扶情况
  1472. tab1Change16: function (e) {
  1473. console.log(e.detail.value)
  1474. const items = this.data.oldInfo[this.data.activeIndex].familyHelpArr
  1475. const values = e.detail.value
  1476. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1477. items[i].checked = false
  1478. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1479. if (items[i].name === values[j]) {
  1480. items[i].checked = true
  1481. break
  1482. }
  1483. }
  1484. }
  1485. let familyHelpArr = 'oldInfo[' + this.data.activeIndex + '].familyHelpArr'
  1486. this.setData({
  1487. [familyHelpArr]: items
  1488. })
  1489. if (e.detail.value.length == 0) {
  1490. this.setData({
  1491. familyHelp: true
  1492. })
  1493. return
  1494. } else {
  1495. this.setData({
  1496. familyHelp: false
  1497. })
  1498. }
  1499. this.SubmitOldmanInfo({
  1500. id: this.data.nameArr[this.data.activeIndex]._id,
  1501. rescueState: JSON.stringify(e.detail.value)
  1502. })
  1503. },
  1504. // 其他救助帮扶情况
  1505. tab1Change16_1: function (e) {
  1506. if (e.detail.value == null || e.detail.value == '') {
  1507. this.setData({
  1508. otherhelpQtnull: true
  1509. })
  1510. } else {
  1511. this.setData({
  1512. otherhelpQtnull: false
  1513. })
  1514. let rescueStateExt = 'oldInfo[' + this.data.activeIndex + '].rescueStateExt'
  1515. this.setData({
  1516. [rescueStateExt]: e.detail.value
  1517. })
  1518. this.SubmitOldmanInfo({
  1519. id: this.data.nameArr[this.data.activeIndex]._id,
  1520. rescueStateExt: e.detail.value
  1521. })
  1522. }
  1523. },
  1524. // 是否为失独家庭
  1525. tab1Change17: function (e) {
  1526. console.log(e.detail.value)
  1527. let data = this.data.oldInfo[this.data.activeIndex].loneArr.map(v => {
  1528. if (v.name == e.detail.value) {
  1529. return {
  1530. name: v.name,
  1531. checked: true
  1532. }
  1533. }
  1534. return {
  1535. name: v.name,
  1536. checked: false
  1537. }
  1538. })
  1539. let loneArr = 'oldInfo[' + this.data.activeIndex + '].loneArr'
  1540. this.setData({
  1541. [loneArr]: data
  1542. })
  1543. this.SubmitOldmanInfo({
  1544. id: this.data.nameArr[this.data.activeIndex]._id,
  1545. isLoss: e.detail.value
  1546. })
  1547. },
  1548. // 陪伴居住情况
  1549. tab1Change18: function (e) {
  1550. console.log(e.detail.value)
  1551. const items = this.data.oldInfo[this.data.activeIndex].liveStatus
  1552. const values = e.detail.value
  1553. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1554. items[i].checked = false
  1555. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1556. if (items[i].name === values[j]) {
  1557. items[i].checked = true
  1558. break
  1559. }
  1560. }
  1561. }
  1562. let liveStatus = 'oldInfo[' + this.data.activeIndex + '].liveStatus'
  1563. this.setData({
  1564. [liveStatus]: items
  1565. })
  1566. let revise1 = "oldInfo[" + this.data.activeIndex + "].liveStatus[1].disabled";
  1567. let revise2 = "oldInfo[" + this.data.activeIndex + "].liveStatus[2].disabled";
  1568. let revise3 = "oldInfo[" + this.data.activeIndex + "].liveStatus[3].disabled";
  1569. let revise4 = "oldInfo[" + this.data.activeIndex + "].liveStatus[4].disabled";
  1570. let rev1 = "oldInfo[" + this.data.activeIndex + "].liveStatus[1].checked";
  1571. let rev2 = "oldInfo[" + this.data.activeIndex + "].liveStatus[2].checked";
  1572. let rev3 = "oldInfo[" + this.data.activeIndex + "].liveStatus[3].checked";
  1573. let rev4 = "oldInfo[" + this.data.activeIndex + "].liveStatus[4].checked";
  1574. if (e.detail.value.length == 0) {
  1575. this.setData({
  1576. isliveNull: true
  1577. })
  1578. } else {
  1579. this.setData({
  1580. isliveNull: false
  1581. })
  1582. }
  1583. let index = e.detail.value.indexOf('无人陪伴居住');
  1584. if (index >= 0) {
  1585. console.log('有无人陪伴居住')
  1586. this.setData({
  1587. [revise1]: true,
  1588. [revise2]: true,
  1589. [revise3]: true,
  1590. [revise4]: true,
  1591. [rev1]: false,
  1592. [rev2]: false,
  1593. [rev3]: false,
  1594. [rev4]: false,
  1595. })
  1596. this.SubmitOldmanInfo({
  1597. id: this.data.nameArr[this.data.activeIndex]._id,
  1598. accompany: JSON.stringify(['无人陪伴居住'])
  1599. })
  1600. console.log(this.data.oldInfo[this.data.activeIndex].liveStatus)
  1601. } else {
  1602. this.setData({
  1603. [revise1]: false,
  1604. [revise2]: false,
  1605. [revise3]: false,
  1606. [revise4]: false
  1607. })
  1608. }
  1609. if (index < 0 && e.detail.value.length != 0) {
  1610. this.SubmitOldmanInfo({
  1611. id: this.data.nameArr[this.data.activeIndex]._id,
  1612. accompany: JSON.stringify(e.detail.value)
  1613. })
  1614. }
  1615. },
  1616. // 其他陪伴居住情况
  1617. tab1Change18_1: function (e) {
  1618. if (e.detail.value == null || e.detail.value == '') {
  1619. this.setData({
  1620. isliveQtNull: true
  1621. })
  1622. } else {
  1623. this.setData({
  1624. isliveQtNull: false
  1625. })
  1626. let accompanyExt = 'oldInfo[' + this.data.activeIndex + '].accompanyExt'
  1627. this.setData({
  1628. [accompanyExt]: e.detail.value
  1629. })
  1630. this.SubmitOldmanInfo({
  1631. id: this.data.nameArr[this.data.activeIndex]._id,
  1632. accompanyExt: e.detail.value
  1633. })
  1634. }
  1635. },
  1636. // 日常生活照料人
  1637. tab1Change19: function (e) {
  1638. console.log(e.detail.value)
  1639. const items = this.data.oldInfo[this.data.activeIndex].oftenMan
  1640. const values = e.detail.value
  1641. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1642. items[i].checked = false
  1643. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1644. if (items[i].name === values[j]) {
  1645. items[i].checked = true
  1646. break
  1647. }
  1648. }
  1649. }
  1650. let oftenMan = 'oldInfo[' + this.data.activeIndex + '].oftenMan'
  1651. this.setData({
  1652. [oftenMan]: items
  1653. })
  1654. let revise1 = "oldInfo[" + this.data.activeIndex + "].oftenMan[1].disabled";
  1655. let revise2 = "oldInfo[" + this.data.activeIndex + "].oftenMan[2].disabled";
  1656. let revise3 = "oldInfo[" + this.data.activeIndex + "].oftenMan[3].disabled";
  1657. let revise4 = "oldInfo[" + this.data.activeIndex + "].oftenMan[4].disabled";
  1658. let revise5 = "oldInfo[" + this.data.activeIndex + "].oftenMan[5].disabled";
  1659. let rev1 = "oldInfo[" + this.data.activeIndex + "].oftenMan[1].checked";
  1660. let rev2 = "oldInfo[" + this.data.activeIndex + "].oftenMan[2].checked";
  1661. let rev3 = "oldInfo[" + this.data.activeIndex + "].oftenMan[3].checked";
  1662. let rev4 = "oldInfo[" + this.data.activeIndex + "].oftenMan[4].checked";
  1663. let rev5 = "oldInfo[" + this.data.activeIndex + "].oftenMan[5].checked";
  1664. if (e.detail.value.length == 0) {
  1665. this.setData({
  1666. isoftenManNull: true
  1667. })
  1668. } else {
  1669. this.setData({
  1670. isoftenManNull: false
  1671. })
  1672. }
  1673. let index = e.detail.value.indexOf('无人照料');
  1674. if (index >= 0) {
  1675. this.setData({
  1676. [revise1]: true,
  1677. [revise2]: true,
  1678. [revise3]: true,
  1679. [revise4]: true,
  1680. [revise5]: true,
  1681. [rev1]: false,
  1682. [rev2]: false,
  1683. [rev3]: false,
  1684. [rev4]: false,
  1685. [rev5]: false,
  1686. })
  1687. this.SubmitOldmanInfo({
  1688. id: this.data.nameArr[this.data.activeIndex]._id,
  1689. lookAfter: JSON.stringify(['无人照料'])
  1690. })
  1691. } else {
  1692. this.setData({
  1693. [revise1]: false,
  1694. [revise2]: false,
  1695. [revise3]: false,
  1696. [revise4]: false,
  1697. [revise5]: false
  1698. })
  1699. }
  1700. if (index < 0 && e.detail.value.length != 0) {
  1701. // this.setData({
  1702. // ofenmanDetail: true
  1703. // })
  1704. this.SubmitOldmanInfo({
  1705. id: this.data.nameArr[this.data.activeIndex]._id,
  1706. lookAfter: JSON.stringify(e.detail.value)
  1707. })
  1708. }
  1709. // else {
  1710. // this.setData({
  1711. // ofenmanDetail: false
  1712. // })
  1713. // }
  1714. },
  1715. // 其他人员关系
  1716. tab1Change20: function (e) {
  1717. if (e.detail.value == null || e.detail.value == '') {
  1718. this.setData({
  1719. isoftenReaNull: true
  1720. })
  1721. } else {
  1722. this.setData({
  1723. isoftenReaNull: false
  1724. })
  1725. let lookAfterExt = 'oldInfo[' + this.data.activeIndex + '].lookAfterExt'
  1726. this.setData({
  1727. [lookAfterExt]: e.detail.value
  1728. })
  1729. this.SubmitOldmanInfo({
  1730. id: this.data.nameArr[this.data.activeIndex]._id,
  1731. lookAfterExt: e.detail.value
  1732. })
  1733. }
  1734. },
  1735. // 主要照料人姓名
  1736. tab1Change21: function (e) {
  1737. if (e.detail.value == null || e.detail.value == '') {
  1738. this.setData({
  1739. lookAfterName: true
  1740. })
  1741. } else {
  1742. this.setData({
  1743. lookAfterName: false
  1744. })
  1745. let mainLookName = 'oldInfo[' + this.data.activeIndex + '].mainLookName'
  1746. this.setData({
  1747. [mainLookName]: e.detail.value
  1748. })
  1749. this.SubmitOldmanInfo({
  1750. id: this.data.nameArr[this.data.activeIndex]._id,
  1751. mainLookName: e.detail.value
  1752. })
  1753. }
  1754. },
  1755. // 主要照料人性别
  1756. tab1Change22: function (e) {
  1757. console.log(e.detail.value)
  1758. let data = this.data.oldInfo[this.data.activeIndex].mainLookSex.map(v => {
  1759. if (v.name == e.detail.value) {
  1760. return {
  1761. name: v.name,
  1762. checked: true
  1763. }
  1764. }
  1765. return {
  1766. name: v.name,
  1767. checked: false
  1768. }
  1769. })
  1770. let mainLookSex = 'oldInfo[' + this.data.activeIndex + '].mainLookSex'
  1771. this.setData({
  1772. [mainLookSex]: data
  1773. })
  1774. this.SubmitOldmanInfo({
  1775. id: this.data.nameArr[this.data.activeIndex]._id,
  1776. mainLookSex: e.detail.value
  1777. })
  1778. },
  1779. // 主要照料人电话
  1780. tab1Change23: function (e) {
  1781. if (e.detail.value == '' || e.detail.value == null) {
  1782. this.setData({
  1783. islookPhoneNull: true
  1784. })
  1785. } else {
  1786. this.setData({
  1787. islookPhoneNull: false
  1788. })
  1789. let mainLookPhone = 'oldInfo[' + this.data.activeIndex + '].mainLookPhone'
  1790. this.setData({
  1791. [mainLookPhone]: e.detail.value
  1792. })
  1793. this.SubmitOldmanInfo({
  1794. id: this.data.nameArr[this.data.activeIndex]._id,
  1795. mainLookPhone: e.detail.value
  1796. })
  1797. }
  1798. },
  1799. // 关爱服务需求
  1800. tab1Change24: function (e) {
  1801. console.log(e.detail.value)
  1802. const items = this.data.oldInfo[this.data.activeIndex].loveRequire
  1803. const values = e.detail.value
  1804. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1805. items[i].checked = false
  1806. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1807. if (items[i].name === values[j]) {
  1808. items[i].checked = true
  1809. break
  1810. }
  1811. }
  1812. }
  1813. let loveRequire = 'oldInfo[' + this.data.activeIndex + '].loveRequire'
  1814. this.setData({
  1815. [loveRequire]: items
  1816. })
  1817. if (e.detail.value == '' || e.detail.value == null) {
  1818. this.setData({
  1819. isloveNull: true
  1820. })
  1821. } else {
  1822. this.setData({
  1823. isloveNull: false
  1824. })
  1825. this.SubmitOldmanInfo({
  1826. id: this.data.nameArr[this.data.activeIndex]._id,
  1827. demand: JSON.stringify(e.detail.value)
  1828. })
  1829. }
  1830. },
  1831. // 其他收入来源sourceOfIncomeExt
  1832. tab1Change14_1: function (e) {
  1833. if (e.detail.value == null || e.detail.value == '') {
  1834. this.setData({
  1835. isloveNull: true
  1836. })
  1837. } else {
  1838. this.setData({
  1839. isloveNull: false
  1840. })
  1841. this.SubmitOldmanInfo({
  1842. id: this.data.nameArr[this.data.activeIndex]._id,
  1843. demandExt: e.detail.value
  1844. })
  1845. }
  1846. },
  1847. // 其他关爱服务需求
  1848. tab1change25: function (e) {
  1849. console.log(e.detail.value)
  1850. const items = this.data.oldInfo[this.data.activeIndex].oldType
  1851. const values = e.detail.value
  1852. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1853. items[i].checked = false
  1854. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1855. if (items[i].name === values[j]) {
  1856. items[i].checked = true
  1857. break
  1858. }
  1859. }
  1860. }
  1861. let oldType = 'oldInfo[' + this.data.activeIndex + '].oldType'
  1862. this.setData({
  1863. [oldType]: items
  1864. })
  1865. if (e.detail.value == '' || e.detail.value == null) {
  1866. this.setData({
  1867. isloveQtNull: true
  1868. })
  1869. } else {
  1870. this.setData({
  1871. isloveQtNull: false,
  1872. })
  1873. this.SubmitOldmanInfo({
  1874. id: this.data.nameArr[this.data.activeIndex]._id,
  1875. demandExt: e.detail.value
  1876. })
  1877. }
  1878. },
  1879. // 老年人类别
  1880. tab1Change26: function (e) {
  1881. console.log(e.detail.value)
  1882. if (e.detail.value == '' || e.detail.value == null) {
  1883. this.setData({
  1884. isoldtypeNull: true
  1885. })
  1886. } else {
  1887. this.setData({
  1888. isoldtypeNull: false,
  1889. })
  1890. }
  1891. let index1 = e.detail.value.indexOf('农村留守老年人')
  1892. let index2 = e.detail.value.indexOf('分散供养特困老年人')
  1893. let index3 = e.detail.value.indexOf('计划生育特殊家庭老人')
  1894. let index4 = e.detail.value.indexOf('空巢老年人')
  1895. // let revise1 = 'oldInfo[' + this.data.activeIndex + '].healthAyy[1].disabled'
  1896. let revise1 = "oldInfo[" + this.data.activeIndex + "].oldType[0].disable";
  1897. let revise2 = "oldInfo[" + this.data.activeIndex + "].oldType[1].disable";
  1898. let revise3 = "oldInfo[" + this.data.activeIndex + "].oldType[2].disable";
  1899. let revise4 = "oldInfo[" + this.data.activeIndex + "].oldType[3].disable";
  1900. let revise5 = "oldInfo[" + this.data.activeIndex + "].oldType[3].checked";
  1901. this.SubmitOldmanInfo({
  1902. id: this.data.nameArr[this.data.activeIndex]._id,
  1903. oldType: JSON.stringify(e.detail.value)
  1904. })
  1905. if (index1 >= 0) {
  1906. this.setData({
  1907. [revise2]: true,
  1908. [revise3]: true,
  1909. [revise4]: true,
  1910. [revise5]: true
  1911. })
  1912. return false;
  1913. } else {
  1914. console.log("反選的");
  1915. this.setData({
  1916. // [revise1]: false,
  1917. [revise2]: false,
  1918. [revise3]: false,
  1919. [revise4]: false,
  1920. [revise5]: false
  1921. })
  1922. index4 = -1;
  1923. }
  1924. if (index2 >= 0) {
  1925. this.setData({
  1926. [revise1]: true,
  1927. [revise3]: true,
  1928. [revise4]: true
  1929. })
  1930. return false;
  1931. } else {
  1932. this.setData({
  1933. [revise1]: false,
  1934. [revise3]: false,
  1935. [revise4]: false
  1936. })
  1937. }
  1938. if (index3 >= 0) {
  1939. this.setData({
  1940. [revise1]: true,
  1941. [revise2]: true,
  1942. [revise4]: true
  1943. })
  1944. return false;
  1945. } else {
  1946. this.setData({
  1947. [revise1]: false,
  1948. [revise2]: false,
  1949. [revise4]: false
  1950. })
  1951. }
  1952. if (index4 >= 0) {
  1953. this.setData({
  1954. [revise1]: true,
  1955. [revise2]: true,
  1956. [revise3]: true
  1957. })
  1958. return false;
  1959. } else {
  1960. this.setData({
  1961. [revise1]: false,
  1962. [revise2]: false,
  1963. [revise3]: false
  1964. })
  1965. }
  1966. },
  1967. goPhoto() {
  1968. let that = this;
  1969. isTwoOnshow = true;
  1970. wx.chooseImage({
  1971. count: 1,
  1972. sizeType: ['compressed'],
  1973. sourceType: ['camera'],
  1974. success: function (res) {
  1975. let tempFilePaths = res.tempFilePaths
  1976. wx.uploadFile({
  1977. url: util.globalData.publicUrl + '/sys/user/upload',
  1978. filePath: tempFilePaths[0],
  1979. name: 'uploadFile',
  1980. formData: {
  1981. "user": "test",
  1982. },
  1983. header: {
  1984. appletsId: wx.getStorageSync('openId'),
  1985. },
  1986. success: function (res) {
  1987. console.log(JSON.parse(res.data), "45454545");
  1988. let datas = JSON.parse(res.data)
  1989. let imgPath = 'oldInfo[' + that.data.activeIndex + '].imgPath'
  1990. let isHavePhoto = 'oldInfo[' + that.data.activeIndex + '].isHavePhoto'
  1991. // if (datas.code == 0) {
  1992. that.setData({
  1993. [imgPath]: datas.data,
  1994. [isHavePhoto]: true,
  1995. })
  1996. that.SubmitOldmanInfo({
  1997. id: that.data.nameArr[that.data.activeIndex]._id,
  1998. photo: datas.data,
  1999. })
  2000. }
  2001. })
  2002. }
  2003. })
  2004. },
  2005. closeImage(e) {
  2006. console.log(e.currentTarget.dataset.activeindex, "121212");
  2007. let imgPath = 'oldInfo[' + e.currentTarget.dataset.activeindex + '].imgPath'
  2008. this.setData({
  2009. [imgPath]: '',
  2010. })
  2011. this.SubmitOldmanInfo({
  2012. id: this.data.nameArr[this.data.activeIndex]._id,
  2013. photo: '',
  2014. })
  2015. },
  2016. // 子女个数
  2017. tab2Change1: function (e) {
  2018. console.log(e.detail.value)
  2019. let childrenNum = 'childInfo[' + this.data.activeIndex + '].childrenNum'
  2020. let Info = 'childInfo[' + this.data.activeIndex + '].Info'
  2021. this.setData({
  2022. [childrenNum]: this.data.childNumArr[e.detail.value],
  2023. })
  2024. if (e.detail.value == 0) {
  2025. this.setData({
  2026. [Info]: []
  2027. })
  2028. } else if (e.detail.value == 1) {
  2029. this.setData({
  2030. [Info]: [{
  2031. name: '', // 姓名
  2032. sex: '',
  2033. phone: '', // 常用联系电话,
  2034. isHasGoOut: '', // 子女是否外出
  2035. outgoingplace: '', // 外出地点
  2036. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2037. name2: '', // 子女配偶姓名
  2038. phone2: '', // 子女配偶电话
  2039. outgoingTime: '', // 最后一次离家时间
  2040. outgoingCause: '', // 外出原因
  2041. visit: '', // 平均一年探望次数
  2042. }]
  2043. })
  2044. } else if (e.detail.value == 2) {
  2045. this.setData({
  2046. [Info]: [{
  2047. name: '', // 姓名
  2048. sex: '',
  2049. phone: '', // 常用联系电话,
  2050. isHasGoOut: '', // 子女是否外出
  2051. outgoingplace: '', // 外出地点
  2052. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2053. name2: '', // 子女配偶姓名
  2054. phone2: '', // 子女配偶电话
  2055. outgoingTime: '', // 最后一次离家时间
  2056. outgoingCause: '', // 外出原因
  2057. visit: '', // 平均一年探望次数
  2058. }, {
  2059. name: '', // 姓名
  2060. sex: '',
  2061. phone: '', // 常用联系电话,
  2062. isHasGoOut: '', // 子女是否外出
  2063. outgoingplace: '', // 外出地点
  2064. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2065. name2: '', // 子女配偶姓名
  2066. phone2: '', // 子女配偶电话
  2067. outgoingTime: '', // 最后一次离家时间
  2068. outgoingCause: '', // 外出原因
  2069. visit: '', // 平均一年探望次数
  2070. }]
  2071. })
  2072. } else {
  2073. this.setData({
  2074. [Info]: [{
  2075. name: '', // 姓名
  2076. sex: '',
  2077. phone: '', // 常用联系电话,
  2078. isHasGoOut: '', // 子女是否外出
  2079. outgoingplace: '', // 外出地点
  2080. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2081. name2: '', // 子女配偶姓名
  2082. phone2: '', // 子女配偶电话
  2083. outgoingTime: '', // 最后一次离家时间
  2084. outgoingCause: '', // 外出原因
  2085. visit: '', // 平均一年探望次数
  2086. }, {
  2087. name: '', // 姓名
  2088. sex: '',
  2089. phone: '', // 常用联系电话,
  2090. isHasGoOut: '', // 子女是否外出
  2091. outgoingplace: '', // 外出地点
  2092. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2093. name2: '', // 子女配偶姓名
  2094. phone2: '', // 子女配偶电话
  2095. outgoingTime: '', // 最后一次离家时间
  2096. outgoingCause: '', // 外出原因
  2097. visit: '', // 平均一年探望次数
  2098. }, {
  2099. name: '', // 姓名
  2100. sex: '',
  2101. phone: '', // 常用联系电话,
  2102. isHasGoOut: '', // 子女是否外出
  2103. outgoingplace: '', // 外出地点
  2104. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  2105. name2: '', // 子女配偶姓名
  2106. phone2: '', // 子女配偶电话
  2107. outgoingTime: '', // 最后一次离家时间
  2108. outgoingCause: '', // 外出原因
  2109. visit: '', // 平均一年探望次数
  2110. }]
  2111. })
  2112. }
  2113. this.SubmitOldmanInfo({
  2114. id: this.data.nameArr[this.data.activeIndex]._id,
  2115. childrenNum: e.detail.value
  2116. // childrenNum: this.data.childNums[e.detail.value].substring(0, 1)
  2117. })
  2118. },
  2119. // 子女姓名
  2120. tab2Change2: function (e) {
  2121. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].name';
  2122. console.log(this.data.childInfo[this.data.activeIndex].Info, "多个数字的问题");
  2123. console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info));
  2124. this.setData({
  2125. [child]: e.detail.value
  2126. })
  2127. this.SubmitOldmanInfo({
  2128. id: this.data.nameArr[this.data.activeIndex]._id,
  2129. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2130. })
  2131. // }
  2132. },
  2133. // 子女性别
  2134. tab2Change3: function (e) {
  2135. console.log(e, '000000000000')
  2136. console.log(e.currentTarget.dataset.index + "@@@@@@@@@@@@@@@@@@@@@@")
  2137. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].sex';
  2138. this.setData({
  2139. [child]: this.data.childSexArr[e.detail.value]
  2140. })
  2141. console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info) + "#####################")
  2142. this.SubmitOldmanInfo({
  2143. id: this.data.nameArr[this.data.activeIndex]._id,
  2144. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2145. })
  2146. },
  2147. // 子女联系电话
  2148. tab2Change4: function (e) {
  2149. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].phone';
  2150. this.setData({
  2151. [child]: e.detail.value
  2152. })
  2153. this.SubmitOldmanInfo({
  2154. id: this.data.nameArr[this.data.activeIndex]._id,
  2155. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2156. })
  2157. },
  2158. // 子女是否外出
  2159. tab2Change5: function (e) {
  2160. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].isHasGoOut';
  2161. this.setData({
  2162. [child]: this.data.childIsout[e.detail.value]
  2163. })
  2164. console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info) + "#####################")
  2165. this.SubmitOldmanInfo({
  2166. id: this.data.nameArr[this.data.activeIndex]._id,
  2167. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2168. })
  2169. },
  2170. //外出原因
  2171. tab2Change6: function (e) {
  2172. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].outgoingCause';
  2173. this.setData({
  2174. [child]: e.detail.value
  2175. })
  2176. this.SubmitOldmanInfo({
  2177. id: this.data.nameArr[this.data.activeIndex]._id,
  2178. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2179. })
  2180. },
  2181. // 外出地点
  2182. tab2Change7: function (e) {
  2183. console.log(e.detail.value)
  2184. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].outgoingplace';
  2185. this.setData({
  2186. [child]: e.detail.value
  2187. })
  2188. this.SubmitOldmanInfo({
  2189. id: this.data.nameArr[this.data.activeIndex]._id,
  2190. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2191. })
  2192. },
  2193. // 最后一次离家时间
  2194. tab2Change8: function (e) {
  2195. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].outgoingTime';
  2196. this.setData({
  2197. [child]: e.detail.value
  2198. })
  2199. this.SubmitOldmanInfo({
  2200. id: this.data.nameArr[this.data.activeIndex]._id,
  2201. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2202. })
  2203. },
  2204. // 是否有配偶
  2205. tab2Change9: function (e) {
  2206. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].isHasPartner';
  2207. this.setData({
  2208. [child]: this.data.childIsMArry[e.detail.value]
  2209. })
  2210. console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info) + "#####################")
  2211. this.SubmitOldmanInfo({
  2212. id: this.data.nameArr[this.data.activeIndex]._id,
  2213. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2214. })
  2215. },
  2216. // 配偶姓名
  2217. tab2Change10: function (e) {
  2218. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].name2';
  2219. this.setData({
  2220. [child]: e.detail.value
  2221. })
  2222. this.SubmitOldmanInfo({
  2223. id: this.data.nameArr[this.data.activeIndex]._id,
  2224. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2225. })
  2226. },
  2227. // 配偶联系电话
  2228. tab2Change11: function (e) {
  2229. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].phone2';
  2230. this.setData({
  2231. [child]: e.detail.value
  2232. })
  2233. this.SubmitOldmanInfo({
  2234. id: this.data.nameArr[this.data.activeIndex]._id,
  2235. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2236. })
  2237. },
  2238. // 一年探望次数
  2239. tab2Change12: function (e) {
  2240. let child = 'childInfo[' + this.data.activeIndex + '].Info[' + e.currentTarget.dataset.index + '].visit';
  2241. this.setData({
  2242. [child]: this.data.childTfTimes[e.detail.value]
  2243. })
  2244. console.log(JSON.stringify(this.data.childInfo[this.data.activeIndex].Info) + "#####################")
  2245. this.SubmitOldmanInfo({
  2246. id: this.data.nameArr[this.data.activeIndex]._id,
  2247. childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
  2248. })
  2249. },
  2250. // tab3是否有赡养人状态改变
  2251. tab3Change1: function (e) {
  2252. // 否是1
  2253. console.log(e.detail.value, "1111111");
  2254. let isHasOther = 'otherInfo[' + this.data.activeIndex + '].isHasOther'
  2255. if (e.detail.value == '0') {
  2256. this.setData({
  2257. [isHasOther]: this.data.othersyrArr[e.detail.value],
  2258. })
  2259. console.log("1111111");
  2260. this.SubmitOldmanInfo({
  2261. id: this.data.nameArr[this.data.activeIndex]._id,
  2262. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2263. })
  2264. } else {
  2265. this.setData({
  2266. [isHasOther]: this.data.othersyrArr[e.detail.value],
  2267. })
  2268. this.SubmitOldmanInfo({
  2269. id: this.data.nameArr[this.data.activeIndex]._id,
  2270. otherInfo: ''
  2271. })
  2272. }
  2273. this.setData({
  2274. [isHasOther]: this.data.othersyrArr[e.detail.value],
  2275. })
  2276. },
  2277. // 其他赡养人姓名
  2278. tab3Change2: function (e) {
  2279. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.name'
  2280. this.setData({
  2281. [Info]: e.detail.value,
  2282. })
  2283. this.SubmitOldmanInfo({
  2284. id: this.data.nameArr[this.data.activeIndex]._id,
  2285. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2286. })
  2287. },
  2288. // 其他赡养人性别
  2289. tab3Change3: function (e) {
  2290. let data = this.data.otherInfo[this.data.activeIndex].Info.othersyrSexArr.map(v => {
  2291. if (v.name == e.detail.value) {
  2292. return {
  2293. name: v.name,
  2294. checked: true
  2295. }
  2296. }
  2297. return {
  2298. name: v.name,
  2299. checked: false
  2300. }
  2301. })
  2302. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.sex'
  2303. let othersyrSexArr = 'otherInfo[' + this.data.activeIndex + '].Info.othersyrSexArr'
  2304. this.setData({
  2305. [Info]: e.detail.value,
  2306. [othersyrSexArr]: data,
  2307. })
  2308. this.SubmitOldmanInfo({
  2309. id: this.data.nameArr[this.data.activeIndex]._id,
  2310. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2311. })
  2312. },
  2313. // 其他赡养人电话
  2314. tab3Change4: function (e) {
  2315. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.phone'
  2316. this.setData({
  2317. [Info]: e.detail.value,
  2318. })
  2319. this.SubmitOldmanInfo({
  2320. id: this.data.nameArr[this.data.activeIndex]._id,
  2321. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2322. })
  2323. },
  2324. // 与被赡养人关系状态改变
  2325. tab3Change5: function (e) {
  2326. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.relation'
  2327. this.setData({
  2328. [Info]: this.data.othersyrRelation[e.detail.value],
  2329. })
  2330. this.SubmitOldmanInfo({
  2331. id: this.data.nameArr[this.data.activeIndex]._id,
  2332. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2333. })
  2334. },
  2335. // 输选择其他时入与被赡养人其他关系
  2336. tab3Change6: function (e) {
  2337. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.relationExt'
  2338. this.setData({
  2339. [Info]: e.detail.value,
  2340. })
  2341. this.SubmitOldmanInfo({
  2342. id: this.data.nameArr[this.data.activeIndex]._id,
  2343. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2344. })
  2345. },
  2346. // 是否外出
  2347. tab3Change7: function (e) {
  2348. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.isHasGoOut'
  2349. this.setData({
  2350. [Info]: this.data.othersyrIsout[e.detail.value],
  2351. })
  2352. this.SubmitOldmanInfo({
  2353. id: this.data.nameArr[this.data.activeIndex]._id,
  2354. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2355. })
  2356. },
  2357. // 外出原因
  2358. tab3Change8: function (e) {
  2359. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.outgoingCause'
  2360. this.setData({
  2361. [Info]: e.detail.value,
  2362. })
  2363. this.SubmitOldmanInfo({
  2364. id: this.data.nameArr[this.data.activeIndex]._id,
  2365. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2366. })
  2367. },
  2368. // 外出地点改变
  2369. tab3Change9: function (e) {
  2370. console.log(e)
  2371. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.outgoingplace'
  2372. this.setData({
  2373. [Info]: e.detail.value,
  2374. })
  2375. this.SubmitOldmanInfo({
  2376. id: this.data.nameArr[this.data.activeIndex]._id,
  2377. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2378. })
  2379. },
  2380. //最后一次离家时间
  2381. tab3Change10: function (e) {
  2382. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.outgoingTime'
  2383. this.setData({
  2384. [Info]: e.detail.value,
  2385. })
  2386. this.SubmitOldmanInfo({
  2387. id: this.data.nameArr[this.data.activeIndex]._id,
  2388. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2389. })
  2390. },
  2391. //是否有配偶
  2392. tab3Change11: function (e) {
  2393. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.isHasPartner'
  2394. this.setData({
  2395. [Info]: this.data.othersyrIsMarry[e.detail.value],
  2396. })
  2397. this.SubmitOldmanInfo({
  2398. id: this.data.nameArr[this.data.activeIndex]._id,
  2399. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2400. })
  2401. },
  2402. // 配偶姓名
  2403. tab3Change12: function (e) {
  2404. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.name2'
  2405. this.setData({
  2406. [Info]: e.detail.value,
  2407. })
  2408. this.SubmitOldmanInfo({
  2409. id: this.data.nameArr[this.data.activeIndex]._id,
  2410. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2411. })
  2412. },
  2413. // 配偶电话
  2414. tab3Change13: function (e) {
  2415. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.phone2'
  2416. this.setData({
  2417. [Info]: e.detail.value,
  2418. })
  2419. this.SubmitOldmanInfo({
  2420. id: this.data.nameArr[this.data.activeIndex]._id,
  2421. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2422. })
  2423. },
  2424. //平均一年探望次数
  2425. tab3Change14: function (e) {
  2426. let Info = 'otherInfo[' + this.data.activeIndex + '].Info.visit'
  2427. this.setData({
  2428. [Info]: this.data.othersyrTfTimes[e.detail.value],
  2429. })
  2430. this.SubmitOldmanInfo({
  2431. id: this.data.nameArr[this.data.activeIndex]._id,
  2432. otherInfo: JSON.stringify(this.data.otherInfo[this.data.activeIndex].Info)
  2433. })
  2434. },
  2435. // // tab4巡访方式
  2436. // tab4Change1(e) {
  2437. // let info = 'regularsInfo.visitMode'
  2438. // let index = e.detail.value.indexOf('其它')
  2439. // if (e.detail.value.length == 0) {
  2440. // this.setData({
  2441. // isnull1: true
  2442. // })
  2443. // } else {
  2444. // this.setData({
  2445. // isnull1: false,
  2446. // [info]: e.detail.value
  2447. // })
  2448. // this.SubmitOldmanInfo({
  2449. // id: this.data.nameArr[this.data.activeIndex]._id,
  2450. // regularsInfo: JSON.stringify(this.data.regularsInfo)
  2451. // })
  2452. // }
  2453. // if (index >= 0) {
  2454. // this.setData({
  2455. // isVisitways: true
  2456. // })
  2457. // } else {
  2458. // this.setData({
  2459. // isVisitways: false,
  2460. // isVisitwaysnull: false
  2461. // })
  2462. // }
  2463. // },
  2464. // 巡访方式
  2465. tab4Change1: function (e) {
  2466. console.log(e.detail.value)
  2467. console.log(this.data.oldInfo[this.data.activeIndex].regularsInfo);
  2468. const items = this.data.oldInfo[this.data.activeIndex].regularsInfos.visitMode
  2469. let itemss = this.data.oldInfo[this.data.activeIndex].regularsInfo.visitMode
  2470. itemss = JSON.stringify(e.detail.value);
  2471. const values = e.detail.value
  2472. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  2473. items[i].checked = false
  2474. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  2475. if (items[i].name === values[j]) {
  2476. items[i].checked = true
  2477. break
  2478. }
  2479. }
  2480. }
  2481. let visitModes = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitMode'
  2482. let visitMode = 'oldInfo[' + this.data.activeIndex + '].regularsInfo.visitMode'
  2483. this.setData({
  2484. [visitModes]: items,
  2485. [visitMode]: itemss
  2486. })
  2487. if (e.detail.value.length == 0) {
  2488. this.setData({
  2489. visitWaysFromOther: true
  2490. })
  2491. return
  2492. } else {
  2493. this.setData({
  2494. visitWaysFromOther: false
  2495. })
  2496. }
  2497. this.SubmitOldmanInfo({
  2498. id: this.data.nameArr[this.data.activeIndex]._id,
  2499. regularsInfo: JSON.stringify(this.data.oldInfo[this.data.activeIndex].regularsInfo)
  2500. })
  2501. },
  2502. // 巡防方式其他内容
  2503. tab4Change1_1: function (e) {
  2504. console.log(e.detail.value);
  2505. let visitModeExts = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitModeExt'
  2506. let visitModeExt = 'oldInfo[' + this.data.activeIndex + '].regularsInfo.visitModeExt'
  2507. if (e.detail.value == null || e.detail.value == '') {
  2508. this.setData({
  2509. moneyOtherQtnull: true
  2510. })
  2511. } else {
  2512. this.setData({
  2513. moneyOtherQtnull: false,
  2514. [visitModeExts]: e.detail.value,
  2515. [visitModeExt]: e.detail.value
  2516. })
  2517. this.SubmitOldmanInfo({
  2518. id: this.data.nameArr[this.data.activeIndex]._id,
  2519. regularsInfo: JSON.stringify(this.data.oldInfo[this.data.activeIndex].regularsInfo)
  2520. })
  2521. }
  2522. },
  2523. // 巡访频次
  2524. tab4Change3: function (e) {
  2525. console.log(e.detail.value)
  2526. let items = this.data.oldInfo[this.data.activeIndex].regularsInfos.visitCount
  2527. let itemss = this.data.oldInfo[this.data.activeIndex].regularsInfo.visitCount
  2528. itemss = e.detail.value;
  2529. for (let i = 0, len = items.length; i < len; ++i) {
  2530. items[i].checked = items[i].name === e.detail.value
  2531. }
  2532. let visitCounts = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitCount'
  2533. let visitCount = 'oldInfo[' + this.data.activeIndex + '].regularsInfo.visitCount'
  2534. this.setData({
  2535. [visitCounts]: items,
  2536. [visitCount]: itemss
  2537. })
  2538. if (e.detail.value.length == 0) {
  2539. this.setData({
  2540. isVisittimesnull: true
  2541. })
  2542. return
  2543. } else {
  2544. this.setData({
  2545. isVisittimesnull: false
  2546. })
  2547. }
  2548. this.SubmitOldmanInfo({
  2549. id: this.data.nameArr[this.data.activeIndex]._id,
  2550. regularsInfo: JSON.stringify(this.data.oldInfo[this.data.activeIndex].regularsInfo)
  2551. })
  2552. },
  2553. // 巡防方式其他内容
  2554. tab4change4: function (e) {
  2555. console.log(e.detail.value);
  2556. let visitCountExts = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitCountExt'
  2557. let visitCountExt = 'oldInfo[' + this.data.activeIndex + '].regularsInfo.visitCountExt'
  2558. if (e.detail.value == null || e.detail.value == '') {
  2559. this.setData({
  2560. moneyOtherQtnull: true
  2561. })
  2562. } else {
  2563. this.setData({
  2564. moneyOtherQtnull: false,
  2565. [visitCountExts]: e.detail.value,
  2566. [visitCountExt]: e.detail.value
  2567. })
  2568. this.SubmitOldmanInfo({
  2569. id: this.data.nameArr[this.data.activeIndex]._id,
  2570. regularsInfo: JSON.stringify(this.data.oldInfo[this.data.activeIndex].regularsInfo)
  2571. })
  2572. }
  2573. },
  2574. formSubmit(e) {
  2575. console.log('form发生了submit事件,携带数据为:', e.detail.value)
  2576. },
  2577. chooseAdress() {
  2578. this.setData({
  2579. adressShow: true
  2580. })
  2581. },
  2582. removeExcess(data) {
  2583. if (data) {
  2584. data = JSON.parse(data);
  2585. }
  2586. return data;
  2587. },
  2588. huixian(id, name) {
  2589. console.log(id);
  2590. console.log(name);
  2591. if (id) {
  2592. this.setData({
  2593. showBj: false,
  2594. showBj1: false,
  2595. nameArr: [],
  2596. activeIndex: 0,
  2597. familyFid: id
  2598. })
  2599. var that = this;
  2600. wx.request({
  2601. url: util.globalData.publicUrl + '/wxinfo/listByFid',
  2602. method: "GET",
  2603. data: {
  2604. fid: id,
  2605. },
  2606. header: {
  2607. appletsId: wx.getStorageSync('openId')
  2608. },
  2609. success: (res) => {
  2610. console.log(res.data.data, "单查赋值锕")
  2611. that.setData({
  2612. oldInfo: res.data.data
  2613. })
  2614. let data = res.data.data;
  2615. let fristIndex = data.findIndex((item) => {
  2616. return name == item.name;
  2617. });
  2618. let fristArray = data.filter((item) => {
  2619. return name == item.name;
  2620. });
  2621. data.splice(fristIndex, 1);
  2622. data.unshift(fristArray[0]);
  2623. that.setData({
  2624. nameArr: data,
  2625. })
  2626. console.log(data, "dadadsadasdasdsadsadsadsa");
  2627. let oldSex = [{
  2628. name: '男',
  2629. checked: false
  2630. },
  2631. {
  2632. name: '女',
  2633. checked: false
  2634. }
  2635. ]
  2636. let oldMarry = [{
  2637. name: "未婚"
  2638. }, {
  2639. name: "已婚"
  2640. }, {
  2641. name: "离异"
  2642. }, {
  2643. name: "丧偶"
  2644. }];
  2645. let loneArr = [{
  2646. name: "是"
  2647. }, {
  2648. name: "否"
  2649. }];
  2650. let mainLookSex = [{
  2651. name: "男"
  2652. }, {
  2653. name: "女"
  2654. }];
  2655. let abc = data.map(item => {
  2656. let visitWays = [{
  2657. name: '电话问候'
  2658. }, {
  2659. name: '上门巡访'
  2660. }, {
  2661. name: '其它'
  2662. }];
  2663. let visitTimes = [{
  2664. name: '每天'
  2665. }, {
  2666. name: '每周'
  2667. }, {
  2668. name: '每月'
  2669. }, {
  2670. name: '每季'
  2671. }, {
  2672. name: '其它'
  2673. }];
  2674. let visitModeExt = '';
  2675. let visitCountExt = '';
  2676. let visitModes = '';
  2677. let visitCounts = '';
  2678. let otherInfo = ''
  2679. let imgPath = ''
  2680. if (item.photo) {
  2681. imgPath = item.photo;
  2682. } else {
  2683. imgPath = ''
  2684. }
  2685. if (item.regularsInfo) {
  2686. let partol = this.removeExcess(item.regularsInfo);
  2687. console.log(partol, "大姨娘");
  2688. if (partol.visitMode) {
  2689. let parto11 = this.removeExcess(partol.visitMode);
  2690. visitWays.forEach(itemss => {
  2691. parto11.forEach(item => {
  2692. if (itemss.name == item) {
  2693. itemss.checked = true;
  2694. }
  2695. })
  2696. })
  2697. visitModes = partol.visitMode
  2698. }
  2699. console.log(visitWays, "返回的你锕");
  2700. if (partol.visitCount) {
  2701. visitTimes.forEach(itemss => {
  2702. if (itemss.name == partol.visitCount) {
  2703. itemss.checked = true
  2704. }
  2705. })
  2706. visitCounts = partol.visitCount
  2707. }
  2708. if (partol.visitModeExt) {
  2709. visitModeExt = partol.visitModeExt;
  2710. }
  2711. if (partol.visitCountExt) {
  2712. visitCountExt = partol.visitCountExt;
  2713. }
  2714. }
  2715. let disabilityAyyss = [{
  2716. name: "视力残疾"
  2717. }, {
  2718. name: "听力残疾"
  2719. }, {
  2720. name: "言语残疾"
  2721. }, {
  2722. name: "肢体残疾"
  2723. }, {
  2724. name: "智力残疾"
  2725. }, {
  2726. name: "精神残疾"
  2727. }, {
  2728. name: "多重残疾"
  2729. }];
  2730. let moneyFromAyy = [{
  2731. name: "家庭经营性收入"
  2732. }, {
  2733. name: "工资性收入"
  2734. }, {
  2735. name: "转移性收入"
  2736. }, {
  2737. name: "财产性收入"
  2738. }, {
  2739. name: "其它"
  2740. }];
  2741. let familyHelpArr = [{
  2742. name: "低保"
  2743. }, {
  2744. name: "建档立卡贫困户"
  2745. }, {
  2746. name: "医疗救助"
  2747. }, {
  2748. name: "临时救助"
  2749. }, {
  2750. name: "老年人福利津贴"
  2751. }, {
  2752. name: "残疾人两项补贴(或一项补贴)"
  2753. }, {
  2754. name: "其他救助"
  2755. }];
  2756. let loveRequire = [{
  2757. name: "生活照料"
  2758. },
  2759. {
  2760. name: "生产帮助"
  2761. },
  2762. {
  2763. name: "精神慰藉"
  2764. },
  2765. {
  2766. name: "医疗保健"
  2767. },
  2768. {
  2769. name: "权益维护"
  2770. },
  2771. {
  2772. name: "安全监护"
  2773. },
  2774. {
  2775. name: "文化娱乐"
  2776. },
  2777. {
  2778. name: "紧急救助"
  2779. },
  2780. {
  2781. name: "其它"
  2782. },
  2783. ];
  2784. let finalarr = [];
  2785. if (item.health.includes("健康")) {
  2786. for (let i = 0; i < 4; i++) {
  2787. let obj = new Object();
  2788. obj.name = (i == 0 ? "健康" : i == 1 ? "残疾" : i == 2 ? "患重特大疾病" : i == 3 ? "老年人慢性病" : "");
  2789. obj.checked = (i == 0 ? true : false);
  2790. obj.disabled = (i == 0 ? false : true);
  2791. finalarr.push(obj)
  2792. }
  2793. } else {
  2794. for (let i = 0; i < 4; i++) {
  2795. let obj = new Object();
  2796. obj.name = (i == 0 ? "健康" : i == 1 ? "残疾" : i == 2 ? "患重特大疾病" : i == 3 ? "老年人慢性病" : "");
  2797. obj.checked = (i == 0 ? false : false);
  2798. obj.disabled = (i == 0 ? false : false);
  2799. finalarr.push(obj)
  2800. }
  2801. if (item.health.includes("残疾")) {
  2802. finalarr[1].checked = true;
  2803. }
  2804. if (item.health.includes("患重特大疾病")) {
  2805. finalarr[2].checked = true;
  2806. }
  2807. if (item.health.includes("老年人慢性病")) {
  2808. finalarr[3].checked = true;
  2809. }
  2810. }
  2811. let accompanyArr = [];
  2812. if (item.accompany.includes("无人陪伴居住")) {
  2813. for (let i = 0; i < 5; i++) {
  2814. let obj = new Object();
  2815. obj.name = (i == 0 ? "无人陪伴居住" : i == 1 ? "配偶" : i == 2 ? "近亲属" : i == 3 ? "未成年孙子女" : "其他情形");
  2816. obj.checked = (i == 0 ? true : false);
  2817. obj.disabled = (i == 0 ? false : true);
  2818. accompanyArr.push(obj)
  2819. }
  2820. } else {
  2821. for (let i = 0; i < 5; i++) {
  2822. let obj = new Object();
  2823. obj.name = (i == 0 ? "无人陪伴居住" : i == 1 ? "配偶" : i == 2 ? "近亲属" : i == 3 ? "未成年孙子女" : "其他情形");
  2824. obj.checked = (i == 0 ? false : false);
  2825. obj.disabled = (i == 0 ? false : false);
  2826. accompanyArr.push(obj)
  2827. }
  2828. if (item.accompany.includes("配偶")) {
  2829. accompanyArr[1].checked = true;
  2830. }
  2831. if (item.accompany.includes("近亲属")) {
  2832. accompanyArr[2].checked = true;
  2833. }
  2834. if (item.accompany.includes("未成年孙子女")) {
  2835. accompanyArr[3].checked = true;
  2836. }
  2837. if (item.accompany.includes("其他情形")) {
  2838. accompanyArr[4].checked = true;
  2839. }
  2840. }
  2841. let lookAfterArr = [];
  2842. if (item.lookAfter.includes("无人照料")) {
  2843. for (let i = 0; i < 6; i++) {
  2844. let obj = new Object();
  2845. obj.name = (i == 0 ? "无人照料" : i == 1 ? "近亲属" : i == 2 ? "配偶" : i == 3 ? "邻里互助" : i == 4 ? "购买养老服务" : '其他人员');
  2846. obj.checked = (i == 0 ? true : false);
  2847. obj.disabled = (i == 0 ? false : true);
  2848. lookAfterArr.push(obj)
  2849. }
  2850. } else {
  2851. for (let i = 0; i < 6; i++) {
  2852. let obj = new Object();
  2853. obj.name = (i == 0 ? "无人照料" : i == 1 ? "近亲属" : i == 2 ? "配偶" : i == 3 ? "邻里互助" : i == 4 ? "购买养老服务" : '其他人员');
  2854. obj.checked = (i == 0 ? false : false);
  2855. obj.disabled = (i == 0 ? false : false);
  2856. lookAfterArr.push(obj)
  2857. }
  2858. if (item.lookAfter.includes("近亲属")) {
  2859. lookAfterArr[1].checked = true;
  2860. }
  2861. if (item.lookAfter.includes("配偶")) {
  2862. lookAfterArr[2].checked = true;
  2863. }
  2864. if (item.lookAfter.includes("邻里互助")) {
  2865. lookAfterArr[3].checked = true;
  2866. }
  2867. if (item.lookAfter.includes("购买养老服务")) {
  2868. lookAfterArr[4].checked = true;
  2869. }
  2870. if (item.lookAfter.includes("其他人员")) {
  2871. lookAfterArr[5].checked = true;
  2872. }
  2873. }
  2874. let oldTypeArr = [];
  2875. for (let i = 0; i < 8; i++) {
  2876. let obj = new Object();
  2877. obj.name = (i == 0 ? "农村留守老年人" : i == 1 ? "分散供养特困老年人" : i == 2 ? "计划生育特殊家庭老人" : i == 3 ? "空巢老年人" : i == 4 ? "独居老年人" : i == 5 ? "重残老人" : i == 6 ? "高龄老人" : "失能老人");
  2878. obj.checked = (i == 0 ? false : false);
  2879. obj.disable = (i == 0 ? false : false);
  2880. oldTypeArr.push(obj)
  2881. }
  2882. if (item.oldType.includes("农村留守老年人")) {
  2883. oldTypeArr[0].checked = true;
  2884. oldTypeArr[1].disable = true;
  2885. oldTypeArr[2].disable = true;
  2886. oldTypeArr[3].checked = true;
  2887. oldTypeArr[3].disable = true;
  2888. }
  2889. if (item.oldType.includes("分散供养特困老年人")) {
  2890. oldTypeArr[1].checked = true;
  2891. oldTypeArr[0].disable = true;
  2892. oldTypeArr[2].disable = true;
  2893. oldTypeArr[3].disable = true;
  2894. }
  2895. if (item.oldType.includes("计划生育特殊家庭老人")) {
  2896. oldTypeArr[2].checked = true;
  2897. oldTypeArr[0].disable = true;
  2898. oldTypeArr[1].disable = true;
  2899. oldTypeArr[3].disable = true;
  2900. }
  2901. if (item.oldType.includes("空巢老年人") && item.oldType.includes("农村留守老年人")) {
  2902. oldTypeArr[3].checked = true;
  2903. oldTypeArr[1].disable = true;
  2904. oldTypeArr[2].disable = true;
  2905. }
  2906. if (item.oldType.includes("空巢老年人") && !item.oldType.includes("农村留守老年人")) {
  2907. oldTypeArr[3].checked = true;
  2908. oldTypeArr[1].disable = true;
  2909. oldTypeArr[2].disable = true;
  2910. oldTypeArr[0].disable = true;
  2911. }
  2912. if (item.oldType.includes("独居老年人")) {
  2913. oldTypeArr[4].checked = true;
  2914. }
  2915. if (item.oldType.includes("重残老人")) {
  2916. oldTypeArr[5].checked = true;
  2917. }
  2918. if (item.oldType.includes("高龄老人")) {
  2919. oldTypeArr[6].checked = true;
  2920. }
  2921. if (item.oldType.includes("失能老人")) {
  2922. oldTypeArr[7].checked = true;
  2923. }
  2924. disabilityAyyss.forEach(itemss => {
  2925. item.disabilityCategory.forEach(item => {
  2926. if (itemss.name == item) {
  2927. itemss.checked = true;
  2928. }
  2929. })
  2930. })
  2931. familyHelpArr.forEach(itemss => {
  2932. item.rescueState.forEach(item => {
  2933. if (itemss.name == item) {
  2934. itemss.checked = true;
  2935. }
  2936. })
  2937. })
  2938. moneyFromAyy.forEach(itemss => {
  2939. item.sourceOfIncome.forEach(item => {
  2940. if (itemss.name == item) {
  2941. itemss.checked = true;
  2942. }
  2943. })
  2944. })
  2945. loveRequire.forEach(itemss => {
  2946. item.demand.forEach(item => {
  2947. if (itemss.name == item) {
  2948. itemss.checked = true;
  2949. }
  2950. })
  2951. })
  2952. return {
  2953. ...item,
  2954. oldSex: oldSex.map(items => {
  2955. if (items.name == item.sex) {
  2956. return {
  2957. name: items.name,
  2958. checked: true
  2959. }
  2960. }
  2961. return {
  2962. name: items.name,
  2963. checked: false
  2964. }
  2965. }),
  2966. oldMarry: oldMarry.map(items => {
  2967. if (items.name == item.partnerState) {
  2968. return {
  2969. name: items.name,
  2970. checked: true
  2971. }
  2972. }
  2973. return {
  2974. name: items.name,
  2975. checked: false
  2976. }
  2977. }),
  2978. imgPath: imgPath,
  2979. healthAyy: finalarr,
  2980. disabilityAyy: disabilityAyyss,
  2981. regularsInfos: {
  2982. visitMode: visitWays,
  2983. visitModeExt: visitModeExt,
  2984. visitCount: visitTimes,
  2985. visitCountExt: visitCountExt
  2986. },
  2987. regularsInfo: {
  2988. visitMode: visitModes,
  2989. visitModeExt: visitModeExt,
  2990. visitCount: visitCounts,
  2991. visitCountExt: visitModeExt
  2992. },
  2993. moneyFromAyy: moneyFromAyy,
  2994. familyHelpArr: familyHelpArr,
  2995. otherInfo: otherInfo, //赡养人存在么
  2996. mainLookSex: mainLookSex.map(items => {
  2997. if (items.name == item.mainLookSex) {
  2998. return {
  2999. name: items.name,
  3000. checked: true
  3001. }
  3002. }
  3003. return {
  3004. name: items.name,
  3005. checked: false
  3006. }
  3007. }),
  3008. loneArr: loneArr.map(items => {
  3009. if (items.name == item.isLoss) {
  3010. return {
  3011. name: items.name,
  3012. checked: true
  3013. }
  3014. }
  3015. return {
  3016. name: items.name,
  3017. checked: false
  3018. }
  3019. }),
  3020. liveStatus: accompanyArr,
  3021. oftenMan: lookAfterArr,
  3022. loveRequire: loveRequire,
  3023. oldType: oldTypeArr
  3024. }
  3025. })
  3026. let def = data.map(item => {
  3027. console.log(item.otherInfo, ";;;;;;;;;;;;;;;;;;;;;;;;;;");
  3028. let sex = [{
  3029. name: '男',
  3030. checked: false
  3031. },
  3032. {
  3033. name: '女',
  3034. checked: false
  3035. }
  3036. ]
  3037. let otherInfo = '';
  3038. let name = '';
  3039. let phone = ''
  3040. let relation = ''
  3041. let relationExt = ''
  3042. let outgoingCause = ''
  3043. let isHasGoOut = ''
  3044. let outgoingTime = ''
  3045. let isHasPartner = ''
  3046. let outgoingplace = ''
  3047. let phone2 = ''
  3048. let name2 = ''
  3049. let visit = '';
  3050. if (item.otherInfo) {
  3051. let partol = this.removeExcess(item.otherInfo);
  3052. otherInfo = '是'
  3053. if (partol.name) {
  3054. name = partol.name
  3055. }
  3056. if (partol.sex) {
  3057. sex.forEach(items => {
  3058. if (items.name == partol.sex) {
  3059. items.checked = true;
  3060. }
  3061. })
  3062. }
  3063. if (partol.phone) {
  3064. phone = partol.phone
  3065. }
  3066. if (partol.relation) {
  3067. relation = partol.relation
  3068. }
  3069. if (partol.relationExt) {
  3070. relationExt = partol.relationExt
  3071. }
  3072. if (partol.visit) {
  3073. visit = partol.visit;
  3074. }
  3075. if (partol.isHasGoOut) {
  3076. isHasGoOut = partol.isHasGoOut;
  3077. }
  3078. if (partol.outgoingCause) {
  3079. outgoingCause = partol.outgoingCause;
  3080. }
  3081. if (partol.outgoingTime) {
  3082. outgoingTime = partol.outgoingTime;
  3083. }
  3084. if (partol.isHasPartner) {
  3085. isHasPartner = partol.isHasPartner;
  3086. }
  3087. if (partol.outgoingplace) {
  3088. outgoingplace = partol.outgoingplace;
  3089. }
  3090. if (partol.name2) {
  3091. name2 = partol.name2;
  3092. }
  3093. if (partol.phone2) {
  3094. phone2 = partol.phone2;
  3095. }
  3096. } else if (item.otherInfo == '') {
  3097. otherInfo = '否'
  3098. } else {
  3099. otherInfo = ''
  3100. }
  3101. return {
  3102. ...item,
  3103. isHasOther: otherInfo, //赡养人存在
  3104. // name: name,
  3105. // othersyrSexArr: sex,
  3106. // phone: phone,
  3107. // othersyrRelationValue: othersyrRelationValue,
  3108. // relationExt: relationExt,
  3109. // visit: visit,
  3110. Info: {
  3111. name: name,
  3112. phone: phone,
  3113. relation: relation,
  3114. relationExt: relationExt,
  3115. isHasGoOut: isHasGoOut,
  3116. outgoingCause: outgoingCause,
  3117. outgoingTime: outgoingTime,
  3118. isHasPartner: isHasPartner,
  3119. outgoingplace: outgoingplace,
  3120. visit: visit,
  3121. name2: name2,
  3122. phone2: phone2,
  3123. othersyrSexArr: sex
  3124. }
  3125. }
  3126. })
  3127. let ghi = data.map(item => {
  3128. // console.log(item, "8888888888888888888888888888888888888888888888888888");
  3129. let childrenNum = '';
  3130. if (item.childrenNum) {
  3131. if (item.childrenNum == '4') {
  3132. childrenNum = '3个以上'
  3133. } else {
  3134. childrenNum = item.childrenNum + '个'
  3135. }
  3136. } else {
  3137. childrenNum = ''
  3138. }
  3139. let Info = [];
  3140. if (item.childInfo) {
  3141. let partol = this.removeExcess(item.childInfo);
  3142. Info = partol
  3143. } else {
  3144. }
  3145. return {
  3146. ...item,
  3147. childrenNum: childrenNum,
  3148. Info: Info
  3149. }
  3150. })
  3151. that.setData({
  3152. oldInfo: abc,
  3153. otherInfo: def,
  3154. childInfo: ghi,
  3155. })
  3156. console.log(that.data.oldInfo, "老人的返现数组")
  3157. console.log(that.data.otherInfo, "其他的返现数组")
  3158. console.log(that.data.childInfo, "孩子的返现数组")
  3159. // let ghi = res.data.data.map(item => {
  3160. // console.log(item.otherInfo, ";;;;;;;;;;;;;;;;;;;;;;;;;;");
  3161. // let sex = [{
  3162. // name: '男',
  3163. // checked: false
  3164. // },
  3165. // {
  3166. // name: '女',
  3167. // checked: false
  3168. // }
  3169. // ]
  3170. // let otherInfo = '';
  3171. // let name = '';
  3172. // let phone = ''
  3173. // let othersyrRelationValue = ''
  3174. // let relationExt = ''
  3175. // let visit = ''
  3176. // if (item.otherInfo) {
  3177. // let partol = this.removeExcess(item.otherInfo);
  3178. // otherInfo = '是'
  3179. // if (partol.name) {
  3180. // name = partol.name
  3181. // }
  3182. // if (partol.sex) {
  3183. // sex.forEach(items => {
  3184. // if (items.name == partol.sex) {
  3185. // items.checked = true;
  3186. // }
  3187. // })
  3188. // }
  3189. // if (partol.phone) {
  3190. // phone = partol.phone
  3191. // }
  3192. // if (partol.relation) {
  3193. // othersyrRelationValue = partol.relation
  3194. // }
  3195. // if (partol.relationExt) {
  3196. // relationExt = partol.relationExt
  3197. // }
  3198. // if (partol.visit) {
  3199. // visit = partol.visit;
  3200. // }
  3201. // } else {
  3202. // otherInfo = ''
  3203. // }
  3204. // return {
  3205. // ...item,
  3206. // otherInfo: otherInfo, //赡养人存在
  3207. // name: name,
  3208. // othersyrSexArr: sex,
  3209. // phone: phone,
  3210. // othersyrRelationValue: othersyrRelationValue,
  3211. // relationExt: relationExt,
  3212. // visit: visit,
  3213. // }
  3214. // })
  3215. // that.setData({
  3216. // oldInfo: abc,
  3217. // otherInfo: def,
  3218. // childInfo: ghi
  3219. // })
  3220. }
  3221. })
  3222. } else {
  3223. this.setData({
  3224. showBj: true,
  3225. nameArr: [],
  3226. oldInfo: [],
  3227. childInfo: [],
  3228. otherInfo: [],
  3229. })
  3230. }
  3231. },
  3232. chooseAdress() {
  3233. wx.request({
  3234. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  3235. method: "get",
  3236. header: {
  3237. appletsId: wx.getStorageSync('openId')
  3238. },
  3239. success: (res) => {
  3240. console.log(res.data.data)
  3241. this.setData({
  3242. showAdress: true,
  3243. provinceArr: res.data.data
  3244. })
  3245. }
  3246. })
  3247. },
  3248. provinceClick(e) {
  3249. console.log(e.currentTarget.dataset.item)
  3250. this.data.chooseAdressArr.push(e.currentTarget.dataset.item)
  3251. console.log(this.data.chooseAdressArr)
  3252. wx.request({
  3253. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  3254. method: "get",
  3255. header: {
  3256. appletsId: wx.getStorageSync('openId')
  3257. },
  3258. data: {
  3259. fid: e.currentTarget.dataset.item.CIVILREGIONALISMID
  3260. },
  3261. success: (res) => {
  3262. this.setData({
  3263. provinceArr: res.data.data,
  3264. isAdress: true,
  3265. chooseAdressArr: this.data.chooseAdressArr
  3266. })
  3267. if (res.data.data.length == 0) {
  3268. this.setData({
  3269. pleaseChoose: false
  3270. })
  3271. }
  3272. }
  3273. })
  3274. },
  3275. closeAdress() {
  3276. this.setData({
  3277. showAdress: false
  3278. })
  3279. },
  3280. reSelect(e) {
  3281. this.setData({
  3282. chooseAdressArr: this.data.chooseAdressArr.slice(0, e.currentTarget.dataset.index)
  3283. })
  3284. let fid;
  3285. if (this.data.chooseAdressArr.length != 0) {
  3286. fid = this.data.chooseAdressArr[this.data.chooseAdressArr.length - 1].CIVILREGIONALISMID;
  3287. } else {
  3288. fid = ''
  3289. }
  3290. wx.request({
  3291. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  3292. method: "get",
  3293. header: {
  3294. appletsId: wx.getStorageSync('openId')
  3295. },
  3296. data: {
  3297. fid
  3298. },
  3299. success: (res) => {
  3300. this.setData({
  3301. provinceArr: res.data.data,
  3302. isAdress: true,
  3303. chooseAdressArr: this.data.chooseAdressArr
  3304. })
  3305. if (res.data.data.length == 0) {
  3306. this.setData({
  3307. pleaseChoose: false
  3308. })
  3309. }
  3310. }
  3311. })
  3312. },
  3313. // 提交老人采集信息
  3314. SubmitOldmanInfo(data) {
  3315. console.log(data, ' 提交老人信息带过来的数据')
  3316. console.log(this.data.nameArr[this.data.activeIndex])
  3317. wx.request({
  3318. url: util.globalData.publicUrl + '/wxinfo/update',
  3319. method: "post",
  3320. header: {
  3321. appletsId: wx.getStorageSync('openId')
  3322. },
  3323. data,
  3324. success: (res) => {
  3325. console.log(res)
  3326. }
  3327. })
  3328. },
  3329. onShow() {
  3330. console.log("11111111111111111111111111111111111");
  3331. if (isTwoOnshow) {
  3332. isTwoOnshow = false;
  3333. return;
  3334. };
  3335. if (isonShow) {
  3336. isonShow = false;
  3337. return;
  3338. };
  3339. this.setData({
  3340. showBj: true,
  3341. addOldname: '',
  3342. currentIndex: 0
  3343. })
  3344. const app = getApp()
  3345. console.log(app.globalData.id, "传参的一户的值");
  3346. this.huixian(app.globalData.id, app.globalData.name);
  3347. },
  3348. onHide() {
  3349. const app = getApp()
  3350. app.globalData.id = ''
  3351. app.globalData.name = ''
  3352. if (this.data.activeIndex >= 0) {
  3353. let visitMode = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitMode'
  3354. let visitCount = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitCount'
  3355. let visitModeExt = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitModeExt'
  3356. let visitCountExt = 'oldInfo[' + this.data.activeIndex + '].regularsInfos.visitCountExt'
  3357. let visitModea = [{
  3358. name: '电话问候',
  3359. checked: false
  3360. }, {
  3361. name: '上门巡访',
  3362. checked: false
  3363. }, {
  3364. name: '其它',
  3365. checked: false
  3366. }];
  3367. let visitCounts = [{
  3368. name: '每天',
  3369. checked: false
  3370. }, {
  3371. name: '每周',
  3372. checked: false
  3373. }, {
  3374. name: '每月',
  3375. checked: false
  3376. },
  3377. {
  3378. name: '每季',
  3379. checked: false
  3380. },
  3381. {
  3382. name: '其它',
  3383. checked: false
  3384. }
  3385. ];
  3386. this.setData({
  3387. [visitMode]: visitModea,
  3388. [visitCount]: visitCounts,
  3389. [visitModeExt]: '',
  3390. [visitCountExt]: '',
  3391. })
  3392. }
  3393. // visitModeExt: '', //巡访其他
  3394. // visitCount: [{
  3395. // name: '每天',
  3396. // checked: false
  3397. // }, {
  3398. // name: '每周',
  3399. // checked: false
  3400. // }, {
  3401. // name: '每月',
  3402. // checked: false
  3403. // }, {
  3404. // name: '每季',
  3405. // checked: false
  3406. // }, {
  3407. // name: '其它',
  3408. // checked: false
  3409. // }],
  3410. // visitCountExt: '', // 频次的其他
  3411. },
  3412. //获取位置
  3413. getSelfLocation: function (varSendOrgId) {
  3414. // 实例化API核心类
  3415. var qqmapsdk = new QQMapWX({
  3416. key: 'B5DBZ-NGIHP-SQMD4-LHMG3-NJ72Z-7KFOV' //申请的开发者秘钥key
  3417. });
  3418. var that = this; //用户授权过可以直接获取位置
  3419. wx.getLocation({
  3420. //type: 'wgs84',
  3421. type: 'gcj02',
  3422. success: function (res) {
  3423. console.log(res, "0000000");
  3424. // 返回当前定位的经纬度
  3425. var latitude = parseFloat(res.latitude).toFixed(5);
  3426. var longitude = parseFloat(res.longitude).toFixed(5);
  3427. qqmapsdk.reverseGeocoder({
  3428. location: {
  3429. latitude: res.latitude,
  3430. longitude: res.longitude
  3431. },
  3432. success: function (res) {
  3433. //获取当前地址成功
  3434. // that.setData({
  3435. // visitLocation: res.result.address
  3436. // })
  3437. let photoAndLocation = 'oldInfo[' + that.data.activeIndex + '].photoAndLocation'
  3438. let gps = longitude + '/' + latitude + '/' + res.result.address
  3439. that.setData({
  3440. [photoAndLocation]: gps
  3441. })
  3442. that.SubmitOldmanInfo({
  3443. id: that.data.nameArr[that.data.activeIndex]._id,
  3444. photoAndLocation: gps
  3445. })
  3446. },
  3447. fail: function (res) {
  3448. console.log('获取当前地址失败');
  3449. }
  3450. });
  3451. },
  3452. fail: function (res) {}
  3453. });
  3454. },
  3455. onLoad() {
  3456. // this.getSelfLocation();
  3457. },
  3458. })