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

drugInOrder.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <div>
  3. <el-button
  4. style="float: right"
  5. size="small"
  6. @click="PrintAction"
  7. type="primary"
  8. >打印
  9. </el-button>
  10. <el-button
  11. style="float: right;margin-right:10px"
  12. size="small"
  13. @click="exportListDetail"
  14. type="primary"
  15. >明细导出
  16. </el-button>
  17. <el-button
  18. style="float: right;margin-right:10px"
  19. size="small"
  20. @click="exportList"
  21. type="primary"
  22. >汇总导出
  23. </el-button>
  24. <div class="cell clearfix">
  25. <el-input
  26. size="small"
  27. style="width: 400px;"
  28. class="filter-item"
  29. v-model.trim="searchKey"
  30. placeholder="单据编码/制单人/药品名称"
  31. />
  32. <el-button
  33. size="small"
  34. class="filter-item"
  35. type="primary"
  36. icon="el-icon-search"
  37. @click="search"
  38. >搜索</el-button
  39. >
  40. <div style="margin-left:10px;">
  41. <label class="title"><span class="name">日期查询</span> : </label>
  42. <el-date-picker
  43. size="small"
  44. v-model="start_time"
  45. prefix-icon="el-icon-date"
  46. :editable="false"
  47. style="width: 150px;"
  48. type="date"
  49. placeholder="选择日期时间"
  50. align="right"
  51. format="yyyy-MM-dd"
  52. value-format="yyyy-MM-dd"
  53. @change="startTimeChange"
  54. ></el-date-picker>
  55. <span class="cellLine"> - </span>
  56. <el-date-picker
  57. size="small"
  58. v-model="end_time"
  59. prefix-icon="el-icon-date"
  60. :editable="false"
  61. style="width: 150px;"
  62. type="date"
  63. placeholder="选择日期时间"
  64. align="right"
  65. format="yyyy-MM-dd"
  66. value-format="yyyy-MM-dd"
  67. @change="endTimeChange"
  68. ></el-date-picker>
  69. </div>
  70. </div>
  71. <!-- <div class="cell clearfix">
  72. <label class="title"><span class="name">单据类型</span> : </label>
  73. <el-select
  74. size="small"
  75. v-model="order_type"
  76. clearable
  77. placeholder="单据类型"
  78. @change="changeType"
  79. >
  80. <el-option
  81. v-for="item in orderTypeArr"
  82. :key="item.value"
  83. :label="item.label"
  84. :value="item.value"
  85. >
  86. </el-option>
  87. </el-select>
  88. </div> -->
  89. <!-- <div class="cell clearfix">
  90. <label class="title"><span class="name">其它</span> : </label>
  91. <el-select
  92. size="small"
  93. v-model="manufacturer_id"
  94. clearable
  95. placeholder="厂商"
  96. @change="changeManufacturer"
  97. >
  98. <el-option
  99. v-for="item in manufacturer"
  100. :key="item.id"
  101. :label="item.manufacturer_name"
  102. :value="item.id"
  103. >
  104. </el-option>
  105. </el-select>
  106. </div> -->
  107. <el-row :gutter="12" style="margin-top: 10px">
  108. <el-table
  109. :data="cancelStockDate"
  110. :class="signAndWeighBoxPatients"
  111. border
  112. highlight-current-row
  113. ref="multipleTable"
  114. @selection-change="select"
  115. :row-style="{ color: '#303133' }"
  116. :header-cell-style="{
  117. backgroundColor: 'rgb(245, 247, 250)',
  118. color: '#606266'
  119. }"
  120. >
  121. <el-table-column label="单据编号" align="center" width="200">
  122. <template slot-scope="scope">
  123. {{scope.row.warehousing_order}}
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="药品类型" align="center">
  127. <template slot-scope="scope">
  128. <span v-if="scope.row.drug_type == 1">西药</span>
  129. <span v-if="scope.row.drug_type == 2">草药</span>
  130. <span v-if="scope.row.drug_type == 3">成药</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="药品名称" align="center">
  134. <template slot-scope="scope">
  135. {{scope.row.drug_name}}
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="规格型号" align="center">
  139. <template slot-scope="scope">
  140. {{scope.row.specification_name}}
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="操作时间" align="center">
  144. <template slot-scope="scope">
  145. <span>{{getTime(scope.row.ctime)}}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="制单人" align="center">
  149. <template slot-scope="scope">
  150. {{getAdminUser(scope.row.creater)}}
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="进货价" align="center">
  154. <template slot-scope="scope">
  155. {{scope.row.price}}
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="数量" align="center">
  159. <template slot-scope="scope">
  160. {{scope.row.warehousing_count}}
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="总价" align="center">
  164. <template slot-scope="scope">
  165. {{scope.row.total_price}}
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. <el-pagination
  170. @size-change="handleSizeChange"
  171. @current-change="handleCurrentChange"
  172. :page-sizes="[10, 50, 100]"
  173. :page-size="10"
  174. background
  175. style="margin-top:20px;float: right"
  176. layout="total, sizes, prev, pager, next, jumper"
  177. :total="total"
  178. >
  179. </el-pagination>
  180. </el-row>
  181. </div>
  182. </template>
  183. <script>
  184. import { uParseTime } from "@/utils/tools";
  185. import { fetchAllAdminUsers } from "@/api/doctor";
  186. import { GetAllConfig } from "@/api/stock";
  187. import { getDrugIndetail,getDrugWarehouseInfoPrint} from "@/api/drug/drug_stock"
  188. export default {
  189. name: "stockInDetail",
  190. created() {
  191. var nowDate = new Date();
  192. var nowYear = nowDate.getFullYear();
  193. var nowMonth = nowDate.getMonth() + 1;
  194. var nowDay = nowDate.getDate();
  195. this.end_time =
  196. nowYear +
  197. "-" +
  198. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  199. "-" +
  200. (nowDay < 10 ? "0" + nowDay : nowDay);
  201. nowDate.setMonth(nowDate.getMonth() - 1);
  202. nowYear = nowDate.getFullYear();
  203. nowMonth = nowDate.getMonth() + 1;
  204. nowDay = nowDate.getDate();
  205. this.start_time =
  206. nowYear +
  207. "-" +
  208. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  209. "-" +
  210. (nowDay < 10 ? "0" + nowDay : nowDay);
  211. var start = window.sessionStorage.getItem('start_in_time')
  212. console.log("start23323232322323",start)
  213. var end = window.sessionStorage.getItem('end_in_time')
  214. if(start!= "null"){
  215. console.log("hh232h23h32h3232322323")
  216. this.start_time = start
  217. }
  218. if(end != "null"){
  219. this.end_time = end
  220. }
  221. this.GetConfigInfo()
  222. this.fetchAllAdminUsers()
  223. //获取入库单数据
  224. this.getlist()
  225. this.getDrugWarehouseInfoPrint()
  226. },
  227. data() {
  228. return {
  229. orderTypeArr: [
  230. { value: 1, label: "药品入库单" },
  231. { value: 2, label: "其他入库单" }
  232. ],
  233. newDate: [{ name: "合计", num: "111111" }],
  234. searchKey: "",
  235. type: 1,
  236. page: 1,
  237. limit: 10,
  238. manufacturer_id: "",
  239. dealer_id: "",
  240. order_type: 1,
  241. checked: false,
  242. total: 0,
  243. pageTotal: 0,
  244. pageSelect: 0,
  245. adminUserOptions: [],
  246. multipleSelection: [],
  247. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  248. start_time: "",
  249. cancelStockDate: [],
  250. end_time: "",
  251. goodType: [],
  252. goodInfo: [],
  253. manufacturer: [],
  254. selectedTableData: [],
  255. dealer: [],
  256. tableList:[],
  257. tabelePrintList:[],
  258. };
  259. },
  260. methods: {
  261. changeType: function(val) {
  262. this.order_type = val;
  263. },
  264. changeManufacturer: function(val) {
  265. this.manufacturer_id = val;
  266. },
  267. changeDealer: function(val) {
  268. this.dealer_id = val;
  269. },
  270. search: function() {
  271. this.getlist()
  272. },
  273. getTime: function(val) {
  274. if (val == 0) {
  275. return "";
  276. } else {
  277. return uParseTime(val, "{y}-{m}-{d}");
  278. }
  279. },
  280. AddNewOrder: function() {
  281. },
  282. fetchAllAdminUsers() {
  283. fetchAllAdminUsers().then(response => {
  284. if (response.data.state == 1) {
  285. this.adminUserOptions = response.data.data.users;
  286. }
  287. });
  288. },
  289. handleSelectionChange: function(val) {
  290. this.multipleSelection = val;
  291. },
  292. handleSizeChange(val) {
  293. this.limit = val;
  294. this.getlist()
  295. },
  296. handleCurrentChange(val) {
  297. this.page = val;
  298. this.getlist()
  299. },
  300. startTimeChange(val) {
  301. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  302. if (time > 0) {
  303. this.$message.error("结束时间不能小于开始时间");
  304. this.start_time = "";
  305. } else {
  306. this.getlist()
  307. this.getDrugWarehouseInfoPrint()
  308. }
  309. },
  310. endTimeChange(val) {
  311. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  312. if (time < 0) {
  313. this.$message.error("结束时间不能小于开始时间");
  314. this.end_time = "";
  315. } else {
  316. this.getlist()
  317. this.getDrugWarehouseInfoPrint()
  318. }
  319. },
  320. getTimestamp(time) {
  321. // 把时间日期转成时间戳
  322. return new Date(time).getTime() / 1000;
  323. },
  324. calculate: function(val) {
  325. return Math.round(parseFloat(val) * 100) / 100;
  326. },
  327. GetConfigInfo(){
  328. GetAllConfig().then(response => {
  329. if (response.data.state == 0) {
  330. this.$message.error(response.data.msg);
  331. return false;
  332. } else {
  333. this.manufacturer = response.data.data.manufacturer;
  334. this.dealer = response.data.data.dealer;
  335. this.goodInfo = response.data.data.goodInfo;
  336. this.goodType = response.data.data.goodType;
  337. }
  338. });
  339. },
  340. getlist(){
  341. var params = {
  342. start_time:this.start_time,
  343. end_time:this.end_time,
  344. order_type:this.order_type,
  345. manufacturer_id:this.manufacturer_id,
  346. keyword:this.searchKey,
  347. limit:this.limit,
  348. page:this.page,
  349. }
  350. getDrugIndetail(params).then(response=>{
  351. if(response.data.state == 1){
  352. var drugInOrder = response.data.data.detail
  353. var total_price = 0
  354. for(let i=0;i<drugInOrder.length;i++){
  355. drugInOrder[i].specification_name = drugInOrder[i].dose + drugInOrder[i].dose_unit + "*" + drugInOrder[i].min_number + drugInOrder[i].min_unit + "/" + drugInOrder[i].max_unit
  356. drugInOrder[i].is_total = 0
  357. total_price += drugInOrder[i].warehousing_count * drugInOrder[i].price
  358. }
  359. drugInOrder.push({
  360. warehousing_order: "合计",
  361. is_total: 1,
  362. specification_name:"",
  363. ctime:"",
  364. total_price:total_price.toFixed(2),
  365. });
  366. this.cancelStockDate = drugInOrder
  367. let objInfo = {}
  368. drugInOrder.forEach((item,index)=>{
  369. let { drug_id } = item
  370. if(!objInfo[drug_id]){
  371. objInfo[drug_id] = {
  372. drug_id,
  373. child:[],
  374. drug_name:item.drug_name,
  375. drug_spec:item.drug_spec,
  376. min_unit:item.min_unit,
  377. warehousing_count:0,
  378. price:item.price,
  379. remark:item.remark,
  380. total_price:0,
  381. dose:item.dose,
  382. dose_unit:item.dose_unit,
  383. min_number:item.min_number,
  384. max_unit:item.max_unit
  385. }
  386. }
  387. })
  388. let list = Object.values(objInfo);
  389. for(let i=0;i<drugInOrder.length;i++){
  390. list.map(item=>{
  391. if(drugInOrder[i].drug_id == item.drug_id){
  392. item.child.push(drugInOrder[i])
  393. }
  394. })
  395. }
  396. for(let i=0;i<list.length;i++){
  397. for(let j=0;j<list[i].child.length;j++){
  398. if(list[i].child[j].warehousing_count!=null || list[i].child[j].warehousing_count != "" || list[i].child[j].warehousing_count!=0){
  399. list[i].warehousing_count += list[i].child[j].warehousing_count
  400. }
  401. }
  402. }
  403. for(let i=0;i<list.length;i++){
  404. list[i].total_price = list[i].warehousing_count * list[i].price
  405. }
  406. this.tableList = list
  407. var total = response.data.data.total
  408. this.total = total
  409. }
  410. })
  411. },
  412. getDrugWarehouseInfoPrint(){
  413. var params = {
  414. start_time:this.start_time,
  415. end_time:this.end_time,
  416. order_type:this.order_type,
  417. }
  418. console.log("药品入库232323223",params)
  419. getDrugWarehouseInfoPrint(params).then(response=>{
  420. if(response.data.state == 1){
  421. var list = response.data.data.list
  422. this.tabelePrintList = list
  423. }
  424. })
  425. },
  426. PrintAction(){
  427. window.sessionStorage.setItem('start_in_time',this.start_time)
  428. window.sessionStorage.setItem('end_in_time',this.end_time)
  429. this.$router.push("/stock/drugprint?start_time="+this.start_time+"&end_time="+this.end_time+"&order_type="+this.order_type+"&manufacturer_id="+this.manufacturer_id+"&keyword="+this.keyword+"&limit="+this.limit+"&page="+this.page)
  430. },
  431. select(){
  432. },
  433. getAdminUser(id){
  434. var name = ""
  435. for(let i=0;i<this.adminUserOptions.length;i++){
  436. if(id == this.adminUserOptions[i].id){
  437. name = this.adminUserOptions[i].name
  438. }
  439. }
  440. return name
  441. },
  442. exportList(){
  443. for(let i=0;i<this.tabelePrintList.length;i++){
  444. this.tabelePrintList[i].index = i+1
  445. this.tabelePrintList[i].drug_name = this.tabelePrintList[i].XtBaseDrug.drug_name
  446. this.tabelePrintList[i].unit = this.tabelePrintList[i].XtBaseDrug.dose + this.tabelePrintList[i].XtBaseDrug.dose_unit + "*" + this.tabelePrintList[i].XtBaseDrug.min_number +this.tabelePrintList[i].XtBaseDrug.min_unit +"/"+this.tabelePrintList[i].XtBaseDrug.max_unit
  447. }
  448. import('@/vendor/Export2Excel').then(excel => {
  449. const tHeader = ['序号','药品名称', '规格型号', '单位','数量','单价','总价','备注']
  450. const filterVal = ['index','drug_name', 'unit', 'min_unit','warehousing_count','price','total_price','remark']
  451. let obj = {'index':'合计','total_price':0}
  452. for(let i=0;i<this.tabelePrintList.length;i++){
  453. obj.total_price += this.tabelePrintList[i].price * this.tabelePrintList[i].warehousing_count
  454. }
  455. for(let j=0;j<this.tabelePrintList.length;j++){
  456. this.tabelePrintList[j].total_price = this.tabelePrintList[j].total_price.toFixed(2)
  457. }
  458. obj.total_price = obj.total_price.toFixed(2)
  459. this.tabelePrintList.push(obj)
  460. const data = this.formatJson(filterVal, this.tabelePrintList)
  461. excel.export_json_to_excel({
  462. header: tHeader,
  463. data,
  464. filename: '药品入库明细'
  465. })
  466. this.downloadLoading = false
  467. })
  468. },
  469. formatJson(filterVal, jsonData) {
  470. return jsonData.map(v => filterVal.map(j => v[j]));
  471. },
  472. exportListDetail(){
  473. import('@/vendor/Export2Excel').then(excel => {
  474. const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','操作时间','制单人','进货价','数量','总价']
  475. const filterVal = ['index','warehousing_order','drugtype','drug_name', 'specification_name','time','user_name','price','warehousing_count','total']
  476. var newArr = []
  477. newArr = this.cancelStockDate
  478. let obj = {'index':'合计','total':0}
  479. for(let i=0;i<newArr.length;i++){
  480. newArr.specification_name = ""
  481. newArr.index = i+1
  482. if(newArr[i].drug_type == 1){
  483. newArr[i].drugtype = "西药"
  484. }
  485. if(newArr[i].drug_type == 2){
  486. newArr[i].drugtype = "草药"
  487. }
  488. if(newArr[i].drug_type == 3){
  489. newArr[i].drugtype = "成药"
  490. }
  491. newArr[i].specification_name = newArr[i].dose + newArr[i].dose_unit +"*" + newArr[i].min_number + newArr[i].min_unit + "/" + newArr[i].max_unit
  492. newArr[i].time = this.getTime(newArr[i].ctime)
  493. newArr[i].user_name = this.getAdminUser(newArr[i].creater)
  494. newArr[i].total = (newArr[i].price * newArr[i].warehousing_count).toFixed(2)
  495. obj.total += (newArr[i].price * newArr[i].warehousing_count)
  496. }
  497. obj.total = obj.total.toFixed(2)
  498. newArr.push(obj)
  499. const data = this.formatJson(filterVal, newArr)
  500. excel.export_json_to_excel({
  501. header: tHeader,
  502. data,
  503. filename: '药品入库明细'
  504. })
  505. this.downloadLoading = false
  506. })
  507. },
  508. }
  509. };
  510. </script>
  511. <style rel="stylesheet/css" lang="scss" scoped>
  512. .information {
  513. border: 1px #dcdfe6 solid;
  514. padding: 30px 20px 30px 20px;
  515. .border {
  516. border-bottom: 1px #dcdfe6 solid;
  517. margin: 0px 0 20px 0;
  518. }
  519. }
  520. .edit_separater {
  521. border-top: 1px solid rgb(233, 233, 233);
  522. margin-top: 15px;
  523. margin-bottom: 15px;
  524. }
  525. </style>
  526. <style>
  527. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  528. font-size: 12px;
  529. }
  530. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  531. background: #6fb5fa;
  532. }
  533. .count {
  534. color: #bd2c00;
  535. }
  536. .el-table td,
  537. .el-table th.is-leaf,
  538. .el-table--border,
  539. .el-table--group {
  540. border-color: #d0d3da;
  541. }
  542. .el-table--border::after,
  543. .el-table--group::after,
  544. .el-table::before {
  545. background-color: #d0d3da;
  546. }
  547. </style>