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

drugOutDetail.vue 30KB

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