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

drugOutDetail.vue 41KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  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. v-if="org_id != 10265 && org_id!=0&&org_id!=10480"
  13. style="float: right;margin-right:10px"
  14. size="small"
  15. @click="exportListDetai"
  16. type="primary"
  17. >明细导出
  18. </el-button>
  19. <el-button
  20. v-if="org_id == 10265"
  21. style="float: right;margin-right:10px"
  22. size="small"
  23. @click="exportListDetaiOne"
  24. type="primary"
  25. >明细导出
  26. </el-button>
  27. <el-button
  28. v-if="org_id == 10480 || org_id == 0"
  29. style="float: right;margin-right:10px"
  30. size="small"
  31. @click="exportListDetaiTwo"
  32. type="primary"
  33. >明细导出
  34. </el-button>
  35. <el-button
  36. style="float: right;margin-right:10px"
  37. size="small"
  38. @click="exportList"
  39. type="primary"
  40. >汇总导出
  41. </el-button>
  42. <div class="cell clearfix">
  43. <label class="title"><span class="name">仓库</span> :</label>
  44. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeHouseList">
  45. <el-option
  46. v-for="(option, index) in houseList"
  47. :key="index"
  48. :label="option.storehouse_name"
  49. :value="option.id">
  50. </el-option>
  51. </el-select>
  52. <el-input
  53. size="small"
  54. style="width: 200px;"
  55. class="filter-item"
  56. v-model.trim="searchKey"
  57. placeholder="单据编码/制单人/药品名称"
  58. />
  59. <el-button
  60. size="small"
  61. class="filter-item"
  62. type="primary"
  63. icon="el-icon-search"
  64. @click="search"
  65. >搜索</el-button
  66. >
  67. <label class="title"><span class="name">日期查询</span> : </label>
  68. <el-date-picker
  69. size="small"
  70. v-model="start_time"
  71. prefix-icon="el-icon-date"
  72. :editable="false"
  73. style="width: 150px;"
  74. type="date"
  75. placeholder="选择日期时间"
  76. align="right"
  77. format="yyyy-MM-dd"
  78. value-format="yyyy-MM-dd"
  79. @change="startTimeChange"
  80. ></el-date-picker>
  81. <span class="cellLine"> - </span>
  82. <el-date-picker
  83. size="small"
  84. v-model="end_time"
  85. prefix-icon="el-icon-date"
  86. :editable="false"
  87. style="width: 150px;"
  88. type="date"
  89. placeholder="选择日期时间"
  90. align="right"
  91. format="yyyy-MM-dd"
  92. value-format="yyyy-MM-dd"
  93. @change="endTimeChange"
  94. ></el-date-picker>
  95. </div>
  96. <el-row :gutter="12" style="margin-top: 10px">
  97. <el-table
  98. :data="tableData"
  99. :class="signAndWeighBoxPatients"
  100. border
  101. highlight-current-row
  102. ref="multipleTable"
  103. @selection-change="select"
  104. :row-style="{ color: '#303133' }"
  105. :header-cell-style="{
  106. backgroundColor: 'rgb(245, 247, 250)',
  107. color: '#606266'
  108. }"
  109. >
  110. <el-table-column label="单据编号" align="center" width="200">
  111. <template slot-scope="scope">
  112. {{ scope.row.warehouse_out_order_number }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="药品类型" align="center">
  116. <template slot-scope="scope">
  117. <span v-if="scope.row.drug_type == 1">西药</span>
  118. <span v-if="scope.row.drug_type == 2">草药</span>
  119. <span v-if="scope.row.drug_type == 3">成药</span>
  120. <!-- {{getTypeList(scope.row.drug_type)}} -->
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="药品名称" align="center">
  124. <template slot-scope="scope">
  125. {{scope.row.drug_name}}
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="规格型号" align="center">
  129. <template slot-scope="scope">
  130. <!-- {{scope.row.drug_spec}} -->
  131. {{scope.row.specification_name}}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="生产厂商" align="center">
  135. <template slot-scope="scope">
  136. {{getManufacturerName(scope.row.manufacturer)}}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="操作时间" align="center">
  140. <template slot-scope="scope">
  141. <span>{{getTime(scope.row.ctime)}}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="制单人" align="center">
  145. <template slot-scope="scope">
  146. {{getAdminUser(scope.row.creater)}}
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="仓库名称" align="center">
  150. <template slot-scope="scope">
  151. {{getStorehouseName(scope.row.storehouse_id)}}
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="出货价" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="org_id == 9919">{{scope.row.last_price}} </span>
  157. <span v-else>
  158. <span v-if="scope.row.price >0"> {{scope.row.price}}</span>
  159. <span v-if="scope.row.price == 0"> {{getPrice(scope.row.drug_id)}}</span>
  160. </span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="使用人" align="center">
  164. <template slot-scope="scope">
  165. {{getPatientName(scope.row.patient_id) }}
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="数量" align="center">
  169. <template slot-scope="scope">
  170. {{scope.row.count}}
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="单位" align="center">
  174. <template slot-scope="scope">
  175. {{scope.row.count_unit}}
  176. </template>
  177. </el-table-column>
  178. <el-table-column label="总价" align="center">
  179. <template slot-scope="scope">
  180. <span v-if="scope.row.is_total !=1">
  181. <span v-if="org_id == 9919">{{(scope.row.last_price * scope.row.count).toFixed(2)}} </span>
  182. <span v-if="org_id == 10210 ">{{(scope.row.price * scope.row.count).toFixed(2)}} </span>
  183. <span v-if ="org_id!=9919 && org_id!=10210">
  184. {{scope.row.total_price}}
  185. </span>
  186. </span>
  187. <span v-if="scope.row.is_total == 1">
  188. {{scope.row.total_price}}
  189. </span>
  190. </template>
  191. </el-table-column>
  192. </el-table>
  193. <el-pagination
  194. @size-change="handleSizeChange"
  195. @current-change="handleCurrentChange"
  196. :page-sizes="[10, 50, 100,1000,2000,3000,4000,5000,6000,7000]"
  197. :page-size="10"
  198. background
  199. style="margin-top:20px;float: right"
  200. layout="total, sizes, prev, pager, next, jumper"
  201. :total="total"
  202. >
  203. </el-pagination>
  204. </el-row>
  205. </div>
  206. </template>
  207. <script>
  208. import { uParseTime } from "@/utils/tools";
  209. import { fetchAllAdminUsers } from "@/api/doctor";
  210. import {GetAllConfig } from "@/api/stock";
  211. import {getDrugOutDetail,getDrugOutOrderPrint } from "@/api/drug/drug_stock"
  212. import {getBaseDrugLibList} from '@/api/data'
  213. export default {
  214. name: "stockOutDetail",
  215. created() {
  216. this.org_id = this.$store.getters.xt_user.org.id
  217. var nowDate = new Date();
  218. var nowYear = nowDate.getFullYear();
  219. var nowMonth = nowDate.getMonth() + 1;
  220. var nowDay = nowDate.getDate();
  221. this.end_time =
  222. nowYear +
  223. "-" +
  224. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  225. "-" +
  226. (nowDay < 10 ? "0" + nowDay : nowDay);
  227. nowDate.setMonth(nowDate.getMonth() - 1);
  228. nowYear = nowDate.getFullYear();
  229. nowMonth = nowDate.getMonth() + 1;
  230. nowDay = nowDate.getDate();
  231. this.start_time =
  232. nowYear +
  233. "-" +
  234. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  235. "-" +
  236. (nowDay < 10 ? "0" + nowDay : nowDay);
  237. var start_time = window.sessionStorage.getItem('start_out_time')
  238. var end_time = window.sessionStorage.getItem('end_out_time')
  239. if(start_time!=null){
  240. this.start_time = start_time
  241. }
  242. if(end_time!=null){
  243. this.end_time = end_time
  244. }
  245. this.getDrugOutOrderPrint()
  246. this.GetConfigInfo();
  247. this.fetchAllAdminUsers();
  248. this.getlist()
  249. this.getBaseDrugLibList()
  250. },
  251. data() {
  252. return {
  253. orderTypeArr: [
  254. { value: 1, label: "药品出库单" },
  255. { value: 2, label: "其他入库单" }
  256. ],
  257. manufacturer_id: "",
  258. dealer_id: "",
  259. order_type:"",
  260. searchKey: "",
  261. type: 2,
  262. page: 1,
  263. limit: 10,
  264. checked: false,
  265. total: 0,
  266. pageTotal: 0,
  267. pageSelect: 0,
  268. adminUserOptions: [],
  269. multipleSelection: [],
  270. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  271. start_time: "",
  272. cancelStockDate: [],
  273. end_time: "",
  274. goodType: [],
  275. goodInfo: [],
  276. manufacturer: [],
  277. selectedTableData: [],
  278. dealer: [],
  279. tableData:[],
  280. tableList:[],
  281. drugList:[],
  282. tablePrint:[],
  283. org_id:0,
  284. drugTypeList:[],
  285. storehouse_id:0,
  286. houseList:[],
  287. dealerList:[],
  288. manufacturerList:[],
  289. patientsList:[]
  290. };
  291. },
  292. methods: {
  293. changeType: function(val) {
  294. this.order_type = val;
  295. this.getlist()
  296. },
  297. changeManufacturer: function(val) {
  298. this.manufacturer_id = val;
  299. this.getlist()
  300. },
  301. getTypeName: function(row) {
  302. let name = "";
  303. const name2 = "";
  304. if (row.type == 1) {
  305. name = "药品出库单";
  306. } else if (row.type == 2) {
  307. name = "其他出库单";
  308. }
  309. return name;
  310. },
  311. search: function() {
  312. this.getlist()
  313. this.getDrugOutOrderPrint()
  314. },
  315. getXuserName(id) {
  316. if (id <= 0) {
  317. return "";
  318. }
  319. var name = "";
  320. if (
  321. this.adminUserOptions == null ||
  322. typeof this.adminUserOptions.length === "undefined"
  323. ) {
  324. return name;
  325. }
  326. var leng = this.adminUserOptions.length;
  327. if (leng == 0) {
  328. return name;
  329. }
  330. for (let index = 0; index < leng; index++) {
  331. if (this.adminUserOptions[index].id == id) {
  332. name = this.adminUserOptions[index].name;
  333. break;
  334. }
  335. }
  336. return name;
  337. },
  338. fetchAllAdminUsers() {
  339. fetchAllAdminUsers().then(response => {
  340. if (response.data.state == 1) {
  341. this.adminUserOptions = response.data.data.users;
  342. }
  343. });
  344. },
  345. handleSelectionChange: function(val) {
  346. this.multipleSelection = val;
  347. },
  348. handleSizeChange(val) {
  349. this.limit = val;
  350. this.getlist()
  351. },
  352. handleCurrentChange(val) {
  353. this.page = val;
  354. this.getlist()
  355. },
  356. startTimeChange(val) {
  357. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  358. if (time > 0) {
  359. this.$message.error("结束时间不能小于开始时间");
  360. this.start_time = "";
  361. } else {
  362. this.getlist()
  363. this.getDrugOutOrderPrint()
  364. }
  365. },
  366. endTimeChange(val) {
  367. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  368. if (time < 0) {
  369. this.$message.error("结束时间不能小于开始时间");
  370. this.end_time = "";
  371. } else {
  372. this.getlist()
  373. this.getDrugOutOrderPrint()
  374. }
  375. },
  376. getTimestamp(time) {
  377. // 把时间日期转成时间戳
  378. return new Date(time).getTime() / 1000;
  379. },
  380. calculate: function(val) {
  381. return Math.round(parseFloat(val) * 100) / 100;
  382. },
  383. GetConfigInfo() {
  384. GetAllConfig().then(response => {
  385. if (response.data.state == 0) {
  386. this.$message.error(response.data.msg);
  387. return false;
  388. } else {
  389. this.manufacturer = response.data.data.manufacturer;
  390. this.dealer = response.data.data.dealer;
  391. this.goodInfo = response.data.data.goodInfo;
  392. this.goodType = response.data.data.goodType;
  393. }
  394. });
  395. },
  396. getTime: function(val) {
  397. if (val == 0) {
  398. return "";
  399. } else {
  400. return uParseTime(val, "{y}-{m}-{d}");
  401. }
  402. },
  403. getTimeOne: function(val) {
  404. if (val == 0) {
  405. return "";
  406. } else {
  407. return uParseTime(val, "{y}-{m}-{d} {h}:{i}");
  408. }
  409. },
  410. PrintAction: function() {
  411. // window.sessionStorage.setItem('start_out_time',this.start_time)
  412. // window.sessionStorage.setItem('end_out_time',this.end_time)
  413. 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)
  414. },
  415. getlist(){
  416. var params = {
  417. start_time:this.start_time,
  418. end_time:this.end_time,
  419. order_type:this.order_type,
  420. manufacturer_id:this.manufacturer_id,
  421. keyword:this.searchKey,
  422. page:this.page,
  423. limit:this.limit,
  424. storehouse_id:this.storehouse_id,
  425. }
  426. getDrugOutDetail(params).then(response=>{
  427. this.tableData = []
  428. this.tableList = []
  429. if(response.data.state == 1){
  430. var order = response.data.data.order
  431. console.log("order233322332323223",order)
  432. var obj = {id:0,storehouse_name:"全部"}
  433. this.houseList = []
  434. this.houseList.push(obj)
  435. for(let i=0;i<response.data.data.houseList.length;i++){
  436. this.houseList.push(response.data.data.houseList[i])
  437. }
  438. this.patientsList = []
  439. this.patientsList = response.data.data.patientsList
  440. var total_price = 0
  441. for(let i=0;i<order.length;i++){
  442. order[i].specification_name = order[i].dose + order[i].dose_unit + "*" + order[i].min_number + order[i].min_unit + "/" + order[i].max_unit
  443. order[i].is_total = 0
  444. if(this.org_id == 9919){
  445. order[i].total_price = order[i].count * order[i].last_price
  446. total_price += order[i].count * order[i].last_price
  447. }else{
  448. if(order[i].price > 0){
  449. order[i].total_price = 0
  450. if(order[i].count_unit == order[i].min_unit && order[i].max_unit!=order[i].min_unit){
  451. order[i].total_price = order[i].count * order[i].price
  452. }
  453. if(order[i].count_unit == order[i].max_unit){
  454. if(order[i].is_sys == 0){
  455. order[i].total_price += order[i].count * order[i].price
  456. }else{
  457. order[i].total_price += order[i].count * order[i].price * order[i].min_number
  458. }
  459. }
  460. total_price += order[i].total_price
  461. }
  462. if(order[i].price ==0 ){
  463. if(order[i].count_unit == order[i].min_unit && order[i].max_unit!=order[i].min_unit){
  464. order[i].total_price = order[i].count * this.getPrice(order[i].drug_id)
  465. order[i].price = this.getPrice(order[i].drug_id)
  466. }
  467. if(order[i].count_unit == order[i].max_unit){
  468. if(order[i].is_sys == 0){
  469. order[i].total_price += order[i].count * this.getPrice(order[i].drug_id)
  470. }else{
  471. order[i].total_price += order[i].count * this.getPrice(order[i].drug_id) * order[i].min_number
  472. }
  473. order[i].price = this.getPrice(order[i].drug_id)
  474. }
  475. total_price +=order[i].total_price
  476. }
  477. }
  478. }
  479. if(this.org_id!=0&&this.org_id!=10480){
  480. order.push({
  481. warehouse_out_order_number: "合计",
  482. is_total: 1,
  483. specification_name:"",
  484. ctime:"",
  485. total_price:total_price,
  486. });
  487. }
  488. for(let i=0;i<order.length;i++){
  489. order[i].total_price = order[i].total_price.toFixed(2)
  490. }
  491. console.log("orderwowoowwowoo",order)
  492. this.tableData = order
  493. let objInfo = {}
  494. order.forEach((item,index)=>{
  495. let { drug_id } = item
  496. if( this.org_id == 9919){
  497. if(!objInfo[drug_id]){
  498. objInfo[drug_id] = {
  499. drug_id,
  500. child:[],
  501. drug_name:item.drug_name,
  502. drug_spec:item.drug_spec,
  503. min_unit:item.min_unit,
  504. count:0,
  505. price:item.last_price,
  506. remark:item.remark,
  507. total_price:0.0,
  508. dose:item.dose,
  509. dose_unit:item.dose_unit,
  510. min_number:item.min_number,
  511. max_unit:item.max_unit,
  512. in_price:item.in_price,
  513. }
  514. }
  515. }else{
  516. if(!objInfo[drug_id]){
  517. objInfo[drug_id] = {
  518. drug_id,
  519. child:[],
  520. drug_name:item.drug_name,
  521. drug_spec:item.drug_spec,
  522. min_unit:item.min_unit,
  523. count:0,
  524. price:item.price,
  525. remark:item.remark,
  526. total_price:0.0,
  527. dose:item.dose,
  528. dose_unit:item.dose_unit,
  529. min_number:item.min_number,
  530. max_unit:item.max_unit,
  531. in_price:item.in_price,
  532. }
  533. }
  534. }
  535. })
  536. let list = Object.values(objInfo);
  537. for(let i=0;i<order.length;i++){
  538. list.map(item=>{
  539. if(order[i].drug_id == item.drug_id){
  540. item.child.push(order[i])
  541. }
  542. })
  543. }
  544. for(let i=0;i<list.length;i++){
  545. for(let j=0;j<list[i].child.length;j++){
  546. if(list[i].child[j].count!=null || list[i].child[j].count != "" || list[i].child[j].count!=0){
  547. list[i].count += list[i].child[j].count
  548. }
  549. }
  550. }
  551. for(let i=0;i<list.length;i++){
  552. list[i].total_price = list[i].count * list[i].price
  553. }
  554. this.tableList = list
  555. var total = response.data.data.total
  556. this.total = total
  557. }
  558. })
  559. },
  560. select(){
  561. },
  562. getAdminUser(id){
  563. var name = ""
  564. for(let i=0;i<this.adminUserOptions.length;i++){
  565. if(id == this.adminUserOptions[i].id){
  566. name = this.adminUserOptions[i].name
  567. }
  568. }
  569. return name
  570. },
  571. getPatientName(id){
  572. var name =""
  573. for(let i=0;i<this.patientsList.length;i++){
  574. if(id == this.patientsList[i].id){
  575. name = this.patientsList[i].name
  576. }
  577. }
  578. return name
  579. },
  580. exportList(){
  581. for(let i=0;i<this.tablePrint.length;i++){
  582. this.tablePrint[i].index = i+1
  583. this.tablePrint[i].ctime = this.getTime(this.tablePrint[i].ctime)
  584. this.tablePrint[i].manufacturer_name = this.getManufacturerName(this.tablePrint[i].manufacturer)
  585. this.tablePrint[i].dealer_name = this.getDealerName(this.tablePrint[i].dealer)
  586. }
  587. for(let i=0;i<this.tablePrint.length;i++){
  588. if(this.org_id == 9919 || this.org_id == 9671){
  589. this.tablePrint[i].min_price = this.tablePrint[i].price
  590. this.tablePrint[i].count = parseInt((this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child))/this.tablePrint[i].min_number)
  591. this.tablePrint[i].total_price = ((parseInt((this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child))/this.tablePrint[i].min_number))*this.tablePrint[i].price).toFixed(2)
  592. 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
  593. this.tablePrint[i].total = this.getCountSenvenOne(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)/this.tablePrint[i].min_number
  594. }else{
  595. 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)
  596. 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)
  597. 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
  598. 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)
  599. }
  600. }
  601. console.log("wowowoowowowowo",this.tablePrint)
  602. import('@/vendor/Export2Excel').then(excel => {
  603. const tHeader = ['序号','药品名称', '规格型号','生产厂商','进销商', '单位','数量','单价','总价','出库时间','备注']
  604. if(this.org_id == 9919){
  605. const filterVal = ['index','drug_name', 'unit', 'manufacturer_name','dealer_name','max_unit','count','min_price','total_price','ctime','remark']
  606. let obj = {'index':'合计','total_price':0.00}
  607. for(let i=0;i<this.tablePrint.length;i++){
  608. obj.total_price += this.tablePrint[i].total
  609. }
  610. obj.total_price = obj.total_price.toFixed(2)
  611. this.tablePrint.push(obj)
  612. const data = this.formatJson(filterVal, this.tablePrint)
  613. excel.export_json_to_excel({
  614. header: tHeader,
  615. data,
  616. filename: '药品汇总明细'
  617. })
  618. this.downloadLoading = false
  619. }else{
  620. const filterVal = ['index','drug_name', 'unit', 'manufacturer_name','dealer_name','min_unit','count','min_price','total_price','ctime','remark']
  621. let obj = {'index':'合计','total_price':0.00}
  622. for(let i=0;i<this.tablePrint.length;i++){
  623. obj.total_price += this.tablePrint[i].total
  624. }
  625. obj.total_price = obj.total_price.toFixed(2)
  626. this.tablePrint.push(obj)
  627. const data = this.formatJson(filterVal, this.tablePrint)
  628. excel.export_json_to_excel({
  629. header: tHeader,
  630. data,
  631. filename: '药品汇总明细'
  632. })
  633. this.downloadLoading = false
  634. }
  635. })
  636. },
  637. formatJson(filterVal, jsonData) {
  638. return jsonData.map(v => filterVal.map(j => v[j]));
  639. },
  640. exportListDetai(){
  641. import('@/vendor/Export2Excel').then(excel => {
  642. const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','生产厂商','进销商','操作时间','制单人','进货价','出货价','数量','总价']
  643. const filterVal = ['index','warehouse_out_order_number', 'drugtype', 'drug_name','specification_name','manufacturer_name','dealer_name','time','user_name','in_price','price','count','total_price']
  644. console.log("hwhhwhwhwhwhw",this.tableData)
  645. for(let i=0;i<this.tableData.length;i++){
  646. if(this.tableData[i].is_total == 0){
  647. this.tableData[i].index = i+1
  648. if(this.tableData[i].drug_type == 1){
  649. this.tableData[i].drugtype = "西药"
  650. }
  651. if(this.tableData[i].drug_type == 2){
  652. this.tableData[i].drugtype = "草药"
  653. }
  654. if(this.tableData[i].drug_type == 3){
  655. this.tableData[i].drugtype = "成药"
  656. }
  657. 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
  658. this.tableData[i].time = this.getTime(this.tableData[i].ctime)
  659. this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
  660. this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
  661. this.tableData[i].dealer_name = this.getDealerName(this.tableData[i].dealer)
  662. if(this.org_id == 9919){
  663. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].last_price)
  664. if(this.tableData[i].count >=this.tableData[i].min_number){
  665. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)/this.tableData[i].min_number
  666. }else{
  667. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)
  668. }
  669. }else{
  670. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
  671. if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
  672. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
  673. }
  674. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
  675. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  676. }
  677. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
  678. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  679. }
  680. }
  681. }
  682. }
  683. const data = this.formatJson(filterVal, this.tableData)
  684. excel.export_json_to_excel({
  685. header: tHeader,
  686. data,
  687. filename: '药品出库明细'
  688. })
  689. this.downloadLoading = false
  690. })
  691. },
  692. exportListDetaiOne(){
  693. import('@/vendor/Export2Excel').then(excel => {
  694. const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','生产厂商','进销商','操作时间','制单人','进货价','出货价','数量','单位','总价']
  695. const filterVal = ['index','warehouse_out_order_number', 'drugtype', 'drug_name','specification_name','manufacturer_name','dealer_name','time','user_name','in_retail_price','price','count','count_unit','total_price']
  696. console.log("hwhhwhwhwhwhw",this.tableData)
  697. for(let i=0;i<this.tableData.length;i++){
  698. if(this.tableData[i].is_total == 0){
  699. this.tableData[i].index = i+1
  700. if(this.tableData[i].drug_type == 1){
  701. this.tableData[i].drugtype = "西药"
  702. }
  703. if(this.tableData[i].drug_type == 2){
  704. this.tableData[i].drugtype = "草药"
  705. }
  706. if(this.tableData[i].drug_type == 3){
  707. this.tableData[i].drugtype = "成药"
  708. }
  709. 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
  710. this.tableData[i].time = this.getTime(this.tableData[i].ctime)
  711. this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
  712. this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
  713. this.tableData[i].dealer_name = this.getDealerName(this.tableData[i].dealer)
  714. this.tableData[i].in_retail_price = (this.tableData[i].in_price/this.tableData[i].min_number).toFixed(2)
  715. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
  716. if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
  717. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
  718. }
  719. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
  720. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  721. }
  722. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
  723. this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  724. }
  725. }
  726. }
  727. const data = this.formatJson(filterVal, this.tableData)
  728. excel.export_json_to_excel({
  729. header: tHeader,
  730. data,
  731. filename: '药品出库明细'
  732. })
  733. this.downloadLoading = false
  734. })
  735. },
  736. exportListDetaiTwo(){
  737. var obj = {index:"合计",out_total_price:0,in_total_price:0}
  738. var out_total = 0
  739. var in_total =0
  740. console.log("tatbledateawowowo",this.tableData)
  741. for(let i=0;i<this.tableData.length;i++){
  742. if(this.tableData[i].is_total == 0){
  743. this.tableData[i].index = i+1
  744. if(this.tableData[i].drug_type == 1){
  745. this.tableData[i].drugtype = "西药"
  746. }
  747. if(this.tableData[i].drug_type == 2){
  748. this.tableData[i].drugtype = "草药"
  749. }
  750. if(this.tableData[i].drug_type == 3){
  751. this.tableData[i].drugtype = "成药"
  752. }
  753. 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
  754. this.tableData[i].time = this.getTime(this.tableData[i].ctime)
  755. this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
  756. this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
  757. this.tableData[i].out_count = this.tableData[i].count
  758. this.tableData[i].in_retail_price = (this.tableData[i].in_price/this.tableData[i].min_number).toFixed(2)
  759. this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
  760. this.tableData[i].patient_name = this.getPatientName(this.tableData[i].patient_id)
  761. if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
  762. this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)
  763. this.tableData[i].in_total_price = this.tableData[i].in_retail_price * this.tableData[i].count
  764. }
  765. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
  766. this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  767. this.tableData[i].in_total_price = this.tableData[i].min_number * (this.tableData[i].count * this.tableData[i].in_retail_price)
  768. }
  769. if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
  770. this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
  771. this.tableData[i].in_total_price = this.tableData[i].min_number * (this.tableData[i].count * this.tableData[i].in_retail_price)
  772. }
  773. this.tableData[i].project_name = "居民医保"
  774. this.tableData[i].expiry_date = this.getTime(this.tableData[i].expiry_date)
  775. this.tableData[i].ctimeOne = this.getTime(this.tableData[i].ctime)
  776. this.tableData[i].ctimeTwo = this.getTimeOne(this.tableData[i].ctime)
  777. out_total += this.tableData[i].out_total_price
  778. in_total += this.tableData[i].in_total_price
  779. }
  780. }
  781. obj.out_total_price = out_total.toFixed(2)
  782. obj.in_total_price = in_total.toFixed(2)
  783. this.tableData.push(obj)
  784. import('@/vendor/Export2Excel').then(excel => {
  785. const tHeader = ['序号','药品名称', '药品规格', '批号','生成厂家','药品类型','报销方式','入库单价','出库单价','出库数量','实际出库数量','单位','出库金额','实际出库金额','实际成本','出库对象','有效日期','出库日期','操作时间','出库单号','备注']
  786. const filterVal = ['index','drug_name', 'specification_name', 'batch_number','manufacturer_name','drug_type','project_name','in_price','price','out_count','out_count','max_unit','out_total_price','out_total_price','in_total_price','patient_name','expiry_date','ctimeOne','ctimeTwo','warehouse_out_order_number','remark']
  787. console.log("hwhhwhwhwhwhw",this.tableData)
  788. const data = this.formatJson(filterVal, this.tableData)
  789. excel.export_json_to_excel({
  790. header: tHeader,
  791. data,
  792. filename: '药品出库明细'
  793. })
  794. this.downloadLoading = false
  795. })
  796. },
  797. getManufacturerName(id){
  798. var manufacturer_name = ""
  799. for(let i=0;i<this.manufacturerList.length;i++){
  800. if(id == this.manufacturerList[i].id){
  801. manufacturer_name = this.manufacturerList[i].manufacturer_name
  802. }
  803. }
  804. return manufacturer_name
  805. },
  806. getDealerName(id){
  807. var dealer_name = ""
  808. for(let i=0;i<this.dealerList.length;i++){
  809. if(id == this.dealerList[i].id){
  810. dealer_name = this.dealerList[i].dealer_name
  811. }
  812. }
  813. return dealer_name
  814. },
  815. getBaseDrugLibList() {
  816. let params = {
  817. page: 1,
  818. limit: 1000,
  819. keyword:"",
  820. is_use: "",
  821. is_charge: "",
  822. is_inject: "",
  823. manufacturer:"",
  824. is_record:""
  825. }
  826. getBaseDrugLibList(params).then(response => {
  827. if (response.data.state == 0) {
  828. this.$message.error(response.data.msg)
  829. return false
  830. } else {
  831. this.drugList = []
  832. for (let i = 0; i < response.data.data.list.length; i++) {
  833. this.drugList.push(response.data.data.list[i])
  834. }
  835. }
  836. })
  837. },
  838. getDrugOutOrderPrint(){
  839. var params = {
  840. start_time:this.start_time,
  841. end_time:this.end_time,
  842. order_type:2,
  843. }
  844. getDrugOutOrderPrint(params).then(response=>{
  845. if(response.data.state == 1){
  846. var list = response.data.data.list
  847. console.log("很粗扣扣我噢噢",list)
  848. this.dealerList = response.data.data.dealerList
  849. this.manufacturerList = response.data.data.manufacturerList
  850. let objInfo = {}
  851. if(this.org_id == 9919){
  852. list.forEach((item,index)=>{
  853. let { drug_id } = item
  854. if(!objInfo[drug_id]){
  855. objInfo[drug_id] = {
  856. drug_id,
  857. child:[],
  858. drug_name:item.XtBaseDrug.drug_name,
  859. drug_spec:item.XtBaseDrug.drug_spec,
  860. min_unit:item.XtBaseDrug.min_unit,
  861. count:0,
  862. price:item.XtBaseDrug.last_price,
  863. remark:item.XtBaseDrug.remark,
  864. total_price:"",
  865. dose:item.XtBaseDrug.dose,
  866. dose_unit:item.XtBaseDrug.dose_unit,
  867. min_number:item.XtBaseDrug.min_number,
  868. max_unit:item.XtBaseDrug.max_unit,
  869. min_price:item.XtBaseDrug.min_price,
  870. ctime:item.ctime,
  871. manufacturer:item.manufacturer,
  872. dealer:item.dealer,
  873. }
  874. }
  875. })
  876. }else{
  877. list.forEach((item,index)=>{
  878. let { drug_id } = item
  879. if(!objInfo[drug_id]){
  880. objInfo[drug_id] = {
  881. drug_id,
  882. child:[],
  883. drug_name:item.XtBaseDrug.drug_name,
  884. drug_spec:item.XtBaseDrug.drug_spec,
  885. min_unit:item.XtBaseDrug.min_unit,
  886. count:0,
  887. price:item.XtBaseDrug.last_price,
  888. remark:item.XtBaseDrug.remark,
  889. total_price:"",
  890. dose:item.XtBaseDrug.dose,
  891. dose_unit:item.XtBaseDrug.dose_unit,
  892. min_number:item.XtBaseDrug.min_number,
  893. max_unit:item.XtBaseDrug.max_unit,
  894. min_price:item.XtBaseDrug.min_price,
  895. ctime:item.ctime,
  896. manufacturer:item.manufacturer,
  897. dealer:item.dealer,
  898. }
  899. }
  900. })
  901. }
  902. let newArr = Object.values(objInfo);
  903. for(let i=0;i<newArr.length;i++){
  904. for(let j=0;j<list.length;j++){
  905. if(newArr[i].drug_id == list[j].drug_id){
  906. newArr[i].child.push(list[j])
  907. }
  908. }
  909. }
  910. console.log("newArrwowowowowoowowowowowowow",newArr)
  911. this.tablePrint = newArr
  912. }
  913. })
  914. },
  915. getCount(arr,max_unit,min_unit,min_number){
  916. var total = 0
  917. var str = ""
  918. var min_str = ""
  919. for(let i=0;i<arr.length;i++){
  920. if(arr[i].count_unit == max_unit){
  921. arr[i].count_one = 0
  922. arr[i].count_one = arr[i].count * min_number
  923. }else{
  924. arr[i].count_one = arr[i].count
  925. }
  926. }
  927. for(let i=0;i<arr.length;i++){
  928. total+= arr[i].count_one
  929. }
  930. if(total<min_number){
  931. str = ""
  932. min_str = total + min_unit
  933. }
  934. if(total >= min_number){
  935. if(parseInt(total/min_number)!=0){
  936. str = parseInt(total/min_number)+ max_unit
  937. }
  938. if((total%min_number)!=0){
  939. min_str = total%min_number + min_unit
  940. }
  941. }
  942. return str + min_str
  943. },
  944. getTotalPrice(arr,max_unit,min_number,min_price){
  945. console.log("arrwoowowow",arr)
  946. var total = 0
  947. for(let i=0;i<arr.length;i++){
  948. if(arr[i].count_unit == max_unit){
  949. arr[i].count = arr[i].count * min_number
  950. }else{
  951. arr[i].count = arr[i].count
  952. }
  953. }
  954. for(let j=0;j<arr.length;j++){
  955. total +=arr[j].count
  956. }
  957. return (total*min_price).toFixed(2)
  958. },
  959. getTotalPriceOne(arr,max_unit,min_number,min_price){
  960. var total = 0
  961. for(let i=0;i<arr.length;i++){
  962. if(arr[i].count_unit == max_unit){
  963. arr[i].count = arr[i].count * min_number
  964. }else{
  965. arr[i].count = arr[i].count
  966. }
  967. }
  968. for(let j=0;j<arr.length;j++){
  969. total +=arr[j].count
  970. }
  971. return total*min_price
  972. },
  973. getCountSix(drug_id,val){
  974. var count = 0
  975. for(let i=0;i<val.length;i++){
  976. count+= val[i].count
  977. }
  978. return count
  979. },
  980. getCountSenven(drug_id,val,price,min_number){
  981. console.log("min_number232333223",min_number)
  982. var count = 0
  983. for(let i=0;i<val.length;i++){
  984. count+= val[i].count
  985. }
  986. return (parseInt(count/min_number)*price).toFixed(2)
  987. },
  988. getCountSenvenOne(drug_id,val,price){
  989. var count = 0
  990. for(let i=0;i<val.length;i++){
  991. count+= val[i].count
  992. }
  993. return (count*price)
  994. },
  995. getTypeList(id){
  996. var name = ""
  997. for(let i=0;i<this.drugTypeList.length;i++){
  998. if(id == this.drugTypeList[i].value){
  999. name = this.drugTypeList[i].name
  1000. }
  1001. }
  1002. return name
  1003. },
  1004. getPrice(drug_id){
  1005. var price = ""
  1006. for(let i=0;i<this.drugList.length;i++){
  1007. if(drug_id == this.drugList[i].id){
  1008. price = this.drugList[i].min_price
  1009. }
  1010. }
  1011. return price
  1012. },
  1013. getStorehouseName(id){
  1014. var storehouse_name = ""
  1015. for(let i=0;i<this.houseList.length;i++){
  1016. if(id == this.houseList[i].id){
  1017. storehouse_name = this.houseList[i].storehouse_name
  1018. }
  1019. }
  1020. if(storehouse_name == "全部"){
  1021. return ""
  1022. }else{
  1023. return storehouse_name
  1024. }
  1025. },
  1026. changeHouseList(){
  1027. this.houseList = []
  1028. this.getlist()
  1029. }
  1030. }
  1031. };
  1032. </script>
  1033. <style rel="stylesheet/css" lang="scss" scoped>
  1034. .information {
  1035. border: 1px #dcdfe6 solid;
  1036. padding: 30px 20px 30px 20px;
  1037. .border {
  1038. border-bottom: 1px #dcdfe6 solid;
  1039. margin: 0px 0 20px 0;
  1040. }
  1041. }
  1042. .edit_separater {
  1043. border-top: 1px solid rgb(233, 233, 233);
  1044. margin-top: 15px;
  1045. margin-bottom: 15px;
  1046. }
  1047. </style>
  1048. <style>
  1049. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1050. font-size: 12px;
  1051. }
  1052. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1053. background: #6fb5fa;
  1054. }
  1055. .count {
  1056. color: #bd2c00;
  1057. }
  1058. .el-table td,
  1059. .el-table th.is-leaf,
  1060. .el-table--border,
  1061. .el-table--group {
  1062. border-color: #d0d3da;
  1063. }
  1064. .el-table--border::after,
  1065. .el-table--group::after,
  1066. .el-table::before {
  1067. background-color: #d0d3da;
  1068. }
  1069. </style>