DiagBaseItem.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <div class="groups-cont" v-if="groupData">
  3. <!--<el-form ref="groupData" label-width="150px" class="sub-condition-form" :model="groupData" :rules="rules">-->
  4. <div class="sub-condition-form">
  5. <span v-if="!hideDel" class="del-btn" @click="delRule">删除</span>
  6. <!--:class="isLast?'disable del-btn':'del-btn'"-->
  7. <el-form-item label="基础依据名称:" :key="0" :prop="ruleLine+ind+'.basDescription'">
  8. <el-input v-model.trim="groupData.basDescription" clearable></el-input>
  9. </el-form-item>
  10. <el-form-item label="基础依据类型:" :key="1" :prop="ruleLine+ind+'.basType'">
  11. <el-select
  12. v-model="groupData.basType"
  13. id="basTypeRef"
  14. placeholder="请选择"
  15. size="small"
  16. @change="basTypeChange"
  17. >
  18. <el-option v-for="item in baseTypes" :key="item.id" :label="item.name" :value="item.type"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item v-if="!showRegx" :key="2" label="基础依据术语类型:" :prop="ruleLine+ind+'.basLibType'">
  22. <el-select
  23. v-model="groupData.basLibType"
  24. placeholder="请选择"
  25. size="small"
  26. :disabled="showRegx"
  27. @change="basLibTypeChange"
  28. >
  29. <el-option
  30. v-for="item in baseTermTypeList"
  31. :key="item.id"
  32. :label="item.name"
  33. :value="Number(item.code)"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item v-if="showRegx" :key="3" label="基础依据术语类型:" class="is-required">
  38. <el-input disabled v-model="basTypeName"></el-input>
  39. </el-form-item>
  40. <el-form-item
  41. v-if="!showRegx"
  42. :key="4"
  43. class="addDepartFormItem"
  44. label="医学标准术语:"
  45. :prop="ruleLine+ind+'.basConceptId'"
  46. >
  47. <el-select
  48. clearable
  49. remote
  50. filterable
  51. :remote-method="searchConcept"
  52. v-model.trim="groupData.basConceptId"
  53. @change="conceptChange"
  54. >
  55. <el-option
  56. v-for="item in conceptList"
  57. :key="item.conceptId"
  58. :label="item.conceptName"
  59. :value="item.conceptId"
  60. ></el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item
  64. :key="5"
  65. v-if="groupData.basType===2&&!onlyNum&&!onlyTxt"
  66. label="选择类型:"
  67. :prop="ruleLine+ind+'.dataType'"
  68. >
  69. <el-select
  70. v-model="groupData.dataType"
  71. placeholder="请选择"
  72. size="small"
  73. @change="dataTypeChange"
  74. >
  75. <el-option v-for="item in dataTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item
  79. class="min-margin"
  80. :key="6"
  81. v-if="(!showRegx&&groupData.dataType==='1')||onlyNum"
  82. label="最大值:"
  83. >
  84. <div class="select-item clearfix">
  85. <el-col :span="3">
  86. <el-form-item :prop="ruleLine+ind+'.maxOperator'">
  87. <el-select v-model="groupData.maxOperator" placeholder="请选择" size="small" clearable>
  88. <el-option
  89. v-for="item in operMaxList"
  90. :key="item.key"
  91. :label="item.name"
  92. :value="item.key"
  93. ></el-option>
  94. </el-select>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="3">
  98. <el-form-item :prop="ruleLine+ind+'.maxVal'">
  99. <el-input type="text" v-model="groupData.maxVal" placeholder="填写数值" />
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="3">
  103. <el-form-item prop="maxUnit">
  104. <el-input type="text" v-model.trim="groupData.maxUnit" placeholder="填写单位" />
  105. </el-form-item>
  106. </el-col>
  107. </div>
  108. </el-form-item>
  109. <el-form-item
  110. class="min-margin"
  111. v-if="(!showRegx&&groupData.dataType==='1')||onlyNum"
  112. label="最小值:"
  113. >
  114. <div class="select-item clearfix">
  115. <el-col :span="3">
  116. <el-form-item :prop="ruleLine+ind+'.minOperator'">
  117. <el-select v-model="groupData.minOperator" placeholder="请选择" size="small" clearable>
  118. <el-option
  119. v-for="item in operMinList"
  120. :key="item.name"
  121. :label="item.name"
  122. :value="item.name"
  123. ></el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="3">
  128. <el-form-item :prop="ruleLine+ind+'.minVal'">
  129. <el-input type="text" v-model="groupData.minVal" placeholder="填写数值" />
  130. </el-form-item>
  131. </el-col>
  132. <el-col :span="3">
  133. <el-form-item prop="minUnit">
  134. <el-input type="text" v-model.trim="groupData.minUnit" placeholder="填写单位" />
  135. </el-form-item>
  136. </el-col>
  137. </div>
  138. </el-form-item>
  139. <el-form-item
  140. v-if="showRegx"
  141. key="v11"
  142. label="正则表达式:"
  143. :prop="ruleLine+ind+'.eqValue'"
  144. class="discDesc"
  145. >
  146. <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model.trim="groupData.eqValue"></el-input>
  147. </el-form-item>
  148. <el-form-item
  149. key="v13"
  150. v-if="(!onlyNum&&!showRegx&&groupData.basType===2&&groupData.dataType==='2')||onlyTxt"
  151. label="医学内容:"
  152. :prop="ruleLine+ind+'.eqValue'"
  153. class="discDesc"
  154. >
  155. <el-input placeholder="请输入医学内容" v-model.trim="groupData.eqValue"></el-input>
  156. <span class="tip-text">注:可输入升高、降低、阴性、阳性等~</span>
  157. </el-form-item>
  158. </div>
  159. <!--</el-form>-->
  160. </div>
  161. </template>
  162. <script>
  163. import api from '@api/zskDiagBase.js';
  164. export default {
  165. name: 'DiagBaseItem',
  166. props: ['groupData', 'ind', 'baseTypes', 'parInx', 'inx', 'hideDel'],
  167. data() {
  168. return {
  169. dicts: {},
  170. baseTermTypeList: [],
  171. typeList: [],
  172. numTypes: '', //只有数值类型的类型id
  173. //basTypeName:'',
  174. operMaxList: [
  175. { name: '<=', key: '<=' },
  176. { name: '<', key: '<' }
  177. ],
  178. operMinList: [
  179. { name: '>', key: '>' },
  180. { name: '>=', key: '>=' }
  181. ],
  182. dataTypes: [
  183. { id: '1', name: '数值类型' },
  184. { id: '2', name: '文本类型' }
  185. ],
  186. conceptList: []
  187. };
  188. },
  189. created() {
  190. this.dicts = JSON.parse(localStorage.getItem('zskDiagDicts') || '{}');
  191. if (this.groupData) {
  192. if (this.groupData.maxOperator || this.groupData.minOperator) {
  193. this.groupData.dataType = '1';
  194. } else if (this.groupData.eqValue) {
  195. this.groupData.dataType = '2';
  196. }
  197. }
  198. this.conceptList = [
  199. {
  200. conceptName: this.groupData.basLibName,
  201. conceptId: this.groupData.basConceptId
  202. }
  203. ];
  204. if (this.groupData.basType) {
  205. const obj = this.baseTypes.find(it => it.type === this.groupData.basType);
  206. this.baseTermTypeList = obj.subMenuList;
  207. }
  208. },
  209. computed: {
  210. basTypeName: function() {
  211. return (
  212. this.baseTypes.find(it => it.type === this.groupData.basType) || {}
  213. ).name;
  214. },
  215. onlyNum: function() {
  216. const onlyNum = this.dicts['onlyNum'] || '&';
  217. const codes = onlyNum + ',';
  218. const type = this.groupData.basLibType;
  219. return type && codes.indexOf(this.groupData.basLibType + ',') > -1;
  220. },
  221. onlyTxt: function() {
  222. const onlyTxt = this.dicts['onlyTxt'] || '&';
  223. const codes = onlyTxt + ',';
  224. const type = this.groupData.basLibType;
  225. return type && codes.indexOf(this.groupData.basLibType + ',') > -1;
  226. },
  227. ruleLine: function() {
  228. return (
  229. 'klDiagnoseTypeVO.' +
  230. this.parInx +
  231. '.groupVO.' +
  232. this.inx +
  233. '.klDiagnoseDetail.'
  234. );
  235. },
  236. showRegx: function() {
  237. return this.groupData.basType === 3 || this.groupData.basType === 4;
  238. }
  239. },
  240. methods: {
  241. dataTypeChange(val) {
  242. this.groupData.eqOperator = val === '2' ? '=' : '';
  243. this.clearNumText();
  244. delete this.groupData.dataType; //触发更新
  245. this.$set(this.groupData, 'dataType', val);
  246. },
  247. basTypeChange(val) {
  248. //基础依据类型修改
  249. if (!val) {
  250. this.baseTermTypeList = [];
  251. return;
  252. }
  253. this.groupData.basLibType = '';
  254. this.groupData.dataType = '';
  255. this.clearConcept(); //清空医学标准术语
  256. this.clearNumText(); //清空数值、医学内容
  257. const obj = this.baseTypes.find(it => it.type === val);
  258. this.baseTermTypeList = obj.subMenuList;
  259. },
  260. basLibTypeChange(val) {
  261. console.log(val)
  262. //基础依据术语类型修改
  263. this.groupData.basLibType = val;
  264. console.log((this.numTypes + ',').indexOf(val + ','))
  265. if ((this.numTypes + ',').indexOf(val + ',') > -1) {
  266. this.groupData.dataType = '1';
  267. } else {
  268. this.groupData.dataType = '';
  269. }
  270. this.clearConcept();
  271. this.clearNumText();
  272. },
  273. conceptChange(val) {
  274. this.groupData.basConceptId = val;
  275. if (val) {
  276. this.groupData.basLibName = this.conceptList.find(
  277. it => it.conceptId === val
  278. ).conceptName;
  279. } else {
  280. this.groupData.basLibName = '';
  281. }
  282. },
  283. clearConcept() {
  284. this.groupData.basConceptId = '';
  285. this.groupData.basLibName = '';
  286. this.conceptList = [];
  287. },
  288. clearNumText() {
  289. this.groupData.maxOperator = '';
  290. this.groupData.maxVal = '';
  291. this.groupData.maxUnit = '';
  292. this.groupData.minOperator = '';
  293. this.groupData.minVal = '';
  294. this.groupData.minUnit = '';
  295. this.groupData.eqValue = '';
  296. this.groupData.eqOperator = '';
  297. },
  298. searchConcept(val) {
  299. const param = {
  300. excludedConceptIds: [this.groupData.basType],
  301. libType: this.groupData.basLibType,
  302. name: val
  303. };
  304. api
  305. .searchConcept(param)
  306. .then(res => {
  307. if (res.data.code == '0') {
  308. const data = res.data.data;
  309. this.conceptList = data;
  310. }
  311. })
  312. .catch(error => {
  313. console.log(error);
  314. });
  315. },
  316. /*addRule(){
  317. this.$emit("addRule");
  318. this.$emit('setRules');
  319. },*/
  320. delRule() {
  321. this.$emit('delRule', this.ind);
  322. this.$emit('setRules');
  323. },
  324. warning(msg, type) {
  325. this.$message({
  326. showClose: true,
  327. message: msg,
  328. type: type || 'warning'
  329. });
  330. },
  331. showConfirmDialog(msg, resolve) {
  332. this.$alert(msg, '提示', {
  333. confirmButtonText: '确定',
  334. type: 'warning'
  335. })
  336. .then(() => {
  337. resolve();
  338. })
  339. .catch(() => {});
  340. }
  341. }
  342. };
  343. </script>
  344. <style lang="less">
  345. .groups-cont {
  346. background: #fff;
  347. border-bottom: 2px solid #f5f5f5;
  348. .conceptItem {
  349. padding: 0 10px;
  350. cursor: pointer;
  351. height: 32px;
  352. line-height: 32px;
  353. &:hover {
  354. background: #ebedf1;
  355. }
  356. }
  357. .sub-condition-form {
  358. padding: 10px 20px 9px;
  359. position: relative;
  360. border-bottom: 1px solid #f5f5f5;
  361. .del-btn {
  362. color: #ff5b5b;
  363. cursor: pointer;
  364. position: absolute;
  365. right: 20px;
  366. top: 20px;
  367. z-index: 1;
  368. &.disable {
  369. color: #b8b8b8;
  370. }
  371. }
  372. }
  373. .el-input__icon {
  374. line-height: 32px;
  375. }
  376. .select-item {
  377. & > div {
  378. float: left;
  379. margin-right: 10px;
  380. }
  381. .el-input {
  382. width: auto;
  383. }
  384. input {
  385. width: 95px;
  386. line-height: 32px;
  387. height: 32px;
  388. }
  389. }
  390. .el-input,
  391. .el-input__inner {
  392. width: 190px;
  393. line-height: 32px;
  394. height: 32px;
  395. }
  396. .el-button--danger.is-plain {
  397. background: none;
  398. }
  399. .itemList {
  400. position: absolute;
  401. // display: none;
  402. background: #fff;
  403. width: 188px;
  404. max-height: 160px;
  405. border: 1px solid #dcdfe6;
  406. left: 0;
  407. top: 37px;
  408. z-index: 2;
  409. overflow-y: auto;
  410. }
  411. .el-form-item {
  412. margin-bottom: 6px;
  413. &.min-margin {
  414. margin-bottom: 0;
  415. position: relative;
  416. .el-form-item__content {
  417. position: unset;
  418. }
  419. .el-form-item__error {
  420. top: 10px;
  421. left: 460px;
  422. white-space: normal;
  423. width: 260px;
  424. }
  425. }
  426. .el-textarea + .el-form-item__error {
  427. top: 80px;
  428. left: 0;
  429. }
  430. .tip-text + .el-form-item__error {
  431. top: 40px;
  432. left: 0;
  433. }
  434. }
  435. .el-input-number {
  436. width: 95px;
  437. }
  438. .el-input-number.is-controls-right .el-input-number__decrease,
  439. .el-input-number.is-controls-right .el-input-number__increase {
  440. width: 25px;
  441. height: 15px;
  442. line-height: 16px;
  443. }
  444. .el-col-3 {
  445. width: 94px;
  446. }
  447. }
  448. </style>