AddMedicalName.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. <template>
  2. <div>
  3. <crumbs :title="minTitle"
  4. :param="$route.params"
  5. linkTo="MedicalName"></crumbs>
  6. <div class="contents">
  7. <div class="content">
  8. <h3>添加术语:</h3>
  9. <p class="titl">医学标准术语:</p>
  10. <table class="deptbox" v-if="id == ''">
  11. <tr>
  12. <td class="ind">序号</td>
  13. <td>标准词<span class="necess">*</span></td>
  14. <td>拼音</td>
  15. <td>类型<span class="necess">*</span></td>
  16. <td class="desc">说明</td>
  17. </tr>
  18. <tr>
  19. <td class="ind">1</td>
  20. <td :title="data.name&&data.name.length>9?data.name:''">
  21. <!-- 修改时标准词不能修改,修改了会当做新增处理 4-17 -->
  22. <p v-if="id">{{data.name}}</p>
  23. <!-- 4-18 需求变更 -->
  24. <input v-else type="text" v-model="data.name" placeholder="请输入术语" maxlength="50" @blur="handleBlur(1)">
  25. <SimilarListDrag
  26. :searchType='searchType'
  27. :similarList = 'similarList'
  28. isShow = "true"
  29. @closeTable = "closeTable"
  30. >
  31. </SimilarListDrag>
  32. </td>
  33. <td>
  34. <input type="text" v-model="data.spell" placeholder="请输入拼音" maxlength="50" @input="handlePinyin($event,1)">
  35. </td>
  36. <td>
  37. <!-- <el-select v-if="!id" v-model="data.type" filterable placeholder="请选择" size="small" @change="selectType">
  38. <el-option
  39. v-for="item in typeList"
  40. :key="item.id"
  41. :label="item.name"
  42. :value="item.name">
  43. </el-option>
  44. </el-select> -->
  45. <template v-if="!id">
  46. <el-select v-model="data.type" filterable clearable placeholder="请选择" size="small" @change="selectType">
  47. <el-option-group
  48. v-for="group in options"
  49. :key="group.label">
  50. <el-option
  51. v-for="item in group.options"
  52. :key="item.id"
  53. :label="item.name"
  54. :value="item.name">
  55. </el-option>
  56. </el-option-group>
  57. </el-select>
  58. </template>
  59. <span v-else>{{data.type}}</span>
  60. </td>
  61. <td class="desc">
  62. <input v-model="data.remark" placeholder="请输入术语说明" maxlength="120"/>
  63. </td>
  64. </tr>
  65. </table>
  66. <div class="deptboxChange" v-else>
  67. <table class="deptbox deptboxTable">
  68. <tr>
  69. <td class="ind">序号</td>
  70. <td>术语</td>
  71. <td>拼音</td>
  72. <td>类型</td>
  73. <td class="desc">说明</td>
  74. <td class="descs">术语性质</td>
  75. <td v-if="id">操作</td>
  76. </tr>
  77. <tr v-for="(item,index) in allwords">
  78. <td class="ind">{{index+1}}</td>
  79. <td :title="item.name&&item.name.length>9?item.name:''">
  80. <!-- 使用原生input,输入限制 -->
  81. <!-- <el-input v-model="item.name" placeholder="请输入术语" maxlength="30" size="small" @input.native="handleInput(2,index)"></el-input> -->
  82. <input type="text" v-model="item.name" :title="item.name" placeholder="请输入术语" maxlength="50" @blur="handleBlur(2,index,99)" />
  83. <SimilarListDrag
  84. :searchType='searchType'
  85. :similarList = 'similarList'
  86. :isShow = "index ===searchIndex"
  87. @closeTable = "closeTable"
  88. >
  89. </SimilarListDrag>
  90. </td>
  91. <!-- <td v-if="!item.isEdit">
  92. {{item.spell}}
  93. </td>
  94. <td v-else> -->
  95. <td>
  96. <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50" @input="handlePinyin($event,2,index)" class="spell">
  97. </td>
  98. <td>
  99. <!-- {{data.type}} -->
  100. <template v-if="index==0&&copy">
  101. <el-select v-model="data.type" filterable placeholder="请选择" size="small" @change="selectType">
  102. <el-option-group
  103. v-for="group in options"
  104. :key="group.label">
  105. <el-option
  106. v-for="item in group.options"
  107. :key="item.id"
  108. :label="item.name"
  109. :value="item.name">
  110. </el-option>
  111. </el-option-group>
  112. </el-select>
  113. </template>
  114. <span v-else>{{data.type}}</span>
  115. </td>
  116. <td class="desc">
  117. <input v-model="item.remark" placeholder="请输入术语说明" maxlength="120" />
  118. </td>
  119. <td class="desc">
  120. {{item.isConcept == 1?"标准词":"同义词"}}
  121. </td>
  122. <td v-if="id">
  123. <span class="displayColor" v-if="item.isConcept == 1">删除</span>
  124. <span @click="deleLine(index,55)" class="delete" v-else>删除</span>
  125. </td>
  126. </tr>
  127. <tr @click="addSpan(55)">
  128. <td colspan="7" class="addSpan">+</td>
  129. </tr>
  130. </table>
  131. <div class="actionDo">
  132. <!-- <div class="btnWrap"> -->
  133. <!-- <el-button type="primary" size="mini" v-if="show" @click="comfirn(14)">确认修改</el-button> -->
  134. <!-- <el-button plain size="mini" v-if="show" @click="toggleShow(1)">放弃修改</el-button>
  135. <el-button plain size="mini" @click="toggleShow(2)" v-if="!show">修改标准词</el-button> -->
  136. <!-- </div> -->
  137. <div class="radioWrap" v-if="show">
  138. <el-radio-group v-model="radioVal" size="mini">
  139. <el-radio v-for="(item,index) in allwords" :label="index" :disabled="index == 0">选为标准词</el-radio>
  140. </el-radio-group>
  141. </div>
  142. </div>
  143. </div>
  144. <p class="titl" v-if="id == ''">同义词:</p>
  145. <table class="deptbox" v-if="id == ''">
  146. <tr>
  147. <td class="ind">序号</td>
  148. <td>术语</td>
  149. <td>拼音</td>
  150. <td>类型</td>
  151. <td class="desc">说明</td>
  152. <td v-if="id">操作</td>
  153. </tr>
  154. <tr v-for="(item,index) in synonymous">
  155. <td class="ind">{{index+1}}</td>
  156. <td :title="item.name&&item.name.length>9?item.name:''">
  157. <!-- 使用原生input,输入限制 -->
  158. <!-- <el-input v-model="item.name" placeholder="请输入术语" maxlength="30" size="small" @input.native="handleInput(2,index)"></el-input> -->
  159. <input type="text" v-model="item.name" placeholder="请输入术语" maxlength="50" @blur="handleBlur(2,index)">
  160. <SimilarListDrag
  161. :searchType='searchType'
  162. :similarList = 'similarList'
  163. :isShow = "index ===searchIndex"
  164. @closeTable = "closeTable"
  165. >
  166. </SimilarListDrag>
  167. </td>
  168. <td>
  169. <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50" @input="handlePinyin($event,3,index)">
  170. </td>
  171. <td>
  172. {{data.type}}
  173. </td>
  174. <td class="desc">
  175. <input v-model="item.remark" placeholder="请输入术语说明" maxlength="120" />
  176. </td>
  177. <td v-if="id">
  178. <span @click="deleLine(index)" class="delete">删除</span>
  179. </td>
  180. </tr>
  181. <tr @click="addSpan">
  182. <td :colspan="colspan" class="addSpan">+</td>
  183. </tr>
  184. </table>
  185. <div class="moreInfo" v-if="showMore==1">
  186. <p>更多信息:</p>
  187. <el-form>
  188. <el-form-item label="性别:">
  189. <el-select v-model="sexType">
  190. <el-option v-for="(it,i) in sex" :label="it.name" :value="it.name"></el-option>
  191. </el-select>
  192. </el-form-item>
  193. <el-form-item label="年龄:" class="ages">
  194. <el-input
  195. v-model.number="minAge"
  196. type="number"
  197. @input="inputAge">
  198. </el-input>
  199. <span class="ageLine">~</span>
  200. <el-input
  201. v-model.number="maxAge"
  202. type="number"
  203. @input="inputAge"
  204. ></el-input>
  205. </el-form-item>
  206. <el-form-item label="科室:" v-if="dioType" class="marT">
  207. <el-select v-model="dept">
  208. <!-- <el-option v-for="(it,i) in deptList" :label="it.name" :value="it.name"></el-option> -->
  209. <el-option-group
  210. v-for="group in deptListArr"
  211. :key="group.label">
  212. <el-option
  213. v-for="item in group.deptList"
  214. :key="item.id"
  215. :label="item.name"
  216. :value="item.name">
  217. </el-option>
  218. </el-option-group>
  219. </el-select>
  220. </el-form-item>
  221. <el-form-item label="归属类型:" v-if="dioType" class="marT">
  222. <el-select v-model="dioType">
  223. <el-option v-for="(it,i) in dioTypeList" :label="it.name" :value="it.val"></el-option>
  224. </el-select>
  225. </el-form-item>
  226. </el-form>
  227. </div>
  228. <div class="btn">
  229. <el-button
  230. type="primary"
  231. :disabled = 'saveDisable'
  232. @click="comfirn"
  233. >确 定</el-button>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </template>
  239. <script type="text/javascript">
  240. import api from '@api/icss.js';
  241. import pinyin from '../../js/Convert_Pinyin.js';
  242. import utils from '@api/utils.js';
  243. import SimilarListDrag from './SimilarListDrag'
  244. export default {
  245. name:'AddMedicalName',
  246. data(){
  247. return{
  248. minTitle:'医学术语命名维护-添加',
  249. data:{
  250. name:'',
  251. type:'',
  252. remark:'',
  253. isConcept:1,
  254. spell:''
  255. },
  256. radioVal:'',
  257. typeList:[],
  258. id:'',
  259. synonymous:[],//同义词
  260. singleword:[],
  261. allwords:[],//标准词和同义词
  262. colspan:5,
  263. colspans:6,
  264. currentPage:1,
  265. pageSize:10,
  266. show:false,
  267. tmpSynonymous:[],
  268. sexType:'通用',
  269. maxAge:200,
  270. minAge:0,
  271. showMore:'',
  272. sex:[
  273. {
  274. name:'通用',
  275. value:3
  276. },
  277. {
  278. name:'男',
  279. value:1
  280. },
  281. {
  282. name:'女',
  283. value:2
  284. }
  285. ],
  286. unfit:false, //点确认时是否弹提示,
  287. saveDisable: false, //保存按钮禁止点击
  288. options:[],
  289. copy:null,
  290. dioTypeList:[],//更多信息-类型
  291. dioType:'', //默认展示一类
  292. deptList:[], //更多信息-科室
  293. deptListArr:[], //科室信息分组
  294. dept:'', //默认展示全科
  295. similarList: [], //相似词列表
  296. searchIndex: -1, //展示哪个的同义词
  297. searchType: ''
  298. }
  299. },
  300. created(){
  301. this.getTypeList();
  302. const id = this.$route.params.id || '';
  303. const copy = this.$route.params.copy || '';
  304. this.copy = copy;
  305. if(id){
  306. this.minTitle = copy?'医学术语命名维护-复制':'医学术语命名维护-修改';
  307. this.id = id;
  308. this.colspan = 5;
  309. this.getDetail(id);
  310. }
  311. },
  312. watch:{
  313. radioVal(newVal,preVal){
  314. if(newVal && newVal != preVal){
  315. this.changeState(newVal);
  316. }
  317. },
  318. },
  319. methods:{
  320. dragAdd(ev){
  321. utils.dragBox('dragModalWrap','dragModalTitle','add')
  322. },
  323. dragDel(){
  324. utils.dragBox('dragModalWrap','dragModalTitle','del')
  325. },
  326. closeTable(){
  327. this.searchType = ''
  328. this.similarList = []
  329. },
  330. // 诊断类型下--更多信息-类型
  331. getDioType(flag){
  332. api.getknowledgeList().then((res)=>{
  333. const data = res.data;
  334. if(data.code==0){
  335. this.dioTypeList = data.data[2];
  336. // 修改时无需赋值
  337. if(!flag){
  338. this.dioType = this.dioTypeList[0].val;
  339. }
  340. }
  341. })
  342. },
  343. // 诊断类型下--更多信息-科室
  344. getDdeptList(conptId){
  345. api.getDeptList({"type":1}).then((res)=>{
  346. const data = res.data;
  347. if(data.code==0){
  348. this.deptList = data.data;
  349. if(!conptId){
  350. console.log('this.deptListArr')
  351. this.dept = "全科"; //默认展示全科
  352. }else{
  353. // 科室id转成name显示
  354. this.deptList.map((v,i)=>{
  355. if(v.conceptId==conptId){
  356. this.dept = v.name;
  357. }
  358. })
  359. }
  360. const total = this.deptList.length;
  361. const average = parseInt(total/3);
  362. const mod = total%3; //余数
  363. const firstGroup = this.deptList.slice(0,average);
  364. let secGroup = [];
  365. let thirdGroup = [];
  366. let tempArr = []
  367. if(mod == 2){
  368. secGroup = this.deptList.slice(average,average*2+1);
  369. thirdGroup = this.deptList.slice(average*2+1,total);
  370. }else{
  371. secGroup = this.deptList.slice(average,average*2);
  372. thirdGroup = this.deptList.slice(average*2,total);
  373. }
  374. tempArr.push({label:1,deptList:firstGroup},{label:2,deptList:secGroup},{label:3,deptList:thirdGroup});
  375. this.deptListArr = tempArr
  376. }
  377. })
  378. },
  379. changeState(val){
  380. let tmpAllwords = JSON.parse(JSON.stringify(this.synonymous));
  381. for(let i = 0;i < tmpAllwords.length;i++){
  382. if(i+1 == val){
  383. tmpAllwords[i].isConcept = 1
  384. tmpAllwords[i].type = this.data.type
  385. }else{
  386. tmpAllwords[i].isConcept = 0
  387. }
  388. }
  389. this.tmpSynonymous = tmpAllwords
  390. this.synonymous = tmpAllwords
  391. },
  392. toggleShow(num){
  393. let tmpShow = this.show
  394. this.show = !tmpShow
  395. if(num == 1){
  396. this.changeState(-1)
  397. this.radioVal = ''
  398. }
  399. },
  400. getDetail(ids){
  401. if(ids){
  402. api.getMedicalDetail({'conceptId':ids}).then((res)=>{
  403. const result = res.data;
  404. if(result.code == 0){
  405. this.data = result.data.libName[0];
  406. this.singleword = result.data.libName;
  407. this.synonymous = result.data.otherNames;
  408. this.allwords = (result.data.libName).concat(result.data.otherNames);
  409. this.showMore = result.data.isHasCommon;
  410. this.maxAge = result.data.maxAge;
  411. this.minAge = result.data.minAge;
  412. const type = result.data.type;
  413. if(type == '诊断'){
  414. this.dioType = result.data.classify || "Ⅰ"; //类型,默认展示Ⅰ类
  415. const deptConptId = result.data.deptId;
  416. this.getDioType(true);
  417. this.getDdeptList(deptConptId);
  418. }
  419. // this.sexType = result.data.sexType;
  420. let sexType = result.data.sexType;
  421. this.sex.map((v,i)=>{
  422. if(v.value==sexType){
  423. this.sexType = v.name;
  424. }
  425. })
  426. }else{
  427. this.$message({
  428. message:result.msg,
  429. type:'warning'
  430. });
  431. }
  432. })
  433. }
  434. },
  435. getTypeList(){
  436. api.allKnowledgeType({'name':''}).then((res)=>{
  437. const data = res.data;
  438. if(data.code==0){
  439. // this.typeList = data.data.records;
  440. this.typeList = data.data;
  441. // 类型改成平铺
  442. if(data.data.length>0){
  443. const total = data.data.length;
  444. const average = parseInt(total/3);
  445. const mod = total%3; //余数
  446. const firstGroup = data.data.slice(0,average);
  447. let secGroup = [];
  448. let thirdGroup = [];
  449. if(mod == 2){
  450. secGroup = data.data.slice(average,average*2+1);
  451. thirdGroup = data.data.slice(average*2+1,total);
  452. }else{
  453. secGroup = data.data.slice(average,average*2);
  454. thirdGroup = data.data.slice(average*2,total);
  455. }
  456. this.options.push({label:1,options:firstGroup},{label:2,options:secGroup},{label:3,options:thirdGroup});
  457. }
  458. }else{
  459. this.$message({
  460. message:data.msg,
  461. type:'warning'
  462. });
  463. }
  464. }).catch((error) => {
  465. console.log(error);
  466. });
  467. },
  468. // handleInput(index,name){
  469. /* handleInput(type,index){
  470. // 可输入内容:字母、数字、汉字、特殊字符:% —— 其余不可输入;
  471. // if(!name){//标准词输入
  472. if(type==1){//标准词输入
  473. this.data.name = this.data.name.replace(/[^%0-9a-zA-Z\u4e00-\u9fa5]/g,'');
  474. }else{
  475. this.synonymous[index].name = this.synonymous[index].name.replace(/[^%0-9a-zA-Z\u4e00-\u9fa5]/g,'');
  476. }
  477. },*/
  478. handleBlur(type,index,flg){
  479. // 不能为纯数字、纯字符、纯数字加字符 4-18
  480. // const pattern = /[^~@#$%^&*_\-+=,,.。::"“??”;;、!!0-9]/g;
  481. // 需求更改:不能为纯数字,其余均可输入 5-20
  482. const pattern = /[^0-9]/g;
  483. if(type==1){//标准词输入
  484. if(this.data.name && !pattern.test(this.data.name)){
  485. this.$message({
  486. // message:'无法输入纯数字或者纯字符,请输入正确数据!',
  487. message:'无法输入纯数字,请输入正确数据!',
  488. type:'warning'
  489. });
  490. // this.data.name = '';
  491. this.unfit = true;
  492. }else{
  493. let data = this.data;
  494. data.spell = pinyin.getCamelChars(data.name);
  495. this.unfit = false;
  496. this.searchType = 'standard'
  497. this.getSimilarList(this.data.name)
  498. }
  499. }else if(type==2){
  500. // 修改时术语名称、拼音和类型均不能修改
  501. if(flg == 99){
  502. // if(this.synonymous[index-1].name && !pattern.test(this.synonymous[index-1].name)){
  503. if(this.allwords[index].name && !pattern.test(this.allwords[index].name)){
  504. this.$message({
  505. message:'无法输入纯数字,请输入正确数据!',
  506. type:'warning'
  507. });
  508. // this.synonymous[index-1].name = '';
  509. this.unfit = true;
  510. }else{
  511. // let current = this.synonymous[index-1];
  512. let current = this.allwords[index];
  513. current.spell = pinyin.getCamelChars(current.name);
  514. this.unfit = false;
  515. this.searchType = 'standard';
  516. this.searchIndex = index;
  517. this.getSimilarList(this.allwords[index].name)
  518. }
  519. }else{
  520. if(this.synonymous[index].name && !pattern.test(this.synonymous[index].name)){
  521. this.$message({
  522. message:'无法输入纯数字,请输入正确数据!',
  523. type:'warning'
  524. });
  525. // this.synonymous[index].name = '';
  526. this.unfit = true;
  527. }else{
  528. let current = this.synonymous[index];
  529. current.spell = pinyin.getCamelChars(current.name);
  530. this.unfit = false;
  531. this.searchType = 'similar';
  532. this.searchIndex = index;
  533. this.getSimilarList(this.synonymous[index].name)
  534. }
  535. }
  536. }
  537. },
  538. handlePinyin(e,flag,index){//只能输入英文
  539. e.target.value = e.target.value.replace(/[^a-zA-Z]/g,'');
  540. // 解决输入数字不触发更新
  541. if(flag==1){//标准词
  542. this.data.spell = e.target.value;
  543. }else if(flag==2){//同义词-修改
  544. this.allwords[index].spell = e.target.value;
  545. }else if(flag==3){//同义词-新增
  546. this.synonymous[index].spell = e.target.value;
  547. }
  548. // e.target.value = e.target.value.replace(/[^a-zA-Z]/g,'');
  549. },
  550. getSimilarList(name){
  551. if(!name){
  552. this.closeTable()
  553. return
  554. }
  555. const param = {
  556. inputStr: name
  557. }
  558. api.getSimilarList(param).then((res) =>{
  559. this.similarList = res.data.data
  560. })
  561. },
  562. addSpan(type){
  563. let singleSpan = {
  564. name:'',
  565. remark:'',
  566. isConcept:0,
  567. isEdit:true,
  568. spell:null
  569. }
  570. if(type == 55){
  571. this.allwords.push(singleSpan);
  572. this.synonymous.push(singleSpan);
  573. }else{
  574. this.synonymous.push(singleSpan);
  575. }
  576. },
  577. warning(msg,type){
  578. this.$message({
  579. showClose: true,
  580. message:msg,
  581. type:type||'warning'
  582. })
  583. },
  584. showConfirmDialog(msg,resolve){
  585. this.$alert(msg, '提示', {
  586. confirmButtonText: '确定',
  587. type: 'warning'
  588. }).then(() => {
  589. resolve();
  590. }).catch(() => {});
  591. },
  592. deleLine(index,type){
  593. // 只在界面删除数据,待点确认 后参才真正删除
  594. if(type == 55){
  595. this.synonymous.splice(index-1,1);
  596. this.allwords.splice(index,1);
  597. }else{
  598. this.synonymous.splice(index,1);
  599. }
  600. },
  601. comfirn(flg){
  602. if(!this.data.name){
  603. this.warning('请输入标准词');
  604. return
  605. }
  606. if(!this.data.type && !this.unfit){
  607. this.warning('请选择术语类型');
  608. return
  609. }
  610. // 处于修改标准词状态且没有选中,不能保存
  611. if(this.show && !this.radioVal){
  612. this.warning('请先选择标准词');
  613. return
  614. }
  615. // 年龄为必填项--2019-6-5需求
  616. if(this.showMore == 1){
  617. if(!this.minAge && this.minAge != 0 || !this.maxAge){
  618. this.warning('年龄不能为空,区间为0-200');
  619. return
  620. }
  621. if(this.minAge < 0 || this.minAge > 200 || this.maxAge < 0 || this.maxAge > 200){
  622. this.warning('年龄必须是0-200');
  623. return
  624. }
  625. }
  626. // 过滤同义词空数据
  627. let realData=[];
  628. if(this.id){//修改用暂存的列表
  629. realData = this.synonymous.filter((item)=>{
  630. return item.name;
  631. })
  632. let tmpArr = []
  633. for(let k = 0;k < realData.length;k++){
  634. if(realData[k].isConcept == 1){
  635. let tmpdata = JSON.parse(JSON.stringify(this.data))
  636. tmpArr.push(realData[k])
  637. realData.splice(k,1)
  638. tmpdata.isConcept = 0
  639. realData.push(tmpdata)
  640. this.data = tmpArr[0]
  641. }
  642. }
  643. }else{
  644. realData = this.synonymous.filter((item)=>{
  645. return item.name;
  646. })
  647. }
  648. let detailList = [];
  649. detailList[0] = this.data;
  650. for(let i=0; i<realData.length; i++){
  651. realData[i].type = this.data.type;
  652. detailList.push(realData[i]);
  653. }
  654. // 校验是否有名称全为数字
  655. const pattern = /[^0-9]/g;
  656. for(let d=0; d<detailList.length; d++){
  657. let dname = detailList[d].name;
  658. // if(detailList[d].name && !pattern.test(detailList[d].name)){
  659. if(dname && !dname.match(pattern)){
  660. if(!this.unfit){//避免和失焦事件同事弹出
  661. this.$message({
  662. message:'无法输入纯数字,请输入正确数据!',
  663. type:'warning'
  664. });
  665. }
  666. this.unfit = false;
  667. return false;
  668. break
  669. }
  670. }
  671. let params;
  672. if(this.showMore==1){
  673. // 下拉文字转code
  674. let sexCode;
  675. this.sex.map((v,i)=>{
  676. if(v.name==this.sexType){
  677. sexCode = v.value;
  678. }
  679. })
  680. if(this.dioType){
  681. const deptList = this.deptList;
  682. let conptId = null;
  683. for(let i in deptList){
  684. if(deptList[i].name == this.dept){
  685. conptId = deptList[i].conceptId;
  686. }
  687. }
  688. params = {
  689. "addCptDiseaseExtVO": {
  690. "classify": this.dioType,
  691. "deptId": conptId
  692. },
  693. 'name':this.data.name,
  694. 'type':this.data.type,
  695. 'detailList':detailList,
  696. 'conceptId':this.copy?'':this.id,//复制当新增,把id置空
  697. 'sexType':sexCode,
  698. 'maxAge':this.maxAge,
  699. 'minAge':this.minAge
  700. }
  701. }else{
  702. params = {
  703. 'name':this.data.name,
  704. 'type':this.data.type,
  705. 'detailList':detailList,
  706. 'conceptId':this.copy?'':this.id,//复制当新增,把id置空
  707. 'sexType':sexCode,
  708. 'maxAge':this.maxAge,
  709. 'minAge':this.minAge
  710. }
  711. }
  712. }else{
  713. params = {
  714. 'name':this.data.name,
  715. 'type':this.data.type,
  716. 'detailList':detailList,
  717. 'conceptId':this.copy?'':this.id
  718. }
  719. }
  720. this.saveDisable = true //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  721. api.addMedicalName(params).then((res)=>{
  722. const result = res.data;
  723. if(result.code==0){
  724. this.warning(res.data.msg||'操作成功','success');
  725. //返回带搜索条件的首页
  726. this.$router.push({name:'MedicalName',params:Object.assign({},this.$route.params,{currentPage:1})});
  727. /*if(flg == 14){
  728. this.getDetail(this.id)
  729. this.radioVal = ''
  730. this.show = false
  731. }else{
  732. this.$router.push({name:'MedicalName'});
  733. }*/
  734. }else{
  735. this.warning(res.data.msg);
  736. }
  737. this.saveDisable = false
  738. })
  739. },
  740. inputAge(){
  741. // console.log("输入年龄")
  742. },
  743. selectType(e){
  744. this.typeList.map((v,i)=>{
  745. if(v.name==e){
  746. this.showMore = v.isHasCommon;
  747. }
  748. })
  749. if(e == '诊断'){
  750. this.getDioType();
  751. this.getDdeptList();
  752. }else{
  753. this.dioType = '';
  754. this.dept = '';
  755. }
  756. }
  757. },
  758. components: {
  759. SimilarListDrag
  760. }
  761. }
  762. </script>
  763. <style lang="less" scoped>
  764. @import "../../less/admin.less";
  765. table,tr,td {
  766. list-style: none;
  767. }
  768. /deep/ .radioWrap .el-radio {
  769. display: block;
  770. height: 41px;
  771. line-height: 41px;
  772. text-align: right;
  773. margin-left: 0;
  774. }
  775. /deep/ .moreInfo .el-form-item .el-form-item__label {
  776. width: 85px;
  777. text-align: left;
  778. }
  779. // 饿了么分组下拉
  780. .el-scrollbar{
  781. .el-select-dropdown__list{
  782. .el-select-group__wrap{
  783. min-width: 160px !important;
  784. display: inline-block !important;
  785. vertical-align: top !important;
  786. }
  787. }
  788. }
  789. .el-select-group__wrap::after{
  790. background:#fff !important;
  791. }
  792. .displayColor {
  793. color: #ccc;
  794. cursor:not-allowed;
  795. }
  796. .delete {
  797. cursor: pointer;
  798. }
  799. .content{
  800. background: #fff;
  801. padding: 20px 20px 30px;
  802. color: #545455;
  803. }
  804. .titl{
  805. margin: 25px 0 10px;
  806. }
  807. .deptbox{
  808. // width: 100%;
  809. background: #fff;
  810. padding: 20px 10px 30px;
  811. font-size: 14px;
  812. text-align: left;
  813. border-collapse: collapse;
  814. >tr{
  815. height: 30px;
  816. text-align: center;
  817. td{
  818. width: 135px;
  819. border: 1px solid #666;
  820. padding:5px;
  821. position: relative;
  822. }
  823. input{
  824. border:none;
  825. border: 1px solid #ccc;
  826. width: 100%;
  827. height: 30px;
  828. padding: 0 7px;
  829. box-sizing: border-box;
  830. border-radius: 4px;
  831. }
  832. .ind{
  833. width: 55px;
  834. }
  835. .desc{
  836. width: 280px;
  837. }
  838. .descs{
  839. width: 50px;
  840. }
  841. }
  842. .addSpan{
  843. text-align: center;
  844. cursor: pointer;
  845. }
  846. }
  847. .deptboxTable {
  848. width: 100%;
  849. }
  850. .deptboxChange {
  851. padding-right: 210px;
  852. position: relative;
  853. }
  854. .actionDo {
  855. width: 200px;
  856. position: absolute;
  857. top: 1px;
  858. right: 0;
  859. .btnWrap {
  860. height: 30px;
  861. }
  862. }
  863. .btn {
  864. text-align: right;
  865. margin-top: 20px;
  866. }
  867. .necess{
  868. display: inline-block;
  869. vertical-align: middle;
  870. color: red;
  871. margin-left: 2px;
  872. }
  873. .moreInfo{
  874. border-top: 1px solid #c0c4cc ;
  875. margin-top: 45px;
  876. p{
  877. margin:15px 0;
  878. }
  879. }
  880. .spell{
  881. text-align: center;
  882. }
  883. /deep/.ages{
  884. margin-top: 20px;
  885. .el-input {
  886. display: inline-block;
  887. width: auto;
  888. .el-input__inner {
  889. width: 60px;
  890. padding: 0 5px;
  891. text-align: center;
  892. }
  893. .el-input__inner::-webkit-outer-spin-button,
  894. .el-input__inner::-webkit-inner-spin-button {
  895. -webkit-appearance: none;
  896. }
  897. .el-input__inner[type="number"] {
  898. -moz-appearance: textfield;
  899. }
  900. }
  901. .ageLine{
  902. display: inline-block;
  903. margin: 0 35px;
  904. }
  905. }
  906. /deep/ .marT{
  907. margin-top: 20px;
  908. }
  909. </style>