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

drugOutDetail.vue 16KB

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