index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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="durgBrand">
  11. <el-input
  12. v-model="queryParams.durgBrand"
  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:bdgldurgputin: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:bdgldurgputin: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:bdgldurgputin: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:bdgldurgputin: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="bdgldurgputinList"
  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="durgName" />
  94. <el-table-column label="入库数量" align="center" prop="putIn" />
  95. <el-table-column label="入库位置" align="center" prop="place" />
  96. <el-table-column label="药品来源" align="center" prop="source" />
  97. <!-- <el-table-column label="入库说明" align="center" prop="remarks" /> -->
  98. <el-table-column
  99. label="过期日期"
  100. align="center"
  101. prop="overduedate"
  102. width="120"
  103. >
  104. <template slot-scope="scope">
  105. <span>{{ parseTime(scope.row.overduedate, "{y}-{m}-{d}") }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. label="入库时间"
  110. align="center"
  111. prop="putTime"
  112. width="120"
  113. >
  114. <template slot-scope="scope">
  115. <span>{{ parseTime(scope.row.putTime, "{y}-{m}-{d}") }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="编号" align="center" prop="number" />
  119. <el-table-column label="剩余库存" align="center" prop="surplus" />
  120. <!-- <el-table-column label="是否销毁" align="center" prop="status" /> -->
  121. <el-table-column label="品牌" align="center" prop="durgBrand" />
  122. <el-table-column label="生产厂商" align="center" prop="manufacturer" />
  123. <el-table-column label="规格" align="center" prop="specifications" />
  124. <el-table-column label="库房" align="center" prop="storeHouse">
  125. <template slot-scope="scope">
  126. <dict-tag
  127. :options="dict.type.storage_room"
  128. :value="scope.row.storeHouse"
  129. />
  130. </template>
  131. </el-table-column>
  132. <!-- <el-table-column label="库房" align="center" prop="unitId" /> -->
  133. <!-- <el-table-column
  134. label="操作"
  135. align="center"
  136. class-name="small-padding fixed-width"
  137. >
  138. <template slot-scope="scope">
  139. <el-button
  140. size="mini"
  141. type="text"
  142. icon="el-icon-edit"
  143. @click="handleUpdate(scope.row)"
  144. v-hasPermi="['medicalhealth:bdgldurgputin:edit']"
  145. >修改</el-button
  146. >
  147. <el-button
  148. size="mini"
  149. type="text"
  150. icon="el-icon-delete"
  151. @click="handleDelete(scope.row)"
  152. v-hasPermi="['medicalhealth:bdgldurgputin:remove']"
  153. >删除</el-button
  154. >
  155. </template>
  156. </el-table-column> -->
  157. </el-table>
  158. <pagination
  159. v-show="total > 0"
  160. :total="total"
  161. :page.sync="queryParams.pageNum"
  162. :limit.sync="queryParams.pageSize"
  163. @pagination="getList"
  164. />
  165. <!-- 添加或修改药品入库登记对话框 -->
  166. <el-dialog
  167. :title="title"
  168. :visible.sync="open"
  169. width="500px"
  170. append-to-body
  171. :close-on-click-modal="false"
  172. >
  173. <el-form
  174. ref="form"
  175. :model="form"
  176. :rules="rules"
  177. label-width="80px"
  178. inline
  179. >
  180. <el-form-item label="入库编号" prop="number">
  181. <el-input v-model="form.number" placeholder="请输入入库编号" />
  182. </el-form-item>
  183. <el-form-item label="药品名称" prop="durgName">
  184. <el-select v-model="form.durgName" placeholder="请选择药品名称">
  185. <el-option
  186. class="input_xiala"
  187. v-for="(item, i) in yaoList"
  188. :key="i"
  189. :value="item.durgName"
  190. :label="item.yaoPinName"
  191. @click.native="yapPing(item)"
  192. >
  193. </el-option>
  194. </el-select>
  195. </el-form-item>
  196. <el-form-item label="药品来源" prop="source">
  197. <el-input v-model="form.source" placeholder="请输入药品来源" />
  198. </el-form-item>
  199. <el-form-item label="入库数量" prop="putIn">
  200. <el-input v-model="form.putIn" placeholder="请输入入库数量" />
  201. </el-form-item>
  202. <el-form-item label="入库位置" prop="place">
  203. <el-input v-model="form.place" placeholder="请输入入库位置" />
  204. </el-form-item>
  205. <el-form-item label="入库时间" prop="putTime">
  206. <el-date-picker
  207. clearable
  208. size="small"
  209. v-model="form.putTime"
  210. type="date"
  211. value-format="yyyy-MM-dd"
  212. placeholder="选择入库时间"
  213. >
  214. </el-date-picker>
  215. </el-form-item>
  216. <!-- <el-form-item label="入库说明" prop="remarks">
  217. <el-input v-model="form.remarks" placeholder="请输入入库说明" />
  218. </el-form-item> -->
  219. <el-form-item label="过期日期" prop="overduedate">
  220. <el-date-picker
  221. clearable
  222. size="small"
  223. v-model="form.overduedate"
  224. type="date"
  225. value-format="yyyy-MM-dd"
  226. placeholder="选择过期日期"
  227. >
  228. </el-date-picker>
  229. </el-form-item>
  230. <div class="jiben">入库说明</div>
  231. <el-form-item prop="remarks">
  232. <el-input
  233. v-model="form.remarks"
  234. type="textarea"
  235. placeholder="请输入内容"
  236. />
  237. </el-form-item>
  238. </el-form>
  239. <div slot="footer" class="dialog-footer">
  240. <el-button type="primary" @click="submitForm">确 定</el-button>
  241. <el-button @click="cancel" size="btn">取 消</el-button>
  242. </div>
  243. </el-dialog>
  244. </div>
  245. </template>
  246. <script>
  247. import {
  248. listBdgldurgputin,
  249. updateBdgldurgputin,
  250. delBdgldurgputin,
  251. addBdgldurgputin,
  252. exportBdgldurgputin,
  253. exportYao,
  254. getBdgldurgputin,
  255. } from "@/api/medicalhealth/bdgldurgputin";
  256. export default {
  257. name: "Bdgldurgputin",
  258. dicts: ["storage_room"],
  259. data() {
  260. return {
  261. // 遮罩层
  262. loading: true,
  263. // 导出遮罩层
  264. exportLoading: false,
  265. // 选中数组
  266. ids: [],
  267. // 非单个禁用
  268. single: true,
  269. // 非多个禁用
  270. multiple: true,
  271. // 显示搜索条件
  272. showSearch: true,
  273. // 总条数
  274. total: 0,
  275. // 药品入库登记表格数据
  276. bdgldurgputinList: [],
  277. // 弹出层标题
  278. title: "",
  279. // 是否显示弹出层
  280. open: false,
  281. // 查询参数
  282. queryParams: {
  283. pageNum: 1,
  284. pageSize: 10,
  285. durgArchivesId: null,
  286. putIn: null,
  287. place: null,
  288. source: null,
  289. remarks: null,
  290. overduedate: null,
  291. putTime: null,
  292. adminId: null,
  293. number: null,
  294. surplus: null,
  295. status: null,
  296. durgBrand: null,
  297. manufacturer: null,
  298. specifications: null,
  299. productIntroduction: null,
  300. storeHouse: null,
  301. unitId: null,
  302. },
  303. // 表单参数
  304. form: {},
  305. // 表单校验
  306. rules: {},
  307. // 药品列表
  308. yaoList: [],
  309. };
  310. },
  311. created() {
  312. this.getList();
  313. },
  314. methods: {
  315. // 编号
  316. planName() {
  317. let date = new Date();
  318. let year = date.getFullYear();
  319. let month =
  320. date.getMonth() + 1 <= 9
  321. ? "0" + (date.getMonth() + 1)
  322. : date.getMonth() + 1;
  323. let day = date.getDate();
  324. let hour = date.getHours() <= 9 ? "0" + date.getHours() : date.getHours();
  325. let minute =
  326. date.getMinutes <= 9 ? "0" + date.getMinutes() : date.getMinutes();
  327. this.form.number = year + month + day + hour + minute;
  328. },
  329. // 药品名称触发赋值
  330. yapPing(data) {
  331. this.form.unitId = data.unitId;
  332. this.form.unitName = data.unitName;
  333. this.form.manufacturer = data.manufacturer;
  334. this.form.specifications = data.specifications;
  335. this.form.storeHouse = data.storeHouse;
  336. this.form.durgArchivesId = data.id;
  337. this.form.durgBrand = data.durgBrand;
  338. this.planName();
  339. },
  340. // 查询药品名称列表
  341. getYaoPing() {
  342. exportYao().then((response) => {
  343. this.yaoList = response.data;
  344. });
  345. },
  346. /** 查询药品入库登记列表 */
  347. getList() {
  348. this.loading = true;
  349. listBdgldurgputin(this.queryParams).then((response) => {
  350. this.bdgldurgputinList = response.rows;
  351. this.total = response.total;
  352. this.loading = false;
  353. });
  354. },
  355. // 取消按钮
  356. cancel() {
  357. this.open = false;
  358. this.reset();
  359. },
  360. // 表单重置
  361. reset() {
  362. this.form = {
  363. id: null,
  364. durgArchivesId: null,
  365. putIn: null,
  366. place: null,
  367. source: null,
  368. remarks: null,
  369. overduedate: null,
  370. putTime: null,
  371. adminId: null,
  372. createTime: null,
  373. updateTime: null,
  374. number: null,
  375. surplus: null,
  376. status: "0",
  377. durgBrand: null,
  378. manufacturer: null,
  379. specifications: null,
  380. productIntroduction: null,
  381. storeHouse: null,
  382. unitId: null,
  383. };
  384. this.resetForm("form");
  385. },
  386. /** 搜索按钮操作 */
  387. handleQuery() {
  388. this.queryParams.pageNum = 1;
  389. this.getList();
  390. },
  391. /** 重置按钮操作 */
  392. resetQuery() {
  393. this.resetForm("queryForm");
  394. this.handleQuery();
  395. },
  396. // 多选框选中数据
  397. handleSelectionChange(selection) {
  398. this.ids = selection.map((item) => item.id);
  399. this.single = selection.length !== 1;
  400. this.multiple = !selection.length;
  401. },
  402. /** 新增按钮操作 */
  403. handleAdd() {
  404. this.reset();
  405. this.getYaoPing();
  406. this.open = true;
  407. this.title = "添加药品入库登记";
  408. },
  409. /** 修改按钮操作 */
  410. handleUpdate(row) {
  411. this.reset();
  412. const id = row.id || this.ids;
  413. console.log(id);
  414. getBdgldurgputin(id).then((response) => {
  415. this.form = response.data;
  416. this.getYaoPing();
  417. this.open = true;
  418. this.title = "修改药品入库登记";
  419. });
  420. },
  421. /** 提交按钮 */
  422. submitForm() {
  423. this.$refs["form"].validate((valid) => {
  424. if (valid) {
  425. if (this.form.id != null) {
  426. updateBdgldurgputin(this.form).then((response) => {
  427. this.$modal.msgSuccess("修改成功");
  428. this.open = false;
  429. this.getList();
  430. });
  431. } else {
  432. this.form.surplus = this.form.putIn;
  433. addBdgldurgputin(this.form).then((response) => {
  434. this.$modal.msgSuccess("新增成功");
  435. this.open = false;
  436. this.getList();
  437. });
  438. }
  439. }
  440. });
  441. },
  442. /** 删除按钮操作 */
  443. handleDelete(row) {
  444. const ids = row.id || this.ids;
  445. this.$modal
  446. .confirm("是否确认删除药品入库登记的数据项?")
  447. .then(function () {
  448. return delBdgldurgputin(ids);
  449. })
  450. .then(() => {
  451. this.getList();
  452. this.$modal.msgSuccess("删除成功");
  453. })
  454. .catch(() => {});
  455. },
  456. /** 导出按钮操作 */
  457. handleExport() {
  458. const queryParams = this.queryParams;
  459. this.$modal
  460. .confirm("是否确认导出所有药品入库登记数据项?")
  461. .then(() => {
  462. this.exportLoading = true;
  463. return exportBdgldurgputin(queryParams);
  464. })
  465. .then((response) => {
  466. this.$download.name(response.msg);
  467. this.exportLoading = false;
  468. })
  469. .catch(() => {});
  470. },
  471. },
  472. };
  473. </script>
  474. <style scoped>
  475. /* 对话框背景颜色 */
  476. ::v-deep .el-dialog {
  477. background: #004d86 !important;
  478. }
  479. ::v-deep .el-textarea__inner {
  480. width: 920px;
  481. height: 104px;
  482. margin: auto;
  483. }
  484. ::v-deep .el-dialog__header {
  485. border-bottom: 1px solid #718a9d;
  486. }
  487. ::v-deep .el-dialog__title {
  488. color: #fff;
  489. font: 18px;
  490. }
  491. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  492. color: #fff;
  493. }
  494. ::v-deep .el-form-item__label {
  495. font: 16px;
  496. color: #fff;
  497. width: 100px !important;
  498. }
  499. ::v-deep .el-input__inner {
  500. /* width: 200px !important;
  501. height: 36px; */
  502. background: transparent;
  503. color: #fff;
  504. border: 1px solid white !important;
  505. }
  506. /* 单位框背景颜色 */
  507. ::v-deep .vue-treeselect__control {
  508. background: #004d86 !important;
  509. }
  510. /* 基本信息背景 */
  511. .jiben {
  512. width: 920px;
  513. height: 32px;
  514. background-image: url(../../../images/小标题底.png);
  515. margin-bottom: 25px;
  516. color: #fff;
  517. padding-left: 16px;
  518. line-height: 32px;
  519. }
  520. /*调整表单间距 */
  521. ::v-deep .el-form-item__content {
  522. width: 200px;
  523. }
  524. ::v-deep .el-input__inner {
  525. cursor: pointer !important;
  526. }
  527. /* 底部确定取消按钮 */
  528. ::v-deep .el-dialog__footer {
  529. padding: 30px 50px;
  530. }
  531. ::v-deep .el-dialog__body {
  532. margin: 10px 30px 20px 50px;
  533. padding-top: 20px !important;
  534. box-sizing: border-box;
  535. /* padding: 30px 12px 30px 28px; */
  536. }
  537. .contents {
  538. padding: 0px 40px !important;
  539. }
  540. /* 下拉菜单 */
  541. .el-dropdown-link {
  542. cursor: pointer;
  543. color: #409eff;
  544. }
  545. .el-icon-arrow-down {
  546. font-size: 12px;
  547. }
  548. /* 刷新图标 */
  549. /* .el-icon-refresh {
  550. width: 76px;
  551. height: 36px;
  552. color: #fff;
  553. background-color: #1d96ff !important;
  554. border-radius: 4px;
  555. border: none;
  556. margin-left: 20px;
  557. font-size: 14px;
  558. } */
  559. /* 下拉菜单字体/背景颜色 */
  560. .el-select-dropdown__item.hover,
  561. .el-select-dropdown__item:hover {
  562. background-color: #004d86;
  563. color: #fff;
  564. }
  565. .el-select-dropdown__item {
  566. color: #fff;
  567. }
  568. /* 时间选择 */
  569. ::v-deep .el-input--small .el-input__inner {
  570. width: 200px;
  571. height: 36px;
  572. line-height: 36px;
  573. }
  574. .el-date-editor.el-input {
  575. width: 200px;
  576. height: 36px;
  577. line-height: 36px;
  578. }
  579. ::v-deep .el-date-editor.el-input .el-input__inner {
  580. height: 36px;
  581. line-height: 36px;
  582. }
  583. /* 单位框背景颜色 */
  584. ::v-deep .vue-treeselect__control {
  585. background: #004d86 !important;
  586. color: #fff;
  587. }
  588. /* 单位下拉菜单选中字体颜色 */
  589. ::v-deep .vue-treeselect__single-value {
  590. color: #fff !important;
  591. }
  592. /* 分页按钮 */
  593. ::v-deep .el-pagination.is-background .el-pager li {
  594. background-color: #004d86;
  595. color: #fff;
  596. }
  597. ::v-deep .el-pagination.is-background .btn-next {
  598. background-color: #004d86;
  599. color: #fff;
  600. }
  601. /* 底部确定取消按钮 */
  602. ::v-deep .el-dialog__footer {
  603. padding: 18px 42px 30px 0px;
  604. margin-right: 30px;
  605. }
  606. /* 增加按钮弹框 */
  607. ::v-deep .el-dialog {
  608. width: 1060px !important;
  609. }
  610. ::v-deep .el-dialog__body {
  611. padding: none !important;
  612. }
  613. ::v-deep .box4 .el-textarea__inner {
  614. min-height: 120px !important;
  615. }
  616. /* 调整输入框提示文字颜色 */
  617. ::v-deep .vue-treeselect__placeholder {
  618. color: #bdbdbd4f !important;
  619. }
  620. ::v-deep input::-webkit-input-placeholder {
  621. color: #bdbdbd4f !important;
  622. }
  623. ::v-deep input:-moz-placeholder {
  624. color: #bdbdbd4f !important;
  625. }
  626. </style>