index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item prop="durgName">
  11. <el-input
  12. v-model="queryParams.durgName"
  13. placeholder="请输入药品名称"
  14. clearable
  15. size="small"
  16. @input="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item>
  20. <!-- <el-button type="primary" size="btn" @click="handleQuery"
  21. >搜索</el-button
  22. > -->
  23. <el-button size="btr" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. <el-row :gutter="10" class="mb8">
  27. <el-col :span="1.5">
  28. <el-button
  29. type="primary"
  30. plain
  31. icon="el-icon-plus"
  32. size="mini"
  33. @click="handleAdd"
  34. v-hasPermi="['medicalhealth:bdgldurgarchives:add']"
  35. >新增</el-button
  36. >
  37. </el-col>
  38. <!-- <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. plain
  42. icon="el-icon-edit"
  43. size="mini"
  44. :disabled="single"
  45. @click="handleUpdate"
  46. v-hasPermi="['medicalhealth:bdgldurgarchives:edit']"
  47. >修改</el-button
  48. >
  49. </el-col> -->
  50. <el-col :span="1.5">
  51. <el-button
  52. type="danger"
  53. plain
  54. icon="el-icon-delete"
  55. size="mini"
  56. :disabled="multiple"
  57. @click="handleDelete"
  58. v-hasPermi="['medicalhealth:bdgldurgarchives:remove']"
  59. >删除</el-button
  60. >
  61. </el-col>
  62. <!-- <el-col :span="1.5">
  63. <el-button
  64. type="warning"
  65. plain
  66. icon="el-icon-download"
  67. size="mini"
  68. :loading="exportLoading"
  69. @click="handleExport"
  70. v-hasPermi="['medicalhealth:bdgldurgarchives:export']"
  71. >导出</el-button
  72. >
  73. </el-col> -->
  74. <!-- <right-toolbar
  75. :showSearch.sync="showSearch"
  76. @queryTable="getList"
  77. ></right-toolbar> -->
  78. </el-row>
  79. <el-table
  80. v-loading="loading"
  81. :data="bdgldurgarchivesList"
  82. @selection-change="handleSelectionChange"
  83. :header-cell-style="{ background: '#003C69', color: 'white' }"
  84. >
  85. <el-table-column type="selection" width="55" align="center" />
  86. <el-table-column label="序号" align="center">
  87. <template scope="scope">
  88. <span>{{
  89. (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
  90. }}</span>
  91. </template>
  92. </el-table-column>
  93. <!-- <el-table-column label="单位" align="center" prop="unitName" /> -->
  94. <el-table-column label="药品编码" align="center" prop="drugNo" />
  95. <el-table-column label="药品名称" align="center" prop="durgName" />
  96. <el-table-column label="品牌" align="center" prop="durgBrand" />
  97. <el-table-column label="规格" align="center" prop="specifications" />
  98. <el-table-column label="厂家" align="center" prop="manufacturer" />
  99. <el-table-column
  100. label="功能主治"
  101. align="center"
  102. prop="productIntroduction"
  103. show-overflow-tooltip
  104. />
  105. <el-table-column
  106. label="库房"
  107. align="center"
  108. prop="storeHouse"
  109. :formatter="kuFang"
  110. />
  111. <el-table-column label="库存数量" align="center" prop="amount" />
  112. <el-table-column label="入库数量" align="center" prop="putIn" />
  113. <el-table-column label="出库数量" align="center" prop="putOut" />
  114. <el-table-column label="过期数量" align="center" prop="overdue" />
  115. <!-- <el-table-column label="录入人" align="center" prop="userName" /> -->
  116. <el-table-column
  117. label="操作"
  118. align="center"
  119. class-name="small-padding fixed-width"
  120. width="150"
  121. >
  122. <template slot-scope="scope">
  123. <el-button
  124. size="btu"
  125. type="text"
  126. @click="handleUpdate(scope.row)"
  127. v-hasPermi="['medicalhealth:bdgldurgarchives:edit']"
  128. >修改</el-button
  129. >
  130. <el-button
  131. size="btd"
  132. type="text"
  133. @click="handleDelete(scope.row)"
  134. v-hasPermi="['medicalhealth:bdgldurgarchives:remove']"
  135. >删除</el-button
  136. >
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <pagination
  141. v-show="total > 0"
  142. :total="total"
  143. :page.sync="queryParams.pageNum"
  144. :limit.sync="queryParams.pageSize"
  145. @pagination="getList"
  146. />
  147. <!-- 添加或修改药品库存档案对话框 -->
  148. <el-dialog
  149. :title="title"
  150. :visible.sync="open"
  151. width="500px"
  152. append-to-body
  153. :close-on-click-modal="false"
  154. >
  155. <el-form
  156. ref="form"
  157. :model="form"
  158. :rules="rules"
  159. label-width="80px"
  160. inline
  161. >
  162. <el-form-item label="药品编码" prop="drugNo">
  163. <el-input v-model="form.drugNo" placeholder="请输入药品编码" @blur="No(form.drugNo)"/>
  164. </el-form-item>
  165. <el-form-item label="药品名称" prop="durgName">
  166. <el-input v-model="form.durgName" placeholder="请输入药品名称" />
  167. </el-form-item>
  168. <!-- <el-form-item label="单位" prop="unitId">
  169. <treeselect
  170. v-model="form.unitId"
  171. :options="deptOptions"
  172. placeholder="选择单位"
  173. />
  174. </el-form-item> -->
  175. <el-form-item label="库房" prop="storeHouse">
  176. <el-select v-model="form.storeHouse" placeholder="请选择库房">
  177. <el-option
  178. class="input_xiala"
  179. v-for="(item, i) in warehouse"
  180. :key="i"
  181. :value="item.dictValue"
  182. :label="item.dictLabel"
  183. >
  184. </el-option>
  185. </el-select>
  186. </el-form-item>
  187. <el-form-item label="品牌" prop="durgBrand">
  188. <el-input v-model="form.durgBrand" placeholder="请输入品牌" />
  189. </el-form-item>
  190. <el-form-item label="规格" prop="specifications">
  191. <el-input v-model="form.specifications" placeholder="请输入规格" />
  192. </el-form-item>
  193. <el-form-item label="厂家" prop="manufacturer">
  194. <el-input v-model="form.manufacturer" placeholder="请输入厂家" />
  195. </el-form-item>
  196. <div class="jiben">功能主治</div>
  197. <el-form-item prop="productIntroduction">
  198. <el-input
  199. v-model="form.productIntroduction"
  200. type="textarea"
  201. placeholder="请输入内容"
  202. />
  203. </el-form-item>
  204. <div class="jiben">备注</div>
  205. <el-form-item prop="remarks">
  206. <el-input
  207. v-model="form.remarks"
  208. type="textarea"
  209. placeholder="请输入内容"
  210. />
  211. </el-form-item>
  212. <!-- <el-form-item label="库存数量" prop="amount">
  213. <el-input v-model="form.amount" placeholder="请输入库存数量" />
  214. </el-form-item>
  215. <el-form-item label="入库数量" prop="putIn">
  216. <el-input v-model="form.putIn" placeholder="请输入入库数量" />
  217. </el-form-item>
  218. <el-form-item label="出库数量" prop="putOut">
  219. <el-input v-model="form.putOut" placeholder="请输入出库数量" />
  220. </el-form-item>
  221. <el-form-item label="过期数量" prop="overdue">
  222. <el-input v-model="form.overdue" placeholder="请输入过期数量" />
  223. </el-form-item> -->
  224. <!-- <el-form-item label="录入人(创建人)" prop="adminId">
  225. <el-input v-model="form.adminId" placeholder="请输入录入人(创建人)" />
  226. </el-form-item> -->
  227. </el-form>
  228. <div slot="footer" class="dialog-footer">
  229. <el-button type="primary" @click="submitForm">确 定</el-button>
  230. <el-button @click="cancel" size="btn">取 消</el-button>
  231. </div>
  232. </el-dialog>
  233. </div>
  234. </template>
  235. <script>
  236. import {
  237. listBdgldurgarchives,
  238. getBdgldurgarchives,
  239. delBdgldurgarchives,
  240. addBdgldurgarchives,
  241. updateBdgldurgarchives,
  242. exportBdgldurgarchives,
  243. getDept,
  244. } from "@/api/medicalhealth/bdgldurgarchives";
  245. // 导入树形结构
  246. import Treeselect from "@riophae/vue-treeselect";
  247. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  248. // 查询字典
  249. import { getDicts } from "@/api/system/dict/data";
  250. export default {
  251. name: "Bdgldurgarchives",
  252. components: {
  253. Treeselect,
  254. },
  255. dicts: ["storage_room"],
  256. data() {
  257. return {
  258. // 遮罩层
  259. loading: true,
  260. // 导出遮罩层
  261. exportLoading: false,
  262. // 选中数组
  263. ids: [],
  264. // 非单个禁用
  265. single: true,
  266. // 非多个禁用
  267. multiple: true,
  268. // 显示搜索条件
  269. showSearch: true,
  270. // 总条数
  271. total: 0,
  272. // 药品库存档案表格数据
  273. bdgldurgarchivesList: [],
  274. // 弹出层标题
  275. title: "",
  276. // 是否显示弹出层
  277. open: false,
  278. // 查询参数
  279. queryParams: {
  280. pageNum: 1,
  281. pageSize: 10,
  282. drugNo: null,
  283. durgName: null,
  284. durgBrand: null,
  285. manufacturer: null,
  286. specifications: null,
  287. productIntroduction: null,
  288. storeHouse: null,
  289. unitId: null,
  290. amount: null,
  291. putIn: null,
  292. putOut: null,
  293. overdue: null,
  294. remarks: null,
  295. adminId: null,
  296. },
  297. // 表单参数
  298. form: {},
  299. // 表单校验
  300. rules: {
  301. adminId: [
  302. {
  303. required: true,
  304. message: "录入人(创建人)不能为空",
  305. trigger: "blur",
  306. },
  307. ],
  308. },
  309. // 树形单位
  310. deptOptions: [],
  311. // 库房
  312. warehouse: [],
  313. };
  314. },
  315. created() {
  316. this.getList();
  317. getDicts("storage_room").then((response) => {
  318. this.warehouse = response.data;
  319. });
  320. },
  321. methods: {
  322. // 字典查询库房翻译
  323. kuFang(row) {
  324. var kufang = "";
  325. this.warehouse.map((item) => {
  326. if (item.dictValue == row.storeHouse) {
  327. kufang = item.dictLabel;
  328. }
  329. });
  330. return kufang;
  331. },
  332. /** 查询部门下拉树结构 */
  333. getTreeselect() {
  334. getDept().then((response) => {
  335. this.deptOptions = response.data;
  336. });
  337. },
  338. /** 查询药品库存档案列表 */
  339. getList() {
  340. this.loading = true;
  341. listBdgldurgarchives(this.queryParams).then((response) => {
  342. this.bdgldurgarchivesList = response.rows;
  343. console.log(response.rows)
  344. this.total = response.total;
  345. this.loading = false;
  346. });
  347. },
  348. // 取消按钮
  349. cancel() {
  350. this.open = false;
  351. this.reset();
  352. },
  353. // 药品编码
  354. No(a){
  355. if(a){
  356. this.loading = true;
  357. this.queryParams.drugNo=this.form.drugNo
  358. listBdgldurgarchives( this.queryParams).then((response) => {
  359. this.total = response.total;
  360. this.loading = false;
  361. if( response.total > 0 ){
  362. this.$modal.msgError("请勿重复录入");
  363. }
  364. });
  365. }
  366. },
  367. // 表单重置
  368. reset() {
  369. this.form = {
  370. id: null,
  371. drugNo: null,
  372. durgName: null,
  373. durgBrand: null,
  374. manufacturer: null,
  375. specifications: null,
  376. productIntroduction: null,
  377. storeHouse: null,
  378. unitId: null,
  379. amount: null,
  380. putIn: null,
  381. putOut: null,
  382. overdue: null,
  383. remarks: null,
  384. adminId: null,
  385. createTime: null,
  386. updateTime: null,
  387. };
  388. this.resetForm("form");
  389. },
  390. /** 搜索按钮操作 */
  391. handleQuery() {
  392. this.queryParams.pageNum = 1;
  393. this.getList();
  394. },
  395. /** 重置按钮操作 */
  396. resetQuery() {
  397. this.resetForm("queryForm");
  398. this.handleQuery();
  399. },
  400. // 多选框选中数据
  401. handleSelectionChange(selection) {
  402. this.ids = selection.map((item) => item.id);
  403. this.single = selection.length !== 1;
  404. this.multiple = !selection.length;
  405. },
  406. /** 新增按钮操作 */
  407. handleAdd() {
  408. this.getTreeselect();
  409. this.reset();
  410. this.open = true;
  411. this.title = "添加药品库存档案";
  412. },
  413. /** 修改按钮操作 */
  414. handleUpdate(row) {
  415. this.reset();
  416. this.getTreeselect();
  417. const id = row.id || this.ids;
  418. getBdgldurgarchives(id).then((response) => {
  419. this.form = response.data;
  420. this.open = true;
  421. this.title = "修改药品库存档案";
  422. });
  423. },
  424. /** 提交按钮 */
  425. submitForm() {
  426. this.$refs["form"].validate((valid) => {
  427. if (valid) {
  428. if (this.form.id != null) {
  429. updateBdgldurgarchives(this.form).then((response) => {
  430. this.$modal.msgSuccess("修改成功");
  431. this.open = false;
  432. this.getList();
  433. });
  434. } else {
  435. addBdgldurgarchives(this.form).then((response) => {
  436. this.$modal.msgSuccess("新增成功");
  437. this.open = false;
  438. this.getList();
  439. });
  440. }
  441. }
  442. });
  443. },
  444. /** 删除按钮操作 */
  445. handleDelete(row) {
  446. const ids = row.id || this.ids;
  447. this.$confirm("是否确认删除药品库存档案的数据项?", "警告", {
  448. confirmButtonText: "确定",
  449. cancelButtonText: "取消",
  450. type: "warning",
  451. })
  452. .then(function () {
  453. return delBdgldurgarchives(ids);
  454. })
  455. .then(() => {
  456. this.getList();
  457. this.msgSuccess("删除成功");
  458. })
  459. .catch(() => {});
  460. },
  461. /** 导出按钮操作 */
  462. handleExport() {
  463. const queryParams = this.queryParams;
  464. this.$confirm("是否确认导出所有药品库存档案数据项?", "警告", {
  465. confirmButtonText: "确定",
  466. cancelButtonText: "取消",
  467. type: "warning",
  468. })
  469. .then(() => {
  470. this.exportLoading = true;
  471. return exportBdgldurgarchives(queryParams);
  472. })
  473. .then((response) => {
  474. this.download(response.msg);
  475. this.exportLoading = false;
  476. })
  477. .catch(() => {});
  478. },
  479. },
  480. };
  481. </script>
  482. <style scoped>
  483. /* 对话框背景颜色 */
  484. ::v-deep .el-dialog {
  485. background: #004d86 !important;
  486. }
  487. ::v-deep .el-textarea__inner {
  488. width: 920px;
  489. height: 104px;
  490. margin: auto;
  491. }
  492. ::v-deep .el-dialog__header {
  493. border-bottom: 1px solid #718a9d;
  494. }
  495. ::v-deep .el-dialog__title {
  496. color: #fff;
  497. font: 18px;
  498. }
  499. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  500. color: #fff;
  501. }
  502. ::v-deep .el-form-item__label {
  503. font: 16px;
  504. color: #fff;
  505. width: 100px !important;
  506. }
  507. ::v-deep .el-input__inner {
  508. /* width: 200px !important;
  509. height: 36px; */
  510. background: transparent;
  511. color: #fff;
  512. border: 1px solid white !important;
  513. }
  514. /* 单位框背景颜色 */
  515. ::v-deep .vue-treeselect__control {
  516. background: #004d86 !important;
  517. }
  518. /* 基本信息背景 */
  519. .jiben {
  520. width: 920px;
  521. height: 32px;
  522. background-image: url(../../../images/小标题底.png);
  523. margin-bottom: 25px;
  524. color: #fff;
  525. padding-left: 16px;
  526. line-height: 32px;
  527. }
  528. /*调整表单间距 */
  529. ::v-deep .el-form-item__content {
  530. width: 200px;
  531. }
  532. ::v-deep .el-input__inner {
  533. cursor: pointer !important;
  534. }
  535. /* 底部确定取消按钮 */
  536. ::v-deep .el-dialog__footer {
  537. padding: 30px 50px;
  538. }
  539. ::v-deep .el-dialog__body {
  540. margin: 10px 30px 20px 50px;
  541. padding-top: 20px !important;
  542. box-sizing: border-box;
  543. /* padding: 30px 12px 30px 28px; */
  544. }
  545. .contents {
  546. padding: 0px 40px !important;
  547. }
  548. /* 下拉菜单 */
  549. .el-dropdown-link {
  550. cursor: pointer;
  551. color: #409eff;
  552. }
  553. .el-icon-arrow-down {
  554. font-size: 12px;
  555. }
  556. /* 刷新图标 */
  557. /* .el-icon-refresh {
  558. width: 76px;
  559. height: 36px;
  560. color: #fff;
  561. background-color: #1d96ff !important;
  562. border-radius: 4px;
  563. border: none;
  564. margin-left: 20px;
  565. font-size: 14px;
  566. } */
  567. /* 下拉菜单字体/背景颜色 */
  568. .el-select-dropdown__item.hover,
  569. .el-select-dropdown__item:hover {
  570. background-color: #004d86;
  571. color: #fff;
  572. }
  573. .el-select-dropdown__item {
  574. color: #fff;
  575. }
  576. /* 时间选择 */
  577. ::v-deep .el-input--small .el-input__inner {
  578. width: 200px;
  579. height: 36px;
  580. line-height: 36px;
  581. }
  582. .el-date-editor.el-input {
  583. width: 200px;
  584. height: 36px;
  585. line-height: 36px;
  586. }
  587. ::v-deep .el-date-editor.el-input .el-input__inner {
  588. height: 36px;
  589. line-height: 36px;
  590. }
  591. /* 单位框背景颜色 */
  592. ::v-deep .vue-treeselect__control {
  593. background: #004d86 !important;
  594. color: #fff;
  595. }
  596. /* 单位下拉菜单选中字体颜色 */
  597. ::v-deep .vue-treeselect__single-value {
  598. color: #fff !important;
  599. }
  600. /* 分页按钮 */
  601. ::v-deep .el-pagination.is-background .el-pager li {
  602. background-color: #004d86;
  603. color: #fff;
  604. }
  605. ::v-deep .el-pagination.is-background .btn-next {
  606. background-color: #004d86;
  607. color: #fff;
  608. }
  609. /* 底部确定取消按钮 */
  610. ::v-deep .el-dialog__footer {
  611. padding: 18px 42px 30px 0px;
  612. margin-right: 30px;
  613. }
  614. /* 增加按钮弹框 */
  615. ::v-deep .el-dialog {
  616. width: 1060px !important;
  617. }
  618. ::v-deep .el-dialog__body {
  619. padding: none !important;
  620. }
  621. ::v-deep .box4 .el-textarea__inner {
  622. min-height: 120px !important;
  623. }
  624. /* 调整输入框提示文字颜色 */
  625. ::v-deep .vue-treeselect__placeholder {
  626. color: #bdbdbd4f !important;
  627. }
  628. ::v-deep input::-webkit-input-placeholder {
  629. color: #bdbdbd4f !important;
  630. }
  631. ::v-deep input:-moz-placeholder {
  632. color: #bdbdbd4f !important;
  633. }
  634. </style>