DiagBaseItem.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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><!--:class="isLast?'disable del-btn':'del-btn'"-->
  6. <el-form-item label="基础依据名称:" :key="0" :prop="ruleLine+ind+'.basDescription'">
  7. <el-input v-model.trim = "groupData.basDescription"></el-input>
  8. </el-form-item>
  9. <el-form-item label="基础依据类型:" :key="1" :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" :key="2" 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="Number(item.code)">
  33. </el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item v-if="showRegx" :key="3" label="基础依据术语类型:" class="is-required">
  37. <el-input disabled v-model="basTypeName"></el-input>
  38. </el-form-item>
  39. <el-form-item v-if="!showRegx" :key="4" 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 :key="5" 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" :key="6" v-if="(!showRegx&&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="(!showRegx&&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 placeholder="请输入医学内容" v-model.trim="groupData.eqValue"></el-input>
  119. <span class="tip-text">注:可输入升高、降低、阴性、阳性等~</span>
  120. </el-form-item>
  121. <el-form-item v-if="showRegx" label="正则表达式:" :prop="ruleLine+ind+'.eqValue'" class="discDesc is-required">
  122. <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model.trim="groupData.eqValue"></el-input>
  123. </el-form-item>
  124. </div>
  125. <!--</el-form>-->
  126. </div>
  127. </template>
  128. <script>
  129. import api from '@api/zskDiagBase.js';
  130. export default {
  131. name:'DiagBaseItem',
  132. props:['groupData','ind','baseTypes','parInx','inx','hideDel'],
  133. data(){
  134. return {
  135. dicts:{},
  136. baseTermTypeList:[],
  137. typeList:[],
  138. numTypes:'', //只有数值类型的类型id
  139. //basTypeName:'',
  140. operMaxList:[
  141. {name:'<=',key:'<='},
  142. {name:'<',key:'<'},
  143. ],
  144. operMinList:[{name:'>',key:'>'},
  145. {name:'>=',key:'>='},
  146. ],
  147. dataTypes:[{id:'1',name:'数值类型'},{id:'2',name:'文本类型'}],
  148. conceptList:[],
  149. }
  150. },
  151. watch: {
  152. 'groupData': {
  153. handler: function (val) {
  154. this.$emit("changeVal", val, this.ind);
  155. },
  156. deep: true
  157. },
  158. },
  159. created(){
  160. this.dicts=JSON.parse(localStorage.getItem("zskDiagDicts")||'{}');
  161. if(this.groupData){
  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. this.conceptList=[{conceptName:this.groupData.basLibName,conceptId:this.groupData.basConceptId}];
  169. if(this.groupData.basType){
  170. const obj = this.baseTypes.find((it)=>it.type===this.groupData.basType);
  171. this.baseTermTypeList = obj.subMenuList;
  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 onlyNum =this.dicts['onlyNum']||'&';
  180. const codes=onlyNum+',';
  181. const type=this.groupData.basLibType;
  182. return type&&codes.indexOf(this.groupData.basLibType+',')>-1;
  183. },
  184. onlyTxt:function(){
  185. const onlyTxt =this.dicts['onlyTxt']||'&';
  186. const codes=onlyTxt+',';
  187. const type=this.groupData.basLibType;
  188. return type&&codes.indexOf(this.groupData.basLibType+',')>-1;
  189. },
  190. ruleLine:function(){
  191. return 'klDiagnoseTypeVO.'+this.parInx+'.groupVO.'+this.inx+'.klDiagnoseDetail.';
  192. },
  193. showRegx:function(){
  194. return this.groupData.basType===3||this.groupData.basType===4;
  195. },
  196. },
  197. methods:{
  198. dataTypeChange(val){
  199. this.groupData.eqOperator=(val==='2'?'=':'');
  200. this.clearNumText();
  201. delete this.groupData.dataType; //触发更新
  202. this.$set(this.groupData,'dataType',val);
  203. },
  204. basTypeChange(val){ //基础依据类型修改
  205. if(!val){
  206. this.baseTermTypeList =[];
  207. return;
  208. }
  209. this.groupData.basLibType='';
  210. this.clearConcept(); //清空医学标准术语
  211. this.clearNumText(); //清空数值、医学内容
  212. const obj = this.baseTypes.find((it)=>it.type===val);
  213. this.baseTermTypeList = obj.subMenuList;
  214. },
  215. subCodeChange(val){ //基础依据术语类型修改
  216. this.groupData.basLibType=val;
  217. if((this.numTypes+',').indexOf(val+',')>-1){
  218. this.groupData.dataType='1';
  219. }else{
  220. this.groupData.dataType='';
  221. }
  222. this.clearConcept();
  223. this.clearNumText();
  224. },
  225. clearConcept(){
  226. this.groupData.basConceptId='';
  227. this.conceptList=[];
  228. },
  229. clearNumText(){
  230. this.groupData.maxOperator='';
  231. this.groupData.maxVal='';
  232. this.groupData.maxUnit='';
  233. this.groupData.minOperator='';
  234. this.groupData.minVal='';
  235. this.groupData.minUnit='';
  236. this.groupData.eqValue='';
  237. this.groupData.eqOperator='';
  238. },
  239. searchConcept(val){
  240. const param = {
  241. excludedConceptIds:[this.groupData.basType],
  242. libType:this.groupData.basLibType,
  243. name:val,
  244. };
  245. api.searchConcept(param).then((res) => {
  246. if (res.data.code == '0') {
  247. const data = res.data.data;
  248. this.conceptList = data;
  249. }
  250. }).catch((error) => {
  251. console.log(error);
  252. });
  253. },
  254. /*addRule(){
  255. this.$emit("addRule");
  256. this.$emit('setRules');
  257. },*/
  258. delRule(){
  259. this.$emit("delRule",this.ind);
  260. this.$emit('setRules');
  261. },
  262. warning(msg,type){
  263. this.$message({
  264. showClose: true,
  265. message:msg,
  266. type:type||'warning'
  267. })
  268. },
  269. showConfirmDialog(msg,resolve){
  270. this.$alert(msg, '提示', {
  271. confirmButtonText: '确定',
  272. type: 'warning'
  273. }).then(() => {
  274. resolve();
  275. }).catch(() => {});
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang="less">
  281. .groups-cont{
  282. background: #fff;
  283. border-bottom:2px solid #F5F5F5;
  284. .conceptItem{
  285. padding: 0 10px;
  286. cursor: pointer;
  287. height: 32px;
  288. line-height: 32px;
  289. &:hover{
  290. background: #ebedf1;
  291. }
  292. }
  293. .sub-condition-form{
  294. padding:10px 20px 9px;
  295. position: relative;
  296. border-bottom:1px solid #F5F5F5;
  297. .del-btn{
  298. color: #FF5B5B;
  299. cursor: pointer;
  300. position: absolute;
  301. right: 20px;
  302. top:20px;
  303. z-index: 1;
  304. &.disable{
  305. color: #B8B8B8;
  306. }
  307. }
  308. }
  309. .el-input__icon{
  310. line-height: 32px;
  311. }
  312. .select-item{
  313. &>div{
  314. float: left;
  315. margin-right: 10px;
  316. }
  317. .el-input{
  318. width: auto;
  319. }
  320. input{
  321. width: 95px;
  322. line-height: 32px;
  323. height: 32px;
  324. }
  325. }
  326. .el-input,.el-input__inner{
  327. width: 190px;
  328. line-height: 32px;
  329. height: 32px;
  330. }
  331. .el-button--danger.is-plain{
  332. background: none;
  333. }
  334. .itemList {
  335. position: absolute;
  336. // display: none;
  337. background: #fff;
  338. width: 188px;
  339. max-height: 160px;
  340. border: 1px solid #DCDFE6;
  341. left: 0;
  342. top: 37px;
  343. z-index: 2;
  344. overflow-y: auto;
  345. }
  346. .el-form-item{
  347. margin-bottom: 6px;
  348. &.min-margin{
  349. margin-bottom: 0;
  350. position: relative;
  351. .el-form-item__content{
  352. position: unset;
  353. }
  354. .el-form-item__error{
  355. top:10px;
  356. left: 460px;
  357. white-space: normal;
  358. width: 260px;
  359. }
  360. }
  361. .el-textarea + .el-form-item__error{
  362. top:80px;
  363. left: 0;
  364. }
  365. .tip-text + .el-form-item__error{
  366. top:40px;
  367. left: 0;
  368. }
  369. }
  370. .el-input-number{
  371. width: 95px;
  372. }
  373. .el-input-number.is-controls-right .el-input-number__decrease, .el-input-number.is-controls-right .el-input-number__increase{
  374. width: 25px;
  375. height: 15px;
  376. line-height: 16px;
  377. }
  378. .el-col-3 {
  379. width: 94px;
  380. }
  381. }
  382. </style>