AddTerm.vue 35 KB

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