AddDiagBase.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723
  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)"
  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||items.basType===6 || items.basType===5"
  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. form: {
  508. description: '',
  509. conceptId: '',
  510. klDiagnoseTypeVO: [
  511. {
  512. conditionType: '',
  513. depart_id: 0,
  514. groupVO: [
  515. {
  516. baseGroup: '',
  517. conditionGroup: '',
  518. fitNo: '',
  519. klDiagnoseDetail: [
  520. {
  521. dataType: '',
  522. basNameType: false,
  523. onlyNumType: false,
  524. onlyTxtType: false,
  525. basTypeName: '',
  526. basConceptId: '',
  527. basDescription: '',
  528. basLename: '',
  529. basLibName: '',
  530. basLibType: null,
  531. basType: '',
  532. eqOperator: '',
  533. eqUnit: '',
  534. eqValue: '',
  535. maxOperator: '',
  536. maxUnit: '',
  537. maxVal: '',
  538. minOperator: '',
  539. minUnit: '',
  540. minVal: ''
  541. }
  542. ]
  543. }
  544. ]
  545. }
  546. ]
  547. },
  548. id: null,
  549. rules: tableRules,
  550. dataTypes: [
  551. { id: '1', name: '数值类型' },
  552. { id: '2', name: '文本类型' }
  553. ],
  554. operMaxList: [
  555. { name: '<=', key: '<=' },
  556. { name: '<', key: '<' }
  557. ],
  558. operMinList: [
  559. { name: '>', key: '>' },
  560. { name: '>=', key: '>=' }
  561. ],
  562. basType: '',
  563. dataType: '',
  564. spanArr: [],
  565. list: [], //提交数据数组,
  566. i: 1,
  567. onshow: true
  568. };
  569. },
  570. created() {
  571. const param = this.$route.params;
  572. this.baseTypes = JSON.parse(localStorage.getItem('zskDiagList') || '[]');
  573. this.dicts = JSON.parse(localStorage.getItem('zskDiagDicts') || '{}');
  574. let info = param.data;
  575. if (info) {
  576. this.id = info.id;
  577. this.isCopy = param.copy;
  578. this.title =
  579. '诊断依据维护-' + (this.isCopy ? '复制' : '修改') + '诊断依据';
  580. this.conceptList = [
  581. { conceptId: info.conceptId, conceptName: info.conceptName }
  582. ];
  583. for (let i = 0; i < info.klDiagnoseTypeVO.length; i++) {
  584. info.klDiagnoseTypeVO[i].depart_id = i;
  585. }
  586. this.form = Object.assign({}, this.form, this.formatData(info));
  587. if (this.isCopy) {
  588. this.conceptList = [];
  589. delete this.form.conceptName;
  590. delete this.form.conceptId;
  591. delete this.form.description;
  592. delete this.form.id;
  593. }
  594. var index2 = this.baseTypes.findIndex(
  595. item => item.ruleType === this.form.klDiagnoseTypeVO[0].conditionType
  596. );
  597. this.baseTermTypeList = this.baseTypes[index2].subMenuList;
  598. for (let i = 0; i < this.form.klDiagnoseTypeVO.length; i++) {
  599. for (let j = 0; j < this.form.klDiagnoseTypeVO[i].groupVO.length; j++) {
  600. for (
  601. let k = 0;
  602. k <
  603. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  604. k++
  605. ) {
  606. var index2 = this.baseTermTypeList.findIndex(
  607. item =>
  608. item.type ===
  609. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  610. .basType
  611. );
  612. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  613. k
  614. ].basLibTypeList = this.baseTermTypeList[index2].subMenuList;
  615. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  616. k
  617. ].conceptList = [
  618. {
  619. conceptName: this.form.klDiagnoseTypeVO[i].groupVO[j]
  620. .klDiagnoseDetail[k].basLibName,
  621. conceptId: this.form.klDiagnoseTypeVO[i].groupVO[j]
  622. .klDiagnoseDetail[k].basConceptId
  623. }
  624. ];
  625. if (
  626. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  627. .maxOperator ||
  628. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  629. .minOperator
  630. ) {
  631. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  632. k
  633. ].dataType = '1';
  634. } else if (
  635. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  636. .eqValue
  637. ) {
  638. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  639. k
  640. ].dataType = '2';
  641. }
  642. if (
  643. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  644. .basType == 3 ||
  645. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  646. .basType == 4
  647. ) {
  648. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  649. k
  650. ].basTypeName = this.form.klDiagnoseTypeVO[i].groupVO[
  651. j
  652. ].klDiagnoseDetail[k].basLibTypeList[0].name;
  653. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  654. k
  655. ].basNameType = true;
  656. } else {
  657. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  658. k
  659. ].basTypeName = '';
  660. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  661. k
  662. ].basNameType = false;
  663. }
  664. const onlyNum = this.dicts['onlyNum'] || '&';
  665. const onlyTxt = this.dicts['onlyTxt'] || '&';
  666. const codes = onlyNum + ',';
  667. const code = onlyTxt + ',';
  668. let type = this.form.klDiagnoseTypeVO[i].groupVO[j]
  669. .klDiagnoseDetail[k].basLibType;
  670. let a = this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  671. .basLibType;
  672. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  673. k
  674. ].onlyNumType = type && codes.indexOf(a + ',') > -1;
  675. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[
  676. k
  677. ].onlyTxtType = type && code.indexOf(a + ',') > -1;
  678. }
  679. }
  680. }
  681. this.i = this.form.klDiagnoseTypeVO.slice(-1)[0].depart_id + 1;
  682. }
  683. },
  684. computed: {
  685. numArr() {
  686. let arr = [];
  687. let num = [];
  688. for (let i = 0; i < this.form.klDiagnoseTypeVO.length; i++) {
  689. arr.push({ num: [] });
  690. for (let j = 0; j < this.form.klDiagnoseTypeVO[i].groupVO.length; j++) {
  691. arr[i].num.push([]);
  692. for (
  693. let k = 0;
  694. k <
  695. this.form.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  696. k++
  697. ) {
  698. arr[i].num[j].push({ id: k + 1, name: k + 1 });
  699. }
  700. }
  701. }
  702. return arr;
  703. },
  704. dest() {
  705. const formData = JSON.parse(JSON.stringify(this.form));
  706. let map = {},
  707. dest = [];
  708. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  709. let ai = formData.klDiagnoseTypeVO[i];
  710. if (!map[ai.depart_id]) {
  711. dest.push({
  712. depart_id: ai.depart_id,
  713. conditionType: ai.conditionType,
  714. groupVO: ai.groupVO
  715. });
  716. map[ai.depart_id] = ai;
  717. } else {
  718. for (let j = 0; j < dest.length; j++) {
  719. var dj = dest[j];
  720. if (dj.depart_id == ai.depart_id) {
  721. dj.groupVO = dj.groupVO.concat(ai.groupVO);
  722. break;
  723. }
  724. }
  725. }
  726. }
  727. return dest;
  728. }
  729. },
  730. // mounted() {
  731. // this.onscroll();
  732. // },
  733. methods: {
  734. // onscroll() {
  735. // this.$nextTick(function() {
  736. // // 监听当前组件的滚动事件
  737. // this.box = this.$refs.tableList.bodyWrapper;
  738. // this.box.addEventListener(
  739. // 'scroll',
  740. // () => {
  741. // // select组件层级太高,滚动隐藏
  742. // if (this.$refs.tableList.bodyWrapper.scrollLeft > 0) {
  743. // console.log(this.$refs.aa.handleClose)
  744. // // this.$refs.aa.handleClose()
  745. // // this.$refs.aa.blur()
  746. // // const SELECTWRAP_BODY = document.body; // body
  747. // // const SELECTWRAP_DOWNALL = document.querySelectorAll(
  748. // // '.el-select-dropdown'
  749. // // ); // select下拉框
  750. // // SELECTWRAP_BODY.click();
  751. // // SELECTWRAP_DOWNALL.forEach(item => {
  752. // // item.blur();
  753. // // });
  754. // }
  755. // },
  756. // false
  757. // );
  758. // });
  759. // },
  760. // 最大值 选择rule
  761. maxOperator(items, rule, value, callback) {
  762. const { maxVal, minOperator, minVal } = items;
  763. const val = value + minOperator + minVal + maxVal;
  764. if (!val || (!value && maxVal !== '')) {
  765. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  766. } else {
  767. callback();
  768. }
  769. },
  770. // 最大值 数值rule
  771. maxVal(items, rule, value, callback) {
  772. const { maxOperator, minOperator, minVal } = items;
  773. const val = value + maxOperator + minOperator + minVal;
  774. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  775. if (!val || (value == '' && maxOperator)) {
  776. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  777. } else if (value !== '' && !isNum) {
  778. callback(new Error('只能输入数字'));
  779. } else {
  780. callback();
  781. }
  782. },
  783. // 最小值 选择rule
  784. minOperator(items, rule, value, callback) {
  785. const { maxVal, maxOperator, minVal } = items;
  786. const val = value + maxVal + maxOperator + minVal;
  787. if (!val || (!value && minVal !== '')) {
  788. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  789. } else {
  790. callback();
  791. }
  792. },
  793. // 最小值 数值rule
  794. minVal(items, rule, value, callback) {
  795. const { maxVal, minOperator, maxOperator } = items;
  796. const val = value + maxVal + minOperator + maxOperator;
  797. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  798. if (!val || (value == '' && minOperator)) {
  799. callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
  800. } else if (value !== '' && !isNum) {
  801. callback(new Error('只能输入数字'));
  802. } else {
  803. callback();
  804. }
  805. },
  806. isMax(id) {
  807. const typeNum = this.form.klDiagnoseTypeVO.filter(
  808. item => item.depart_id === id
  809. ).length;
  810. return typeNum > 1;
  811. },
  812. getData(data) {
  813. let arr = data;
  814. let str = [];
  815. let newArr = [];
  816. arr.filter((value, index, array) => {
  817. if (value.groupVO.length > 1 && value.groupVO.length != 0) {
  818. for (let j = 0; j < value.groupVO.length; j++) {
  819. var db = {
  820. conditionType: value.conditionType,
  821. depart_id: value.depart_id,
  822. groupVO: [value.groupVO[j]]
  823. };
  824. str.push(db);
  825. }
  826. value.groupVO = [];
  827. arr.splice(index, 1);
  828. arr.splice(index, 0, ...str);
  829. newArr = str;
  830. } else {
  831. newArr = arr;
  832. }
  833. });
  834. // console.log(newArr)
  835. // this.$set(this, 'form.klDiagnoseTypeVO', newArr);
  836. this.getSpanArr(newArr);
  837. },
  838. getSpanArr(data) {
  839. this.spanArr = [];
  840. for (var i = 0; i < data.length; i++) {
  841. if (i === 0) {
  842. this.spanArr.push(1);
  843. this.pos = 0;
  844. } else {
  845. if (data[i].depart_id === data[i - 1].depart_id) {
  846. this.spanArr[this.pos] += 1;
  847. this.spanArr.push(0);
  848. } else {
  849. this.spanArr.push(1);
  850. this.pos = i;
  851. }
  852. }
  853. }
  854. },
  855. dataSpanMethod({ row, column, rowIndex, columnIndex }) {
  856. if (columnIndex === 0 || columnIndex === 1) {
  857. //合并行的行为只在第一列进行
  858. const _row = this.spanArr[rowIndex];
  859. const _col = _row > 0 ? 1 : 0;
  860. return {
  861. rowspan: _row,
  862. colspan: _col
  863. };
  864. }
  865. },
  866. getInitData() {
  867. this.i++
  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. });
  916. this.form.klDiagnoseTypeVO.splice(i + 1, 0, temp);
  917. },
  918. //复制依据
  919. copyDiag(id) {
  920. this.i++
  921. const formData = JSON.parse(JSON.stringify(this.form));
  922. let i = -1;
  923. let arr = [];
  924. formData.klDiagnoseTypeVO.forEach((item, inx) => {
  925. if (item.depart_id == id) {
  926. arr.push(item);
  927. i = inx;
  928. }
  929. });
  930. arr.forEach((item, index) => {
  931. item.depart_id = this.i;
  932. this.form.klDiagnoseTypeVO.splice(i + index + 1, 0, item);
  933. });
  934. // console.log(this.form.klDiagnoseTypeVO);
  935. // let map = {},
  936. // dest = [];
  937. // for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  938. // let ai = formData.klDiagnoseTypeVO[i];
  939. // if (!map[ai.depart_id]) {
  940. // dest.push({
  941. // depart_id: ai.depart_id,
  942. // conditionType: ai.conditionType,
  943. // groupVO: ai.groupVO
  944. // });
  945. // map[ai.depart_id] = ai;
  946. // } else {
  947. // for (let j = 0; j < dest.length; j++) {
  948. // var dj = dest[j];
  949. // if (dj.depart_id == ai.depart_id) {
  950. // dj.groupVO = dj.groupVO.concat(ai.groupVO);
  951. // break;
  952. // }
  953. // }
  954. // }
  955. // }
  956. // var index = dest.findIndex(item => {
  957. // return item.depart_id == id;
  958. // });
  959. // JSON.parse(JSON.stringify(dest[index])).depart_id=this.i
  960. // dest.splice(index + 1, 0, JSON.parse(JSON.stringify(dest[index])));
  961. // dest.forEach((item, i) => {
  962. // item.depart_id = i;
  963. // });
  964. // this.form.klDiagnoseTypeVO = JSON.parse(JSON.stringify(dest));
  965. },
  966. //删除依据
  967. delDiag(id, inx) {
  968. this.form.klDiagnoseTypeVO = this.form.klDiagnoseTypeVO.filter(
  969. item => item.depart_id !== id
  970. );
  971. this.form.klDiagnoseTypeVO.forEach((item, index) => {
  972. if (item.depart_id > id) {
  973. item.depart_id = item.depart_id - 1;
  974. }
  975. });
  976. },
  977. //新增组
  978. addGroup(i) {
  979. const temp = {
  980. baseGroup: '',
  981. conditionGroup: '',
  982. fitNo: '',
  983. klDiagnoseDetail: [
  984. {
  985. dataType: '',
  986. basNameType: false,
  987. onlyNumType: false,
  988. onlyTxtType: false,
  989. basTypeName: '',
  990. basConceptId: '',
  991. basDescription: '',
  992. basLename: '',
  993. basLibName: '',
  994. basLibType: null,
  995. basType: '',
  996. eqOperator: '',
  997. eqUnit: '',
  998. eqValue: '',
  999. maxOperator: '',
  1000. maxUnit: '',
  1001. maxVal: '',
  1002. minOperator: '',
  1003. minUnit: '',
  1004. minVal: ''
  1005. }
  1006. ]
  1007. };
  1008. this.form.klDiagnoseTypeVO[i].groupVO.splice(i + 1, 0, temp);
  1009. },
  1010. delGroup(id, i) {
  1011. this.form.klDiagnoseTypeVO.splice(i, 1);
  1012. },
  1013. //新增基础依据
  1014. addRule(row, index, i) {
  1015. let temp = {
  1016. dataType: '',
  1017. basNameType: false,
  1018. basTypeName: '',
  1019. basConceptId: '',
  1020. basDescription: '',
  1021. basLename: '',
  1022. basLibName: '',
  1023. basLibType: null,
  1024. basType: '',
  1025. eqOperator: '',
  1026. eqUnit: '',
  1027. eqValue: '',
  1028. maxOperator: '',
  1029. maxUnit: '',
  1030. maxVal: '',
  1031. minOperator: '',
  1032. minUnit: '',
  1033. minVal: '',
  1034. dataType: ''
  1035. };
  1036. this.form.klDiagnoseTypeVO[index].groupVO[i].klDiagnoseDetail.push(temp);
  1037. },
  1038. delRule(row, inx, index, i) {
  1039. if (
  1040. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail
  1041. .length == 1
  1042. ) {
  1043. return;
  1044. } else {
  1045. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail.splice(
  1046. i,
  1047. 1
  1048. );
  1049. }
  1050. },
  1051. //诊断依据类型修改
  1052. basTypeChange(val, inx) {
  1053. if (!val) {
  1054. this.baseTermTypeList = [];
  1055. return;
  1056. }
  1057. var index2 = this.baseTypes.findIndex(item => item.ruleType === val);
  1058. this.baseTermTypeList = this.baseTypes[index2].subMenuList;
  1059. },
  1060. //基础依据类型修改
  1061. baseTermTypeChange(val, inx, index, i) {
  1062. if (!val) {
  1063. return;
  1064. }
  1065. this.basType = val;
  1066. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1067. i
  1068. ].basType = val;
  1069. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1070. i
  1071. ].basLibType = '';
  1072. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1073. i
  1074. ].dataType = '';
  1075. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1076. i
  1077. ].conceptList = [];
  1078. this.clearConcept(val, inx, index, i); //清空医学标准术语
  1079. this.clearNumText(val, inx, index, i); //清空数值、医学内容
  1080. var index2 = this.baseTermTypeList.findIndex(item => item.type === val);
  1081. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1082. i
  1083. ].basLibTypeList = this.baseTermTypeList[index2].subMenuList;
  1084. this.form.klDiagnoseTypeVO[inx].groupVO[
  1085. index
  1086. ].baseTermTypeList = this.baseTermTypeList;
  1087. if (val == 3 || val == 4||val == 5 || val == 6) {
  1088. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1089. i
  1090. ].basTypeName = this.form.klDiagnoseTypeVO[inx].groupVO[
  1091. index
  1092. ].klDiagnoseDetail[i].basLibTypeList[0].name;
  1093. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1094. i
  1095. ].basNameType = true;
  1096. this.$refs['form'].clearValidate([
  1097. 'klDiagnoseTypeVO.' +
  1098. inx +
  1099. '.groupVO.' +
  1100. index +
  1101. '.klDiagnoseDetail.' +
  1102. i +
  1103. '.basLibType'
  1104. ]);
  1105. } else {
  1106. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1107. i
  1108. ].basTypeName = '';
  1109. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1110. i
  1111. ].basNameType = false;
  1112. }
  1113. },
  1114. //基础依据术语类型修改
  1115. basLibTypeChange(val, inx, index, i) {
  1116. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1117. i
  1118. ].basLibType = val;
  1119. // this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1120. // i
  1121. // ].dataType = '';
  1122. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1123. i
  1124. ].basConceptId = '';
  1125. if ((this.numTypes + ',').indexOf(val + ',') > -1) {
  1126. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1127. i
  1128. ].dataType = '1';
  1129. } else {
  1130. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1131. i
  1132. ].dataType = '';
  1133. }
  1134. const onlyNum = this.dicts['onlyNum'] || '&';
  1135. const onlyTxt = this.dicts['onlyTxt'] || '&';
  1136. const codes = onlyNum + ',';
  1137. const code = onlyTxt + ',';
  1138. let type = this.form.klDiagnoseTypeVO[inx].groupVO[index]
  1139. .klDiagnoseDetail[i].basLibType;
  1140. let a = this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1141. .basLibType;
  1142. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1143. i
  1144. ].onlyNumType = type && codes.indexOf(a + ',') > -1;
  1145. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1146. i
  1147. ].onlyTxtType = type && code.indexOf(a + ',') > -1;
  1148. this.clearConcept(val, inx, index, i);
  1149. this.clearNumText2(val, inx, index, i);
  1150. },
  1151. //医学标准术语
  1152. conceptChange(val, inx, index, i) {
  1153. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1154. i
  1155. ].basConceptId = val;
  1156. if (val) {
  1157. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1158. i
  1159. ].basLibName = this.form.klDiagnoseTypeVO[inx].groupVO[
  1160. index
  1161. ].klDiagnoseDetail[i].conceptList.find(
  1162. it => it.conceptId === val
  1163. ).conceptName;
  1164. } else {
  1165. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1166. i
  1167. ].basLibName = '';
  1168. }
  1169. },
  1170. searchConcept(val, inx, index, i) {
  1171. const formData = JSON.parse(JSON.stringify(this.form));
  1172. const param = {
  1173. excludedConceptIds: [
  1174. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1175. .basType
  1176. ],
  1177. libType:
  1178. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[i]
  1179. .basLibType,
  1180. name: val
  1181. };
  1182. api
  1183. .searchConcept(param)
  1184. .then(res => {
  1185. if (res.data.code == '0') {
  1186. const data = res.data.data;
  1187. this.$nextTick(() => {
  1188. // dom元素更新后执行,因此这里能正确打印更改之后的值
  1189. formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1190. i
  1191. ].conceptList = data; // 改变了的值
  1192. });
  1193. this.form = formData;
  1194. }
  1195. })
  1196. .catch(error => {
  1197. console.log(error);
  1198. });
  1199. },
  1200. dataTypeChange(val, inx, index, i) {
  1201. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1202. i
  1203. ].dataType = val;
  1204. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1205. i
  1206. ].eqOperator = val === '2' ? '=' : '';
  1207. },
  1208. clearConcept(val, inx, index, i) {
  1209. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1210. i
  1211. ].basConceptId = '';
  1212. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1213. i
  1214. ].basLibName = '';
  1215. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1216. i
  1217. ].conceptList = [];
  1218. },
  1219. clearNumText2(val, inx, index, i) {
  1220. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1221. i
  1222. ].maxOperator = '';
  1223. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1224. i
  1225. ].maxVal = '';
  1226. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1227. i
  1228. ].maxUnit = '';
  1229. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1230. i
  1231. ].minOperator = '';
  1232. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1233. i
  1234. ].minVal = '';
  1235. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1236. i
  1237. ].minUnit = '';
  1238. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1239. i
  1240. ].eqValue = '';
  1241. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1242. i
  1243. ].eqOperator = '';
  1244. },
  1245. clearNumText(val, inx, index, i) {
  1246. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1247. i
  1248. ].maxOperator = '';
  1249. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1250. i
  1251. ].maxVal = '';
  1252. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1253. i
  1254. ].maxUnit = '';
  1255. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1256. i
  1257. ].minOperator = '';
  1258. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1259. i
  1260. ].minVal = '';
  1261. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1262. i
  1263. ].minUnit = '';
  1264. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1265. i
  1266. ].eqValue = '';
  1267. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1268. i
  1269. ].eqOperator = '';
  1270. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1271. i
  1272. ].onlyNumType = false;
  1273. this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
  1274. i
  1275. ].onlyTxtType = false;
  1276. },
  1277. formatData(data) {
  1278. //转换字段名
  1279. let str = JSON.stringify(data)
  1280. .replace(/byIdDTO/g, 'groupVO')
  1281. .replace(/klDiagnoseByIdDTO/g, 'klDiagnoseDetail');
  1282. //console.log(JSON.parse(str))
  1283. return JSON.parse(str);
  1284. },
  1285. searchDiag(val) {
  1286. const param = {
  1287. diseaseName: val
  1288. };
  1289. api
  1290. .searchDiag(param)
  1291. .then(res => {
  1292. if (res.data.code == '0') {
  1293. const data = res.data.data;
  1294. this.conceptList = data;
  1295. }
  1296. })
  1297. .catch(error => {
  1298. console.log(error);
  1299. });
  1300. },
  1301. setInitGroupData() {
  1302. let temp = this.getInitData();
  1303. this.form.klDiagnoseTypeVO = [temp];
  1304. },
  1305. setRules() {
  1306. let that = this;
  1307. let list = this.form.klDiagnoseTypeVO;
  1308. if (list && list.length > 0) {
  1309. list.forEach((item, i) => {
  1310. let list1 = list[i].groupVO;
  1311. list1.forEach((it, x) => {
  1312. let list2 = list1[x].klDiagnoseDetail;
  1313. list2.forEach((t, j) => {
  1314. let grandeObj = this.form.klDiagnoseTypeVO[i].groupVO[x]
  1315. .klDiagnoseDetail[j];
  1316. if (grandeObj) {
  1317. const keyTxt =
  1318. 'klDiagnoseTypeVO.' +
  1319. i +
  1320. '.groupVO.' +
  1321. x +
  1322. '.klDiagnoseDetail.' +
  1323. j;
  1324. that.rules[keyTxt + '.dataType'] = [
  1325. {
  1326. required: true,
  1327. message: '请选择类型',
  1328. trigger: ['change']
  1329. }
  1330. ];
  1331. that.rules[keyTxt + '.maxOperator'] = [
  1332. {
  1333. validator: (rule, value, callback) => {
  1334. const { maxVal, minOperator, minVal } = grandeObj;
  1335. const val = value + minOperator + minVal + maxVal;
  1336. if (!val || (!value && maxVal !== '')) {
  1337. callback(
  1338. new Error(
  1339. '最大值和最小值至少完整填写一个,单位不必填'
  1340. )
  1341. );
  1342. } else {
  1343. callback();
  1344. }
  1345. },
  1346. trigger: 'change'
  1347. }
  1348. ];
  1349. that.rules[keyTxt + '.minOperator'] = [
  1350. {
  1351. validator: (rule, value, callback) => {
  1352. const { maxVal, maxOperator, minVal } = grandeObj;
  1353. const val = value + maxOperator + minVal + maxVal;
  1354. if (!val || (!value && minVal !== '')) {
  1355. callback(
  1356. new Error(
  1357. '最大值和最小值至少完整填写一个,单位不必填'
  1358. )
  1359. );
  1360. } else {
  1361. callback();
  1362. }
  1363. },
  1364. trigger: 'change'
  1365. }
  1366. ];
  1367. that.rules[keyTxt + '.maxVal'] = [
  1368. {
  1369. validator: (rule, value, callback) => {
  1370. const { maxOperator, minOperator, minVal } = grandeObj;
  1371. const val = value + maxOperator + minVal + minOperator;
  1372. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  1373. if (!val || (value === '' && maxOperator)) {
  1374. callback(
  1375. new Error(
  1376. '最大值和最小值至少完整填写一个,单位不必填'
  1377. )
  1378. );
  1379. } else if (value !== '' && !isNum) {
  1380. callback(new Error('只能输入数字'));
  1381. } else {
  1382. callback();
  1383. }
  1384. },
  1385. trigger: 'blur'
  1386. }
  1387. ];
  1388. that.rules[keyTxt + '.minVal'] = [
  1389. {
  1390. validator: (rule, value, callback) => {
  1391. const { maxVal, minOperator, maxOperator } = grandeObj;
  1392. const val = value + maxOperator + maxVal + minOperator;
  1393. const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
  1394. if (!val || (value === '' && minOperator)) {
  1395. callback(
  1396. new Error(
  1397. '最大值和最小值至少完整填写一个,单位不必填'
  1398. )
  1399. );
  1400. } else if (value !== '' && !isNum) {
  1401. callback(new Error('只能输入数字'));
  1402. } else {
  1403. callback();
  1404. }
  1405. },
  1406. trigger: 'blur'
  1407. }
  1408. ];
  1409. }
  1410. });
  1411. });
  1412. });
  1413. }
  1414. },
  1415. saveDiagBase(params) {
  1416. api.saveDiagBase(params).then(res => {
  1417. if (res.data.code == 0) {
  1418. this.$message({
  1419. message: '操作成功',
  1420. type: 'success'
  1421. });
  1422. this.$router.push({
  1423. name: 'ZskDiagBase',
  1424. params: this.$route.params
  1425. });
  1426. } else {
  1427. this.$message({
  1428. message: res.data.msg,
  1429. type: 'warning'
  1430. });
  1431. }
  1432. });
  1433. },
  1434. validateForms(callBack) {
  1435. this.$refs['form'].validate(valid => {
  1436. if (valid) {
  1437. callBack();
  1438. } else {
  1439. return false;
  1440. }
  1441. });
  1442. },
  1443. confirm() {
  1444. const formData = JSON.parse(JSON.stringify(this.form));
  1445. const _this = this;
  1446. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  1447. for (let j = 0; j < formData.klDiagnoseTypeVO[i].groupVO.length; j++) {
  1448. delete formData.klDiagnoseTypeVO[i].groupVO[j].baseTermTypeList;
  1449. for (
  1450. let k = 0;
  1451. k < formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail.length;
  1452. k++
  1453. ) {
  1454. delete formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  1455. .basLibTypeList;
  1456. delete formData.klDiagnoseTypeVO[i].groupVO[j].klDiagnoseDetail[k]
  1457. .conceptList;
  1458. }
  1459. }
  1460. }
  1461. let map = {},
  1462. dest = [];
  1463. for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
  1464. let ai = formData.klDiagnoseTypeVO[i];
  1465. if (!map[ai.depart_id]) {
  1466. dest.push({
  1467. depart_id: ai.depart_id,
  1468. conditionType: ai.conditionType,
  1469. groupVO: ai.groupVO
  1470. });
  1471. map[ai.depart_id] = ai;
  1472. } else {
  1473. for (let j = 0; j < dest.length; j++) {
  1474. var dj = dest[j];
  1475. if (dj.depart_id == ai.depart_id) {
  1476. dj.groupVO = dj.groupVO.concat(ai.groupVO);
  1477. break;
  1478. }
  1479. }
  1480. }
  1481. }
  1482. formData.klDiagnoseTypeVO = dest;
  1483. this.validateForms(function() {
  1484. let params = formData;
  1485. _this.saveDiagBase(params);
  1486. });
  1487. }
  1488. },
  1489. watch: {
  1490. form: {
  1491. handler: function(newQuestion, oldQuestion) {
  1492. this.getData(this.form.klDiagnoseTypeVO);
  1493. },
  1494. deep: true,
  1495. immediate: true
  1496. }
  1497. }
  1498. };
  1499. </script>
  1500. <style lang="less" scoped>
  1501. @import '../../less/admin.less';
  1502. .contents {
  1503. height: 100%;
  1504. .content {
  1505. background: #fff;
  1506. padding: 20px 20px;
  1507. color: #545455;
  1508. min-width: 980px;
  1509. position: relative;
  1510. .tip-text {
  1511. color: #f56c6c;
  1512. margin-left: 10px;
  1513. }
  1514. .conceptItem {
  1515. padding: 0 10px;
  1516. cursor: pointer;
  1517. height: 32px;
  1518. line-height: 32px;
  1519. &:hover {
  1520. background: #ebedf1;
  1521. }
  1522. }
  1523. .el-table--scrollable-y .el-table__body-wrapper {
  1524. height: calc(100vh - 370px);
  1525. }
  1526. /deep/ .el-input {
  1527. height: 30px;
  1528. line-height: 30px;
  1529. .el-input__inner {
  1530. height: 30px;
  1531. line-height: 30px;
  1532. font-size: 12px;
  1533. }
  1534. }
  1535. .inps {
  1536. width: 500px !important;
  1537. font-size: 14px;
  1538. /deep/ .el-input__inner {
  1539. width: 500px !important;
  1540. font-size: 14px;
  1541. }
  1542. }
  1543. .item {
  1544. /deep/.el-form-item__label {
  1545. font-size: 14px;
  1546. }
  1547. /deep/.el-input__inner {
  1548. font-size: 14px;
  1549. }
  1550. }
  1551. }
  1552. .content-2 {
  1553. margin-top: 10px;
  1554. padding: 20px 20px;
  1555. height: calc(100vh - 370px);
  1556. .cell {
  1557. overflow: initial;
  1558. }
  1559. .content-2-header {
  1560. padding: 20px 0;
  1561. .title1 {
  1562. font-size: 14px;
  1563. font-weight: 400;
  1564. color: #333333;
  1565. line-height: 20px;
  1566. }
  1567. .title2 {
  1568. font-size: 12px;
  1569. font-weight: 400;
  1570. color: #ff545b;
  1571. line-height: 17px;
  1572. }
  1573. }
  1574. .el-form-item {
  1575. margin-bottom: 10px;
  1576. margin-right: 0;
  1577. }
  1578. .discDesc {
  1579. margin-bottom: 20px;
  1580. /deep/ .el-form-item__error {
  1581. top: 38px;
  1582. left: 100px !important;
  1583. white-space: nowrap;
  1584. }
  1585. }
  1586. .el-popper[x-placement^='bottom'] {
  1587. width: 100px !important;
  1588. }
  1589. .disclButn {
  1590. position: absolute;
  1591. right: calc(50% - 60px);
  1592. bottom: 10px;
  1593. }
  1594. .el-table .cell.el-tooltip {
  1595. position: relative;
  1596. }
  1597. .box-2 {
  1598. position: relative;
  1599. .tips {
  1600. left: 3px;
  1601. }
  1602. }
  1603. .box-3 {
  1604. position: relative;
  1605. }
  1606. .tips {
  1607. width: 12px;
  1608. height: 12px;
  1609. position: absolute;
  1610. left: 15px;
  1611. top: 15px;
  1612. }
  1613. .title {
  1614. position: absolute;
  1615. z-index: -1;
  1616. }
  1617. .last-box {
  1618. display: flex;
  1619. height: 50px;
  1620. margin-bottom: 10px;
  1621. position: relative;
  1622. /deep/ .el-input,
  1623. .el-input__inner {
  1624. width: 85px;
  1625. font-size: 12px;
  1626. margin-right: 15px;
  1627. }
  1628. /deep/ .el-form-item__content {
  1629. position: inherit !important;
  1630. }
  1631. .last-box-1 {
  1632. display: flex;
  1633. /deep/ .el-form-item__error {
  1634. top: 38px;
  1635. left: 10px;
  1636. white-space: nowrap;
  1637. width: 360px;
  1638. }
  1639. }
  1640. .last-box-s {
  1641. position: absolute;
  1642. /deep/ .el-form-item__error {
  1643. top: 38px;
  1644. left: 0px;
  1645. white-space: nowrap;
  1646. width: 260px;
  1647. }
  1648. }
  1649. /deep/ .el-form-item__error {
  1650. top: 38px;
  1651. left: 10px;
  1652. white-space: nowrap;
  1653. }
  1654. /deep/ .inp {
  1655. width: 600px !important;
  1656. .el-input__inner {
  1657. width: 600px !important;
  1658. }
  1659. }
  1660. .el-form-item {
  1661. margin: 0;
  1662. overflow: hidden;
  1663. display: flex;
  1664. }
  1665. }
  1666. .tmall {
  1667. visibility: hidden;
  1668. height: 60px;
  1669. }
  1670. .medical {
  1671. margin-right: 26px;
  1672. }
  1673. .group {
  1674. border-bottom: 1px solid red;
  1675. padding: 30px 0;
  1676. .group-row {
  1677. padding: 10px 0;
  1678. border-bottom: 1px solid red;
  1679. }
  1680. }
  1681. .group:last-child {
  1682. border-bottom: none;
  1683. }
  1684. .icon {
  1685. padding: 0 3px;
  1686. cursor: pointer;
  1687. }
  1688. .star {
  1689. color: #ff545b;
  1690. }
  1691. }
  1692. .Butn {
  1693. display: flex;
  1694. justify-content: center;
  1695. background: #fff;
  1696. .el-button {
  1697. margin: 15px 0;
  1698. }
  1699. }
  1700. .name {
  1701. font-size: 14px;
  1702. font-weight: 400;
  1703. color: #333333;
  1704. line-height: 20px;
  1705. }
  1706. }
  1707. </style>