drugOutDetail.vue 48KB

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