RegisteredDrug.vue 9.3 KB

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