Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugStockInOrder.vue 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. @click="handleWarehouse"
  8. class="filter-item"
  9. style="float:right;"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增</el-button
  13. >
  14. </div>
  15. <div class="app-container">
  16. <div class="cell clearfix">
  17. <el-input
  18. size="small"
  19. style="width: 400px;"
  20. v-model.trim="searchKey"
  21. class="filter-item"
  22. placeholder="单据编码/制单人/药品名称"
  23. />
  24. <el-button
  25. size="small"
  26. class="filter-item"
  27. type="primary"
  28. icon="el-icon-search"
  29. @click="search"
  30. >搜索</el-button
  31. >
  32. <div style="margin-left:10px;">
  33. <label class="title"><span class="name">入库时间</span> : </label>
  34. <el-date-picker
  35. size="small"
  36. v-model="start_time"
  37. prefix-icon="el-icon-date"
  38. :editable="false"
  39. style="width: 196px;"
  40. type="date"
  41. placeholder="选择日期时间"
  42. align="right"
  43. format="yyyy-MM-dd"
  44. value-format="yyyy-MM-dd"
  45. @change="startTimeChange"
  46. ></el-date-picker>
  47. <span class="cellLine"> - </span>
  48. <el-date-picker
  49. size="small"
  50. v-model="end_time"
  51. prefix-icon="el-icon-date"
  52. :editable="false"
  53. style="width: 196px;"
  54. type="date"
  55. placeholder="选择日期时间"
  56. align="right"
  57. format="yyyy-MM-dd"
  58. value-format="yyyy-MM-dd"
  59. @change="endTimeChange"
  60. ></el-date-picker>
  61. </div>
  62. </div>
  63. <div class="cell clearfix">
  64. <el-checkbox
  65. style="width: 70px"
  66. v-model="checked"
  67. @change="changeAllSelected"
  68. >全选</el-checkbox
  69. >
  70. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  71. <el-button size="small" type="primary" @click="drugPrint()">打印</el-button>
  72. <el-button size="small" type="primary" @click="toExport()">导出</el-button>
  73. </div>
  74. <el-table
  75. :data="Warehouse.warehouseDate"
  76. :class="signAndWeighBoxPatients"
  77. style="width: 100%"
  78. border
  79. highlight-current-row
  80. v-loading="Warehouse.loading"
  81. ref="multipleTable"
  82. @selection-change="select"
  83. :row-style="{ color: '#303133' }"
  84. :header-cell-style="{
  85. backgroundColor: 'rgb(245, 247, 250)',
  86. color: '#606266'
  87. }"
  88. @current-change="handleCurrentChangeOne"
  89. >
  90. <el-table-column align="center" type="selection" width="55">
  91. </el-table-column>
  92. <el-table-column label="单据日期" align="center">
  93. <template slot-scope="scope">
  94. {{ scope.row.warehousing_time | parseTime("{y}-{m}-{d}") }}
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="单据编号" align="center">
  98. <template slot-scope="scope">
  99. {{ scope.row.warehousing_order }}
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="制单人" align="center">
  103. <template slot-scope="scope">
  104. {{ getXuserName(scope.row.creater) }}
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="操作" align="center" width="240">
  108. <template slot-scope="scope">
  109. <el-tooltip
  110. class="item"
  111. effect="dark"
  112. content="编辑"
  113. placement="top"
  114. >
  115. <el-button
  116. size="small"
  117. type="primary"
  118. icon="el-icon-edit-outline"
  119. @click="handleEdit(scope.$index, scope.row)"
  120. >
  121. </el-button>
  122. </el-tooltip>
  123. <el-tooltip
  124. class="item"
  125. effect="dark"
  126. content="删除"
  127. placement="top"
  128. >
  129. <el-button
  130. size="small"
  131. type="danger"
  132. icon="el-icon-delete"
  133. @click="handleDelete(scope.$index, scope.row)"
  134. >
  135. </el-button>
  136. </el-tooltip>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <el-pagination
  141. @size-change="handleSizeChange"
  142. @current-change="handleCurrentChange"
  143. :page-sizes="[5, 10, 50, 100]"
  144. :page-size="5"
  145. background
  146. style="margin-top:20px;text-align: right"
  147. layout="total, sizes, prev, pager, next, jumper"
  148. :total="total"
  149. >
  150. </el-pagination>
  151. <el-table
  152. v-show="showOne"
  153. :data="WarehouseInfo.warehouseInfoDate"
  154. :class="signAndWeighBoxPatients"
  155. style="width: 100%;margin-top:10px;"
  156. border
  157. highlight-current-row
  158. v-loading="Warehouse.loading"
  159. ref="multipleTableOne"
  160. @selection-change="select"
  161. :row-style="{ color: '#303133' }"
  162. :header-cell-style="{
  163. backgroundColor: 'rgb(245, 247, 250)',
  164. color: '#606266'
  165. }"
  166. >
  167. <el-table-column label="药品名称" align="center">
  168. <template slot-scope="scope">
  169. {{scope.row.drug.drug_name}}
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="药品类型" align="center">
  173. <template slot-scope="scope">
  174. {{getDrugType(scope.row.drug.drug_type)}}
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="规格&单位" align="center">
  178. <template slot-scope="scope">
  179. {{scope.row.drug.dose}}&nbsp;{{scope.row.drug.dose_unit}}*{{scope.row.drug.min_number}}{{scope.row.drug.min_unit}}/{{scope.row.drug.max_unit}}
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="批号" align="center">
  183. <template slot-scope="scope">
  184. {{scope.row.batch_number}}
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="入库数量" align="center">
  188. <template slot-scope="scope">
  189. {{scope.row.warehousing_count}}{{scope.row.max_unit}}
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="包装零售价" align="center">
  193. <template slot-scope="scope">
  194. {{scope.row.retail_price}}
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="进货价" align="center">
  198. <template slot-scope="scope">
  199. {{scope.row.price}}
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="总价" align="center">
  203. <template slot-scope="scope">
  204. {{scope.row.total_price}}
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="生产厂家" align="center">
  208. <template slot-scope="scope">
  209. {{getManufacturer(scope.row.manufacturer)}}
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="生产日期" align="center">
  213. <template slot-scope="scope">
  214. {{getTime(scope.row.product_date)}}
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="有效日期" align="center">
  218. <template slot-scope="scope">
  219. {{getTime(scope.row.expiry_date)}}
  220. </template>
  221. </el-table-column>
  222. <el-table-column label="经销商" align="center">
  223. <template slot-scope="scope">
  224. {{getDealer(scope.row.dealer)}}
  225. </template>
  226. </el-table-column>
  227. <el-table-column label="批准文号" align="center">
  228. <template slot-scope="scope">
  229. {{scope.row.number}}
  230. </template>
  231. </el-table-column>
  232. <el-table-column label="备注" align="center">
  233. <template slot-scope="scope">
  234. {{scope.row.remark}}
  235. </template>
  236. </el-table-column>
  237. </el-table>
  238. </div>
  239. <el-dialog
  240. title="药品详细"
  241. :visible.sync="dialogVisible"
  242. width="60%">
  243. <span>
  244. <el-table
  245. :data="WarehouseInfo.warehouseInfoDate"
  246. :class="signAndWeighBoxPatients"
  247. style="width: 100%"
  248. border
  249. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  250. >
  251. <el-table-column min-width="35" align="center">
  252. <template slot="header" slot-scope="scope">
  253. <span>药品名称</span>
  254. </template>
  255. <template slot-scope="scope">
  256. <span v-if="scope.row.drug_id != 0">{{
  257. scope.row.drug.drug_name
  258. }}</span>
  259. </template>
  260. </el-table-column>
  261. <el-table-column min-width="35" align="center">
  262. <template slot="header" slot-scope="scope">
  263. <span>规格名称</span>
  264. </template>
  265. <template slot-scope="scope">
  266. <span v-if="scope.row.drug_id != 0">{{
  267. scope.row.drug?scope.row.drug.drug_spec:''
  268. }}</span>
  269. </template>
  270. </el-table-column>
  271. <el-table-column min-width="23" align="center">
  272. <template slot="header" slot-scope="scope">
  273. <span>单价</span>
  274. </template>
  275. <template slot-scope="scope">
  276. <span>{{ scope.row.price }}</span>
  277. </template>
  278. </el-table-column>
  279. <el-table-column min-width="23" align="center">
  280. <template slot="header" slot-scope="scope">
  281. <span>入库数量</span>
  282. </template>
  283. <template slot-scope="scope">
  284. <span>{{ scope.row.warehousing_count }}</span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column label="总价" min-width="20" align="center">
  288. <template slot-scope="scope">
  289. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  290. </template>
  291. </el-table-column>
  292. <el-table-column align="center" min-width="25">
  293. <template slot="header" slot-scope="scope">
  294. <span>批号</span>
  295. </template>
  296. <template slot-scope="scope">
  297. <span>{{ scope.row.number }}</span>
  298. </template>
  299. </el-table-column>
  300. <el-table-column label="生产日期" min-width="40" align="center">
  301. <template v-if="scope.row.product_date != 0" slot-scope="scope">
  302. {{ scope.row.product_date | parseTime("{y}-{m}-{d}") }}
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="有效日期" min-width="40" align="center">
  306. <template v-if="scope.row.expiry_date != 0" slot-scope="scope">
  307. {{ scope.row.expiry_date | parseTime("{y}-{m}-{d}") }}
  308. </template>
  309. </el-table-column>
  310. <el-table-column label="备注" min-width="20" align="center">
  311. <template slot-scope="scope">
  312. <el-popover placement="top-start" width="250" trigger="hover">
  313. <div>{{ scope.row.remark }}</div>
  314. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  315. scope.row.remark.substr(0, 20) + "..."
  316. }}</span>
  317. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  318. </el-popover>
  319. </template>
  320. </el-table-column>
  321. </el-table>
  322. </span>
  323. <span slot="footer" class="dialog-footer">
  324. <el-button @click="dialogVisible = false">取 消</el-button>
  325. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  326. </span>
  327. </el-dialog>
  328. </div>
  329. </template>
  330. <script>
  331. import { uParseTime } from "@/utils/tools";
  332. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  333. import {
  334. deleteDrugWarehouseInfo,
  335. GetAllConfig,
  336. getDrugWarehouseInfoList,
  337. getDrugWarehouseList,
  338. exportDrugList
  339. } from "@/api/drug/drug_stock";
  340. import {getAllDrugList}from "@/api/data"
  341. import {getDictionaryDataConfig } from "@/utils/data";
  342. import BreadCrumb from "../../components/bread-crumb";
  343. export default {
  344. name: "drugStockInOrder",
  345. components: { BreadCrumb },
  346. created() {
  347. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  348. var nowDate = new Date();
  349. var nowYear = nowDate.getFullYear();
  350. var nowMonth = nowDate.getMonth() + 1;
  351. var nowDay = nowDate.getDate();
  352. this.end_time =
  353. nowYear +
  354. "-" +
  355. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  356. "-" +
  357. (nowDay < 10 ? "0" + nowDay : nowDay);
  358. nowDate.setMonth(nowDate.getMonth() - 1);
  359. nowYear = nowDate.getFullYear();
  360. nowMonth = nowDate.getMonth() + 1;
  361. nowDay = nowDate.getDate();
  362. this.start_time =
  363. nowYear +
  364. "-" +
  365. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  366. "-" +
  367. (nowDay < 10 ? "0" + nowDay : nowDay);
  368. this.GetWarehouse();
  369. this.fetchAllAdminUsers();
  370. },
  371. data() {
  372. return {
  373. crumbs: [
  374. { path: false, name: "库存管理" },
  375. { path: false, name: "入库单" }
  376. ],
  377. searchKey: "",
  378. type: 1,
  379. page: 1,
  380. limit: 5,
  381. checked: false,
  382. total: 0,
  383. pageTotal: 0,
  384. pageSelect: 0,
  385. adminUserOptions: [],
  386. multipleSelection: [],
  387. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  388. start_time: "",
  389. end_time: "",
  390. selectedTableData: [],
  391. Warehouse: {
  392. loading: false,
  393. warehouseDate: [],
  394. tableCurrentIndex: ""
  395. },
  396. WarehouseInfo: {
  397. loading: false,
  398. warehouseInfoDate: []
  399. },
  400. startTime: "",
  401. dialogVisible:false,
  402. showOne:false,
  403. drugTypeList:[],
  404. manufacturerList:[],
  405. order_id:"",
  406. dealerList:[],
  407. exportList:[],
  408. };
  409. },
  410. methods: {
  411. search: function() {
  412. const Params = {
  413. page: this.page,
  414. limit: this.limit,
  415. start_time: this.start_time,
  416. end_time: this.end_time,
  417. type: this.type,
  418. keywords: this.searchKey
  419. };
  420. console.log("parasm2222222",Params)
  421. this.Warehouse.warehouseDate = [];
  422. getDrugWarehouseList(Params).then(response => {
  423. if (response.data.state == 0) {
  424. this.Warehouse.loading = false;
  425. this.$message.error(response.data.msg);
  426. return false;
  427. } else {
  428. this.Warehouse.loading = false;
  429. this.total = response.data.data.total;
  430. for (let i = 0; i < response.data.data.list.length; i++) {
  431. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  432. }
  433. }
  434. });
  435. },
  436. GetWarehouse: function() {
  437. const Params = {
  438. page: this.page,
  439. limit: this.limit,
  440. start_time: this.start_time,
  441. end_time: this.end_time,
  442. type: this.type,
  443. keywords:this.searchKey,
  444. };
  445. this.Warehouse.warehouseDate = [];
  446. getDrugWarehouseList(Params).then(response => {
  447. if (response.data.state == 0) {
  448. this.Warehouse.loading = false;
  449. this.$message.error(response.data.msg);
  450. return false;
  451. } else {
  452. this.Warehouse.loading = false;
  453. this.total = response.data.data.total;
  454. for (let i = 0; i < response.data.data.list.length; i++) {
  455. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  456. }
  457. // console.log("列表999988888",this.warehouse.warehouseDate)
  458. }
  459. });
  460. },
  461. tableRowClassName({ row, rowIndex }) {
  462. // 把每一行的索引放进row
  463. row.index = rowIndex;
  464. },
  465. onRowClick(row, event, column) {
  466. this.WarehouseInfo.warehouseInfoDate = [];
  467. this.Warehouse.tableCurrentIndex = row.index;
  468. const params = {
  469. id: row.id
  470. };
  471. this.WarehouseInfo.loading = true;
  472. getDrugWarehouseInfoList(params).then(response => {
  473. if (response.data.state == 0) {
  474. this.WarehouseInfo.loading = false;
  475. this.$message.error(response.data.msg);
  476. return false;
  477. } else {
  478. this.WarehouseInfo.loading = false;
  479. for (let i = 0; i < response.data.data.info.length; i++) {
  480. this.WarehouseInfo.warehouseInfoDate.push(
  481. response.data.data.info[i]
  482. );
  483. }
  484. }
  485. });
  486. },
  487. getXuserName(id) {
  488. if (id <= 0) {
  489. return "";
  490. }
  491. var name = "";
  492. if (
  493. this.adminUserOptions == null ||
  494. typeof this.adminUserOptions.length === "undefined"
  495. ) {
  496. return name;
  497. }
  498. var leng = this.adminUserOptions.length;
  499. if (leng == 0) {
  500. return name;
  501. }
  502. for (let index = 0; index < leng; index++) {
  503. if (this.adminUserOptions[index].id == id) {
  504. name = this.adminUserOptions[index].name;
  505. break;
  506. }
  507. }
  508. return name;
  509. },
  510. fetchAllDoctorAndNurse() {
  511. fetchAllDoctorAndNurse().then(response => {
  512. if (response.data.state == 1) {
  513. this.doctorOptions = response.data.data.doctors;
  514. }
  515. });
  516. },
  517. fetchAllAdminUsers() {
  518. fetchAllAdminUsers().then(response => {
  519. console.log(response);
  520. if (response.data.state == 1) {
  521. this.adminUserOptions = response.data.data.users;
  522. console.log("制单人2222222",this.adminUserOptions)
  523. var alen = this.adminUserOptions.length;
  524. for (let index = 0; index < alen; index++) {
  525. if (this.adminUserOptions[index].user_type == 2) {
  526. // this.doctorOptions.push(this.adminUserOptions[index]);
  527. }
  528. }
  529. }
  530. });
  531. },
  532. clicks: function() {
  533. console.log(this.WarehouseInfo.warehouseInfoDate);
  534. },
  535. handleWarehouse: function() {
  536. this.$router.push({ path: "/drugstock/in/add", query: { type: this.type } });
  537. },
  538. handleSelectionChange: function(val) {
  539. this.multipleSelection = val;
  540. },
  541. handleSizeChange(val) {
  542. this.limit = val;
  543. this.GetWarehouse();
  544. },
  545. handleCurrentChange(val) {
  546. this.page = val;
  547. this.GetWarehouse();
  548. },
  549. startTimeChange(val) {
  550. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  551. if (time > 0) {
  552. this.$message.error("结束时间不能小于开始时间");
  553. this.start_time = "";
  554. } else {
  555. this.startTime = this.getTimestamp(val);
  556. this.start_time = val
  557. this.GetWarehouse();
  558. }
  559. },
  560. endTimeChange(val) {
  561. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  562. if (time < 0) {
  563. this.$message.error("结束时间不能小于开始时间");
  564. this.end_time = "";
  565. } else {
  566. this.end_time = val
  567. this.GetWarehouse();
  568. }
  569. },
  570. getTimestamp(time) {
  571. // 把时间日期转成时间戳
  572. return new Date(time).getTime() / 1000;
  573. },
  574. calculate: function(val) {
  575. return Math.round(parseFloat(val) * 100) / 100;
  576. },
  577. // handleEdit: function(index, row) {
  578. // this.$router.push({
  579. // name: "drugStockInDetail",
  580. // query: { id: row.id, type: this.type }
  581. // });
  582. // },
  583. handleEdit:function(index,row){
  584. this.$router.push({
  585. name:"drugStockInOrderEdit",
  586. query:{id:row.id,type:this.type}
  587. })
  588. },
  589. handleSearch(id){
  590. this.WarehouseInfo.warehouseInfoDate=[]
  591. this.GetOrderDetail(id);
  592. this.dialogVisible = true
  593. },
  594. GetOrderDetail(order_id) {
  595. const params = {
  596. id: order_id
  597. };
  598. console.log("parasm222222222",params)
  599. this.WarehouseInfo.warehouseInfoDate = []
  600. getDrugWarehouseInfoList(params).then(response => {
  601. if (response.data.state == 0) {
  602. this.$message.error(response.data.msg);
  603. return false;
  604. } else {
  605. console.log("hhhhhhhhhh",response.data.data.info)
  606. for (let i = 0; i < response.data.data.info.length; i++) {
  607. this.showOne = true
  608. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  609. console.log("列表详情",this.WarehouseInfo.warehouseInfoDate)
  610. }
  611. this.WarehouseInfo.warehouse = response.data.data.warehousing;
  612. this.getAllDrugList()
  613. }
  614. });
  615. },
  616. handleDelete: function(index, row) {
  617. const ids = [];
  618. ids.push(row.id);
  619. const idStr = ids.join(",");
  620. const params = {
  621. ids: idStr
  622. };
  623. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  624. confirmButtonText: "确定",
  625. cancelButtonText: "取消",
  626. type: "warning"
  627. })
  628. .then(() => {
  629. deleteDrugWarehouseInfo(params).then(response => {
  630. if (response.data.state == 0) {
  631. this.$message.error(response.data.msg);
  632. return false;
  633. } else {
  634. this.$notify({
  635. title: "成功",
  636. message: "删除成功",
  637. type: "success",
  638. duration: 2000
  639. });
  640. for (let i = 0; i < ids.length; i++) {
  641. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  642. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  643. this.Warehouse.warehouseDate.splice(y, 1);
  644. }
  645. }
  646. }
  647. }
  648. });
  649. })
  650. .catch(() => {});
  651. },
  652. changeAllSelected: function(val) {
  653. if (val) {
  654. this.$refs.multipleTable.toggleAllSelection();
  655. } else {
  656. this.$refs.multipleTable.clearSelection();
  657. }
  658. },
  659. select(selection) {
  660. var ids=[]
  661. for(let i=0;i<selection.length;i++){
  662. ids.push(selection[i].id)
  663. }
  664. this.order_id = ids.join(",")
  665. this.selectedTableData = selection;
  666. this.exportDrugList()
  667. },
  668. batchDelete() {
  669. if (this.selectedTableData.length <= 0) {
  670. this.$message.error("请选择要删除的记录");
  671. return;
  672. }
  673. const ids = [];
  674. for (let i = 0; i < this.selectedTableData.length; i++) {
  675. ids.push(this.selectedTableData[i].id);
  676. }
  677. const idStr = ids.join(",");
  678. const params = {
  679. ids: idStr
  680. };
  681. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  682. confirmButtonText: "确定",
  683. cancelButtonText: "取消",
  684. type: "warning"
  685. })
  686. .then(() => {
  687. deleteDrugWarehouseInfo(params).then(response => {
  688. if (response.data.state == 0) {
  689. this.$message.error(response.data.msg);
  690. return false;
  691. } else {
  692. this.$notify({
  693. title: "成功",
  694. message: "删除成功",
  695. type: "success",
  696. duration: 2000
  697. });
  698. for (let i = 0; i < ids.length; i++) {
  699. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  700. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  701. this.Warehouse.warehouseDate.splice(y, 1);
  702. }
  703. }
  704. }
  705. }
  706. });
  707. })
  708. .catch(() => {});
  709. },
  710. handleCurrentChangeOne(val){
  711. this.GetOrderDetail(val.id)
  712. },
  713. getTime(val) {
  714. if(val < 0){
  715. return ""
  716. }
  717. if(val == ""){
  718. return ""
  719. }else {
  720. return uParseTime(val, '{y}-{m}-{d}')
  721. }
  722. },
  723. getDrugType(id){
  724. var name = ""
  725. for(let i=0;i<this.drugTypeList.length;i++){
  726. if(id == this.drugTypeList[i].id){
  727. name = this.drugTypeList[i].name
  728. }
  729. }
  730. return name
  731. },
  732. getAllDrugList(){
  733. getAllDrugList().then(response=>{
  734. if(response.data.state == 1){
  735. var manufacturerList = response.data.data.manufacturerList
  736. this.manufacturerList = manufacturerList
  737. this.dealerList = response.data.data.dealerList
  738. }
  739. })
  740. },
  741. getManufacturer(id){
  742. var name = ""
  743. for(let i=0;i<this.manufacturerList.length;i++){
  744. if(id == this.manufacturerList[i].id){
  745. name = this.manufacturerList[i].manufacturer_name
  746. }
  747. }
  748. return name
  749. },
  750. getDealer(id){
  751. var name = ""
  752. for(let i=0;i<this.dealerList.length;i++){
  753. if(id == this.dealerList[i].id){
  754. name = this.dealerList[i].dealer_name
  755. }
  756. }
  757. return name
  758. },
  759. getDictionaryDataConfig(module, filed_name) {
  760. return getDictionaryDataConfig(module, filed_name)
  761. },
  762. drugPrint(){
  763. if(this.order_id == ""){
  764. this.$message.error("请选择入库单")
  765. }else{
  766. this.$router.push({path:"/stock/drugStockInOrderDetailPrint?id="+this.order_id})
  767. }
  768. },
  769. exportDrugList(){
  770. var params = {
  771. order_id:this.order_id,
  772. }
  773. exportDrugList(params).then(response=>{
  774. if(response.data.state == 1){
  775. var list = response.data.data.list
  776. console.log("list23232323",list)
  777. for(let i=0;i<list.length;i++){
  778. list[i].product_date = this.getTime(list[i].product_date)
  779. list[i].expiry_date = this.getTime(list[i].expiry_date)
  780. }
  781. this.exportList = list
  782. var manufacturerList = response.data.data.manufacturerList
  783. this.manufacturerList = manufacturerList
  784. var dealerList = response.data.data.dealerList
  785. console.log("经销是,",dealerList)
  786. this.dealerList = dealerList
  787. }
  788. })
  789. },
  790. toExport(){
  791. if(this.order_id == ""){
  792. this.$message.error("请勾选入库单")
  793. }
  794. console.log("hhhh2323",this.exportList)
  795. for(let i=0;i<this.exportList.length;i++){
  796. this.exportList[i].index = i+1
  797. this.exportList[i].unit = this.exportList[i].dose + this.exportList[i].dose_unit + "*" + this.exportList[i].min_number + this.exportList[i].min_unit + "/"+this.exportList[i].max_unit
  798. this.exportList[i].total_price = (this.exportList[i].warehousing_count * this.exportList[i].price).toFixed(2)
  799. for(let j=0;j<this.manufacturerList.length;j++){
  800. if(this.exportList[i].manufacturer == this.manufacturerList[j].id){
  801. this.exportList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  802. }
  803. if(this.exportList[i].manufacturer == 0){
  804. this.exportList[i].manufacturer = ""
  805. }
  806. }
  807. for(let z=0;z<this.dealerList.length;z++){
  808. if(this.exportList[i].dealer == this.dealerList[z].id){
  809. this.exportList[i].dealer = this.dealerList[z].dealer_name
  810. }
  811. if(this.exportList[i].dealer == 0){
  812. this.exportList[i].dealer = ""
  813. }
  814. }
  815. }
  816. import('@/vendor/Export2Excel').then(excel => {
  817. console.log("232323",this.drugTypeList)
  818. console.log("hhh23",this.exportList)
  819. for(let i=0;i<this.exportList.length;i++){
  820. for(let j=0;j<this.drugTypeList.length;j++){
  821. if(this.exportList[i].drug_type == this.drugTypeList[j].id){
  822. this.exportList[i].drug_type = this.drugTypeList[j].name
  823. }
  824. }
  825. }
  826. const tHeader = ['序号','药品名称','药品类型','规格&单位', '批号','入库数量','进货价','总价','生产厂家','生产日期','有效日期','经销商','批注文号','备注']
  827. const filterVal = ['index','drug_name', 'drug_type','unit','batch_number','warehousing_count','price','total_price','manufacturer','product_date','expiry_date','dealer','number','remark']
  828. console.log("table",this.exportList)
  829. const data = this.formatJson(filterVal, this.exportList)
  830. excel.export_json_to_excel({
  831. header: tHeader,
  832. data,
  833. filename: '药品入库单详情'
  834. })
  835. this.downloadLoading = false
  836. })
  837. },
  838. formatJson(filterVal, jsonData) {
  839. return jsonData.map(v => filterVal.map(j => v[j]));
  840. },
  841. }
  842. };
  843. </script>
  844. <style rel="stylesheet/css" lang="scss" scoped>
  845. .information {
  846. border: 1px #dcdfe6 solid;
  847. padding: 30px 20px 30px 20px;
  848. .border {
  849. border-bottom: 1px #dcdfe6 solid;
  850. margin: 0px 0 20px 0;
  851. }
  852. }
  853. .edit_separater {
  854. border-top: 1px solid rgb(233, 233, 233);
  855. margin-top: 15px;
  856. margin-bottom: 15px;
  857. }
  858. </style>
  859. <style>
  860. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  861. font-size: 12px;
  862. }
  863. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  864. background: #6fb5fa;
  865. }
  866. .count {
  867. color: #bd2c00;
  868. }
  869. .el-table td,
  870. .el-table th.is-leaf,
  871. .el-table--border,
  872. .el-table--group {
  873. border-color: #d0d3da;
  874. }
  875. .el-table--border::after,
  876. .el-table--group::after,
  877. .el-table::before {
  878. background-color: #d0d3da;
  879. }
  880. </style>