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

cancelStockOrder.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. @click="AddNewOrder"
  8. class="filter-item"
  9. style="float:right;"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增
  13. </el-button>
  14. </div>
  15. <div class="app-container">
  16. <div class="cell clearfix">
  17. <el-input
  18. size="small"
  19. style="width: 400px;"
  20. class="filter-item"
  21. v-model.trim="searchKey"
  22. placeholder="单据编码/制单人/厂商"
  23. />
  24. <el-button
  25. size="small"
  26. class="filter-item"
  27. type="primary"
  28. icon="el-icon-search"
  29. @click="search"
  30. >搜索</el-button
  31. >
  32. <div style="margin-left:10px;">
  33. <label class="title"><span class="name">退库时间</span> : </label>
  34. <el-date-picker
  35. size="small"
  36. v-model="start_time"
  37. prefix-icon="el-icon-date"
  38. :editable="false"
  39. style="width: 196px;"
  40. type="date"
  41. placeholder="选择日期时间"
  42. align="right"
  43. format="yyyy-MM-dd"
  44. value-format="yyyy-MM-dd"
  45. @change="startTimeChange"
  46. ></el-date-picker>
  47. <span class="cellLine"> - </span>
  48. <el-date-picker
  49. size="small"
  50. v-model="end_time"
  51. prefix-icon="el-icon-date"
  52. :editable="false"
  53. style="width: 196px;"
  54. type="date"
  55. placeholder="选择日期时间"
  56. align="right"
  57. format="yyyy-MM-dd"
  58. value-format="yyyy-MM-dd"
  59. @change="endTimeChange"
  60. ></el-date-picker>
  61. </div>
  62. </div>
  63. <div class="filter-container" style="margin-top: 10px">
  64. <el-checkbox
  65. style="width: 70px"
  66. v-model="checked"
  67. @change="changeAllSelected"
  68. >全选</el-checkbox
  69. >
  70. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  71. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  72. <el-button size="small" type="primary" @click="toExport">导出</el-button>
  73. </div>
  74. <el-row :gutter="12" style="margin-top: 10px">
  75. <el-table
  76. :data="cancelStockDate"
  77. @current-change='currentChange'
  78. :class="signAndWeighBoxPatients"
  79. border
  80. highlight-current-row
  81. ref="multipleTable"
  82. @selection-change="select"
  83. :row-style="{ color: '#303133' }"
  84. :header-cell-style="{
  85. backgroundColor: 'rgb(245, 247, 250)',
  86. color: '#606266'
  87. }"
  88. >
  89. <el-table-column type="selection" width="55"> </el-table-column>
  90. <el-table-column label="单据日期" align="center">
  91. <template slot-scope="scope">
  92. {{ scope.row.return_time | parseTime("{y}-{m}-{d}") }}
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="单据编号" align="center">
  96. <template slot-scope="scope">
  97. {{ scope.row.order_number }}
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="制单人" align="center">
  101. <template slot-scope="scope">
  102. {{ getXuserName(scope.row.creater) }}
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="操作" align="center">
  106. <template slot-scope="scope">
  107. <el-tooltip
  108. class="item"
  109. effect="dark"
  110. content="编辑"
  111. placement="top"
  112. >
  113. <el-button
  114. size="mini"
  115. type="primary"
  116. icon="el-icon-edit-outline"
  117. @click="handleEdit(scope.$index, scope.row)"
  118. >
  119. </el-button>
  120. </el-tooltip>
  121. <el-tooltip
  122. class="item"
  123. effect="dark"
  124. content="删除"
  125. placement="top"
  126. >
  127. <el-button
  128. size="mini"
  129. type="danger"
  130. icon="el-icon-delete"
  131. @click="handleDelete(scope.$index, scope.row)"
  132. >
  133. </el-button>
  134. </el-tooltip>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. <el-pagination
  139. @size-change="handleSizeChange"
  140. @current-change="handleCurrentChange"
  141. :page-sizes="[10, 50, 100]"
  142. :page-size="10"
  143. background
  144. style="margin-top:20px;float: right"
  145. layout="total, sizes, prev, pager, next, jumper"
  146. :total="total"
  147. >
  148. </el-pagination>
  149. </el-row>
  150. <div v-show="showTable" style="margin-top:10px">
  151. <el-table
  152. :data="tableList"
  153. :class="signAndWeighBoxPatients"
  154. border
  155. highlight-current-row
  156. ref="multipleTableOne"
  157. @selection-change="select"
  158. :row-style="{ color: '#303133' }"
  159. :header-cell-style="{
  160. backgroundColor: 'rgb(245, 247, 250)',
  161. color: '#606266'
  162. }"
  163. >
  164. <el-table-column type="selection" width="55"> </el-table-column>
  165. <el-table-column label="耗材名称" align="center">
  166. <template slot-scope="scope">
  167. {{scope.row.GoodInfo.good_name}}
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="规格&单位" align="center">
  171. <template slot-scope="scope">
  172. {{scope.row.GoodInfo.specification_name}} / {{scope.row.GoodInfo.packing_unit}}
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="退库数量" align="center">
  176. <template slot-scope="scope">
  177. {{ scope.row.count}}{{scope.row.GoodInfo.packing_unit}}
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="退库单价" align="center">
  181. <template slot-scope="scope">
  182. {{ scope.row.price}}
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="批次" align="center">
  186. <template slot-scope="scope">
  187. {{ scope.row.number}}
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="品名/注册证号(备案凭证号)" align="center">
  191. <template slot-scope="scope">
  192. {{ scope.row.register_account}}
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="生产厂家" align="center">
  196. <template slot-scope="scope">
  197. {{ scope.row.manufacturer}}
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="生产日期" align="center">
  201. <template slot-scope="scope">
  202. {{getTime(scope.row.product_date,"{y}-{h}-{d}")}}
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="有效期" align="center">
  206. <template slot-scope="scope">
  207. {{getTime(scope.row.expiry_date,"{y}-{h}-{d}")}}
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="经销商" align="center">
  211. <template slot-scope="scope">
  212. {{ scope.row.dealer}}
  213. </template>
  214. </el-table-column>
  215. <el-table-column label="退库原因" align="center">
  216. <template slot-scope="scope">
  217. {{ scope.row.remark}}
  218. </template>
  219. </el-table-column>
  220. </el-table>
  221. </div>
  222. </div>
  223. </div>
  224. </template>
  225. <script>
  226. import { uParseTime } from "@/utils/tools";
  227. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  228. import {
  229. deleteCancelStock,
  230. GetAllConfig,
  231. getCancelStockList,
  232. getSingCancelOrder,
  233. getCancelExportList
  234. } from "@/api/stock";
  235. import BreadCrumb from "../components/bread-crumb";
  236. export default {
  237. name: "salesReturnOrder",
  238. components: { BreadCrumb },
  239. created() {
  240. var nowDate = new Date();
  241. var nowYear = nowDate.getFullYear();
  242. var nowMonth = nowDate.getMonth() + 1;
  243. var nowDay = nowDate.getDate();
  244. this.end_time =
  245. nowYear +
  246. "-" +
  247. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  248. "-" +
  249. (nowDay < 10 ? "0" + nowDay : nowDay);
  250. nowDate.setMonth(nowDate.getMonth() - 1);
  251. nowYear = nowDate.getFullYear();
  252. nowMonth = nowDate.getMonth() + 1;
  253. nowDay = nowDate.getDate();
  254. this.start_time =
  255. nowYear +
  256. "-" +
  257. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  258. "-" +
  259. (nowDay < 10 ? "0" + nowDay : nowDay);
  260. this.GetCancelStock();
  261. this.GetConfigInfo();
  262. this.fetchAllAdminUsers();
  263. },
  264. data() {
  265. return {
  266. crumbs: [
  267. { path: false, name: "库存管理" },
  268. { path: false, name: "出库退库单" }
  269. ],
  270. searchKey: "",
  271. type: 1,
  272. page: 1,
  273. limit: 10,
  274. checked: false,
  275. total: 0,
  276. pageTotal: 0,
  277. pageSelect: 0,
  278. adminUserOptions: [],
  279. multipleSelection: [],
  280. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  281. start_time: "",
  282. cancelStockDate: [],
  283. end_time: "",
  284. goodType: [],
  285. goodInfo: [],
  286. manufacturer: [],
  287. selectedTableData: [],
  288. dealer: [],
  289. tableList:[],
  290. showTable:false,
  291. order_id:"",
  292. exportList:[]
  293. };
  294. },
  295. methods: {
  296. search: function() {
  297. const Params = {
  298. page: this.page,
  299. limit: this.limit,
  300. start_time: this.start_time,
  301. end_time: this.end_time,
  302. type: this.type,
  303. keywords: this.searchKey
  304. };
  305. this.cancelStockDate = [];
  306. getCancelStockList(Params).then(response => {
  307. if (response.data.state == 0) {
  308. this.$message.error(response.data.msg);
  309. return false;
  310. } else {
  311. this.total = response.data.data.total;
  312. for (let i = 0; i < response.data.data.list.length; i++) {
  313. this.cancelStockDate.push(response.data.data.list[i]);
  314. }
  315. }
  316. });
  317. },
  318. AddNewOrder: function() {
  319. this.$router.push({
  320. name: "cancelStockOrderAdd",
  321. query: { type: this.type }
  322. });
  323. },
  324. GetCancelStock: function() {
  325. const Params = {
  326. page: this.page,
  327. limit: this.limit,
  328. start_time: this.start_time,
  329. end_time: this.end_time,
  330. type: this.type
  331. };
  332. this.cancelStockDate = [];
  333. getCancelStockList(Params).then(response => {
  334. if (response.data.state == 0) {
  335. this.$message.error(response.data.msg);
  336. return false;
  337. } else {
  338. this.total = response.data.data.total;
  339. for (let i = 0; i < response.data.data.list.length; i++) {
  340. this.cancelStockDate.push(response.data.data.list[i]);
  341. }
  342. }
  343. });
  344. },
  345. getXuserName(id) {
  346. if (id <= 0) {
  347. return "";
  348. }
  349. var name = "";
  350. if (
  351. this.adminUserOptions == null ||
  352. typeof this.adminUserOptions.length === "undefined"
  353. ) {
  354. return name;
  355. }
  356. var leng = this.adminUserOptions.length;
  357. if (leng == 0) {
  358. return name;
  359. }
  360. for (let index = 0; index < leng; index++) {
  361. if (this.adminUserOptions[index].id == id) {
  362. name = this.adminUserOptions[index].name;
  363. break;
  364. }
  365. }
  366. return name;
  367. },
  368. fetchAllAdminUsers() {
  369. fetchAllAdminUsers().then(response => {
  370. console.log(response);
  371. if (response.data.state == 1) {
  372. this.adminUserOptions = response.data.data.users;
  373. var alen = this.adminUserOptions.length;
  374. for (let index = 0; index < alen; index++) {
  375. if (this.adminUserOptions[index].user_type == 2) {
  376. // this.doctorOptions.push(this.adminUserOptions[index]);
  377. }
  378. }
  379. }
  380. });
  381. },
  382. handleSelectionChange: function(val) {
  383. this.multipleSelection = val;
  384. },
  385. handleSizeChange(val) {
  386. this.limit = val;
  387. this.GetCancelStock();
  388. },
  389. handleCurrentChange(val) {
  390. this.page = val;
  391. this.GetCancelStock();
  392. },
  393. startTimeChange(val) {
  394. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  395. if (time > 0) {
  396. this.$message.error("结束时间不能小于开始时间");
  397. this.start_time = "";
  398. } else {
  399. this.GetCancelStock();
  400. }
  401. this.GetCancelStock();
  402. },
  403. endTimeChange(val) {
  404. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  405. if (time < 0) {
  406. this.$message.error("结束时间不能小于开始时间");
  407. this.end_time = "";
  408. } else {
  409. this.GetCancelStock();
  410. }
  411. },
  412. getTimestamp(time) {
  413. // 把时间日期转成时间戳
  414. return new Date(time).getTime() / 1000;
  415. },
  416. calculate: function(val) {
  417. return Math.round(parseFloat(val) * 100) / 100;
  418. },
  419. GetConfigInfo: function() {
  420. GetAllConfig().then(response => {
  421. if (response.data.state == 0) {
  422. this.$message.error(response.data.msg);
  423. return false;
  424. } else {
  425. this.manufacturer = response.data.data.manufacturer;
  426. this.dealer = response.data.data.dealer;
  427. }
  428. });
  429. },
  430. getManufactuerName: function(manufacturer_id) {
  431. for (let i = 0; i < this.manufacturer.length; i++) {
  432. if (this.manufacturer[i].id == manufacturer_id) {
  433. return this.manufacturer[i].manufacturer_name;
  434. }
  435. }
  436. },
  437. getDealerName: function(dealer_id) {
  438. for (let i = 0; i < this.dealer.length; i++) {
  439. if (this.dealer[i].id == dealer_id) {
  440. return this.dealer[i].dealer_name;
  441. }
  442. }
  443. },
  444. handleEdit: function(index, row) {
  445. console.log("row22222",row.id)
  446. this.$router.push({"path":"/stock/cancel/cancelstockorderedit?id="+row.id})
  447. },
  448. handleDelete: function(index, row) {
  449. const ids = [];
  450. ids.push(row.id);
  451. const idStr = ids.join(",");
  452. const params = {
  453. ids: idStr
  454. };
  455. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  456. confirmButtonText: "确定",
  457. cancelButtonText: "取消",
  458. type: "warning"
  459. })
  460. .then(() => {
  461. deleteCancelStock(params).then(response => {
  462. if (response.data.state == 0) {
  463. this.$message.error(response.data.msg);
  464. return false;
  465. } else {
  466. this.$notify({
  467. title: "成功",
  468. message: "删除成功",
  469. type: "success",
  470. duration: 2000
  471. });
  472. for (let i = 0; i < ids.length; i++) {
  473. for (let y = 0; y < this.cancelStockDate.length; y++) {
  474. if (ids[i] == this.cancelStockDate[y].id) {
  475. this.cancelStockDate.splice(y, 1);
  476. }
  477. }
  478. }
  479. }
  480. });
  481. })
  482. .catch(() => {});
  483. },
  484. changeAllSelected(val) {
  485. if (val) {
  486. this.$refs.multipleTable.toggleAllSelection();
  487. } else {
  488. this.$refs.multipleTable.clearSelection();
  489. }
  490. },
  491. select(val) {
  492. var ids = []
  493. for(let i=0;i<val.length;i++){
  494. ids.push(val[i].id)
  495. }
  496. this.order_id = ids.join(",")
  497. this.selectedTableData = val;
  498. this.getCancelExportList()
  499. },
  500. batchDelete() {
  501. if (this.selectedTableData.length <= 0) {
  502. this.$message.error("请选择要删除的记录");
  503. return;
  504. }
  505. const ids = [];
  506. for (let i = 0; i < this.selectedTableData.length; i++) {
  507. ids.push(this.selectedTableData[i].id);
  508. }
  509. const idStr = ids.join(",");
  510. const params = {
  511. ids: idStr
  512. };
  513. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  514. confirmButtonText: "确定",
  515. cancelButtonText: "取消",
  516. type: "warning"
  517. })
  518. .then(() => {
  519. deleteCancelStock(params).then(response => {
  520. if (response.data.state == 0) {
  521. this.$message.error(response.data.msg);
  522. return false;
  523. } else {
  524. this.$notify({
  525. title: "成功",
  526. message: "删除成功",
  527. type: "success",
  528. duration: 2000
  529. });
  530. for (let i = 0; i < ids.length; i++) {
  531. for (let y = 0; y < this.cancelStockDate.length; y++) {
  532. if (ids[i] == this.cancelStockDate[y].id) {
  533. this.cancelStockDate.splice(y, 1);
  534. }
  535. }
  536. }
  537. }
  538. });
  539. })
  540. .catch(() => {});
  541. },
  542. currentChange(val){
  543. var params ={
  544. id:val.id
  545. }
  546. getSingCancelOrder(params).then(response=>{
  547. if(response.data.state == 1){
  548. var list = response.data.data.list
  549. console.log("list0000000000",list)
  550. this.tableList = list
  551. this.showTable = true
  552. }
  553. })
  554. },
  555. toPrint(){
  556. console.log("22222",this.order_id)
  557. if(this.order_id == ""){
  558. this.$message.error("请勾选退库单")
  559. }else{
  560. console.log("232332332")
  561. this.$router.push({path:'/stock/drugs/cancelstockorderprint?order_id='+this.order_id+"&start_time="+this.start_time+"&end_time="+this.end_time})
  562. }
  563. },
  564. getTime(val) {
  565. if(val < 0){
  566. return ""
  567. }
  568. if(val == ""){
  569. return ""
  570. }else {
  571. return uParseTime(val, '{y}-{m}-{d}')
  572. }
  573. },
  574. getCancelExportList(){
  575. const Params = {
  576. start_time: this.start_time,
  577. end_time: this.end_time,
  578. order_id:this.order_id,
  579. };
  580. console.log("params2323232",Params)
  581. getCancelExportList(Params).then(response=>{
  582. if(response.data.state == 1){
  583. var list = response.data.data.list
  584. console.log("list2323232",list)
  585. this.exportList = list
  586. }
  587. })
  588. },
  589. toExport(){
  590. if(this.order_id == ""){
  591. this.$message.error("请勾选退库单")
  592. return
  593. }
  594. import('@/vendor/Export2Excel').then(excel => {
  595. console.log("23232323",this.exportList)
  596. for(let i=0;i<this.exportList.length;i++){
  597. this.exportList[i].total_price = this.exportList[i].count * this.exportList[i].price
  598. this.exportList[i].good_name = this.exportList[i].GoodInfo.good_name
  599. this.exportList[i].unit = this.exportList[i].GoodInfo.specification_name + "/" +this.exportList[i].GoodInfo.packing_unit
  600. if(this.exportList[i].dealer == 0){
  601. this.exportList[i].dealer = ""
  602. }
  603. if(this.exportList[i].manufacturer == 0){
  604. this.exportList[i].manufacturer = ""
  605. }
  606. this.exportList[i].product_date = this.getTime(this.exportList[i].product_date,"{y}-{h}-{d}")
  607. this.exportList[i].expiry_date = this.getTime(this.exportList[i].expiry_date,"{y}-{h}-{d}")
  608. }
  609. const tHeader = ['耗材名称', '规格&单位','退库数量','退库单价','批次','品名/注册证号(备案凭证号)','生产厂家','生产日期','有效期','退库原因']
  610. const filterVal = ['good_name', 'unit','count','price','number','register_account','manufacturer','product_date','expiry_date','remark']
  611. console.log("table",this.exportList)
  612. const data = this.formatJson(filterVal, this.exportList)
  613. excel.export_json_to_excel({
  614. header: tHeader,
  615. data,
  616. filename: '耗材退库单详情'
  617. })
  618. this.downloadLoading = false
  619. })
  620. },
  621. formatJson(filterVal, jsonData) {
  622. return jsonData.map(v => filterVal.map(j => v[j]));
  623. },
  624. }
  625. };
  626. </script>
  627. <style rel="stylesheet/css" lang="scss" scoped>
  628. .information {
  629. border: 1px #dcdfe6 solid;
  630. padding: 30px 20px 30px 20px;
  631. .border {
  632. border-bottom: 1px #dcdfe6 solid;
  633. margin: 0px 0 20px 0;
  634. }
  635. }
  636. .edit_separater {
  637. border-top: 1px solid rgb(233, 233, 233);
  638. margin-top: 15px;
  639. margin-bottom: 15px;
  640. }
  641. </style>
  642. <style>
  643. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  644. font-size: 12px;
  645. }
  646. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  647. background: #6fb5fa;
  648. }
  649. .count {
  650. color: #bd2c00;
  651. }
  652. .el-table td,
  653. .el-table th.is-leaf,
  654. .el-table--border,
  655. .el-table--group {
  656. border-color: #d0d3da;
  657. }
  658. .el-table--border::after,
  659. .el-table--group::after,
  660. .el-table::before {
  661. background-color: #d0d3da;
  662. }
  663. </style>