DiagBaseItem.vue 15 KB

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