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

drugStockInOrder.vue 31KB

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