AddDiagBase.vue 59 KB

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