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

drugInOrder.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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="cancelStockDate"
  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.warehousing_order}}
  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.warehousing_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]"
  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 { getDrugIndetail} from "@/api/drug/drug_stock"
  189. export default {
  190. name: "stockInDetail",
  191. created() {
  192. var nowDate = new Date();
  193. var nowYear = nowDate.getFullYear();
  194. var nowMonth = nowDate.getMonth() + 1;
  195. var nowDay = nowDate.getDate();
  196. this.end_time =
  197. nowYear +
  198. "-" +
  199. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  200. "-" +
  201. (nowDay < 10 ? "0" + nowDay : nowDay);
  202. nowDate.setMonth(nowDate.getMonth() - 1);
  203. nowYear = nowDate.getFullYear();
  204. nowMonth = nowDate.getMonth() + 1;
  205. nowDay = nowDate.getDate();
  206. this.start_time =
  207. nowYear +
  208. "-" +
  209. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  210. "-" +
  211. (nowDay < 10 ? "0" + nowDay : nowDay);
  212. this.GetConfigInfo()
  213. this.fetchAllAdminUsers()
  214. //获取入库单数据
  215. this.getlist()
  216. },
  217. data() {
  218. return {
  219. orderTypeArr: [
  220. { value: 1, label: "药品入库单" },
  221. { value: 2, label: "其他入库单" }
  222. ],
  223. newDate: [{ name: "合计", num: "111111" }],
  224. searchKey: "",
  225. type: 1,
  226. page: 1,
  227. limit: 10,
  228. manufacturer_id: "",
  229. dealer_id: "",
  230. order_type: "",
  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. tableList:[],
  247. };
  248. },
  249. methods: {
  250. changeType: function(val) {
  251. this.order_type = val;
  252. },
  253. changeManufacturer: function(val) {
  254. this.manufacturer_id = val;
  255. },
  256. changeDealer: function(val) {
  257. this.dealer_id = val;
  258. },
  259. search: function() {
  260. this.getlist()
  261. },
  262. getTime: function(val) {
  263. if (val == 0) {
  264. return "";
  265. } else {
  266. return uParseTime(val, "{y}-{m}-{d}");
  267. }
  268. },
  269. AddNewOrder: function() {
  270. },
  271. fetchAllAdminUsers() {
  272. fetchAllAdminUsers().then(response => {
  273. console.log(response);
  274. if (response.data.state == 1) {
  275. this.adminUserOptions = response.data.data.users;
  276. console.log("医生护士",this.adminUserOptions)
  277. }
  278. });
  279. },
  280. handleSelectionChange: function(val) {
  281. this.multipleSelection = val;
  282. },
  283. handleSizeChange(val) {
  284. this.limit = val;
  285. this.getlist()
  286. },
  287. handleCurrentChange(val) {
  288. this.page = val;
  289. this.getlist()
  290. },
  291. startTimeChange(val) {
  292. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  293. if (time > 0) {
  294. this.$message.error("结束时间不能小于开始时间");
  295. this.start_time = "";
  296. } else {
  297. this.getlist();
  298. }
  299. },
  300. endTimeChange(val) {
  301. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  302. if (time < 0) {
  303. this.$message.error("结束时间不能小于开始时间");
  304. this.end_time = "";
  305. } else {
  306. this.getlist();
  307. }
  308. },
  309. getTimestamp(time) {
  310. // 把时间日期转成时间戳
  311. return new Date(time).getTime() / 1000;
  312. },
  313. calculate: function(val) {
  314. return Math.round(parseFloat(val) * 100) / 100;
  315. },
  316. GetConfigInfo(){
  317. GetAllConfig().then(response => {
  318. if (response.data.state == 0) {
  319. this.$message.error(response.data.msg);
  320. return false;
  321. } else {
  322. this.manufacturer = response.data.data.manufacturer;
  323. this.dealer = response.data.data.dealer;
  324. this.goodInfo = response.data.data.goodInfo;
  325. this.goodType = response.data.data.goodType;
  326. }
  327. });
  328. },
  329. getlist(){
  330. var params = {
  331. start_time:this.start_time,
  332. end_time:this.end_time,
  333. order_type:this.order_type,
  334. manufacturer_id:this.manufacturer_id,
  335. keyword:this.searchKey,
  336. limit:this.limit,
  337. page:this.page,
  338. }
  339. getDrugIndetail(params).then(response=>{
  340. if(response.data.state == 1){
  341. var drugInOrder = response.data.data.detail
  342. console.log("drug3434444",drugInOrder)
  343. this.cancelStockDate = drugInOrder
  344. let objInfo = {}
  345. drugInOrder.forEach((item,index)=>{
  346. let { drug_id } = item
  347. if(!objInfo[drug_id]){
  348. objInfo[drug_id] = {
  349. drug_id,
  350. child:[],
  351. drug_name:item.drug_name,
  352. drug_spec:item.drug_spec,
  353. min_unit:item.min_unit,
  354. warehousing_count:0,
  355. price:item.price,
  356. remark:item.remark,
  357. total_price:0,
  358. dose:item.dose,
  359. dose_unit:item.dose_unit,
  360. min_number:item.min_number,
  361. max_unit:item.max_unit
  362. }
  363. }
  364. })
  365. let list = Object.values(objInfo);
  366. console.log("list22333333",list)
  367. for(let i=0;i<drugInOrder.length;i++){
  368. list.map(item=>{
  369. if(drugInOrder[i].drug_id == item.drug_id){
  370. item.child.push(drugInOrder[i])
  371. }
  372. })
  373. }
  374. console.log("list2334444",list)
  375. for(let i=0;i<list.length;i++){
  376. for(let j=0;j<list[i].child.length;j++){
  377. if(list[i].child[j].warehousing_count!=null || list[i].child[j].warehousing_count != "" || list[i].child[j].warehousing_count!=0){
  378. list[i].warehousing_count += list[i].child[j].warehousing_count
  379. }
  380. }
  381. }
  382. for(let i=0;i<list.length;i++){
  383. list[i].total_price = list[i].warehousing_count * list[i].price
  384. }
  385. console.log("list666666666",list)
  386. this.tableList = list
  387. var total = response.data.data.total
  388. this.total = total
  389. }
  390. })
  391. },
  392. PrintAction(){
  393. 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)
  394. },
  395. select(){
  396. },
  397. getAdminUser(id){
  398. var name = ""
  399. for(let i=0;i<this.adminUserOptions.length;i++){
  400. if(id == this.adminUserOptions[i].id){
  401. name = this.adminUserOptions[i].name
  402. }
  403. }
  404. return name
  405. },
  406. exportList(){
  407. for(let i=0;i<this.tableList.length;i++){
  408. this.tableList[i].index = i+1
  409. 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
  410. }
  411. import('@/vendor/Export2Excel').then(excel => {
  412. const tHeader = ['序号','药品名称', '规格型号', '单位','数量','单价','总价','备注']
  413. const filterVal = ['index','drug_name', 'unit', 'min_unit','warehousing_count','price','total_price','remark']
  414. console.log("表格22222222",this.tableList)
  415. let obj = {'index':'合计','total_price':0}
  416. for(let i=0;i<this.tableList.length;i++){
  417. obj.total_price += this.tableList[i].price * this.tableList[i].warehousing_count
  418. }
  419. for(let j=0;j<this.tableList.length;j++){
  420. this.tableList[j].total_price = this.tableList[j].total_price.toFixed(2)
  421. }
  422. obj.total_price = obj.total_price.toFixed(2)
  423. this.tableList.push(obj)
  424. const data = this.formatJson(filterVal, this.tableList)
  425. console.log("data",data)
  426. excel.export_json_to_excel({
  427. header: tHeader,
  428. data,
  429. filename: '药品入库明细'
  430. })
  431. this.downloadLoading = false
  432. })
  433. },
  434. formatJson(filterVal, jsonData) {
  435. return jsonData.map(v => filterVal.map(j => v[j]));
  436. },
  437. }
  438. };
  439. </script>
  440. <style rel="stylesheet/css" lang="scss" scoped>
  441. .information {
  442. border: 1px #dcdfe6 solid;
  443. padding: 30px 20px 30px 20px;
  444. .border {
  445. border-bottom: 1px #dcdfe6 solid;
  446. margin: 0px 0 20px 0;
  447. }
  448. }
  449. .edit_separater {
  450. border-top: 1px solid rgb(233, 233, 233);
  451. margin-top: 15px;
  452. margin-bottom: 15px;
  453. }
  454. </style>
  455. <style>
  456. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  457. font-size: 12px;
  458. }
  459. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  460. background: #6fb5fa;
  461. }
  462. .count {
  463. color: #bd2c00;
  464. }
  465. .el-table td,
  466. .el-table th.is-leaf,
  467. .el-table--border,
  468. .el-table--group {
  469. border-color: #d0d3da;
  470. }
  471. .el-table--border::after,
  472. .el-table--group::after,
  473. .el-table::before {
  474. background-color: #d0d3da;
  475. }
  476. </style>