index.vue 19 KB

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