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

drugStockInOrder.vue 29KB

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