drugOutDetail.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. <template>
  2. <div>
  3. <el-button
  4. style="float: right"
  5. size="small"
  6. icon="el-icon-printer"
  7. @click="PrintAction"
  8. type="primary"
  9. >打印
  10. </el-button>
  11. <el-button
  12. style="float: right;margin-right:10px"
  13. size="small"
  14. @click="exportListDetai"
  15. type="primary"
  16. >明细导出
  17. </el-button>
  18. <el-button
  19. style="float: right;margin-right:10px"
  20. size="small"
  21. @click="exportList"
  22. type="primary"
  23. >汇总导出
  24. </el-button>
  25. <div class="cell clearfix">
  26. <label class="title"><span class="name">仓库</span> :</label>
  27. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeHouseList">
  28. <el-option
  29. v-for="(option, index) in houseList"
  30. :key="index"
  31. :label="option.storehouse_name"
  32. :value="option.id">
  33. </el-option>
  34. </el-select>
  35. <el-input
  36. size="small"
  37. style="width: 200px;"
  38. class="filter-item"
  39. v-model.trim="searchKey"
  40. placeholder="单据编码/制单人/药品名称"
  41. />
  42. <el-button
  43. size="small"
  44. class="filter-item"
  45. type="primary"
  46. icon="el-icon-search"
  47. @click="search"
  48. >搜索</el-button
  49. >
  50. <label class="title"><span class="name">日期查询</span> : </label>
  51. <el-date-picker
  52. size="small"
  53. v-model="start_time"
  54. prefix-icon="el-icon-date"
  55. :editable="false"
  56. style="width: 150px;"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. @change="startTimeChange"
  63. ></el-date-picker>
  64. <span class="cellLine"> - </span>
  65. <el-date-picker
  66. size="small"
  67. v-model="end_time"
  68. prefix-icon="el-icon-date"
  69. :editable="false"
  70. style="width: 150px;"
  71. type="date"
  72. placeholder="选择日期时间"
  73. align="right"
  74. format="yyyy-MM-dd"
  75. value-format="yyyy-MM-dd"
  76. @change="endTimeChange"
  77. ></el-date-picker>
  78. </div>
  79. <el-row :gutter="12" style="margin-top: 10px">
  80. <el-table
  81. :data="tableData"
  82. :class="signAndWeighBoxPatients"
  83. border
  84. highlight-current-row
  85. ref="multipleTable"
  86. @selection-change="select"
  87. :row-style="{ color: '#303133' }"
  88. :header-cell-style="{
  89. backgroundColor: 'rgb(245, 247, 250)',
  90. color: '#606266'
  91. }"
  92. >
  93. <el-table-column label="单据编号" align="center" width="200">
  94. <template slot-scope="scope">
  95. {{ scope.row.warehouse_out_order_number }}
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="药品类型" align="center">
  99. <template slot-scope="scope">
  100. <span v-if="scope.row.drug_type == 1">西药</span>
  101. <span v-if="scope.row.drug_type == 2">草药</span>
  102. <span v-if="scope.row.drug_type == 3">成药</span>
  103. <!-- {{getTypeList(scope.row.drug_type)}} -->
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="药品名称" align="center">
  107. <template slot-scope="scope">
  108. {{scope.row.drug_name}}
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="规格型号" align="center">
  112. <template slot-scope="scope">
  113. <!-- {{scope.row.drug_spec}} -->
  114. {{scope.row.specification_name}}
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="操作时间" align="center">
  118. <template slot-scope="scope">
  119. <span>{{getTime(scope.row.ctime)}}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="制单人" align="center">
  123. <template slot-scope="scope">
  124. {{getAdminUser(scope.row.creater)}}
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="仓库名称" align="center">
  128. <template slot-scope="scope">
  129. {{getStorehouseName(scope.row.storehouse_id)}}
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="出货价" align="center">
  133. <template slot-scope="scope">
  134. <span v-if="org_id == 9919">{{scope.row.last_price}} </span>
  135. <span v-else>
  136. <span v-if="scope.row.price >0"> {{scope.row.price}}</span>
  137. <span v-if="scope.row.price == 0"> {{getPrice(scope.row.drug_id)}}</span>
  138. </span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="数量" align="center">
  142. <template slot-scope="scope">
  143. {{scope.row.count}}
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="单位" align="center">
  147. <template slot-scope="scope">
  148. {{scope.row.count_unit}}
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="总价" align="center">
  152. <template slot-scope="scope">
  153. <span v-if="org_id == 9919">{{(scope.row.last_price * scope.row.count).toFixed(2)}} </span>
  154. <span v-else>
  155. <span v-if="scope.row.price >0">
  156. <span v-if="scope.row.count >= scope.row.min_number">
  157. {{((scope.row.price * scope.row.count)/scope.row.min_number).toFixed(2)}}
  158. </span>
  159. <span v-else>{{(scope.row.price * scope.row.count).toFixed(2)}}</span>
  160. </span>
  161. <span v-if="scope.row.price == 0">
  162. <span v-if="scope.row.count >=scope.row.min_number">
  163. {{((getPrice(scope.row.drug_id)* scope.row.count)/scope.row.min_number).toFixed(2)}}
  164. </span>
  165. <span v-else>{{(getPrice(scope.row.drug_id)* scope.row.count).toFixed(2)}}</span>
  166. </span>
  167. </span>
  168. <!-- {{scope.row.total_price}} -->
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. <el-pagination
  173. @size-change="handleSizeChange"
  174. @current-change="handleCurrentChange"
  175. :page-sizes="[10, 50, 100,1000]"
  176. :page-size="10"
  177. background
  178. style="margin-top:20px;float: right"
  179. layout="total, sizes, prev, pager, next, jumper"
  180. :total="total"
  181. >
  182. </el-pagination>
  183. </el-row>
  184. </div>
  185. </template>
  186. <script>
  187. import { uParseTime } from "@/utils/tools";
  188. import { fetchAllAdminUsers } from "@/api/doctor";
  189. import {GetAllConfig } from "@/api/stock";
  190. import {getDrugOutDetail,getDrugOutOrderPrint } from "@/api/drug/drug_stock"
  191. import {getBaseDrugLibList} from '@/api/data'
  192. export default {
  193. name: "stockOutDetail",
  194. created() {
  195. this.org_id = this.$store.getters.xt_user.org.id
  196. var nowDate = new Date();
  197. var nowYear = nowDate.getFullYear();
  198. var nowMonth = nowDate.getMonth() + 1;
  199. var nowDay = nowDate.getDate();
  200. this.end_time =
  201. nowYear +
  202. "-" +
  203. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  204. "-" +
  205. (nowDay < 10 ? "0" + nowDay : nowDay);
  206. nowDate.setMonth(nowDate.getMonth() - 1);
  207. nowYear = nowDate.getFullYear();
  208. nowMonth = nowDate.getMonth() + 1;
  209. nowDay = nowDate.getDate();
  210. this.start_time =
  211. nowYear +
  212. "-" +
  213. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  214. "-" +
  215. (nowDay < 10 ? "0" + nowDay : nowDay);
  216. var start_time = window.sessionStorage.getItem('start_out_time')
  217. var end_time = window.sessionStorage.getItem('end_out_time')
  218. if(start_time!=null){
  219. this.start_time = start_time
  220. }
  221. if(end_time!=null){
  222. this.end_time = end_time
  223. }
  224. this.getDrugOutOrderPrint()
  225. this.GetConfigInfo();
  226. this.fetchAllAdminUsers();
  227. this.getlist()
  228. this.getBaseDrugLibList()
  229. },
  230. data() {
  231. return {
  232. orderTypeArr: [
  233. { value: 1, label: "药品出库单" },
  234. { value: 2, label: "其他入库单" }
  235. ],
  236. manufacturer_id: "",
  237. dealer_id: "",
  238. order_type:"",
  239. searchKey: "",
  240. type: 2,
  241. page: 1,
  242. limit: 10,
  243. checked: false,
  244. total: 0,
  245. pageTotal: 0,
  246. pageSelect: 0,
  247. adminUserOptions: [],
  248. multipleSelection: [],
  249. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  250. start_time: "",
  251. cancelStockDate: [],
  252. end_time: "",
  253. goodType: [],
  254. goodInfo: [],
  255. manufacturer: [],
  256. selectedTableData: [],
  257. dealer: [],
  258. tableData:[],
  259. tableList:[],
  260. drugList:[],
  261. tablePrint:[],
  262. org_id:0,
  263. drugTypeList:[],
  264. storehouse_id:0,
  265. houseList:[],
  266. };
  267. },
  268. methods: {
  269. changeType: function(val) {
  270. this.order_type = val;
  271. this.getlist()
  272. },
  273. changeManufacturer: function(val) {
  274. this.manufacturer_id = val;
  275. this.getlist()
  276. },
  277. getTypeName: function(row) {
  278. let name = "";
  279. const name2 = "";
  280. if (row.type == 1) {
  281. name = "药品出库单";
  282. } else if (row.type == 2) {
  283. name = "其他出库单";
  284. }
  285. return name;
  286. },
  287. search: function() {
  288. this.getlist()
  289. this.getDrugOutOrderPrint()
  290. },
  291. getXuserName(id) {
  292. if (id <= 0) {
  293. return "";
  294. }
  295. var name = "";
  296. if (
  297. this.adminUserOptions == null ||
  298. typeof this.adminUserOptions.length === "undefined"
  299. ) {
  300. return name;
  301. }
  302. var leng = this.adminUserOptions.length;
  303. if (leng == 0) {
  304. return name;
  305. }
  306. for (let index = 0; index < leng; index++) {
  307. if (this.adminUserOptions[index].id == id) {
  308. name = this.adminUserOptions[index].name;
  309. break;
  310. }
  311. }
  312. return name;
  313. },
  314. fetchAllAdminUsers() {
  315. fetchAllAdminUsers().then(response => {
  316. if (response.data.state == 1) {
  317. this.adminUserOptions = response.data.data.users;
  318. }
  319. });
  320. },
  321. handleSelectionChange: function(val) {
  322. this.multipleSelection = val;
  323. },
  324. handleSizeChange(val) {
  325. this.limit = val;
  326. this.getlist()
  327. },
  328. handleCurrentChange(val) {
  329. this.page = val;
  330. this.getlist()
  331. },
  332. startTimeChange(val) {
  333. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  334. if (time > 0) {
  335. this.$message.error("结束时间不能小于开始时间");
  336. this.start_time = "";
  337. } else {
  338. this.getlist()
  339. this.getDrugOutOrderPrint()
  340. }
  341. },
  342. endTimeChange(val) {
  343. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  344. if (time < 0) {
  345. this.$message.error("结束时间不能小于开始时间");
  346. this.end_time = "";
  347. } else {
  348. this.getlist()
  349. this.getDrugOutOrderPrint()
  350. }
  351. },
  352. getTimestamp(time) {
  353. // 把时间日期转成时间戳
  354. return new Date(time).getTime() / 1000;
  355. },
  356. calculate: function(val) {
  357. return Math.round(parseFloat(val) * 100) / 100;
  358. },
  359. GetConfigInfo() {
  360. GetAllConfig().then(response => {
  361. if (response.data.state == 0) {
  362. this.$message.error(response.data.msg);
  363. return false;
  364. } else {
  365. this.manufacturer = response.data.data.manufacturer;
  366. this.dealer = response.data.data.dealer;
  367. this.goodInfo = response.data.data.goodInfo;
  368. this.goodType = response.data.data.goodType;
  369. }
  370. });
  371. },
  372. getTime: function(val) {
  373. if (val == 0) {
  374. return "";
  375. } else {
  376. return uParseTime(val, "{y}-{m}-{d}");
  377. }
  378. },
  379. PrintAction: function() {
  380. // window.sessionStorage.setItem('start_out_time',this.start_time)
  381. // window.sessionStorage.setItem('end_out_time',this.end_time)
  382. this.$router.push("/stock/drugoutorderprint?start_time="+this.start_time+"&end_time="+this.end_time+"&order_type="+2+"&manufacturer_id="+this.manufacturer_id+"&keyword="+this.keyword+"&limit="+this.limit+"&page="+this.page)
  383. },
  384. getlist(){
  385. var params = {
  386. start_time:this.start_time,
  387. end_time:this.end_time,
  388. order_type:this.order_type,
  389. manufacturer_id:this.manufacturer_id,
  390. keyword:this.searchKey,
  391. page:this.page,
  392. limit:this.limit,
  393. storehouse_id:this.storehouse_id,
  394. }
  395. getDrugOutDetail(params).then(response=>{
  396. this.tableData = []
  397. this.tableList = []
  398. if(response.data.state == 1){
  399. var order = response.data.data.order
  400. var obj = {id:0,storehouse_name:"全部"}
  401. this.houseList = []
  402. this.houseList.push(obj)
  403. for(let i=0;i<response.data.data.houseList.length;i++){
  404. this.houseList.push(response.data.data.houseList[i])
  405. }
  406. var total_price = 0
  407. for(let i=0;i<order.length;i++){
  408. order[i].specification_name = order[i].dose + order[i].dose_unit + "*" + order[i].min_number + order[i].min_unit + "/" + order[i].max_unit
  409. order[i].is_total = 0
  410. if(this.org_id == 9919){
  411. order[i].total_price = order[i].count * order[i].last_price
  412. total_price += order[i].count * order[i].last_price
  413. }else{
  414. if(order[i].price > 0){
  415. order[i].total_price = order[i].count * order[i].price
  416. total_price += order[i].count * order[i].price
  417. }
  418. if(order[i].price ==0 ){
  419. order[i].total_price = order[i].count * this.getPrice(order[i].drug_id)
  420. total_price += order[i].count * this.getPrice(order[i].drug_id)
  421. order[i].price = this.getPrice(order[i].drug_id)
  422. }
  423. }
  424. }
  425. order.push({
  426. warehouse_out_order_number: "合计",
  427. is_total: 1,
  428. specification_name:"",
  429. ctime:"",
  430. total_price:total_price,
  431. });
  432. for(let i=0;i<order.length;i++){
  433. order[i].total_price = order[i].total_price.toFixed(2)
  434. }
  435. this.tableData = order
  436. let objInfo = {}
  437. order.forEach((item,index)=>{
  438. let { drug_id } = item
  439. if( this.org_id == 9919){
  440. if(!objInfo[drug_id]){
  441. objInfo[drug_id] = {
  442. drug_id,
  443. child:[],
  444. drug_name:item.drug_name,
  445. drug_spec:item.drug_spec,
  446. min_unit:item.min_unit,
  447. count:0,
  448. price:item.last_price,
  449. remark:item.remark,
  450. total_price:0.0,
  451. dose:item.dose,
  452. dose_unit:item.dose_unit,
  453. min_number:item.min_number,
  454. max_unit:item.max_unit
  455. }
  456. }
  457. }else{
  458. if(!objInfo[drug_id]){
  459. objInfo[drug_id] = {
  460. drug_id,
  461. child:[],
  462. drug_name:item.drug_name,
  463. drug_spec:item.drug_spec,
  464. min_unit:item.min_unit,
  465. count:0,
  466. price:item.price,
  467. remark:item.remark,
  468. total_price:0.0,
  469. dose:item.dose,
  470. dose_unit:item.dose_unit,
  471. min_number:item.min_number,
  472. max_unit:item.max_unit
  473. }
  474. }
  475. }
  476. })
  477. let list = Object.values(objInfo);
  478. for(let i=0;i<order.length;i++){
  479. list.map(item=>{
  480. if(order[i].drug_id == item.drug_id){
  481. item.child.push(order[i])
  482. }
  483. })
  484. }
  485. for(let i=0;i<list.length;i++){
  486. for(let j=0;j<list[i].child.length;j++){
  487. if(list[i].child[j].count!=null || list[i].child[j].count != "" || list[i].child[j].count!=0){
  488. list[i].count += list[i].child[j].count
  489. }
  490. }
  491. }
  492. for(let i=0;i<list.length;i++){
  493. list[i].total_price = list[i].count * list[i].price
  494. }
  495. this.tableList = list
  496. var total = response.data.data.total
  497. this.total = total
  498. }
  499. })
  500. },
  501. select(){
  502. },
  503. getAdminUser(id){
  504. var name = ""
  505. for(let i=0;i<this.adminUserOptions.length;i++){
  506. if(id == this.adminUserOptions[i].id){
  507. name = this.adminUserOptions[i].name
  508. }
  509. }
  510. return name
  511. },
  512. exportList(){
  513. for(let i=0;i<this.tablePrint.length;i++){
  514. this.tablePrint[i].index = i+1
  515. }
  516. for(let i=0;i<this.tablePrint.length;i++){
  517. if(this.org_id == 9919 ){
  518. this.tablePrint[i].count = this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child)
  519. this.tablePrint[i].total_price = this.getCountSenven(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)
  520. this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
  521. this.tablePrint[i].total = this.getCountSenvenOne(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)
  522. }else{
  523. this.tablePrint[i].count = this.getCount(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_unit,this.tablePrint[i].min_number)
  524. this.tablePrint[i].total_price = this.getTotalPrice(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].min_price)
  525. this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
  526. this.tablePrint[i].total = this.getTotalPriceOne(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].min_price)
  527. }
  528. }
  529. import('@/vendor/Export2Excel').then(excel => {
  530. const tHeader = ['序号','药品名称', '规格型号', '单位','数量','单价','总价','备注']
  531. const filterVal = ['index','drug_name', 'unit', 'min_unit','count','min_price','total_price','remark']
  532. let obj = {'index':'合计','total_price':0.00}
  533. for(let i=0;i<this.tablePrint.length;i++){
  534. obj.total_price += this.tablePrint[i].total
  535. }
  536. obj.total_price = obj.total_price.toFixed(2)
  537. this.tablePrint.push(obj)
  538. const data = this.formatJson(filterVal, this.tablePrint)
  539. excel.export_json_to_excel({
  540. header: tHeader,
  541. data,
  542. filename: '药品出库明细'
  543. })
  544. this.downloadLoading = false
  545. })
  546. },
  547. formatJson(filterVal, jsonData) {
  548. return jsonData.map(v => filterVal.map(j => v[j]));
  549. },
  550. exportListDetai(){
  551. import('@/vendor/Export2Excel').then(excel => {
  552. const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','操作时间','制单人','出货价','数量','总价']
  553. const filterVal = ['index','warehouse_out_order_number', 'drugtype', 'drug_name','specification_name','time','user_name','price','count','total_price']
  554. for(let i=0;i<this.tableData.length;i++){
  555. if(this.tableData[i].is_total == 0){
  556. this.tableData[i].index = i+1
  557. if(this.tableData[i].drug_type == 1){
  558. this.tableData[i].drugtype = "西药"
  559. }
  560. if(this.tableData[i].drug_type == 2){
  561. this.tableData[i].drugtype = "草药"
  562. }
  563. if(this.tableData[i].drug_type == 3){
  564. this.tableData[i].drugtype = "成药"
  565. }
  566. // this.tableData[i].drugtype = this.getTypeList(this.tableData[i].drugtype)
  567. this.tableData[i].specification_name = this.tableData[i].dose + this.tableData[i].dose_unit +"*" + this.tableData[i].min_number + this.tableData[i].min_unit + "/" + this.tableData[i].max_unit
  568. this.tableData[i].time = this.getTime(this.tableData[i].ctime)
  569. this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
  570. if(this.org_id == 9671 || this.org_id == 9919){
  571. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].last_price)
  572. if(this.tableData[i].count >=this.tableData[i].min_number){
  573. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)/this.tableData[i].min_number
  574. }else{
  575. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)
  576. }
  577. }else{
  578. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
  579. if(this.tableData[i].count >=this.tableData[i].min_number){
  580. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)/this.tableData[i].min_number
  581. }else{
  582. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
  583. }
  584. }
  585. }
  586. }
  587. const data = this.formatJson(filterVal, this.tableData)
  588. excel.export_json_to_excel({
  589. header: tHeader,
  590. data,
  591. filename: '药品出库明细'
  592. })
  593. this.downloadLoading = false
  594. })
  595. },
  596. getBaseDrugLibList() {
  597. let params = {
  598. page: 1,
  599. limit: 1000,
  600. keyword:"",
  601. is_use: "",
  602. is_charge: "",
  603. is_inject: "",
  604. manufacturer:"",
  605. is_record:""
  606. }
  607. getBaseDrugLibList(params).then(response => {
  608. if (response.data.state == 0) {
  609. this.$message.error(response.data.msg)
  610. return false
  611. } else {
  612. this.drugList = []
  613. for (let i = 0; i < response.data.data.list.length; i++) {
  614. this.drugList.push(response.data.data.list[i])
  615. }
  616. }
  617. })
  618. },
  619. getDrugOutOrderPrint(){
  620. var params = {
  621. start_time:this.start_time,
  622. end_time:this.end_time,
  623. order_type:2,
  624. }
  625. getDrugOutOrderPrint(params).then(response=>{
  626. if(response.data.state == 1){
  627. var list = response.data.data.list
  628. let objInfo = {}
  629. if(this.org_id == 9671 || this.org_id == 9919){
  630. list.forEach((item,index)=>{
  631. let { drug_id } = item
  632. if(!objInfo[drug_id]){
  633. objInfo[drug_id] = {
  634. drug_id,
  635. child:[],
  636. drug_name:item.XtBaseDrug.drug_name,
  637. drug_spec:item.XtBaseDrug.drug_spec,
  638. min_unit:item.XtBaseDrug.min_unit,
  639. count:0,
  640. price:item.XtBaseDrug.last_price,
  641. remark:item.XtBaseDrug.remark,
  642. total_price:"",
  643. dose:item.XtBaseDrug.dose,
  644. dose_unit:item.XtBaseDrug.dose_unit,
  645. min_number:item.XtBaseDrug.min_number,
  646. max_unit:item.XtBaseDrug.max_unit,
  647. min_price:item.XtBaseDrug.min_price,
  648. }
  649. }
  650. })
  651. }else{
  652. list.forEach((item,index)=>{
  653. let { drug_id } = item
  654. if(!objInfo[drug_id]){
  655. objInfo[drug_id] = {
  656. drug_id,
  657. child:[],
  658. drug_name:item.XtBaseDrug.drug_name,
  659. drug_spec:item.XtBaseDrug.drug_spec,
  660. min_unit:item.XtBaseDrug.min_unit,
  661. count:0,
  662. price:item.XtBaseDrug.last_price,
  663. remark:item.XtBaseDrug.remark,
  664. total_price:"",
  665. dose:item.XtBaseDrug.dose,
  666. dose_unit:item.XtBaseDrug.dose_unit,
  667. min_number:item.XtBaseDrug.min_number,
  668. max_unit:item.XtBaseDrug.max_unit,
  669. min_price:item.XtBaseDrug.min_price,
  670. }
  671. }
  672. })
  673. }
  674. let newArr = Object.values(objInfo);
  675. for(let i=0;i<newArr.length;i++){
  676. for(let j=0;j<list.length;j++){
  677. if(newArr[i].drug_id == list[j].drug_id){
  678. newArr[i].child.push(list[j])
  679. }
  680. }
  681. }
  682. this.tablePrint = newArr
  683. }
  684. })
  685. },
  686. getCount(arr,max_unit,min_unit,min_number){
  687. var total = 0
  688. var str = ""
  689. var min_str = ""
  690. for(let i=0;i<arr.length;i++){
  691. if(arr[i].count_unit == max_unit){
  692. arr[i].count = arr[i].count * min_number
  693. }
  694. }
  695. for(let i=0;i<arr.length;i++){
  696. total+= arr[i].count
  697. }
  698. if(total<min_number){
  699. str = ""
  700. min_str = total + min_unit
  701. }
  702. if(total >= min_number){
  703. if(parseInt(total/min_number)!=0){
  704. str = parseInt(total/min_number)+ max_unit
  705. }
  706. if((total%min_number)!=0){
  707. min_str = total%min_number + min_unit
  708. }
  709. }
  710. return str + min_str
  711. },
  712. getTotalPrice(arr,max_unit,min_number,min_price){
  713. var total = 0
  714. for(let i=0;i<arr.length;i++){
  715. if(arr[i].count_unit == max_unit){
  716. arr[i].count = arr[i].count * min_number
  717. }else{
  718. arr[i].count = arr[i].count
  719. }
  720. }
  721. for(let j=0;j<arr.length;j++){
  722. total +=arr[j].count
  723. }
  724. return (total*min_price).toFixed(2)
  725. },
  726. getTotalPriceOne(arr,max_unit,min_number,min_price){
  727. var total = 0
  728. for(let i=0;i<arr.length;i++){
  729. if(arr[i].count_unit == max_unit){
  730. arr[i].count = arr[i].count * min_number
  731. }else{
  732. arr[i].count = arr[i].count
  733. }
  734. }
  735. for(let j=0;j<arr.length;j++){
  736. total +=arr[j].count
  737. }
  738. return total*min_price
  739. },
  740. getCountSix(drug_id,val){
  741. var count = 0
  742. for(let i=0;i<val.length;i++){
  743. count+= val[i].count
  744. }
  745. return count
  746. },
  747. getCountSenven(drug_id,val,price){
  748. var count = 0
  749. for(let i=0;i<val.length;i++){
  750. count+= val[i].count
  751. }
  752. return (count*price).toFixed(2)
  753. },
  754. getCountSenvenOne(drug_id,val,price){
  755. var count = 0
  756. for(let i=0;i<val.length;i++){
  757. count+= val[i].count
  758. }
  759. return (count*price)
  760. },
  761. getTypeList(id){
  762. var name = ""
  763. for(let i=0;i<this.drugTypeList.length;i++){
  764. if(id == this.drugTypeList[i].value){
  765. name = this.drugTypeList[i].name
  766. }
  767. }
  768. return name
  769. },
  770. getPrice(drug_id){
  771. var price = ""
  772. for(let i=0;i<this.drugList.length;i++){
  773. if(drug_id == this.drugList[i].id){
  774. price = this.drugList[i].min_price
  775. }
  776. }
  777. return price
  778. },
  779. getStorehouseName(id){
  780. var storehouse_name = ""
  781. for(let i=0;i<this.houseList.length;i++){
  782. if(id == this.houseList[i].id){
  783. storehouse_name = this.houseList[i].storehouse_name
  784. }
  785. }
  786. if(storehouse_name == "全部"){
  787. return ""
  788. }else{
  789. return storehouse_name
  790. }
  791. },
  792. changeHouseList(){
  793. this.houseList = []
  794. this.getlist()
  795. }
  796. }
  797. };
  798. </script>
  799. <style rel="stylesheet/css" lang="scss" scoped>
  800. .information {
  801. border: 1px #dcdfe6 solid;
  802. padding: 30px 20px 30px 20px;
  803. .border {
  804. border-bottom: 1px #dcdfe6 solid;
  805. margin: 0px 0 20px 0;
  806. }
  807. }
  808. .edit_separater {
  809. border-top: 1px solid rgb(233, 233, 233);
  810. margin-top: 15px;
  811. margin-bottom: 15px;
  812. }
  813. </style>
  814. <style>
  815. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  816. font-size: 12px;
  817. }
  818. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  819. background: #6fb5fa;
  820. }
  821. .count {
  822. color: #bd2c00;
  823. }
  824. .el-table td,
  825. .el-table th.is-leaf,
  826. .el-table--border,
  827. .el-table--group {
  828. border-color: #d0d3da;
  829. }
  830. .el-table--border::after,
  831. .el-table--group::after,
  832. .el-table::before {
  833. background-color: #d0d3da;
  834. }
  835. </style>