AddTerm.vue 32 KB

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