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

drugOutDetail.vue 30KB

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