BasicTermsMaintenance.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div>
  3. <crumbs title="基础术语维护" minWidth="995px" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标准术语:">
  6. <el-input size="mini" v-model="filter.term" placeholder="请输入术语"></el-input>
  7. </el-form-item>
  8. <el-form-item label="术语类型:">
  9. <el-select v-model="filter.type" clearable filterable placeholder="请选择" size="mini">
  10. <el-option
  11. v-for="item in typeList"
  12. :key="item.id"
  13. :label="item.name"
  14. :value="item.code"
  15. ></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="同义词:">
  19. <el-input size="mini" v-model="filter.libName" placeholder="输入同义词"></el-input>
  20. </el-form-item>
  21. <el-form-item label="状态:">
  22. <el-select v-model="filter.isState" clearable placeholder="请选择" size="mini">
  23. <el-option
  24. v-for="item in stateSelect"
  25. :key="item.id"
  26. :label="item.name"
  27. :value="item.id">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button size="mini" @click="filterDatas">搜索</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-form class="secLine">
  36. <el-form-item>
  37. <el-button
  38. size="mini"
  39. :type="reloadFlag?'danger':'info'"
  40. @click="reloadLib"
  41. style="margin:0 10px"
  42. >加载词库</el-button>
  43. <el-button size="mini" type="warning" @click="addMedicalName" style="margin:0 10px">新增术语</el-button>
  44. </el-form-item>
  45. </el-form>
  46. </crumbs>
  47. <div class="contents knowledgeContents">
  48. <el-table :data="list" border style="width: 100%">
  49. <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  50. <el-table-column prop="libName" label="医学标准术语" show-overflow-tooltip></el-table-column>
  51. <el-table-column prop="typeName" label="术语类型"></el-table-column>
  52. <el-table-column prop="synonymName" label="同义词" show-overflow-tooltip></el-table-column>
  53. <el-table-column label="状态" width="100">
  54. <template slot-scope="scope">
  55. <span :class="scope.row.isDeleted == 'Y'?'deletes':'reviews'">{{scope.row.isDeleted == 'N'?'启用中':'禁用中'}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="modifierName" label="操作人"></el-table-column>
  59. <el-table-column prop="gmtModified" label="操作时间" :show-overflow-tooltip="true"></el-table-column>
  60. <el-table-column label="操作" width="160">
  61. <template slot-scope="scope">
  62. <el-button
  63. type="text"
  64. size="small"
  65. :disabled="scope.row.isDeleted != 'N'"
  66. @click="toEditProduct(scope.row)"
  67. >修改</el-button>
  68. <span style="margin:0 3px;">|</span>
  69. <el-button
  70. type="text"
  71. size="small"
  72. :disabled="scope.row.isDeleted != 'N'"
  73. @click="toEditProduct(scope.row,true)"
  74. >复制</el-button>
  75. <span style="margin:0 3px;">|</span>
  76. <el-button
  77. type="text"
  78. size="small"
  79. :class="scope.row.isDeleted == 'N'?'delete':'review'"
  80. @click="showDelDialog(scope.row)"
  81. >{{scope.row.isDeleted == 'Y'?'启用':'禁用'}}</el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <el-pagination
  86. :current-page.sync="currentPage"
  87. @current-change="currentChange"
  88. background
  89. :page-size="pageSize"
  90. :page-sizes="pageSizeArr"
  91. @size-change="handleSizeChange"
  92. :layout="pageLayout"
  93. :total="total"
  94. ></el-pagination>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import api from '@api/knowledgeTree.js';
  100. import config from '@api/config.js';
  101. import utils from '@api/utils.js';
  102. export default {
  103. name: 'BasicTermsMaintenance',
  104. data: function() {
  105. return {
  106. list: [],
  107. stateSelect:[
  108. {id:'N',name:'启用'},
  109. {id:'Y',name:'禁用'},
  110. ],
  111. // isState:'',
  112. cacheData: {}, //因为删除和恢复要及时更新,所以不做缓存
  113. currentPage: 1,
  114. pageSize: config.pageSize,
  115. pageSizeArr: config.pageSizeArr,
  116. pageLayout: config.pageLayout,
  117. total: 0,
  118. searched: false,
  119. filter: {
  120. term: '',
  121. type: '',
  122. libName: '',
  123. },
  124. typeList: [],
  125. reloadFlag: true
  126. };
  127. },
  128. created() {
  129. // this.getDataList();
  130. this.getTypeList();
  131. const that = this;
  132. //返回时避免参数未赋值就获取列表
  133. setTimeout(function() {
  134. });
  135. this.$nextTick(()=>{
  136. that.getDataList();
  137. })
  138. },
  139. watch: {
  140. filter: {
  141. handler: function() {
  142. this.searched = false;
  143. },
  144. deep: true
  145. }
  146. },
  147. beforeRouteEnter(to, from, next) {
  148. next(vm => {
  149. //const pm = to.param;
  150. Object.assign(vm, to.params);
  151. vm.inCurrentPage = to.params.currentPage;
  152. });
  153. },
  154. methods: {
  155. handleSizeChange(val) {
  156. this.pageSize = val;
  157. this.currentPage = utils.getCurrentPage(
  158. this.currentPage,
  159. this.total,
  160. this.pageSize
  161. );
  162. this.getDataList();
  163. },
  164. reloadLib() {
  165. if (this.reloadFlag) {
  166. this.reloadFlag = false;
  167. api.clearStandRuleDrug().then(res => {
  168. if (res.data.code == 0) {
  169. this.reloadFlag = true;
  170. }
  171. });
  172. }
  173. },
  174. addMedicalName() {
  175. const pam = this.searched
  176. ? {
  177. currentPage: this.currentPage,
  178. pageSize: this.pageSize,
  179. filter: this.filter
  180. }
  181. : { currentPage: this.currentPage, pageSize: this.pageSize };
  182. this.$router.push({ name: 'AddTerm', params: pam });
  183. },
  184. toEditProduct(row, copy) {
  185. const pam = this.searched
  186. ? {
  187. currentPage: this.currentPage,
  188. pageSize: this.pageSize,
  189. filter: this.filter
  190. }
  191. : { currentPage: this.currentPage, pageSize: this.pageSize };
  192. this.$router.push({
  193. name: 'AddTerm',
  194. // params: {info:row}
  195. params: Object.assign(pam, { id: row.conceptId, copy: copy })
  196. });
  197. },
  198. filterDatas() {
  199. this.currentPage = 1;
  200. this.getDataList();
  201. },
  202. getDataList(isTurnPage) {
  203. const param = this.getFilterItems(isTurnPage);
  204. this.searched = true;
  205. const loading = this.$loading({
  206. lock: true,
  207. text: 'Loading',
  208. spinner: 'el-icon-loading',
  209. background: 'rgba(0, 0, 0, 0.7)'
  210. });
  211. api.getBaseConceptInfoPage(param)
  212. .then(res => {
  213. loading.close();
  214. if (res.data.code == '0') {
  215. const data = res.data.data;
  216. const templis = data.records;
  217. for(let i = 0;i < templis.length;i++){
  218. templis[i].isDeleted = templis[i].status=='1'?'N':'Y'
  219. }
  220. this.list = templis;
  221. // this.cacheData[param.current] = data.records;
  222. this.total = data.total;
  223. if (this.inCurrentPage !== undefined) {
  224. this.currentPage = this.inCurrentPage;
  225. this.inCurrentPage = undefined;
  226. }
  227. }
  228. })
  229. .catch(error => {
  230. console.log(error);
  231. });
  232. },
  233. getTypeList() {
  234. api
  235. .baseTypeGetPage({ name: '',size: 1000 })
  236. .then(res => {
  237. const data = res.data;
  238. if (data.code == 0) {
  239. this.typeList = data.data.records||[];
  240. } else {
  241. console.log(res.msg);
  242. }
  243. })
  244. .catch(error => {
  245. console.log(error);
  246. });
  247. },
  248. /*getDetailList(id) {
  249. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  250. },*/
  251. getFilterItems(isTurnPage) {
  252. //翻页时筛选条件没点确定则清空
  253. if (isTurnPage && !this.searched) {
  254. this.clearFilter();
  255. }
  256. const param = {
  257. "libName": this.filter.term.trim(),
  258. "libType": this.filter.type,
  259. "status": this.filter.isState=='N'?'1':this.filter.isState=='Y'?'0':'',
  260. "synonymName": this.filter.libName.trim(),
  261. current: this.inCurrentPage || this.currentPage,
  262. size: this.pageSize,
  263. isDeleted: this.filter.isState
  264. };
  265. return param;
  266. },
  267. indexMethod(index) {
  268. return (this.currentPage - 1) * this.pageSize + index + 1;
  269. },
  270. currentChange(next) {
  271. this.currentPage = next;
  272. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  273. // this.list = this.cacheData[next];
  274. // } else {
  275. this.getDataList(true);
  276. // }
  277. },
  278. warning(msg, type) {
  279. this.$message({
  280. showClose: true,
  281. message: msg,
  282. type: type || 'warning'
  283. });
  284. },
  285. showConfirmDialog(msg, resolve) {
  286. this.$alert(msg, '提示', {
  287. confirmButtonText: '确定',
  288. type: 'warning'
  289. })
  290. .then(() => {
  291. resolve();
  292. })
  293. .catch(() => {});
  294. },
  295. showDelDialog(item) {
  296. /*const param = {
  297. term:item.term,
  298. type:item.type,
  299. id:item.id
  300. }*/
  301. const param = {
  302. conceptId: item.conceptId
  303. };
  304. let url = item.isDeleted === 'N'?'disableConcept':'startConcept'
  305. let waringTxt =
  306. item.isDeleted === 'N'
  307. ? '是否禁用该标准术语?'
  308. : '是否重新启用该条数据?';
  309. this.showConfirmDialog(waringTxt, () => {
  310. api[url](param)
  311. .then(res => {
  312. if (res.data.code == '0') {
  313. if (!this.searched) {
  314. //未点确认时清空搜索条件
  315. this.clearFilter();
  316. }
  317. if (item.isDeleted !== 'N') {
  318. //恢复成功后跳转到筛选条件的首页
  319. this.currentPage = 1;
  320. } else {
  321. if (this.filter.isState !== '' && this.list.length === 1) {
  322. //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
  323. this.currentPage =
  324. this.currentPage === 1 ? 1 : this.currentPage - 1;
  325. }
  326. }
  327. this.warning(res.data.msg || '操作成功', 'success');
  328. this.getDataList();
  329. } else {
  330. this.warning(res.data.msg);
  331. }
  332. })
  333. .catch(error => {
  334. this.warning(error);
  335. });
  336. });
  337. },
  338. clearFilter() {
  339. this.filter = {
  340. term: '',
  341. type: '',
  342. libName: '',
  343. isState: ''
  344. };
  345. }
  346. }
  347. };
  348. </script>
  349. <style lang="less" scoped>
  350. @import '../../less/admin.less';
  351. /deep/ .container.knowledgeTitle {
  352. height: 80px;
  353. }
  354. /deep/ .contents.knowledgeContents {
  355. padding: 104px 20px 0;
  356. }
  357. /deep/ .secLine.el-form {
  358. float: right;
  359. display: block;
  360. position: relative;
  361. top: -5px;
  362. }
  363. .delete {
  364. color: red;
  365. }
  366. .review {
  367. color: #22ccc8;
  368. }
  369. .deletes {
  370. cursor: default;
  371. color: red;
  372. }
  373. .reviews {
  374. color: #606266;
  375. cursor: default;
  376. }
  377. .el-table .cell {
  378. overflow: hidden;
  379. white-space: nowrap;
  380. }
  381. #upFile {
  382. display: none !important;
  383. }
  384. </style>