BasicTermsMaintenance.vue 11 KB

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