RegisteredDrug.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div>
  3. <crumbs title="注册药品维护" :minWidth="titleWidth" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="通用名:">
  6. <el-input size="mini" v-model="filter.commonName" placeholder="输入通用名" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="注册名:">
  9. <el-input size="mini" v-model="filter.name" placeholder="输入注册名" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item label="企业:">
  12. <el-input size="mini" v-model="filter.company" placeholder="输入企业名称" clearable></el-input>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button size="mini" @click="filterDatas">确认</el-button>
  16. </el-form-item>
  17. <el-form class="secLine">
  18. <el-form-item>
  19. <el-button size="mini" @click="addRule" type="warning" style="margin:0 10px">+ 新增药品</el-button>
  20. <el-button size="mini" @click="update">更新数据</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </el-form>
  24. </crumbs>
  25. <div class="contents knowledgeContents">
  26. <el-table :data="list" border style="width: 100%">
  27. <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  28. <el-table-column prop="drugCode" label="药品代码" show-overflow-tooltip></el-table-column>
  29. <el-table-column prop="name" label="注册名称" show-overflow-tooltip></el-table-column>
  30. <el-table-column prop="drugName" label="关联的通用名" show-overflow-tooltip></el-table-column>
  31. <el-table-column prop="enName" label="英文名称" show-overflow-tooltip></el-table-column>
  32. <el-table-column prop="tradeName" label="商品名称" show-overflow-tooltip></el-table-column>
  33. <el-table-column prop="form" label="药品剂型" show-overflow-tooltip></el-table-column>
  34. <el-table-column prop="specification" label="注册规格" show-overflow-tooltip></el-table-column>
  35. <el-table-column prop="minPackQuantity" label="最小包装量" show-overflow-tooltip></el-table-column>
  36. <el-table-column prop="minPackUnit" label="最小包单位" show-overflow-tooltip></el-table-column>
  37. <el-table-column prop="company" label="药品企业" show-overflow-tooltip></el-table-column>
  38. <el-table-column prop="approval" label="批准文号" show-overflow-tooltip></el-table-column>
  39. <el-table-column prop="standardCode" label="药品本位码" show-overflow-tooltip></el-table-column>
  40. <el-table-column prop="insuranceType" label="医保类型" show-overflow-tooltip></el-table-column>
  41. <el-table-column prop="insuranceRemrk" label="医保备注" show-overflow-tooltip></el-table-column>
  42. <el-table-column prop="modifierName" label="操作人" show-overflow-tooltip></el-table-column>
  43. <el-table-column prop="gmtModified" label="操作时间" width="180"></el-table-column>
  44. <el-table-column label="操作" width="120" fixed="right">
  45. <template slot-scope="scope">
  46. <el-button type="text" size="small" @click="editData(scope.row)">修改</el-button>
  47. <span style="margin:0 3px;">|</span>
  48. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row)">删除</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <el-pagination
  53. :current-page.sync="currentPage"
  54. @current-change="currentChange"
  55. background
  56. :page-size="pageSize"
  57. :page-sizes="pageSizeArr"
  58. @size-change="handleSizeChange"
  59. :layout="pageLayout"
  60. :total="total"
  61. ></el-pagination>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import api from '@api/icss.js';
  67. import config from '@api/config.js';
  68. import utils from '@api/utils.js';
  69. export default {
  70. name: 'ZskRegisteredDrug',
  71. data: function() {
  72. return {
  73. list: [],
  74. stateSelect: [
  75. { id: 1, name: '启用' },
  76. { id: 0, name: '禁用' }
  77. ],
  78. ruleTypeList: [],
  79. searched: false,
  80. filter: {
  81. commonName: '',
  82. name: '',
  83. company: ''
  84. },
  85. cacheData: {},
  86. currentPage: 1,
  87. pageSize: config.pageSize,
  88. pageSizeArr: config.pageSizeArr,
  89. pageLayout: config.pageLayout,
  90. total: 0,
  91. titleWidth: '1070px' //头部最小宽度
  92. };
  93. },
  94. created() {
  95. this.getDataList();
  96. },
  97. watch: {
  98. filter: {
  99. handler: function() {
  100. this.searched = false;
  101. },
  102. deep: true
  103. }
  104. },
  105. methods: {
  106. handleSizeChange(val) {
  107. this.pageSize = val;
  108. this.currentPage = utils.getCurrentPage(
  109. this.currentPage,
  110. this.total,
  111. this.pageSize
  112. );
  113. this.getDataList();
  114. },
  115. addRule() {
  116. const pam = this.searched
  117. ? {
  118. currentPage: this.currentPage,
  119. pageSize: this.pageSize,
  120. filter: this.filter
  121. }
  122. : { currentPage: this.currentPage, pageSize: this.pageSize };
  123. this.$router.push({ name: 'AddZskRegisteredDrug', params: pam });
  124. },
  125. filterDatas() {
  126. this.currentPage = 1;
  127. this.getDataList(1);
  128. },
  129. getDataList(flag, isTurnPage) {
  130. const params = this.getFilterItems(isTurnPage);
  131. this.searched = true;
  132. const loading = this.$loading({
  133. lock: true,
  134. text: 'Loading',
  135. spinner: 'el-icon-loading',
  136. background: 'rgba(0, 0, 0, 0.7)'
  137. });
  138. api
  139. .getPageList(params)
  140. .then(res => {
  141. loading.close();
  142. if (res.data.code == '0') {
  143. const data = res.data.data;
  144. for (let j = 0; j < data.records.length; j++) {
  145. data.records[j].condition =
  146. data.records[j].parStatus == '1' ? '启用' : '禁用';
  147. }
  148. this.list = data.records;
  149. if (!flag) {
  150. //搜索时不缓存
  151. this.cacheData[params.current] = data.records;
  152. } else {
  153. this.cacheData = {};
  154. }
  155. this.total = data.total;
  156. if (this.inCurrentPage !== undefined) {
  157. this.currentPage = this.inCurrentPage;
  158. this.inCurrentPage = undefined;
  159. }
  160. } else {
  161. this.warning(res.data.msg || '获取列表数据失败');
  162. }
  163. })
  164. .catch(error => {
  165. loading.close();
  166. console.log(error);
  167. });
  168. },
  169. getFilterItems(isTurnPage) {
  170. //翻页时筛选条件没点确定则清空
  171. if (isTurnPage && !this.searched) {
  172. this.clearFilter();
  173. }
  174. const param = {
  175. current: this.inCurrentPage || this.currentPage,
  176. size: this.pageSize,
  177. commonName: this.filter.commonName,
  178. name: this.filter.name,
  179. company: this.filter.company
  180. };
  181. return param;
  182. },
  183. indexMethod(index) {
  184. return (this.currentPage - 1) * this.pageSize + index + 1;
  185. },
  186. currentChange(next) {
  187. this.currentPage = next;
  188. this.getDataList(1, true);
  189. },
  190. warning(msg, type) {
  191. this.$message({
  192. showClose: true,
  193. message: msg,
  194. type: type || 'warning'
  195. });
  196. },
  197. showConfirmDialog(msg, resolve) {
  198. this.$alert(msg, '提示', {
  199. confirmButtonText: '确定',
  200. type: 'warning'
  201. })
  202. .then(() => {
  203. resolve();
  204. })
  205. .catch(() => {});
  206. },
  207. editData(row) {
  208. const pam = this.searched
  209. ? {
  210. currentPage: this.currentPage,
  211. pageSize: this.pageSize,
  212. filter: this.filter
  213. }
  214. : { currentPage: this.currentPage, pageSize: this.pageSize };
  215. this.$router.push({
  216. name: 'AddZskRegisteredDrug',
  217. params: {
  218. id: row.id,
  219. type: 2
  220. }
  221. });
  222. },
  223. showDelDialog(row) {
  224. const params = {
  225. id: row.id
  226. };
  227. const warningTxt = '是否删除该诊断依据?可能对现有系统造成影响';
  228. this.showConfirmDialog(warningTxt, () => {
  229. api.paramDelete(params)
  230. .then(res => {
  231. if (res.data.code == '0') {
  232. if (!this.searched) {
  233. //未点确认时清空搜索条件
  234. this.clearFilter();
  235. }
  236. this.currentPage = 1;
  237. this.warning(res.data.msg || '操作成功', 'success');
  238. this.getDataList();
  239. } else {
  240. this.warning(res.data.msg);
  241. }
  242. })
  243. .catch(error => {
  244. this.warning(error);
  245. });
  246. });
  247. },
  248. clearFilter() {
  249. this.filter = {
  250. commonName: '',
  251. name: '',
  252. company: ''
  253. };
  254. },
  255. update() {
  256. const loading = this.$loading({
  257. lock: true,
  258. text: 'Loading',
  259. spinner: 'el-icon-loading',
  260. background: 'rgba(0, 0, 0, 0.7)'
  261. });
  262. api
  263. .getPageList()
  264. .then(res => {
  265. loading.close();
  266. if (res.data.code == '0') {
  267. this.warning('更新成功', 'success');
  268. this.getDataList();
  269. } else {
  270. this.warning(res.data.msg || '更新失败,请重试');
  271. }
  272. })
  273. .catch(error => {
  274. loading.close();
  275. this.warning('更新失败,请重试');
  276. });
  277. }
  278. }
  279. };
  280. </script>
  281. <style lang="less" scoped>
  282. @import '../../less/admin.less';
  283. /deep/ .container.knowledgeTitle {
  284. height: 40px;
  285. min-width: 970px !important;
  286. }
  287. .demo-form-inline {
  288. margin: 0 20px 0 0;
  289. }
  290. /deep/ .contents.knowledgeContents {
  291. padding: 64px 20px 0;
  292. }
  293. /deep/ .secLine.el-form {
  294. float: right;
  295. display: block;
  296. position: relative;
  297. top: -1px;
  298. }
  299. .delete {
  300. color: red;
  301. }
  302. .review {
  303. color: #22ccc8;
  304. }
  305. .el-table .cell {
  306. overflow: hidden;
  307. white-space: nowrap;
  308. }
  309. #upFile {
  310. display: none !important;
  311. }
  312. .unvailable {
  313. color: #fe7d3d;
  314. &:hover,
  315. &:active,
  316. &:focus {
  317. color: #f19061;
  318. }
  319. }
  320. </style>