AddDiagBase.vue 56 KB

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