drugStockOutOrder.vue 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287
  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="AddNewOrder"
  8. class="filter-item"
  9. style="float:right;"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增</el-button>
  13. </div>
  14. <div class="app-container">
  15. <div class="cell clearfix">
  16. <el-input
  17. size="small"
  18. style="width: 400px;"
  19. class="filter-item"
  20. v-model.trim="searchKey"
  21. placeholder="单据编码/制单人/厂商"
  22. />
  23. <el-button
  24. size="small"
  25. class="filter-item"
  26. type="primary"
  27. icon="el-icon-search"
  28. @click="search"
  29. >搜索</el-button
  30. >
  31. </div>
  32. <div class="cell clearfix">
  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 class="cell clearfix">
  63. <el-checkbox
  64. style="width: 70px"
  65. v-model="checked"
  66. @change="changeAllSelected"
  67. >全选</el-checkbox
  68. >
  69. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  70. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  71. <el-button size="small" type="primary" @click="toExport">导出</el-button>
  72. </div>
  73. <el-table
  74. @current-change="handleSearch"
  75. :data="warehouseOutDate"
  76. :class="signAndWeighBoxPatients"
  77. style="width: 100%"
  78. border
  79. highlight-current-row
  80. ref="multipleTable"
  81. @selection-change="select"
  82. :row-style="{ color: '#303133' }"
  83. :header-cell-style="{
  84. backgroundColor: 'rgb(245, 247, 250)',
  85. color: '#606266'
  86. }"
  87. >
  88. <el-table-column type="selection" width="55" align="center"> </el-table-column>
  89. <el-table-column label="单据日期" align="center">
  90. <template slot-scope="scope">
  91. {{ scope.row.warehouse_out_time | parseTime("{y}-{m}-{d}") }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="单据编号" align="center">
  95. <template slot-scope="scope">
  96. {{ scope.row.warehouse_out_order_number }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="制单人" align="center">
  100. <template slot-scope="scope">
  101. {{ getXuserName(scope.row.creater) }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column min-width="35" align="center">
  105. <template slot="header" slot-scope="scope">
  106. <span>出库方式</span>
  107. </template>
  108. <template slot-scope="scope">
  109. <span v-if="scope.row.is_sys == 1">{{"自动出库"}}</span>
  110. <span v-if="scope.row.is_sys != 1">{{"手动出库"}}</span>
  111. </template>
  112. </el-table-column>
  113. <!-- <el-table-column label="厂家" align="center">
  114. <template slot-scope="scope">
  115. {{scope.row.manufacturers ? scope.row.manufacturers.manufacturer_name:''}}
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="经销商" align="center">
  119. <template slot-scope="scope">
  120. {{scope.row.dealers ? scope.row.dealers.dealer_name:''}}
  121. </template>
  122. </el-table-column> -->
  123. <el-table-column label="操作" align="center" width="240">
  124. <template slot-scope="scope">
  125. <!-- <el-tooltip
  126. class="item"
  127. effect="dark"
  128. content="详情"
  129. placement="top"
  130. >
  131. <el-button
  132. size="small"
  133. type="warning"
  134. icon="el-icon-document"
  135. @click="handleSearch(scope.row.id,scope.row.warehouse_out_time,scope.row.warehouse_out_order_number)"
  136. >
  137. </el-button>
  138. </el-tooltip> -->
  139. <el-tooltip
  140. class="item"
  141. effect="dark"
  142. content="编辑"
  143. placement="top"
  144. >
  145. <el-button
  146. size="mini"
  147. type="primary"
  148. icon="el-icon-edit-outline"
  149. @click="handleEdit(scope.$index, scope.row)"
  150. >
  151. </el-button>
  152. </el-tooltip>
  153. <el-tooltip
  154. class="item"
  155. effect="dark"
  156. content="删除"
  157. placement="top"
  158. >
  159. <el-button
  160. size="mini"
  161. type="danger"
  162. :disabled="scope.row.is_sys == 1"
  163. icon="el-icon-delete"
  164. @click="handleDelete(scope.$index, scope.row)"
  165. >
  166. </el-button>
  167. </el-tooltip>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <el-pagination
  172. @size-change="handleSizeChange"
  173. @current-change="handleCurrentChange"
  174. :page-sizes="[5, 10, 50, 100]"
  175. :page-size="5"
  176. background
  177. style="margin-top:20px;text-align: right"
  178. layout="total, sizes, prev, pager, next, jumper"
  179. :total="total"
  180. >
  181. </el-pagination>
  182. <!-- 使用详情 -->
  183. <div v-show="tableShow" style="margin-top:10px">
  184. <el-table
  185. :data="tableList"
  186. :class="signAndWeighBoxPatients"
  187. style="width: 100%"
  188. border
  189. highlight-current-row
  190. ref="multipleTableOne"
  191. @selection-change="select"
  192. :row-style="{ color: '#303133' }"
  193. :header-cell-style="{
  194. backgroundColor: 'rgb(245, 247, 250)',
  195. color: '#606266'
  196. }"
  197. >
  198. <el-table-column label="药品名称" align="center">
  199. <template slot-scope="scope">
  200. {{scope.row.drug_name}}
  201. </template>
  202. </el-table-column>
  203. <el-table-column label="药品类型" align="center">
  204. <template slot-scope="scope">
  205. {{getDrugType(scope.row.drug_type)}}
  206. </template>
  207. </el-table-column>
  208. <el-table-column label="规格&单位" align="center">
  209. <template slot-scope="scope">
  210. {{scope.row.dose}}&nbsp;{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  211. </template>
  212. </el-table-column>
  213. <el-table-column label="批号" align="center">
  214. <template slot-scope="scope">
  215. <span v-if="scope.row.batch_number!=''">{{scope.row.batch_number}}</span>
  216. <span v-if="scope.row.batch_number == '0'"></span>
  217. </template>
  218. </el-table-column>
  219. <el-table-column label="出库数量" align="center">
  220. <template slot-scope="scope">
  221. {{getTotalCount(scope.row.drug_id)}}
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="出货单价" align="center">
  225. <template slot-scope="scope">
  226. {{scope.row.price}}
  227. </template>
  228. </el-table-column>
  229. <el-table-column label="拆零零售价" align="center">
  230. <template slot-scope="scope">
  231. {{scope.row.min_price}}
  232. </template>
  233. </el-table-column>
  234. <el-table-column label="总价" align="center">
  235. <template slot-scope="scope">
  236. <span>{{getAllPrice(scope.row.drug_id,scope.row.price,scope.row.min_price).toFixed(2)}}</span>
  237. </template>
  238. </el-table-column>
  239. <el-table-column label="生产厂家" align="center">
  240. <template slot-scope="scope">
  241. {{getManufacturerName(scope.row.manufacturer)}}
  242. </template>
  243. </el-table-column>
  244. <el-table-column label="生产日期" align="center">
  245. <template slot-scope="scope">
  246. {{getTime(scope.row.product_date)}}
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="有效日期" align="center">
  250. <template slot-scope="scope">
  251. {{getTime(scope.row.expiry_date)}}
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="经销商" align="center">
  255. <template slot-scope="scope">
  256. {{getDealerName(scope.row.dealer)}}
  257. </template>
  258. </el-table-column>
  259. <el-table-column label="批准文号" align="center">
  260. <template slot-scope="scope">
  261. <span v-if="scope.row.number!=''">{{scope.row.number}}</span>
  262. <span v-if="scope.row.number == '0'"></span>
  263. </template>
  264. </el-table-column>
  265. <el-table-column label="备注" align="center">
  266. <template slot-scope="scope">
  267. {{scope.row.remark}}
  268. </template>
  269. </el-table-column>
  270. <el-table-column label="操作" align="center">
  271. <template slot-scope="scope">
  272. <span style="color: #589ff8" @click="toDetail(scope.row)">使用明细</span>
  273. </template>
  274. </el-table-column>
  275. </el-table>
  276. </div>
  277. </div>
  278. <el-dialog
  279. title="提示"
  280. :visible.sync="drugDialogVisible"
  281. width="90%">
  282. <span>
  283. <el-table :data="userList" :class="signAndWeighBoxPatients" style="width: 50%"
  284. border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  285. >
  286. <el-table-column min-width="35" align="center">
  287. <template slot="header" slot-scope="scope">
  288. <span>序号</span>
  289. </template>
  290. <template slot-scope="scope">
  291. <span v-if="scope.row.is_total == 0">{{scope.$index+1}}</span>
  292. <span v-if="scope.row.is_total == 1">{{'合计'}}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column min-width="35" align="center">
  296. <template slot="header" slot-scope="scope">
  297. <span>使用人</span>
  298. </template>
  299. <template slot-scope="scope">
  300. <span v-if="scope.row.is_total == 0">{{scope.row.user.name}}</span>
  301. <span v-if="scope.row.is_total == 1"></span>
  302. </template>
  303. </el-table-column>
  304. <el-table-column min-width="35" align="center">
  305. <template slot="header" slot-scope="scope">
  306. <span>使用数量</span>
  307. </template>
  308. <template slot-scope="scope">
  309. <span >{{scope.row.count}}{{scope.row.count_unit}}</span>
  310. <span v-if="scope.row.is_total == 1">{{scope.row.total}}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column min-width="35" align="center">
  314. <template slot="header" slot-scope="scope">
  315. <span>使用时间</span>
  316. </template>
  317. <template slot-scope="scope">
  318. <span v-if="scope.row.is_total == 0">{{scope.row.ctime | parseTime('{y}-{m}-{d} {h}:{i}')}} </span>
  319. </template>
  320. </el-table-column>
  321. <el-table-column min-width="35" align="center">
  322. <template slot="header" slot-scope="scope">
  323. <span>批次号</span>
  324. </template>
  325. <template slot-scope="scope">
  326. <span>{{getDrugBatchNumber(scope.row.id)}}</span>
  327. </template>
  328. </el-table-column>
  329. </el-table>
  330. </span>
  331. <span slot="footer" class="dialog-footer">
  332. <el-button @click="drugDialogVisible = false">取 消</el-button>
  333. <el-button type="primary" @click="drugDialogVisible = false">确 定</el-button>
  334. </span>
  335. </el-dialog>
  336. <el-dialog
  337. title="提示"
  338. :visible.sync="drugDialogVisibleTwo"
  339. width="90%">
  340. <span>
  341. <el-table :data="userListOne" :class="signAndWeighBoxPatients" style="width: 50%"
  342. border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  343. >
  344. <el-table-column min-width="35" align="center">
  345. <template slot="header" slot-scope="scope">
  346. <span>序号</span>
  347. </template>
  348. <template slot-scope="scope">
  349. {{scope.$index+1}}
  350. </template>
  351. </el-table-column>
  352. <el-table-column min-width="35" align="center">
  353. <template slot="header" slot-scope="scope">
  354. <span>使用人</span>
  355. </template>
  356. <template slot-scope="scope">
  357. <span>系统</span>
  358. </template>
  359. </el-table-column>
  360. <el-table-column min-width="35" align="center">
  361. <template slot="header" slot-scope="scope">
  362. <span>使用数量</span>
  363. </template>
  364. <template slot-scope="scope">
  365. {{scope.row.count}}
  366. </template>
  367. </el-table-column>
  368. <el-table-column min-width="35" align="center">
  369. <template slot="header" slot-scope="scope">
  370. <span>使用时间</span>
  371. </template>
  372. <template slot-scope="scope">
  373. <span>{{scope.row.ctime | parseTime('{y}-{m}-{d} {h}:{i}')}} </span>
  374. </template>
  375. </el-table-column>
  376. <el-table-column min-width="35" align="center">
  377. <template slot="header" slot-scope="scope">
  378. <span>批号</span>
  379. </template>
  380. <template slot-scope="scope">
  381. <span>{{scope.row.batch_number}} </span>
  382. </template>
  383. </el-table-column>
  384. </el-table>
  385. </span>
  386. <span slot="footer" class="dialog-footer">
  387. <el-button @click="drugDialogVisibleTwo = false">取 消</el-button>
  388. <el-button type="primary" @click="drugDialogVisibleTwo = false">确 定</el-button>
  389. </span>
  390. </el-dialog>
  391. </div>
  392. </template>
  393. <script>
  394. import { uParseTime } from "@/utils/tools";
  395. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  396. import {
  397. deleteDrugWarehouseOut,
  398. GetAllConfig,
  399. getDrugWarehouseOutList,
  400. getDrugWarehouseOutUser,
  401. getDrugAutoMaticList,
  402. getSinleOrderDetail,
  403. getAutoDrugDetail,
  404. getDrugCountList,
  405. getExportOutOrderDrugList
  406. } from "@/api/drug/drug_stock";
  407. import BreadCrumb from "../../components/bread-crumb";
  408. import { getInitializtion } from '@/api/stock'
  409. export default {
  410. name: "salesReturnOrder",
  411. components: { BreadCrumb },
  412. created() {
  413. var nowDate = new Date();
  414. var nowYear = nowDate.getFullYear();
  415. var nowMonth = nowDate.getMonth() + 1;
  416. var nowDay = nowDate.getDate();
  417. this.end_time =
  418. nowYear +
  419. "-" +
  420. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  421. "-" +
  422. (nowDay < 10 ? "0" + nowDay : nowDay);
  423. nowDate.setMonth(nowDate.getMonth() - 1);
  424. nowYear = nowDate.getFullYear();
  425. nowMonth = nowDate.getMonth() + 1;
  426. nowDay = nowDate.getDate();
  427. this.start_time =
  428. nowYear +
  429. "-" +
  430. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  431. "-" +
  432. (nowDay < 10 ? "0" + nowDay : nowDay);
  433. this.GetWarehouseOut();
  434. this.fetchAllAdminUsers();
  435. this.getDrugCountList()
  436. this.getInitializtion()
  437. },
  438. data() {
  439. return {
  440. searchKey: "",
  441. crumbs: [
  442. { path: false, name: "库存管理" },
  443. { path: false, name: "出库单" }
  444. ],
  445. page: 1,
  446. limit: 5,
  447. checked: false,
  448. total: 0,
  449. pageTotal: 0,
  450. pageSelect: 0,
  451. adminUserOptions: [],
  452. multipleSelection: [],
  453. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  454. start_time: "",
  455. warehouseOutDate: [],
  456. end_time: "",
  457. goodType: [],
  458. goodInfo: [],
  459. manufacturer: [],
  460. selectedTableData: [],
  461. dealer: [],
  462. type: 1,
  463. dialogVisible:false,
  464. dialogVisibleTwo:false,
  465. warehousingOutInfo: {
  466. loading: false,
  467. warehousingOutData: [],
  468. info: {}
  469. },
  470. userList:[],
  471. list:[],
  472. drugConfig:{},
  473. drugList:[],
  474. tableList:[],
  475. drugTypeList:[],
  476. tableShow:false,
  477. manufacturerList:[],
  478. drugDialogVisible:false,
  479. drugDialogVisibleTwo:false,
  480. order_id:0,
  481. dealerList:[],
  482. countList:[],
  483. outCountList:[],
  484. autoCountList:[],
  485. keyword:"",
  486. drug_type:0,
  487. minCount:[],
  488. drugOutList:[],
  489. outList:[],
  490. userListOne:[],
  491. exportList:[]
  492. };
  493. },
  494. methods: {
  495. search: function() {
  496. const Params = {
  497. page: this.page,
  498. limit: this.limit,
  499. start_time: this.start_time,
  500. end_time: this.end_time,
  501. type: this.type,
  502. keywords: this.searchKey
  503. };
  504. this.warehouseOutDate = [];
  505. getDrugWarehouseOutList(Params).then(response => {
  506. if (response.data.state == 0) {
  507. this.$message.error(response.data.msg);
  508. return false;
  509. } else {
  510. this.total = response.data.data.total;
  511. for (let i = 0; i < response.data.data.list.length; i++) {
  512. this.warehouseOutDate.push(response.data.data.list[i]);
  513. }
  514. }
  515. });
  516. },
  517. AddNewOrder: function() {
  518. this.$router.push({
  519. name: "drugStockOutOrderAdd",
  520. query: { type: this.type }
  521. });
  522. },
  523. GetWarehouseOut: function() {
  524. const Params = {
  525. page: this.page,
  526. limit: this.limit,
  527. start_time: this.start_time,
  528. end_time: this.end_time,
  529. type: this.type,
  530. keywords: this.searchKey
  531. };
  532. this.warehouseOutDate = [];
  533. getDrugWarehouseOutList(Params).then(response => {
  534. if (response.data.state == 0) {
  535. this.$message.error(response.data.msg);
  536. return false;
  537. } else {
  538. this.total = response.data.data.total;
  539. for (let i = 0; i < response.data.data.list.length; i++) {
  540. this.warehouseOutDate.push(response.data.data.list[i]);
  541. }
  542. }
  543. });
  544. },
  545. getXuserName(id) {
  546. if (id <= 0) {
  547. return "";
  548. }
  549. var name = "";
  550. if (
  551. this.adminUserOptions == null ||
  552. typeof this.adminUserOptions.length === "undefined"
  553. ) {
  554. return name;
  555. }
  556. var leng = this.adminUserOptions.length;
  557. if (leng == 0) {
  558. return name;
  559. }
  560. for (let index = 0; index < leng; index++) {
  561. if (this.adminUserOptions[index].id == id) {
  562. name = this.adminUserOptions[index].name;
  563. break;
  564. }
  565. }
  566. return name;
  567. },
  568. fetchAllAdminUsers() {
  569. fetchAllAdminUsers().then(response => {
  570. if (response.data.state == 1) {
  571. this.adminUserOptions = response.data.data.users;
  572. var alen = this.adminUserOptions.length;
  573. for (let index = 0; index < alen; index++) {
  574. if (this.adminUserOptions[index].user_type == 2) {
  575. // this.doctorOptions.push(this.adminUserOptions[index]);
  576. }
  577. }
  578. }
  579. });
  580. },
  581. handleSelectionChange: function(val) {
  582. this.multipleSelection = val;
  583. },
  584. handleSizeChange(val) {
  585. this.limit = val;
  586. this.GetWarehouseOut();
  587. },
  588. handleCurrentChange(val) {
  589. this.page = val;
  590. this.GetWarehouseOut();
  591. },
  592. startTimeChange(val) {
  593. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  594. if (time > 0) {
  595. this.$message.error("结束时间不能小于开始时间");
  596. this.start_time = "";
  597. } else {
  598. this.GetWarehouseOut();
  599. }
  600. this.GetWarehouseOut();
  601. },
  602. endTimeChange(val) {
  603. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  604. if (time < 0) {
  605. this.$message.error("结束时间不能小于开始时间");
  606. this.end_time = "";
  607. } else {
  608. this.GetWarehouseOut();
  609. }
  610. },
  611. getTimestamp(time) {
  612. // 把时间日期转成时间戳
  613. return new Date(time).getTime() / 1000;
  614. },
  615. calculate: function(val) {
  616. return Math.round(parseFloat(val) * 100) / 100;
  617. },
  618. GetConfigInfo: function() {
  619. GetAllConfig().then(response => {
  620. if (response.data.state == 0) {
  621. this.$message.error(response.data.msg);
  622. return false;
  623. } else {
  624. this.manufacturer = response.data.data.manufacturer;
  625. this.dealer = response.data.data.dealer;
  626. }
  627. });
  628. },
  629. handleEdit: function(index, row) {
  630. this.$router.push({path:"/drug/out/drugstockoutorderedit?id="+row.id+"&type="+this.type+"&is_sys="+row.is_sys})
  631. },
  632. handleSearch(val){
  633. this.getInitializtion()
  634. this.getSinleOrderDetail(val.id)
  635. this.list = []
  636. // this.getDrugAutoMaticList(val.id,val.time,val.warehouse_out_order_number)
  637. },
  638. handleDelete: function(index, row) {
  639. const ids = [];
  640. ids.push(row.id);
  641. const idStr = ids.join(",");
  642. const params = {
  643. ids: idStr
  644. };
  645. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  646. confirmButtonText: "确定",
  647. cancelButtonText: "取消",
  648. type: "warning"
  649. })
  650. .then(() => {
  651. deleteDrugWarehouseOut(params).then(response => {
  652. if (response.data.state == 0) {
  653. this.$message.error(response.data.msg);
  654. return false;
  655. } else {
  656. this.$notify({
  657. title: "成功",
  658. message: "删除成功",
  659. type: "success",
  660. duration: 2000
  661. });
  662. for (let i = 0; i < ids.length; i++) {
  663. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  664. if (ids[i] == this.warehouseOutDate[y].id) {
  665. this.warehouseOutDate.splice(y, 1);
  666. }
  667. }
  668. }
  669. }
  670. });
  671. })
  672. .catch(() => {});
  673. },
  674. changeAllSelected: function(val) {
  675. if (val) {
  676. this.$refs.multipleTable.toggleAllSelection();
  677. } else {
  678. this.$refs.multipleTable.clearSelection();
  679. }
  680. },
  681. select(selection) {
  682. var ids= []
  683. for(let i=0;i<selection.length;i++){
  684. ids.push(selection[i].id)
  685. }
  686. this.order_id = ids.join(",")
  687. this.selectedTableData = selection;
  688. this.getExportOutOrderDrugList()
  689. },
  690. batchDelete() {
  691. if (this.selectedTableData.length <= 0) {
  692. this.$message.error("请选择要删除的记录");
  693. return;
  694. }
  695. const ids = [];
  696. for (let i = 0; i < this.selectedTableData.length; i++) {
  697. if(this.selectedTableData[i].is_sys == 0){
  698. ids.push(this.selectedTableData[i].id);
  699. }
  700. }
  701. const idStr = ids.join(",");
  702. const params = {
  703. ids: idStr
  704. };
  705. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  706. confirmButtonText: "确定",
  707. cancelButtonText: "取消",
  708. type: "warning"
  709. }).then(() => {
  710. deleteDrugWarehouseOut(params).then(response => {
  711. if (response.data.state == 0) {
  712. this.$message.error(response.data.msg);
  713. return false;
  714. } else {
  715. this.$notify({
  716. title: "成功",
  717. message: "删除成功",
  718. type: "success",
  719. duration: 2000
  720. });
  721. for (let i = 0; i < ids.length; i++) {
  722. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  723. if (ids[i] == this.warehouseOutDate[y].id) {
  724. this.warehouseOutDate.splice(y, 1);
  725. }
  726. }
  727. }
  728. }
  729. });
  730. })
  731. .catch(() => {});
  732. },
  733. jump(id){
  734. this.GetOrderDetailTwo(id)
  735. this.userList=[]
  736. this.dialogVisibleTwo = true
  737. },
  738. GetOrderDetailTwo(order_id) {
  739. const params = {
  740. 'id': order_id
  741. }
  742. getDrugWarehouseOutUser(params).then(response => {
  743. if (response.data.state == 0) {
  744. this.$message.error(response.data.msg)
  745. return false
  746. } else {
  747. this.userList=[]
  748. var total = 0
  749. for (let i = 0; i < response.data.data.list.length; i++) {
  750. var obj = response.data.data.list[i]
  751. obj['is_total'] = 0
  752. this.userList.push(obj)
  753. total = total + response.data.data.list[i].count
  754. }
  755. this.userList.push({
  756. is_total: 1,
  757. total: total,
  758. })
  759. }
  760. })
  761. },
  762. merge({ row, column, rowIndex, columnIndex }) {
  763. if (columnIndex === 0) {
  764. const _row = this.tempArr[rowIndex]
  765. const _col = _row > 0 ? 1 : 0
  766. return {
  767. rowspan: _row,
  768. colspan: _col
  769. }
  770. }
  771. },
  772. handleSpanTempArr(){
  773. this.tempArr = []
  774. for (let i = 0; i < this.warehousingOutInfo.warehousingOutData.length; i++) {
  775. if (i === 0) {
  776. this.tempArr.push(1)
  777. this.pos = 0
  778. } else {
  779. // 判断当前元素与上一个元素是否相同
  780. if (this.warehousingOutInfo.warehousingOutData[i].drug_id === this.warehousingOutInfo.warehousingOutData[i - 1].drug_id) {
  781. this.tempArr[this.pos] += 1
  782. this.tempArr.push(0)
  783. } else {
  784. this.tempArr.push(1)
  785. this.pos = i
  786. }
  787. }
  788. }
  789. let sameRowArr = [], sIdx = 0
  790. this.warehousingOutInfo.warehousingOutData.forEach((item, index) => {
  791. item.index = index
  792. if (index === 0) {
  793. sameRowArr.push([index])
  794. } else {
  795. if (item.drug_id === this.warehousingOutInfo.warehousingOutData[index - 1].drug_id) {
  796. sameRowArr[sIdx].push(index)
  797. } else {
  798. sIdx = sIdx + 1
  799. sameRowArr.push([index])
  800. }
  801. }
  802. })
  803. this.sameRowArr = sameRowArr
  804. },
  805. getDrugAutoMaticList(id,recordTime,warehouse_out_order_number){
  806. var params = {
  807. warehous_out_id:id,
  808. record_time:recordTime,
  809. warehouse_out_order_number:warehouse_out_order_number,
  810. }
  811. getDrugAutoMaticList(params).then(response=>{
  812. if(response.data.state ==1){
  813. var list = response.data.data.list
  814. this.list = list
  815. var drugConfig = response.data.data.drugConfig
  816. this.drugConfig = drugConfig
  817. var drugList = response.data.data.drugList
  818. this.drugList = drugList
  819. var manulist = response.data.data.manufacturerList
  820. this.manufacturerList = manulist
  821. }
  822. })
  823. },
  824. getDrugCount(id){
  825. var count = 0
  826. for(let i=0;i<this.list.length;i++){
  827. if(this.list[i].drug_id == id){
  828. count = this.list[i].Total
  829. }
  830. }
  831. return count
  832. },
  833. getRetailPrice(id){
  834. var price = 0
  835. for(let i=0;i<this.drugList.length;i++){
  836. if(id == this.drugList[i].id){
  837. price = this.drugList[i].retail_price
  838. }
  839. }
  840. return price
  841. },
  842. getTime(val) {
  843. if(val < 0){
  844. return ""
  845. }
  846. if(val == ""){
  847. return ""
  848. }else {
  849. return uParseTime(val, '{y}-{m}-{d}')
  850. }
  851. },
  852. getInitializtion(){
  853. getInitializtion().then(response=>{
  854. if(response.data.state ==1){
  855. var drugTypeList = response.data.data.drugTypeList
  856. this.drugTypeList = drugTypeList
  857. }
  858. })
  859. },
  860. getDrugType(id){
  861. var name = ""
  862. for(let i=0;i<this.drugTypeList.length;i++){
  863. if(id == this.drugTypeList[i].value){
  864. name = this.drugTypeList[i].name
  865. }
  866. }
  867. return name
  868. },
  869. getManufacturerName(id){
  870. var name = ""
  871. for(let i=0;i<this.manufacturerList.length;i++){
  872. if(id == this.manufacturerList[i].id){
  873. name = this.manufacturerList[i].manufacturer_name
  874. }
  875. }
  876. return name
  877. },
  878. getDealerName(id){
  879. var name = ""
  880. for(let i=0;i<this.dealerList.length;i++){
  881. if(id == this.dealerList[i].id){
  882. name = this.dealerList[i].dealer_name
  883. }
  884. }
  885. return name
  886. },
  887. getSinleOrderDetail(id){
  888. var params = {
  889. id:id,
  890. }
  891. getSinleOrderDetail(params).then(response=>{
  892. if(response.data.state == 1){
  893. this.tableShow = true
  894. this.tableList = []
  895. var list = response.data.data.list
  896. var outList = response.data.data.outList
  897. for(let i=0;i<outList.length;i++){
  898. //如果都是最大单位,把最数量转为最小数量
  899. if(outList[i].count_unit == outList[i].max_unit){
  900. outList[i].count = outList[i].min_number * outList[i].count
  901. }
  902. }
  903. this.outList = outList
  904. console.log("outList222",outList)
  905. this.manufacturerList = response.data.data.manufacturerList
  906. this.dealerList = response.data.data.dealerList
  907. for(let i=0;i<list.length;i++){
  908. if(list[i].batch_number == "0" || list[i].batch_number == 0){
  909. list[i].batch_number = ""
  910. }
  911. if(list[i].number == "0" || list[i].number == 0){
  912. list[i].number = ""
  913. }
  914. }
  915. this.tableList = list
  916. }
  917. })
  918. },
  919. toDetail(val){
  920. console.log("val",val)
  921. var params = {
  922. warehouse_out_id:val.warehouse_out_id,
  923. drug_id:val.drug_id,
  924. record_time:val.sys_record_time,
  925. }
  926. this.userList = []
  927. getAutoDrugDetail(params).then(response=>{
  928. if(response.data.state == 1){
  929. console.log("list23232323232",response.data.data.list)
  930. var total = 0
  931. for (let i = 0; i < response.data.data.list.length; i++) {
  932. var obj = response.data.data.list[i]
  933. obj['is_total'] = 0
  934. this.userList.push(obj)
  935. var str = 0
  936. var max_unit = ""
  937. var min_unit = ""
  938. var number = 0
  939. var min_str = 0
  940. for(let i=0;i<response.data.data.list.length;i++){
  941. min_str = response.data.data.list[0].drug.min_str
  942. max_unit = response.data.data.list[0].drug.max_unit
  943. min_unit = response.data.data.list[0].drug.min_unit
  944. number = response.data.data.list[0].drug.min_number
  945. if(response.data.data.list[i].count_unit == response.data.data.list[i].drug.max_unit){
  946. response.data.data.list[i].count = response.data.data.list[i].count * response.data.data.list[i].drug.min_number
  947. }
  948. }
  949. var total_count = 0
  950. for(let i=0;i<response.data.data.list.length;i++){
  951. total_count += response.data.data.list[i].count
  952. }
  953. console.log("总规格2323232",total_count,number)
  954. if(parseInt(total_count)!=0){
  955. str = parseInt(total_count/number)
  956. }
  957. if(parseInt(total_count)!=0){
  958. min_str = parseInt(total_count)%number
  959. }
  960. total = str + max_unit + min_str + min_unit
  961. console.log("h2hh2h323",str,min_str)
  962. }
  963. this.userList.push({
  964. is_total: 1,
  965. total: total,
  966. })
  967. if(val.is_sys == 1){
  968. this.drugDialogVisible = true
  969. }
  970. if(val.is_sys == 0){
  971. this.drugDialogVisibleTwo = true
  972. }
  973. var userListOne = response.data.data.outList
  974. console.log("手动出库2232332",userListOne)
  975. this.userListOne = userListOne
  976. }
  977. })
  978. },
  979. toPrint(){
  980. if(this.order_id == 0){
  981. this.$message.error("请选择出库单")
  982. }else{
  983. this.$router.push({path:"/stock/drugStockOutOrderDetailPrint?id="+this.order_id})
  984. }
  985. },
  986. getDrugCountList(){
  987. var params = {
  988. keyword: this.keywords,
  989. start_time:this.start_time,
  990. end_time:this.end_time,
  991. }
  992. console.log("paramsw2ww",params)
  993. getDrugCountList(params).then(response=>{
  994. if(response.data.state == 1){
  995. var countlist = response.data.data.countList
  996. // console.log("入库数据",countlist)
  997. this.countList = countlist
  998. var outcountlist = response.data.data.outCountList
  999. // console.log("出库数据",outcountlist)
  1000. this.outCountList = outcountlist
  1001. var aucountlist = response.data.data.auCountList
  1002. // console.log("自动数据",aucountlist)
  1003. this.autoCountList = aucountlist
  1004. var minCount = response.data.data.minCount
  1005. // console.log("minCount",minCount)
  1006. this.minCount = minCount
  1007. var info = response.data.data.info
  1008. for(let i=0;i<info.length;i++){
  1009. if(info[i].count_unit == info[i].max_unit){
  1010. info[i].count = info[i].count * info[i].min_number
  1011. }
  1012. }
  1013. // console.log("info2222222",info)
  1014. this.drugOutList = info
  1015. }
  1016. })
  1017. },
  1018. getCount(drug_id,min_number,max_unit,min_unit){
  1019. var count= 0
  1020. var str = ""
  1021. var min_str = ""
  1022. for(let i=0;i<this.drugOutList.length;i++){
  1023. if(drug_id == this.drugOutList[i].drug_id){
  1024. count += parseInt(this.drugOutList[i].count)
  1025. }
  1026. }
  1027. if(parseInt(count/min_number)!=0){
  1028. str = parseInt(count/min_number)+ max_unit
  1029. }
  1030. if((count%min_number)!=0){
  1031. min_str = count%min_number + min_unit
  1032. }
  1033. return str + min_str
  1034. },
  1035. getTotalCount(drug_id){
  1036. var str = ""
  1037. var min_str = ""
  1038. for(let i=0;i<this.outList.length;i++){
  1039. if(this.outList[i].drug_id == drug_id){
  1040. if(parseInt(this.outList[i].count/this.outList[i].min_number)!=0){
  1041. str = parseInt(this.outList[i].count/this.outList[i].min_number)+ this.outList[i].max_unit
  1042. }
  1043. if((this.outList[i].count%this.outList[i].min_number)!=0){
  1044. min_str = this.outList[i].count%this.outList[i].min_number + this.outList[i].min_unit
  1045. }
  1046. }
  1047. }
  1048. return str + min_str
  1049. },
  1050. getAllPrice(drug_id,price,min_price){
  1051. var strprice = 0
  1052. var minstrprice = 0
  1053. var str = ""
  1054. var min_str = ""
  1055. var total_price = 0
  1056. for(let i=0;i<this.outList.length;i++){
  1057. if(this.outList[i].drug_id == drug_id){
  1058. if(parseInt(this.outList[i].count/this.outList[i].min_number)!=0){
  1059. str = parseInt(this.outList[i].count/this.outList[i].min_number)
  1060. }
  1061. if((this.outList[i].count%this.outList[i].min_number)!=0){
  1062. min_str = this.outList[i].count%this.outList[i].min_number
  1063. }
  1064. }
  1065. }
  1066. strprice = str * price
  1067. minstrprice = min_str * min_price
  1068. total_price = strprice + minstrprice
  1069. return total_price
  1070. },
  1071. getDrugBatchNumber(id){
  1072. var arr= []
  1073. var batchNumber =[]
  1074. for(let i=0;i<this.userList.length;i++){
  1075. if(id == this.userList[i].id){
  1076. arr.push(this.userList[i].drugwarehouseoutinfo)
  1077. }
  1078. }
  1079. if(batchNumber.length > 0 ){
  1080. for(let j=0;j<arr.length;j++){
  1081. batchNumber.push(arr[j].batch_number)
  1082. }
  1083. }
  1084. return batchNumber.join(",")
  1085. },
  1086. getExportOutOrderDrugList(){
  1087. var params = {
  1088. order_id:this.order_id
  1089. }
  1090. getExportOutOrderDrugList(params).then(response=>{
  1091. if(response.data.state == 1){
  1092. var list = response.data.data.list
  1093. console.log("list22222",list)
  1094. this.exportList = list
  1095. this.manufacturerList = response.data.data.manufacturerList
  1096. this.dealerList = response.data.data.dealerList
  1097. }
  1098. })
  1099. },
  1100. toExport(){
  1101. if(this.order_id == ""){
  1102. this.$message.error("请勾选出库单")
  1103. return
  1104. }
  1105. for(let i=0;i<this.exportList.length;i++){
  1106. 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
  1107. this.exportList[i].total_price = (this.exportList[i].count * this.exportList[i].price).toFixed(2)
  1108. this.exportList[i].expiry_date = this.getTime(this.exportList[i].expiry_date,"{y}-{h}-{d}")
  1109. this.exportList[i].product_date = this.getTime(this.exportList[i].product_date,"{y}-{h}-{d}")
  1110. for(let j=0;j<this.manufacturerList.length;j++){
  1111. if(this.exportList[i].manufacturer == this.manufacturerList[j].id){
  1112. this.exportList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  1113. }
  1114. }
  1115. for(let z=0;z<this.dealerList.length;z++){
  1116. if(this.exportList[i].dealer == this.dealerList[z].id){
  1117. this.exportList[i].dealer = this.dealerList[z].dealer_name
  1118. }
  1119. }
  1120. }
  1121. console.log("23232323",this.exportList)
  1122. console.log("了下23",this.drugTypeList)
  1123. import('@/vendor/Export2Excel').then(excel => {
  1124. for(let i=0;i<this.exportList.length;i++){
  1125. for(let j=0;j<this.drugTypeList.length;j++){
  1126. if(this.exportList[i].drug_type == this.drugTypeList[j].value){
  1127. this.exportList[i].drug_type = this.drugTypeList[j].name
  1128. }
  1129. }
  1130. }
  1131. const tHeader = ['药品名称','药品类型','规格&单位', '批号','出库数量','出货单价','拆零零售价','总价','生产厂家','生产日期','有效日期','经销商','批准文号','备注']
  1132. const filterVal = ['drug_name','drug_type','unit','batch_number', 'count','price','min_price','total_price','manufacturer','product_date','expiry_date','dealer','number','remark']
  1133. console.log("table",this.exportList)
  1134. const data = this.formatJson(filterVal, this.exportList)
  1135. excel.export_json_to_excel({
  1136. header: tHeader,
  1137. data,
  1138. filename: '药品出库单详情'
  1139. })
  1140. this.downloadLoading = false
  1141. })
  1142. },
  1143. formatJson(filterVal, jsonData) {
  1144. return jsonData.map(v => filterVal.map(j => v[j]));
  1145. },
  1146. }
  1147. };
  1148. </script>
  1149. <style rel="stylesheet/scss" lang="scss">
  1150. .app-container {
  1151. // margin: 20px;
  1152. font-size: 15px;
  1153. .filter-container {
  1154. padding-bottom: 5px;
  1155. }
  1156. .search-component {
  1157. width: 500px;
  1158. .searchBox {
  1159. width: 300px;
  1160. height: 36px;
  1161. line-height: 36px;
  1162. padding-left: 15px;
  1163. border: 1px #dcdfe6 solid;
  1164. border-right: none;
  1165. outline: none;
  1166. float: left;
  1167. border-radius: 6px 0 0 6px;
  1168. font-size: 14px;
  1169. color: #333;
  1170. background: #fff;
  1171. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  1172. }
  1173. .searchBtn {
  1174. background-color: #409eff;
  1175. color: #fff;
  1176. font-size: 15px;
  1177. text-align: center;
  1178. height: 36px;
  1179. line-height: 36px;
  1180. float: left;
  1181. outline: none;
  1182. width: 70px;
  1183. border: none;
  1184. border-radius: 0 6px 6px 0;
  1185. font-family: "Microsoft Yahei";
  1186. cursor: pointer;
  1187. }
  1188. }
  1189. .amount {
  1190. font-weight: normal;
  1191. padding: 10px 0 0 0;
  1192. color: #606266;
  1193. font-size: 14px;
  1194. span {
  1195. color: #ef2525;
  1196. font-family: "Arial";
  1197. padding: 0 2px;
  1198. }
  1199. }
  1200. }
  1201. .el-table td,
  1202. .el-table th.is-leaf,
  1203. .el-table--border,
  1204. .el-table--group {
  1205. border-color: #d0d3da;
  1206. }
  1207. .el-table--border::after,
  1208. .el-table--group::after,
  1209. .el-table::before {
  1210. background-color: #d0d3da;
  1211. }
  1212. </style>