DiagBaseItem.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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" 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="groupData.dataType==='2'" 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. baseTermTypeList:[],
  139. typeList:[],
  140. numTypes:'', //只有数值类型的类型id
  141. //basTypeName:'',
  142. operMaxList:[
  143. {name:'<=',key:'<='},
  144. {name:'<',key:'<'},
  145. ],
  146. operMinList:[{name:'>',key:'>'},
  147. {name:'>=',key:'>='},
  148. ],
  149. dataTypes:[{id:'1',name:'数值类型'},{id:'2',name:'文本类型'}],
  150. conceptList:[],
  151. }
  152. },
  153. watch: {
  154. 'groupData': {
  155. handler: function (val) {
  156. this.$emit("changeVal", val, this.ind);
  157. },
  158. deep: true
  159. },
  160. },
  161. created(){
  162. if(this.groupData.maxOperator||this.groupData.minOperator){
  163. this.groupData.dataType='1';
  164. }else if(this.groupData.eqValue){
  165. this.groupData.dataType='2';
  166. }
  167. },
  168. mounted(){
  169. this.conceptList=[{conceptName:this.groupData.basLibName,conceptId:this.groupData.basConceptId}];
  170. if(this.groupData.basLibType){
  171. this.baseTermTypeList=[{name:this.groupData.basLename,code:this.groupData.basLibType}];
  172. }
  173. },
  174. computed:{
  175. basTypeName:function(){
  176. return (this.baseTypes.find((it)=>it.type===this.groupData.basType)||{}).name;
  177. },
  178. onlyNum:function(){
  179. const codes=localStorage.getItem("zskDiagDicts")+',';
  180. const type=this.groupData.basLibType;
  181. return type&&codes.indexOf(this.groupData.basLibType+',')>-1;
  182. },
  183. ruleLine:function(){
  184. return 'klDiagnoseTypeVO.'+this.parInx+'.groupVO.'+this.inx+'.klDiagnoseDetail.';
  185. },
  186. showRegx:function(){
  187. return this.groupData.basType===3||this.groupData.basType===4;
  188. },
  189. textName:function(){
  190. return this.showRegx?'正则表达式':'医学内容';
  191. },
  192. },
  193. methods:{
  194. dataTypeChange(val){
  195. this.groupData.eqOperator=(val==='2'?'=':'');
  196. this.clearNumText();
  197. delete this.groupData.dataType; //触发更新
  198. this.$set(this.groupData,'dataType',val);
  199. },
  200. basTypeChange(val){ //基础规则类型修改
  201. if(!val){
  202. this.baseTermTypeList =[];
  203. return;
  204. }
  205. this.groupData.basLibType='';
  206. this.clearConcept(); //清空医学标准术语
  207. this.clearNumText(); //清空数值、医学内容
  208. const obj = this.baseTypes.find((it)=>it.type===val);
  209. this.baseTermTypeList = obj.subMenuList;
  210. },
  211. subCodeChange(val){ //基础规则术语类型修改
  212. this.groupData.basLibType=val;
  213. if((this.numTypes+',').indexOf(val+',')>-1){
  214. this.groupData.dataType='1';
  215. }else{
  216. this.groupData.dataType='';
  217. }
  218. this.clearConcept();
  219. this.clearNumText();
  220. },
  221. clearConcept(){
  222. this.groupData.basConceptId='';
  223. this.conceptList=[];
  224. },
  225. clearNumText(){
  226. this.groupData.maxOperator='';
  227. this.groupData.maxVal='';
  228. this.groupData.maxUnit='';
  229. this.groupData.minOperator='';
  230. this.groupData.minVal='';
  231. this.groupData.minUnit='';
  232. this.groupData.eqValue='';
  233. this.groupData.eqOperator='';
  234. },
  235. searchConcept(val){
  236. const param = {
  237. excludedConceptIds:[this.groupData.basType],
  238. libType:this.groupData.basLibType,
  239. name:val,
  240. };
  241. api.searchConcept(param).then((res) => {
  242. if (res.data.code == '0') {
  243. const data = res.data.data;
  244. this.conceptList = data;
  245. }
  246. }).catch((error) => {
  247. console.log(error);
  248. });
  249. },
  250. addRule(){
  251. this.$emit("addRule");
  252. this.$emit('setRules');
  253. },
  254. delRule(){
  255. this.$emit("delRule",this.ind);
  256. },
  257. warning(msg,type){
  258. this.$message({
  259. showClose: true,
  260. message:msg,
  261. type:type||'warning'
  262. })
  263. },
  264. showConfirmDialog(msg,resolve){
  265. this.$alert(msg, '提示', {
  266. confirmButtonText: '确定',
  267. type: 'warning'
  268. }).then(() => {
  269. resolve();
  270. }).catch(() => {});
  271. },
  272. }
  273. }
  274. </script>
  275. <style lang="less">
  276. .groups-cont{
  277. background: #fff;
  278. border-bottom:2px solid #F5F5F5;
  279. .conceptItem{
  280. padding: 0 10px;
  281. cursor: pointer;
  282. height: 32px;
  283. line-height: 32px;
  284. &:hover{
  285. background: #ebedf1;
  286. }
  287. }
  288. .inner-oper{
  289. padding: 15px 0 15px 21px;
  290. .add-btn {
  291. cursor: pointer;
  292. img {
  293. vertical-align: middle;
  294. }
  295. }
  296. }
  297. .sub-condition-form{
  298. padding: 20px;
  299. position: relative;
  300. border-bottom:1px solid #F5F5F5;
  301. .del-btn{
  302. color: #FF5B5B;
  303. cursor: pointer;
  304. position: absolute;
  305. right: 20px;
  306. top:20px;
  307. z-index: 1;
  308. &.disable{
  309. color: #B8B8B8;
  310. }
  311. }
  312. }
  313. .el-input__icon{
  314. line-height: 32px;
  315. }
  316. .select-item{
  317. &>div{
  318. float: left;
  319. margin-right: 10px;
  320. }
  321. .el-input{
  322. width: auto;
  323. }
  324. input{
  325. width: 95px;
  326. line-height: 32px;
  327. height: 32px;
  328. }
  329. }
  330. .el-input,.el-input__inner{
  331. width: 190px;
  332. line-height: 32px;
  333. height: 32px;
  334. }
  335. .el-button--danger.is-plain{
  336. background: none;
  337. }
  338. .itemList {
  339. position: absolute;
  340. // display: none;
  341. background: #fff;
  342. width: 188px;
  343. max-height: 160px;
  344. border: 1px solid #DCDFE6;
  345. left: 0;
  346. top: 37px;
  347. z-index: 2;
  348. overflow-y: auto;
  349. }
  350. .el-form-item{
  351. margin-bottom: 22px;
  352. &.min-margin{
  353. margin-bottom: 0;
  354. }
  355. }
  356. .el-form-item__error{
  357. top: auto;
  358. white-space: nowrap;
  359. background: #fff;
  360. }
  361. .el-input-number{
  362. width: 95px;
  363. }
  364. .el-input-number.is-controls-right .el-input-number__decrease, .el-input-number.is-controls-right .el-input-number__increase{
  365. width: 25px;
  366. height: 15px;
  367. line-height: 16px;
  368. }
  369. .el-col-3 {
  370. width: 94px;
  371. }
  372. }
  373. </style>