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

drugInOrder.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. this.start_time = start
  213. var end = window.sessionStorage.getItem('end_in_time')
  214. this.end_time = end
  215. this.GetConfigInfo()
  216. this.fetchAllAdminUsers()
  217. //获取入库单数据
  218. this.getlist()
  219. this.getDrugWarehouseInfoPrint()
  220. },
  221. data() {
  222. return {
  223. orderTypeArr: [
  224. { value: 1, label: "药品入库单" },
  225. { value: 2, label: "其他入库单" }
  226. ],
  227. newDate: [{ name: "合计", num: "111111" }],
  228. searchKey: "",
  229. type: 1,
  230. page: 1,
  231. limit: 10,
  232. manufacturer_id: "",
  233. dealer_id: "",
  234. order_type: 1,
  235. checked: false,
  236. total: 0,
  237. pageTotal: 0,
  238. pageSelect: 0,
  239. adminUserOptions: [],
  240. multipleSelection: [],
  241. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  242. start_time: "",
  243. cancelStockDate: [],
  244. end_time: "",
  245. goodType: [],
  246. goodInfo: [],
  247. manufacturer: [],
  248. selectedTableData: [],
  249. dealer: [],
  250. tableList:[],
  251. tabelePrintList:[],
  252. };
  253. },
  254. methods: {
  255. changeType: function(val) {
  256. this.order_type = val;
  257. },
  258. changeManufacturer: function(val) {
  259. this.manufacturer_id = val;
  260. },
  261. changeDealer: function(val) {
  262. this.dealer_id = val;
  263. },
  264. search: function() {
  265. this.getlist()
  266. },
  267. getTime: function(val) {
  268. if (val == 0) {
  269. return "";
  270. } else {
  271. return uParseTime(val, "{y}-{m}-{d}");
  272. }
  273. },
  274. AddNewOrder: function() {
  275. },
  276. fetchAllAdminUsers() {
  277. fetchAllAdminUsers().then(response => {
  278. if (response.data.state == 1) {
  279. this.adminUserOptions = response.data.data.users;
  280. }
  281. });
  282. },
  283. handleSelectionChange: function(val) {
  284. this.multipleSelection = val;
  285. },
  286. handleSizeChange(val) {
  287. this.limit = val;
  288. this.getlist()
  289. },
  290. handleCurrentChange(val) {
  291. this.page = val;
  292. this.getlist()
  293. },
  294. startTimeChange(val) {
  295. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  296. if (time > 0) {
  297. this.$message.error("结束时间不能小于开始时间");
  298. this.start_time = "";
  299. } else {
  300. this.getlist()
  301. this.getDrugWarehouseInfoPrint()
  302. }
  303. },
  304. endTimeChange(val) {
  305. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  306. if (time < 0) {
  307. this.$message.error("结束时间不能小于开始时间");
  308. this.end_time = "";
  309. } else {
  310. this.getlist()
  311. this.getDrugWarehouseInfoPrint()
  312. }
  313. },
  314. getTimestamp(time) {
  315. // 把时间日期转成时间戳
  316. return new Date(time).getTime() / 1000;
  317. },
  318. calculate: function(val) {
  319. return Math.round(parseFloat(val) * 100) / 100;
  320. },
  321. GetConfigInfo(){
  322. GetAllConfig().then(response => {
  323. if (response.data.state == 0) {
  324. this.$message.error(response.data.msg);
  325. return false;
  326. } else {
  327. this.manufacturer = response.data.data.manufacturer;
  328. this.dealer = response.data.data.dealer;
  329. this.goodInfo = response.data.data.goodInfo;
  330. this.goodType = response.data.data.goodType;
  331. }
  332. });
  333. },
  334. getlist(){
  335. var params = {
  336. start_time:this.start_time,
  337. end_time:this.end_time,
  338. order_type:this.order_type,
  339. manufacturer_id:this.manufacturer_id,
  340. keyword:this.searchKey,
  341. limit:this.limit,
  342. page:this.page,
  343. }
  344. getDrugIndetail(params).then(response=>{
  345. if(response.data.state == 1){
  346. var drugInOrder = response.data.data.detail
  347. var total_price = 0
  348. for(let i=0;i<drugInOrder.length;i++){
  349. drugInOrder[i].specification_name = drugInOrder[i].dose + drugInOrder[i].dose_unit + "*" + drugInOrder[i].min_number + drugInOrder[i].min_unit + "/" + drugInOrder[i].max_unit
  350. drugInOrder[i].is_total = 0
  351. total_price += drugInOrder[i].warehousing_count * drugInOrder[i].price
  352. }
  353. drugInOrder.push({
  354. warehousing_order: "合计",
  355. is_total: 1,
  356. specification_name:"",
  357. ctime:"",
  358. total_price:total_price.toFixed(2),
  359. });
  360. this.cancelStockDate = drugInOrder
  361. let objInfo = {}
  362. drugInOrder.forEach((item,index)=>{
  363. let { drug_id } = item
  364. if(!objInfo[drug_id]){
  365. objInfo[drug_id] = {
  366. drug_id,
  367. child:[],
  368. drug_name:item.drug_name,
  369. drug_spec:item.drug_spec,
  370. min_unit:item.min_unit,
  371. warehousing_count:0,
  372. price:item.price,
  373. remark:item.remark,
  374. total_price:0,
  375. dose:item.dose,
  376. dose_unit:item.dose_unit,
  377. min_number:item.min_number,
  378. max_unit:item.max_unit
  379. }
  380. }
  381. })
  382. let list = Object.values(objInfo);
  383. for(let i=0;i<drugInOrder.length;i++){
  384. list.map(item=>{
  385. if(drugInOrder[i].drug_id == item.drug_id){
  386. item.child.push(drugInOrder[i])
  387. }
  388. })
  389. }
  390. for(let i=0;i<list.length;i++){
  391. for(let j=0;j<list[i].child.length;j++){
  392. if(list[i].child[j].warehousing_count!=null || list[i].child[j].warehousing_count != "" || list[i].child[j].warehousing_count!=0){
  393. list[i].warehousing_count += list[i].child[j].warehousing_count
  394. }
  395. }
  396. }
  397. for(let i=0;i<list.length;i++){
  398. list[i].total_price = list[i].warehousing_count * list[i].price
  399. }
  400. this.tableList = list
  401. var total = response.data.data.total
  402. this.total = total
  403. }
  404. })
  405. },
  406. getDrugWarehouseInfoPrint(){
  407. var params = {
  408. start_time:this.start_time,
  409. end_time:this.end_time,
  410. order_type:this.order_type,
  411. }
  412. getDrugWarehouseInfoPrint(params).then(response=>{
  413. if(response.data.state == 1){
  414. var list = response.data.data.list
  415. this.tabelePrintList = list
  416. }
  417. })
  418. },
  419. PrintAction(){
  420. window.sessionStorage.setItem('start_in_time',this.start_time)
  421. window.sessionStorage.setItem('end_in_time',this.end_time)
  422. 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)
  423. },
  424. select(){
  425. },
  426. getAdminUser(id){
  427. var name = ""
  428. for(let i=0;i<this.adminUserOptions.length;i++){
  429. if(id == this.adminUserOptions[i].id){
  430. name = this.adminUserOptions[i].name
  431. }
  432. }
  433. return name
  434. },
  435. exportList(){
  436. for(let i=0;i<this.tabelePrintList.length;i++){
  437. this.tabelePrintList[i].index = i+1
  438. this.tabelePrintList[i].drug_name = this.tabelePrintList[i].XtBaseDrug.drug_name
  439. 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
  440. }
  441. import('@/vendor/Export2Excel').then(excel => {
  442. const tHeader = ['序号','药品名称', '规格型号', '单位','数量','单价','总价','备注']
  443. const filterVal = ['index','drug_name', 'unit', 'min_unit','warehousing_count','price','total_price','remark']
  444. let obj = {'index':'合计','total_price':0}
  445. for(let i=0;i<this.tabelePrintList.length;i++){
  446. obj.total_price += this.tabelePrintList[i].price * this.tabelePrintList[i].warehousing_count
  447. }
  448. for(let j=0;j<this.tabelePrintList.length;j++){
  449. this.tabelePrintList[j].total_price = this.tabelePrintList[j].total_price.toFixed(2)
  450. }
  451. obj.total_price = obj.total_price.toFixed(2)
  452. this.tabelePrintList.push(obj)
  453. const data = this.formatJson(filterVal, this.tabelePrintList)
  454. excel.export_json_to_excel({
  455. header: tHeader,
  456. data,
  457. filename: '药品入库明细'
  458. })
  459. this.downloadLoading = false
  460. })
  461. },
  462. formatJson(filterVal, jsonData) {
  463. return jsonData.map(v => filterVal.map(j => v[j]));
  464. },
  465. exportListDetail(){
  466. import('@/vendor/Export2Excel').then(excel => {
  467. const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','操作时间','制单人','进货价','数量','总价']
  468. const filterVal = ['index','warehousing_order','drugtype','drug_name', 'specification_name','time','user_name','price','warehousing_count','total']
  469. var newArr = []
  470. newArr = this.cancelStockDate
  471. let obj = {'index':'合计','total':0}
  472. for(let i=0;i<newArr.length;i++){
  473. newArr.specification_name = ""
  474. newArr.index = i+1
  475. if(newArr[i].drug_type == 1){
  476. newArr[i].drugtype = "西药"
  477. }
  478. if(newArr[i].drug_type == 2){
  479. newArr[i].drugtype = "草药"
  480. }
  481. if(newArr[i].drug_type == 3){
  482. newArr[i].drugtype = "成药"
  483. }
  484. newArr[i].specification_name = newArr[i].dose + newArr[i].dose_unit +"*" + newArr[i].min_number + newArr[i].min_unit + "/" + newArr[i].max_unit
  485. newArr[i].time = this.getTime(newArr[i].ctime)
  486. newArr[i].user_name = this.getAdminUser(newArr[i].creater)
  487. newArr[i].total = (newArr[i].price * newArr[i].warehousing_count).toFixed(2)
  488. obj.total += (newArr[i].price * newArr[i].warehousing_count)
  489. }
  490. obj.total = obj.total.toFixed(2)
  491. newArr.push(obj)
  492. const data = this.formatJson(filterVal, newArr)
  493. excel.export_json_to_excel({
  494. header: tHeader,
  495. data,
  496. filename: '药品入库明细'
  497. })
  498. this.downloadLoading = false
  499. })
  500. },
  501. }
  502. };
  503. </script>
  504. <style rel="stylesheet/css" lang="scss" scoped>
  505. .information {
  506. border: 1px #dcdfe6 solid;
  507. padding: 30px 20px 30px 20px;
  508. .border {
  509. border-bottom: 1px #dcdfe6 solid;
  510. margin: 0px 0 20px 0;
  511. }
  512. }
  513. .edit_separater {
  514. border-top: 1px solid rgb(233, 233, 233);
  515. margin-top: 15px;
  516. margin-bottom: 15px;
  517. }
  518. </style>
  519. <style>
  520. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  521. font-size: 12px;
  522. }
  523. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  524. background: #6fb5fa;
  525. }
  526. .count {
  527. color: #bd2c00;
  528. }
  529. .el-table td,
  530. .el-table th.is-leaf,
  531. .el-table--border,
  532. .el-table--group {
  533. border-color: #d0d3da;
  534. }
  535. .el-table--border::after,
  536. .el-table--group::after,
  537. .el-table::before {
  538. background-color: #d0d3da;
  539. }
  540. </style>