AddDiagBase.vue 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682
  1. <template>
  2. <div style="min-height:100%" ref="viewBox">
  3. <crumbs :title="title" :param="$route.params" linkTo="ZskDiagBase"></crumbs>
  4. <div class="contents">
  5. <el-form
  6. :inline="true"
  7. ref="form"
  8. :label-position="labelPosition"
  9. class="add-new-form"
  10. label-width="100px"
  11. :model="form"
  12. :rules="rules"
  13. >
  14. <div class="content">
  15. <el-form-item label="疾病名称:" class="item" prop="conceptId" :rules="rules.conceptId">
  16. <el-select
  17. clearable
  18. remote
  19. filterable
  20. :remote-method="searchDiag"
  21. v-model.trim="form.conceptId"
  22. >
  23. <el-option
  24. v-for="item in conceptList"
  25. :key="item.conceptId"
  26. :label="item.conceptName"
  27. :value="item.conceptId"
  28. ></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="诊断依据描述:" prop="description" class="item">
  32. <el-input
  33. class="inps"
  34. maxlength="200"
  35. placeholder="请输入诊断依据描述"
  36. v-model.trim="form.description"
  37. ></el-input>
  38. </el-form-item>
  39. </div>
  40. <div class="content content-2">
  41. <div class="content-2-header">
  42. <p class="title1">
  43. <span class="star">*</span>诊断依据内容
  44. </p>
  45. <p class="title2">注:1、选择诊断依据类型后才能展示基础依据类型。2、医学内容可输入升高、降低、阴性、阳性等~</p>
  46. </div>
  47. <el-table
  48. size="mini"
  49. :span-method="dataSpanMethod"
  50. :data="form.klDiagnoseTypeVO"
  51. border
  52. ref="tableList"
  53. style="min-height: 200px"
  54. height="calc(100vh - 450px)"
  55. :header-cell-style="{background:'#E3EAF4'}"
  56. >
  57. <el-table-column label="依据" width="100" fixed>
  58. <template slot="header" slot-scope="scope">
  59. <span class="name">依据</span>
  60. </template>
  61. <template slot-scope="scope">
  62. <el-form-item>
  63. <img
  64. src="../../images/icon-copy.png"
  65. height="18"
  66. width="18"
  67. class="icon"
  68. @click="copyDiag(scope.row.depart_id,scope.$index)"
  69. />
  70. <img
  71. src="../../images/icon-add.png"
  72. height="18"
  73. width="18"
  74. class="icon"
  75. @click="addDiag(scope.row.depart_id)"
  76. />
  77. <img
  78. src="../../images/icon-delete.png"
  79. height="18"
  80. width="18"
  81. class="icon"
  82. @click="delDiag(scope.row.depart_id,scope.$index)"
  83. v-show="dest.length>1"
  84. />
  85. </el-form-item>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="诊断依据类型" width="130">
  89. <template slot="header" slot-scope="scope">
  90. <span class="star">*</span>
  91. <span class="name">诊断依据类型</span>
  92. </template>
  93. <template slot-scope="scope">
  94. <el-form-item
  95. class="is-request"
  96. :prop="'klDiagnoseTypeVO.'+scope.$index+'.conditionType'"
  97. :rules="rules.conditionType"
  98. >
  99. <el-select
  100. ref="aa"
  101. v-model="form.klDiagnoseTypeVO[scope.$index].conditionType"
  102. @change="(val)=>basTypeChange(val,scope.$index)"
  103. >
  104. <el-option
  105. v-for="item in baseTypes"
  106. :key="item.ruleType"
  107. :label="item.name"
  108. :value="item.ruleType"
  109. ></el-option>
  110. </el-select>
  111. </el-form-item>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="组" width="130">
  115. <template slot="header" slot-scope="scope">
  116. <span class="star">*</span>
  117. <span class="name">组</span>
  118. </template>
  119. <template slot-scope="scope">
  120. <el-form-item>
  121. <img
  122. src="../../images/icon-add.png"
  123. height="18"
  124. width="18"
  125. class="icon"
  126. @click="addGroup(scope.$index)"
  127. />
  128. <img
  129. src="../../images/icon-delete.png"
  130. height="18"
  131. width="18"
  132. class="icon"
  133. @click="delGroup(scope.row.depart_id,scope.$index)"
  134. v-show="isMax(scope.row.depart_id)"
  135. />
  136. </el-form-item>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="符合条件数量" width="150">
  140. <template slot="header" slot-scope="scope">
  141. <span class="star">*</span>
  142. <span class="name">符合条件数量</span>
  143. </template>
  144. <template slot-scope="scope">
  145. <el-form-item
  146. :prop="'klDiagnoseTypeVO.'+scope.$index+'.groupVO.'+0+'.fitNo'"
  147. :rules="rules.fitNo"
  148. >
  149. <el-select v-model="scope.row.groupVO[0].fitNo">
  150. <el-option
  151. v-for="item in numArr[scope.$index].num[0]"
  152. :key="item.id"
  153. :label="item.name"
  154. :value="item.id"
  155. ></el-option>
  156. </el-select>
  157. </el-form-item>
  158. </template>
  159. </el-table-column>
  160. <el-table-column v-for="(v,i) in columns" :width="v.width" :key="i">
  161. <template slot="header" slot-scope="scope">
  162. <span class="star" v-if="v.istar">*</span>
  163. <span class="name">{{v.title}}</span>
  164. </template>
  165. <template slot-scope="scope">
  166. <div v-for="(item,index) in scope.row.groupVO" :key="index">
  167. <div v-for="(items,i) in item.klDiagnoseDetail" :key="i">
  168. <div v-if="v.title == '基础依据'">
  169. <el-form-item>
  170. <img
  171. src="../../images/icon-add.png"
  172. height="18"
  173. width="18"
  174. class="icon"
  175. @click="addRule(scope.row,scope.$index,index)"
  176. />
  177. <img
  178. src="../../images/icon-delete.png"
  179. height="18"
  180. width="18"
  181. class="icon"
  182. @click="delRule(scope.row,scope.$index,index,i)"
  183. v-show="item.klDiagnoseDetail.length>1"
  184. />
  185. </el-form-item>
  186. </div>
  187. <div class="box-2" v-if="v.title == '基础依据名称'">
  188. <el-form-item
  189. :prop="'klDiagnoseTypeVO.' +
  190. scope.$index +
  191. '.groupVO.' +
  192. index +
  193. '.klDiagnoseDetail.'+i+'.basDescription'"
  194. :rules="rules.basDescription"
  195. >
  196. <el-input
  197. class="inp-name"
  198. placeholder="请输入基础依据名称"
  199. maxlength="100"
  200. v-model.trim="items.basDescription"
  201. ></el-input>
  202. </el-form-item>
  203. </div>
  204. <div class="box-2" v-if="v.title == '基础依据类型'">
  205. <el-form-item
  206. :prop="'klDiagnoseTypeVO.' +
  207. scope.$index +
  208. '.groupVO.' +
  209. index +
  210. '.klDiagnoseDetail.'+i+'.basType'"
  211. :rules="rules.basType"
  212. >
  213. <el-select
  214. v-model="items.basType"
  215. @change="(val)=>baseTermTypeChange(val,scope.$index,index,i)"
  216. >
  217. <el-option
  218. v-for="item in baseTermTypeList"
  219. :key="item.id"
  220. :label="item.name"
  221. :value="item.type"
  222. ></el-option>
  223. </el-select>
  224. </el-form-item>
  225. </div>
  226. <el-form-item
  227. :prop="'klDiagnoseTypeVO.' +
  228. scope.$index +
  229. '.groupVO.' +
  230. index +
  231. '.klDiagnoseDetail.'+i+'.basLibType'"
  232. v-if="!items.basNameType && v.title == '基础依据术语类型'"
  233. :rules="rules.basLibType"
  234. >
  235. <el-select
  236. v-model="items.basLibType"
  237. @change="(val)=>basLibTypeChange(val,scope.$index,index,i)"
  238. >
  239. <el-option
  240. v-for="item in items.basLibTypeList"
  241. :key="item.id"
  242. :label="item.name"
  243. :value="Number(item.code)"
  244. ></el-option>
  245. </el-select>
  246. </el-form-item>
  247. <el-form-item v-if="items.basNameType && v.title == '基础依据术语类型'">
  248. <el-input disabled v-model="items.basTypeName"></el-input>
  249. </el-form-item>
  250. <div
  251. v-if="v.title == '医学标准术语'"
  252. class="box-2"
  253. :class="items.basType===3 || items.basType===4? 'tmall' : 'taobao'"
  254. >
  255. <el-form-item
  256. v-if="items.basType==1 || items.basType==2 || items.basType==''"
  257. :prop="'klDiagnoseTypeVO.' +
  258. scope.$index +
  259. '.groupVO.' +
  260. index +
  261. '.klDiagnoseDetail.'+i+'.basConceptId'"
  262. :rules="rules.subConceptId"
  263. >
  264. <el-select
  265. clearable
  266. remote
  267. filterable
  268. :remote-method="(val)=>searchConcept(val,scope.$index,index,i)"
  269. v-model.trim="items.basConceptId"
  270. @change="(val)=>conceptChange(val,scope.$index,index,i)"
  271. >
  272. <el-option
  273. v-for="item in items.conceptList"
  274. :key="item.conceptId"
  275. :label="item.conceptName"
  276. :value="item.conceptId"
  277. ></el-option>
  278. </el-select>
  279. </el-form-item>
  280. </div>
  281. <div class="last-box" v-if="v.title == '依据具体内容'">
  282. <el-form-item
  283. :prop="'klDiagnoseTypeVO.' +
  284. scope.$index +
  285. '.groupVO.' +
  286. index +
  287. '.klDiagnoseDetail.'+i+'.dataType'"
  288. v-if="items.basType===2&&!items.onlyNumType&&!items.onlyTxtType"
  289. :rules="rules.dataType"
  290. >
  291. <el-select
  292. class="box-1"
  293. :class="items.basType===2&&!items.onlyNumType&&!items.onlyTxtType? 'taobao' : 'tmall'"
  294. v-model="items.dataType"
  295. @change="(val)=>dataTypeChange(val,scope.$index,index,i)"
  296. placeholder="请选择"
  297. size="small"
  298. >
  299. <el-option
  300. v-for="item in dataTypes"
  301. :key="item.id"
  302. :label="item.name"
  303. :value="item.id"
  304. ></el-option>
  305. </el-select>
  306. </el-form-item>
  307. <el-form-item
  308. v-if="(!items.onlyNumType&&items.dataType==='1')||items.onlyNumType"
  309. label="最大值:"
  310. label-width="60px"
  311. >
  312. <div class="last-box-1">
  313. <el-form-item
  314. :prop="'klDiagnoseTypeVO.' +
  315. scope.$index +
  316. '.groupVO.' +
  317. index +
  318. '.klDiagnoseDetail.'+i+'.maxOperator'"
  319. :rules="[
  320. {
  321. validator: (rule, value, callback) => {
  322. maxOperator(items, rule, value, callback);
  323. },
  324. trigger: ['change']
  325. }
  326. ]"
  327. >
  328. <el-select
  329. v-model="items.maxOperator"
  330. placeholder="请选择"
  331. size="small"
  332. clearable
  333. >
  334. <el-option
  335. v-for="item in operMaxList"
  336. :key="item.key"
  337. :label="item.name"
  338. :value="item.key"
  339. ></el-option>
  340. </el-select>
  341. </el-form-item>
  342. <el-form-item
  343. class="num"
  344. :prop="'klDiagnoseTypeVO.' +
  345. scope.$index +
  346. '.groupVO.' +
  347. index +
  348. '.klDiagnoseDetail.'+i+'.maxVal'"
  349. :rules="[
  350. {
  351. validator: (rule, value, callback) => {
  352. maxVal(items, rule, value, callback);
  353. },
  354. trigger: ['blur']
  355. }
  356. ]"
  357. >
  358. <el-input v-model="items.maxVal" placeholder="填写数值"></el-input>
  359. </el-form-item>
  360. <el-form-item prop="minUnit">
  361. <el-input v-model.trim="items.maxUnit" placeholder="填写单位"></el-input>
  362. </el-form-item>
  363. </div>
  364. </el-form-item>
  365. <el-form-item
  366. v-if="(!items.onlyNumType&&items.dataType==='1')||items.onlyNumType"
  367. label="最小值:"
  368. label-width="60px"
  369. >
  370. <div class="last-box-1 last-box-s">
  371. <el-form-item
  372. :prop="'klDiagnoseTypeVO.' +
  373. scope.$index +
  374. '.groupVO.' +
  375. index +
  376. '.klDiagnoseDetail.'+i+'.minOperator'"
  377. :rules="[
  378. {
  379. validator: (rule, value, callback) => {
  380. minOperator(items, rule, value, callback);
  381. },
  382. trigger: ['change']
  383. }
  384. ]"
  385. >
  386. <el-select
  387. v-model="items.minOperator"
  388. placeholder="请选择"
  389. size="small"
  390. clearable
  391. >
  392. <el-option
  393. v-for="item in operMinList"
  394. :key="item.key"
  395. :label="item.name"
  396. :value="item.key"
  397. ></el-option>
  398. </el-select>
  399. </el-form-item>
  400. <el-form-item
  401. class="minnum"
  402. :prop="'klDiagnoseTypeVO.' +
  403. scope.$index +
  404. '.groupVO.' +
  405. index +
  406. '.klDiagnoseDetail.'+i+'.minVal'"
  407. :rules="[
  408. {
  409. validator: (rule, value, callback) => {
  410. minVal(items, rule, value, callback);
  411. },
  412. trigger: ['blur']
  413. }
  414. ]"
  415. >
  416. <el-input v-model="items.minVal" placeholder="填写数值"></el-input>
  417. </el-form-item>
  418. <el-form-item prop="minUnit">
  419. <el-input v-model.trim="items.minUnit" placeholder="填写单位"></el-input>
  420. </el-form-item>
  421. </div>
  422. </el-form-item>
  423. <div>
  424. <el-form-item
  425. :prop="'klDiagnoseTypeVO.' +
  426. scope.$index +
  427. '.groupVO.' +
  428. index +
  429. '.klDiagnoseDetail.'+i+'.eqValue'"
  430. v-if="items.basType===4 || items.basType===3"
  431. maxlength="200"
  432. label="正则表达式:"
  433. class="discDesc"
  434. :rules="[
  435. {
  436. required: true,
  437. message: '请输入正则表达式',
  438. trigger: 'blur'
  439. },
  440. ]"
  441. >
  442. <el-input class="inp" placeholder="请输入正则表达式" v-model.trim="items.eqValue"></el-input>
  443. </el-form-item>
  444. </div>
  445. <div>
  446. <el-form-item
  447. :prop="'klDiagnoseTypeVO.' +
  448. scope.$index +
  449. '.groupVO.' +
  450. index +
  451. '.klDiagnoseDetail.'+i+'.eqValue'"
  452. maxlength="200"
  453. v-if="(!items.onlyNumType&&!items.basNameType&&(items.basType===2 || items.basType===1)&&items.dataType==='2')||items.onlyTxtType"
  454. label="医学内容:"
  455. class="discDesc"
  456. :rules="[
  457. {
  458. required: true,
  459. message: '请输入医学内容',
  460. trigger: 'blur'
  461. }
  462. ]"
  463. >
  464. <el-input v-model.trim="items.eqValue" class="inp" placeholder="请输入医学内容"></el-input>
  465. </el-form-item>
  466. </div>
  467. </div>
  468. </div>
  469. </div>
  470. </template>
  471. </el-table-column>
  472. </el-table>
  473. </div>
  474. </el-form>
  475. <div class="Butn">
  476. <el-button class="disclButn" size="small" type="primary" @click="confirm">确定</el-button>
  477. </div>
  478. </div>
  479. </div>
  480. </template>
  481. <script type="text/javascript">
  482. import util from '../../api/utils.js';
  483. import api from '@api/zskDiagBase.js';
  484. import { tableRules } from './rules';
  485. export default {
  486. name: 'AddZskDiagBase',
  487. data() {
  488. return {
  489. columns: [
  490. { title: '基础依据', width: 90, istar: true },
  491. { title: '基础依据名称', width: 160, istar: true },
  492. { title: '基础依据类型', width: 130, istar: true },
  493. { title: '基础依据术语类型', width: 160, istar: true },
  494. { title: '医学标准术语', width: 130, istar: true },
  495. { title: '依据具体内容', width: 850 }
  496. ],
  497. dicts: {},
  498. baseTypes: [], //诊断数据类型
  499. baseTermTypeList: [], //基础依据类型
  500. basLibTypeList: [], //基础术语依据类型
  501. numTypes: '', //只有数值类型的类型id
  502. labelPosition: 'left',
  503. isCopy: false,
  504. title: '诊断依据维护-添加诊断依据',
  505. conceptName: '',
  506. conceptList: [],
  507. conceptList: [],
  508. form: {
  509. description: '',
  510. conceptId: '',
  511. klDiagnoseTypeVO: [
  512. {
  513. conditionType: '',
  514. depart_id: 0,
  515. groupVO: [
  516. {
  517. baseGroup: '',
  518. conditionGroup: '',
  519. fitNo: '',
  520. klDiagnoseDetail: [
  521. {
  522. dataType: '',
  523. basNameType: false,
  524. onlyNumType: false,
  525. onlyTxtType: false,
  526. basTypeName: '',
  527. basConceptId: '',
  528. basDescription: '',
  529. basLename: '',
  530. basLibName: '',
  531. basLibType: null,
  532. basType: '',
  533. eqOperator: '',
  534. eqUnit: '',
  535. eqValue: '',
  536. maxOperator: '',
  537. maxUnit: '',
  538. maxVal: '',
  539. minOperator: '',
  540. minUnit: '',
  541. minVal: ''
  542. }
  543. ]
  544. }
  545. ]
  546. }
  547. ]
  548. },
  549. id: null,
  550. rules: tableRules,
  551. dataTypes: [
  552. { id: '1', name: '数值类型' },
  553. { id: '2', name: '文本类型' }
  554. ],
  555. operMaxList: [
  556. { name: '<=', key: '<=' },
  557. { name: '<', key: '<' }
  558. ],
  559. operMinList: [
  560. { name: '>', key: '>' },
  561. { name: '>=', key: '>=' }
  562. ],
  563. basType: '',
  564. dataType: '',
  565. spanArr: [],
  566. list: [], //提交数据数组,
  567. i: 1,
  568. onshow: true
  569. };
  570. },
  571. created() {
  572. const param = this.$route.params;
  573. this.baseTypes = JSON.parse(localStorage.getItem('zskDiagList') || '[]');
  574. this.dicts = JSON.parse(localStorage.getItem('zskDiagDicts') || '{}');
  575. let info = param.data;
  576. if (info) {
  577. this.id = info.id;
  578. this.isCopy = param.copy;
  579. this.title =
  580. '诊断依据维护-' + (this.isCopy ? '复制' : '修改') + '诊断依据';
  581. this.conceptList = [
  582. { conceptId: info.conceptId, conceptName: info.conceptName }
  583. ];
  584. for (let i = 0; i < info.klDiagnoseTypeVO.length; i++) {
  585. info.klDiagnoseTypeVO[i].depart_id = i;
  586. }
  587. this.form = Object.assign({}, this.form, this.formatData(info));
  588. if (this.isCopy) {
  589. this.conceptList = [];
  590. delete this.form.conceptName;
  591. delete this.form.conceptId;
  592. delete this.form.description;
  593. delete this.form.id;
  594. }
  595. var index2 = this.baseTypes.findIndex(
  596. item => item.ruleType === this.form.klDiagnoseTypeVO[0].conditionType
  597. );
  598. this.baseTermTypeList = this.baseTypes[index2].subMenuList;
  599. for (let i = 0; i < this.form.klDiagnoseTypeVO.length; i++) {
  600. for (let j = 0; j < this.form.klDiagnoseTypeVO[i].groupVO.length; j++) {
  601. for (
  602. let k = 0;
  603. k <
  604. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  605. k++
  606. ) {
  607. var index2 = this.baseTermTypeList.findIndex(
  608. item =>
  609. item.type ===
  610. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  611. .basType
  612. );
  613. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  614. k
  615. ].basLibTypeList = this.baseTermTypeList[index2].subMenuList;
  616. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  617. k
  618. ].conceptList = [
  619. {
  620. conceptName: this.form.klDiagnoseTypeVO[i].groupVO[j]
  621. .klDiagnoseDetail[k].basLibName,
  622. conceptId: this.form.klDiagnoseTypeVO[i].groupVO[j]
  623. .klDiagnoseDetail[k].basConceptId
  624. }
  625. ];
  626. if (
  627. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  628. .maxOperator ||
  629. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  630. .minOperator
  631. ) {
  632. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  633. k
  634. ].dataType = '1';
  635. } else if (
  636. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  637. .eqValue
  638. ) {
  639. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  640. k
  641. ].dataType = '2';
  642. }
  643. if (
  644. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  645. .basType == 3 ||
  646. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  647. .basType == 4
  648. ) {
  649. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  650. k
  651. ].basTypeName = this.form.klDiagnoseTypeVO[i].groupVO[
  652. j
  653. ].klDiagnoseDetail[k].basLibTypeList[0].name;
  654. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  655. k
  656. ].basNameType = true;
  657. } else {
  658. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  659. k
  660. ].basTypeName = '';
  661. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  662. k
  663. ].basNameType = false;
  664. }
  665. const onlyNum = this.dicts['onlyNum'] || '&';
  666. const onlyTxt = this.dicts['onlyTxt'] || '&';
  667. const codes = onlyNum + ',';
  668. const code = onlyTxt + ',';
  669. let type = this.form.klDiagnoseTypeVO[i].groupVO[j]
  670. .klDiagnoseDetail[k].basLibType;
  671. let a = this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  672. .basLibType;
  673. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  674. k
  675. ].onlyNumType = type && codes.indexOf(a + ',') > -1;
  676. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  677. k
  678. ].onlyTxtType = type && code.indexOf(a + ',') > -1;
  679. }
  680. }
  681. }
  682. this.i = this.form.klDiagnoseTypeVO.slice(-1)[0].depart_id + 1;
  683. }
  684. },
  685. computed: {
  686. numArr() {
  687. let arr = [];
  688. let num = [];
  689. for (let i = 0; i < this.form.klDiagnoseTypeVO.length; i++) {
  690. arr.push({ num: [] });
  691. for (let j = 0; j < this.form.klDiagnoseTypeVO[i].groupVO.length; j++) {
  692. arr[i].num.push([]);
  693. for (
  694. let k = 0;
  695. k <
  696. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  697. k++
  698. ) {
  699. arr[i].num[j].push({ id: k + 1, name: k + 1 });
  700. }
  701. }
  702. }
  703. return arr;
  704. },
  705. dest() {
  706. const formData = JSON.parse(JSON.stringify(this.form));
  707. let map = {},
  708. dest = [];
  709. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  710. let ai = formData.klDiagnoseTypeVO[i];
  711. if (!map[ai.depart_id]) {
  712. dest.push({
  713. depart_id: ai.depart_id,
  714. conditionType: ai.conditionType,
  715. groupVO: ai.groupVO
  716. });
  717. map[ai.depart_id] = ai;
  718. } else {
  719. for (let j = 0; j < dest.length; j++) {
  720. var dj = dest[j];
  721. if (dj.depart_id == ai.depart_id) {
  722. dj.groupVO = dj.groupVO.concat(ai.groupVO);
  723. break;
  724. }
  725. }
  726. }
  727. }
  728. return dest;
  729. }
  730. },
  731. // mounted() {
  732. // this.onscroll();
  733. // },
  734. methods: {
  735. // onscroll() {
  736. // this.$nextTick(function() {
  737. // // 监听当前组件的滚动事件
  738. // this.box = this.$refs.tableList.bodyWrapper;
  739. // this.box.addEventListener(
  740. // 'scroll',
  741. // () => {
  742. // // select组件层级太高,滚动隐藏
  743. // if (this.$refs.tableList.bodyWrapper.scrollLeft > 0) {
  744. // console.log(this.$refs.aa.handleClose)
  745. // // this.$refs.aa.handleClose()
  746. // // this.$refs.aa.blur()
  747. // // const SELECTWRAP_BODY = document.body; // body
  748. // // const SELECTWRAP_DOWNALL = document.querySelectorAll(
  749. // // '.el-select-dropdown'
  750. // // ); // select下拉框
  751. // // SELECTWRAP_BODY.click();
  752. // // SELECTWRAP_DOWNALL.forEach(item => {
  753. // // item.blur();
  754. // // });
  755. // }
  756. // },
  757. // false
  758. // );
  759. // });
  760. // },
  761. // 最大值 选择rule
  762. maxOperator(items, rule, value, callback) {
  763. const { maxVal, minOperator, minVal } = items;
  764. const val = value + minOperator + minVal + maxVal;
  765. if (!val || (!value && maxVal !== '')) {
  766. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  767. } else {
  768. callback();
  769. }
  770. },
  771. // 最大值 数值rule
  772. maxVal(items, rule, value, callback) {
  773. const { maxOperator, minOperator, minVal } = items;
  774. const val = value + maxOperator + minOperator + minVal;
  775. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  776. if (!val || (value == '' && maxOperator)) {
  777. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  778. } else if (value !== '' && !isNum) {
  779. callback(new Error('只能输入数字'));
  780. } else {
  781. callback();
  782. }
  783. },
  784. // 最小值 选择rule
  785. minOperator(items, rule, value, callback) {
  786. const { maxVal, maxOperator, minVal } = items;
  787. const val = value + maxVal + maxOperator + minVal;
  788. if (!val || (!value && minVal !== '')) {
  789. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  790. } else {
  791. callback();
  792. }
  793. },
  794. // 最小值 数值rule
  795. minVal(items, rule, value, callback) {
  796. const { maxVal, minOperator, maxOperator } = items;
  797. const val = value + maxVal + minOperator + maxOperator;
  798. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  799. if (!val || (value == '' && minOperator)) {
  800. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  801. } else if (value !== '' && !isNum) {
  802. callback(new Error('只能输入数字'));
  803. } else {
  804. callback();
  805. }
  806. },
  807. isMax(id) {
  808. const typeNum = this.form.klDiagnoseTypeVO.filter(
  809. item => item.depart_id === id
  810. ).length;
  811. return typeNum > 1;
  812. },
  813. getData(data) {
  814. let arr = data;
  815. let str = [];
  816. let newArr = [];
  817. arr.filter((value, index, array) => {
  818. if (value.groupVO.length > 1 && value.groupVO.length != 0) {
  819. for (let j = 0; j < value.groupVO.length; j++) {
  820. var db = {
  821. conditionType: value.conditionType,
  822. depart_id: value.depart_id,
  823. groupVO: [value.groupVO[j]]
  824. };
  825. str.push(db);
  826. }
  827. value.groupVO = [];
  828. arr.splice(index, 1);
  829. arr.splice(index, 0, ...str);
  830. newArr = str;
  831. } else {
  832. newArr = arr;
  833. }
  834. });
  835. // console.log(newArr)
  836. // this.$set(this, 'form.klDiagnoseTypeVO', newArr);
  837. this.getSpanArr(newArr);
  838. },
  839. getSpanArr(data) {
  840. this.spanArr = [];
  841. for (var i = 0; i < data.length; i++) {
  842. if (i === 0) {
  843. this.spanArr.push(1);
  844. this.pos = 0;
  845. } else {
  846. if (data[i].depart_id === data[i - 1].depart_id) {
  847. this.spanArr[this.pos] += 1;
  848. this.spanArr.push(0);
  849. } else {
  850. this.spanArr.push(1);
  851. this.pos = i;
  852. }
  853. }
  854. }
  855. },
  856. dataSpanMethod({ row, column, rowIndex, columnIndex }) {
  857. if (columnIndex === 0 || columnIndex === 1) {
  858. //合并行的行为只在第一列进行
  859. const _row = this.spanArr[rowIndex];
  860. const _col = _row > 0 ? 1 : 0;
  861. return {
  862. rowspan: _row,
  863. colspan: _col
  864. };
  865. }
  866. },
  867. getInitData() {
  868. return {
  869. conditionType: '',
  870. depart_id: this.i++,
  871. groupVO: [
  872. {
  873. baseGroup: '',
  874. conditionGroup: '',
  875. fitNo: '',
  876. klDiagnoseDetail: [
  877. {
  878. dataType: '',
  879. basNameType: false,
  880. onlyNumType: false,
  881. onlyTxtType: false,
  882. basTypeName: '',
  883. basConceptId: '',
  884. basDescription: '',
  885. basLename: '',
  886. basLibName: '',
  887. basLibType: null,
  888. basType: '',
  889. eqOperator: '',
  890. eqUnit: '',
  891. eqValue: '',
  892. maxOperator: '',
  893. maxUnit: '',
  894. maxVal: '',
  895. minOperator: '',
  896. minUnit: '',
  897. minVal: ''
  898. }
  899. ]
  900. }
  901. ]
  902. };
  903. },
  904. //新增依据
  905. addDiag(id) {
  906. let temp = this.getInitData();
  907. var i = -1;
  908. this.form.klDiagnoseTypeVO.forEach((item, inx) => {
  909. if (item.depart_id == id) {
  910. i = inx;
  911. }
  912. });
  913. this.$nextTick(() => {
  914. this.$refs.tableList.bodyWrapper.scrollLeft = 0;
  915. // this.$refs.form.clearValidate();
  916. });
  917. this.form.klDiagnoseTypeVO.splice(i + 1, 0, temp);
  918. },
  919. //复制依据
  920. copyDiag(id, inx) {
  921. this.i++;
  922. const formData = JSON.parse(JSON.stringify(this.form));
  923. let map = {},
  924. dest = [];
  925. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  926. let ai = formData.klDiagnoseTypeVO[i];
  927. if (!map[ai.depart_id]) {
  928. dest.push({
  929. depart_id: ai.depart_id,
  930. conditionType: ai.conditionType,
  931. groupVO: ai.groupVO
  932. });
  933. map[ai.depart_id] = ai;
  934. } else {
  935. for (let j = 0; j < dest.length; j++) {
  936. var dj = dest[j];
  937. if (dj.depart_id == ai.depart_id) {
  938. dj.groupVO = dj.groupVO.concat(ai.groupVO);
  939. break;
  940. }
  941. }
  942. }
  943. }
  944. var index = dest.findIndex(item => {
  945. return item.depart_id == id;
  946. });
  947. dest.splice(index + 1, 0, JSON.parse(JSON.stringify(dest[index])));
  948. dest.forEach((item, i) => {
  949. item.depart_id = i;
  950. });
  951. this.form.klDiagnoseTypeVO = dest;
  952. },
  953. //删除依据
  954. delDiag(id, inx) {
  955. this.form.klDiagnoseTypeVO = this.form.klDiagnoseTypeVO.filter(
  956. item => item.depart_id !== id
  957. );
  958. this.form.klDiagnoseTypeVO.forEach((item, index) => {
  959. if (item.depart_id > id) {
  960. item.depart_id = item.depart_id - 1;
  961. }
  962. });
  963. },
  964. //新增组
  965. addGroup(i) {
  966. const temp = {
  967. baseGroup: '',
  968. conditionGroup: '',
  969. fitNo: '',
  970. klDiagnoseDetail: [
  971. {
  972. dataType: '',
  973. basNameType: false,
  974. onlyNumType: false,
  975. onlyTxtType: false,
  976. basTypeName: '',
  977. basConceptId: '',
  978. basDescription: '',
  979. basLename: '',
  980. basLibName: '',
  981. basLibType: null,
  982. basType: '',
  983. eqOperator: '',
  984. eqUnit: '',
  985. eqValue: '',
  986. maxOperator: '',
  987. maxUnit: '',
  988. maxVal: '',
  989. minOperator: '',
  990. minUnit: '',
  991. minVal: ''
  992. }
  993. ]
  994. };
  995. this.form.klDiagnoseTypeVO[i].groupVO.splice(i + 1, 0, temp);
  996. },
  997. delGroup(id, i) {
  998. this.form.klDiagnoseTypeVO.splice(i, 1);
  999. },
  1000. //新增基础依据
  1001. addRule(row, index, i) {
  1002. let temp = {
  1003. dataType: '',
  1004. basNameType: false,
  1005. basTypeName: '',
  1006. basConceptId: '',
  1007. basDescription: '',
  1008. basLename: '',
  1009. basLibName: '',
  1010. basLibType: null,
  1011. basType: '',
  1012. eqOperator: '',
  1013. eqUnit: '',
  1014. eqValue: '',
  1015. maxOperator: '',
  1016. maxUnit: '',
  1017. maxVal: '',
  1018. minOperator: '',
  1019. minUnit: '',
  1020. minVal: '',
  1021. dataType: ''
  1022. };
  1023. this.form.klDiagnoseTypeVO[index].groupVO[i].klDiagnoseDetail.push(temp);
  1024. },
  1025. delRule(row, inx, index, i) {
  1026. if (
  1027. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail
  1028. .length == 1
  1029. ) {
  1030. return;
  1031. } else {
  1032. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail.splice(
  1033. i,
  1034. 1
  1035. );
  1036. }
  1037. },
  1038. //诊断依据类型修改
  1039. basTypeChange(val, inx) {
  1040. if (!val) {
  1041. this.baseTermTypeList = [];
  1042. return;
  1043. }
  1044. var index2 = this.baseTypes.findIndex(item => item.ruleType === val);
  1045. this.baseTermTypeList = this.baseTypes[index2].subMenuList;
  1046. },
  1047. //基础依据类型修改
  1048. baseTermTypeChange(val, inx, index, i) {
  1049. if (!val) {
  1050. return;
  1051. }
  1052. this.basType = val;
  1053. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1054. i
  1055. ].basType = val;
  1056. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1057. i
  1058. ].basLibType = '';
  1059. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1060. i
  1061. ].dataType = '';
  1062. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1063. i
  1064. ].conceptList = [];
  1065. this.clearConcept(val, inx, index, i); //清空医学标准术语
  1066. this.clearNumText(val, inx, index, i); //清空数值、医学内容
  1067. var index2 = this.baseTermTypeList.findIndex(item => item.type === val);
  1068. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1069. i
  1070. ].basLibTypeList = this.baseTermTypeList[index2].subMenuList;
  1071. this.form.klDiagnoseTypeVO[inx].groupVO[
  1072. index
  1073. ].baseTermTypeList = this.baseTermTypeList;
  1074. if (val == 3 || val == 4) {
  1075. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1076. i
  1077. ].basTypeName = this.form.klDiagnoseTypeVO[inx].groupVO[
  1078. index
  1079. ].klDiagnoseDetail[i].basLibTypeList[0].name;
  1080. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1081. i
  1082. ].basNameType = true;
  1083. this.$refs['form'].clearValidate([
  1084. 'klDiagnoseTypeVO.' +
  1085. inx +
  1086. '.groupVO.' +
  1087. index +
  1088. '.klDiagnoseDetail.' +
  1089. i +
  1090. '.basLibType'
  1091. ]);
  1092. } else {
  1093. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1094. i
  1095. ].basTypeName = '';
  1096. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1097. i
  1098. ].basNameType = false;
  1099. }
  1100. },
  1101. //基础依据术语类型修改
  1102. basLibTypeChange(val, inx, index, i) {
  1103. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1104. i
  1105. ].basLibType = val;
  1106. // this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1107. // i
  1108. // ].dataType = '';
  1109. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1110. i
  1111. ].conceptList = [];
  1112. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1113. i
  1114. ].basConceptId = '';
  1115. if ((this.numTypes + ',').indexOf(val + ',') > -1) {
  1116. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1117. i
  1118. ].dataType = '1';
  1119. } else {
  1120. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1121. i
  1122. ].dataType = '';
  1123. }
  1124. const onlyNum = this.dicts['onlyNum'] || '&';
  1125. const onlyTxt = this.dicts['onlyTxt'] || '&';
  1126. const codes = onlyNum + ',';
  1127. const code = onlyTxt + ',';
  1128. let type = this.form.klDiagnoseTypeVO[inx].groupVO[index]
  1129. .klDiagnoseDetail[i].basLibType;
  1130. let a = this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1131. .basLibType;
  1132. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1133. i
  1134. ].onlyNumType = type && codes.indexOf(a + ',') > -1;
  1135. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1136. i
  1137. ].onlyTxtType = type && code.indexOf(a + ',') > -1;
  1138. // this.clearConcept(val, inx, index, i);
  1139. // this.clearNumText(val, inx, index, i);
  1140. },
  1141. //医学标准术语
  1142. conceptChange(val, inx, index, i) {
  1143. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1144. i
  1145. ].basConceptId = val;
  1146. if (val) {
  1147. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1148. i
  1149. ].basLibName = this.form.klDiagnoseTypeVO[inx].groupVO[
  1150. index
  1151. ].klDiagnoseDetail[i].conceptList.find(
  1152. it => it.conceptId === val
  1153. ).conceptName;
  1154. } else {
  1155. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1156. i
  1157. ].basLibName = '';
  1158. }
  1159. },
  1160. searchConcept(val, inx, index, i) {
  1161. const formData = JSON.parse(JSON.stringify(this.form));
  1162. const param = {
  1163. excludedConceptIds: [
  1164. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1165. .basType
  1166. ],
  1167. libType:
  1168. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1169. .basLibType,
  1170. name: val
  1171. };
  1172. api
  1173. .searchConcept(param)
  1174. .then(res => {
  1175. if (res.data.code == '0') {
  1176. const data = res.data.data;
  1177. this.$nextTick(() => {
  1178. // dom元素更新后执行,因此这里能正确打印更改之后的值
  1179. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1180. i
  1181. ].conceptList = data; // 改变了的值
  1182. });
  1183. this.form = formData;
  1184. }
  1185. })
  1186. .catch(error => {
  1187. console.log(error);
  1188. });
  1189. },
  1190. dataTypeChange(val, inx, index, i) {
  1191. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1192. i
  1193. ].dataType = val;
  1194. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1195. i
  1196. ].eqOperator = val === '2' ? '=' : '';
  1197. },
  1198. clearConcept(val, inx, index, i) {
  1199. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1200. i
  1201. ].basConceptId = '';
  1202. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1203. i
  1204. ].basLibName = '';
  1205. this.conceptList = [];
  1206. },
  1207. clearNumText(val, inx, index, i) {
  1208. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1209. i
  1210. ].maxOperator = '';
  1211. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1212. i
  1213. ].maxVal = '';
  1214. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1215. i
  1216. ].maxUnit = '';
  1217. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1218. i
  1219. ].minOperator = '';
  1220. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1221. i
  1222. ].minVal = '';
  1223. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1224. i
  1225. ].minUnit = '';
  1226. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1227. i
  1228. ].eqValue = '';
  1229. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1230. i
  1231. ].eqOperator = '';
  1232. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1233. i
  1234. ].onlyNumType = false;
  1235. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1236. i
  1237. ].onlyTxtType = false;
  1238. },
  1239. formatData(data) {
  1240. //转换字段名
  1241. let str = JSON.stringify(data)
  1242. .replace(/byIdDTO/g, 'groupVO')
  1243. .replace(/klDiagnoseByIdDTO/g, 'klDiagnoseDetail');
  1244. //console.log(JSON.parse(str))
  1245. return JSON.parse(str);
  1246. },
  1247. searchDiag(val) {
  1248. const param = {
  1249. diseaseName: val
  1250. };
  1251. api
  1252. .searchDiag(param)
  1253. .then(res => {
  1254. if (res.data.code == '0') {
  1255. const data = res.data.data;
  1256. this.conceptList = data;
  1257. }
  1258. })
  1259. .catch(error => {
  1260. console.log(error);
  1261. });
  1262. },
  1263. setInitGroupData() {
  1264. let temp = this.getInitData();
  1265. this.form.klDiagnoseTypeVO = [temp];
  1266. },
  1267. setRules() {
  1268. let that = this;
  1269. let list = this.form.klDiagnoseTypeVO;
  1270. if (list && list.length > 0) {
  1271. list.forEach((item, i) => {
  1272. let list1 = list[i].groupVO;
  1273. list1.forEach((it, x) => {
  1274. let list2 = list1[x].klDiagnoseDetail;
  1275. list2.forEach((t, j) => {
  1276. let grandeObj = this.form.klDiagnoseTypeVO[i].groupVO[x]
  1277. .klDiagnoseDetail[j];
  1278. if (grandeObj) {
  1279. const keyTxt =
  1280. 'klDiagnoseTypeVO.' +
  1281. i +
  1282. '.groupVO.' +
  1283. x +
  1284. '.klDiagnoseDetail.' +
  1285. j;
  1286. that.rules[keyTxt + '.dataType'] = [
  1287. {
  1288. required: true,
  1289. message: '请选择类型',
  1290. trigger: ['change']
  1291. }
  1292. ];
  1293. that.rules[keyTxt + '.maxOperator'] = [
  1294. {
  1295. validator: (rule, value, callback) => {
  1296. const { maxVal, minOperator, minVal } = grandeObj;
  1297. const val = value + minOperator + minVal + maxVal;
  1298. if (!val || (!value && maxVal !== '')) {
  1299. callback(
  1300. new Error(
  1301. '最大值和最小值至少完整填写一个,单位不必填'
  1302. )
  1303. );
  1304. } else {
  1305. callback();
  1306. }
  1307. },
  1308. trigger: 'change'
  1309. }
  1310. ];
  1311. that.rules[keyTxt + '.minOperator'] = [
  1312. {
  1313. validator: (rule, value, callback) => {
  1314. const { maxVal, maxOperator, minVal } = grandeObj;
  1315. const val = value + maxOperator + minVal + maxVal;
  1316. if (!val || (!value && minVal !== '')) {
  1317. callback(
  1318. new Error(
  1319. '最大值和最小值至少完整填写一个,单位不必填'
  1320. )
  1321. );
  1322. } else {
  1323. callback();
  1324. }
  1325. },
  1326. trigger: 'change'
  1327. }
  1328. ];
  1329. that.rules[keyTxt + '.maxVal'] = [
  1330. {
  1331. validator: (rule, value, callback) => {
  1332. const { maxOperator, minOperator, minVal } = grandeObj;
  1333. const val = value + maxOperator + minVal + minOperator;
  1334. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  1335. if (!val || (value === '' && maxOperator)) {
  1336. callback(
  1337. new Error(
  1338. '最大值和最小值至少完整填写一个,单位不必填'
  1339. )
  1340. );
  1341. } else if (value !== '' && !isNum) {
  1342. callback(new Error('只能输入数字'));
  1343. } else {
  1344. callback();
  1345. }
  1346. },
  1347. trigger: 'blur'
  1348. }
  1349. ];
  1350. that.rules[keyTxt + '.minVal'] = [
  1351. {
  1352. validator: (rule, value, callback) => {
  1353. const { maxVal, minOperator, maxOperator } = grandeObj;
  1354. const val = value + maxOperator + maxVal + minOperator;
  1355. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  1356. if (!val || (value === '' && minOperator)) {
  1357. callback(
  1358. new Error(
  1359. '最大值和最小值至少完整填写一个,单位不必填'
  1360. )
  1361. );
  1362. } else if (value !== '' && !isNum) {
  1363. callback(new Error('只能输入数字'));
  1364. } else {
  1365. callback();
  1366. }
  1367. },
  1368. trigger: 'blur'
  1369. }
  1370. ];
  1371. }
  1372. });
  1373. });
  1374. });
  1375. }
  1376. },
  1377. saveDiagBase(params) {
  1378. api.saveDiagBase(params).then(res => {
  1379. if (res.data.code == 0) {
  1380. this.$message({
  1381. message: '操作成功',
  1382. type: 'success'
  1383. });
  1384. this.$router.push({
  1385. name: 'ZskDiagBase',
  1386. params: this.$route.params
  1387. });
  1388. } else {
  1389. this.$message({
  1390. message: res.data.msg,
  1391. type: 'warning'
  1392. });
  1393. }
  1394. });
  1395. },
  1396. validateForms(callBack) {
  1397. this.$refs['form'].validate(valid => {
  1398. if (valid) {
  1399. callBack();
  1400. } else {
  1401. return false;
  1402. }
  1403. });
  1404. },
  1405. confirm() {
  1406. const formData = JSON.parse(JSON.stringify(this.form));
  1407. const _this = this;
  1408. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  1409. for (let j = 0; j < formData.klDiagnoseTypeVO[i].groupVO.length; j++) {
  1410. delete formData.klDiagnoseTypeVO[i].groupVO[j].baseTermTypeList;
  1411. for (
  1412. let k = 0;
  1413. k < formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  1414. k++
  1415. ) {
  1416. delete formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  1417. .basLibTypeList;
  1418. delete formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  1419. .conceptList;
  1420. }
  1421. }
  1422. }
  1423. let map = {},
  1424. dest = [];
  1425. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  1426. let ai = formData.klDiagnoseTypeVO[i];
  1427. if (!map[ai.depart_id]) {
  1428. dest.push({
  1429. depart_id: ai.depart_id,
  1430. conditionType: ai.conditionType,
  1431. groupVO: ai.groupVO
  1432. });
  1433. map[ai.depart_id] = ai;
  1434. } else {
  1435. for (let j = 0; j < dest.length; j++) {
  1436. var dj = dest[j];
  1437. if (dj.depart_id == ai.depart_id) {
  1438. dj.groupVO = dj.groupVO.concat(ai.groupVO);
  1439. break;
  1440. }
  1441. }
  1442. }
  1443. }
  1444. formData.klDiagnoseTypeVO = dest;
  1445. this.validateForms(function() {
  1446. let params = formData;
  1447. _this.saveDiagBase(params);
  1448. });
  1449. }
  1450. },
  1451. watch: {
  1452. form: {
  1453. handler: function(newQuestion, oldQuestion) {
  1454. this.getData(this.form.klDiagnoseTypeVO);
  1455. },
  1456. deep: true,
  1457. immediate: true
  1458. }
  1459. }
  1460. };
  1461. </script>
  1462. <style lang="less" scoped>
  1463. @import '../../less/admin.less';
  1464. .contents {
  1465. height: 100%;
  1466. .content {
  1467. background: #fff;
  1468. padding: 20px 20px;
  1469. color: #545455;
  1470. min-width: 980px;
  1471. position: relative;
  1472. .tip-text {
  1473. color: #f56c6c;
  1474. margin-left: 10px;
  1475. }
  1476. .conceptItem {
  1477. padding: 0 10px;
  1478. cursor: pointer;
  1479. height: 32px;
  1480. line-height: 32px;
  1481. &:hover {
  1482. background: #ebedf1;
  1483. }
  1484. }
  1485. .el-table--scrollable-y .el-table__body-wrapper {
  1486. height: calc(100vh - 370px);
  1487. }
  1488. /deep/ .el-input {
  1489. height: 30px;
  1490. line-height: 30px;
  1491. .el-input__inner {
  1492. height: 30px;
  1493. line-height: 30px;
  1494. font-size: 12px;
  1495. }
  1496. }
  1497. .inps {
  1498. width: 500px !important;
  1499. font-size: 14px;
  1500. /deep/ .el-input__inner {
  1501. width: 500px !important;
  1502. font-size: 14px;
  1503. }
  1504. }
  1505. .item {
  1506. /deep/.el-form-item__label {
  1507. font-size: 14px;
  1508. }
  1509. /deep/.el-input__inner {
  1510. font-size: 14px;
  1511. }
  1512. }
  1513. }
  1514. .content-2 {
  1515. margin-top: 10px;
  1516. padding: 20px 20px;
  1517. height: calc(100vh - 370px);
  1518. .cell {
  1519. overflow: initial;
  1520. }
  1521. .content-2-header {
  1522. padding: 20px 0;
  1523. .title1 {
  1524. font-size: 14px;
  1525. font-weight: 400;
  1526. color: #333333;
  1527. line-height: 20px;
  1528. }
  1529. .title2 {
  1530. font-size: 12px;
  1531. font-weight: 400;
  1532. color: #ff545b;
  1533. line-height: 17px;
  1534. }
  1535. }
  1536. .el-form-item {
  1537. margin-bottom: 10px;
  1538. margin-right: 0;
  1539. }
  1540. .discDesc {
  1541. margin-bottom: 20px;
  1542. /deep/ .el-form-item__error {
  1543. top: 38px;
  1544. left: 100px !important;
  1545. white-space: nowrap;
  1546. }
  1547. }
  1548. .el-popper[x-placement^='bottom'] {
  1549. width: 100px !important;
  1550. }
  1551. .disclButn {
  1552. position: absolute;
  1553. right: calc(50% - 60px);
  1554. bottom: 10px;
  1555. }
  1556. .el-table .cell.el-tooltip {
  1557. position: relative;
  1558. }
  1559. .box-2 {
  1560. position: relative;
  1561. .tips {
  1562. left: 3px;
  1563. }
  1564. }
  1565. .box-3 {
  1566. position: relative;
  1567. }
  1568. .tips {
  1569. width: 12px;
  1570. height: 12px;
  1571. position: absolute;
  1572. left: 15px;
  1573. top: 15px;
  1574. }
  1575. .title {
  1576. position: absolute;
  1577. z-index: -1;
  1578. }
  1579. .last-box {
  1580. display: flex;
  1581. height: 50px;
  1582. margin-bottom: 10px;
  1583. position: relative;
  1584. /deep/ .el-input,
  1585. .el-input__inner {
  1586. width: 85px;
  1587. font-size: 12px;
  1588. margin-right: 15px;
  1589. }
  1590. /deep/ .el-form-item__content {
  1591. position: inherit !important;
  1592. }
  1593. .last-box-1 {
  1594. display: flex;
  1595. /deep/ .el-form-item__error {
  1596. top: 38px;
  1597. left: 10px;
  1598. white-space: nowrap;
  1599. width: 360px;
  1600. }
  1601. }
  1602. .last-box-s {
  1603. position: absolute;
  1604. /deep/ .el-form-item__error {
  1605. top: 38px;
  1606. left: 0px;
  1607. white-space: nowrap;
  1608. width: 260px;
  1609. }
  1610. }
  1611. /deep/ .el-form-item__error {
  1612. top: 38px;
  1613. left: 10px;
  1614. white-space: nowrap;
  1615. }
  1616. /deep/ .inp {
  1617. width: 600px !important;
  1618. .el-input__inner {
  1619. width: 600px !important;
  1620. }
  1621. }
  1622. .el-form-item {
  1623. margin: 0;
  1624. overflow: hidden;
  1625. display: flex;
  1626. }
  1627. }
  1628. .tmall {
  1629. visibility: hidden;
  1630. height: 60px;
  1631. }
  1632. .medical {
  1633. margin-right: 26px;
  1634. }
  1635. .group {
  1636. border-bottom: 1px solid red;
  1637. padding: 30px 0;
  1638. .group-row {
  1639. padding: 10px 0;
  1640. border-bottom: 1px solid red;
  1641. }
  1642. }
  1643. .group:last-child {
  1644. border-bottom: none;
  1645. }
  1646. .icon {
  1647. padding: 0 3px;
  1648. cursor: pointer;
  1649. }
  1650. .star {
  1651. color: #ff545b;
  1652. }
  1653. }
  1654. .Butn {
  1655. display: flex;
  1656. justify-content: center;
  1657. background: #fff;
  1658. .el-button {
  1659. margin: 15px 0;
  1660. }
  1661. }
  1662. .name {
  1663. font-size: 14px;
  1664. font-weight: 400;
  1665. color: #333333;
  1666. line-height: 20px;
  1667. }
  1668. }
  1669. </style>