drugStockOutOrder.vue 42KB

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