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

cancelStockDetail.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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 style="margin-left:10px;">
  35. <label class="title"><span class="name">日期查询</span> : </label>
  36. <el-date-picker
  37. size="small"
  38. v-model="start_time"
  39. prefix-icon="el-icon-date"
  40. :editable="false"
  41. style="width: 196px;"
  42. type="date"
  43. placeholder="选择日期时间"
  44. align="right"
  45. format="yyyy-MM-dd"
  46. value-format="yyyy-MM-dd"
  47. @change="startTimeChange"
  48. ></el-date-picker>
  49. <span class="cellLine"> - </span>
  50. <el-date-picker
  51. size="small"
  52. v-model="end_time"
  53. prefix-icon="el-icon-date"
  54. :editable="false"
  55. style="width: 196px;"
  56. type="date"
  57. placeholder="选择日期时间"
  58. align="right"
  59. format="yyyy-MM-dd"
  60. value-format="yyyy-MM-dd"
  61. @change="endTimeChange"
  62. ></el-date-picker>
  63. </div>
  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.order_number }}
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="耗材类型" align="center">
  121. <template slot-scope="scope">
  122. {{ typeName(scope.row.good_type_id) }}
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="耗材名称" align="center">
  126. <template slot-scope="scope">
  127. {{ typeNameOne(scope.row.good_id) }}
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="规格型号" align="center">
  131. <template slot-scope="scope">
  132. {{ specificationName(scope.row.good_id) }}
  133. </template>
  134. </el-table-column>
  135. <!-- <el-table-column label="单据类型" align="center">
  136. <template slot-scope="scope">
  137. {{ getTypeName(scope.row) }}
  138. </template>
  139. </el-table-column> -->
  140. <el-table-column label="操作时间" align="center">
  141. <template slot-scope="scope">
  142. {{ scope.row.CancelStock.return_time | parseTime("{y}-{m}-{d}") }}
  143. </template>
  144. </el-table-column>
  145. <el-table-column label="制单人" align="center">
  146. <template slot-scope="scope">
  147. {{ getXuserName(scope.row.CancelStock.creater) }}
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="数量" align="center">
  151. <template slot-scope="scope">
  152. {{ scope.row.count }}
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <el-pagination
  157. @size-change="handleSizeChange"
  158. @current-change="handleCurrentChange"
  159. :page-sizes="[10, 50, 100]"
  160. :page-size="10"
  161. background
  162. style="margin-top:20px;float: right"
  163. layout="total, sizes, prev, pager, next, jumper"
  164. :total="total"
  165. >
  166. </el-pagination>
  167. </el-row>
  168. </div>
  169. </template>
  170. <script>
  171. import { uParseTime } from "@/utils/tools";
  172. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  173. import { deleteCancelStock, GetAllConfig, getStockDetail } from "@/api/stock";
  174. export default {
  175. name: "cancelStockDetail",
  176. created() {
  177. var nowDate = new Date();
  178. var nowYear = nowDate.getFullYear();
  179. var nowMonth = nowDate.getMonth() + 1;
  180. var nowDay = nowDate.getDate();
  181. this.end_time =
  182. nowYear +
  183. "-" +
  184. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  185. "-" +
  186. (nowDay < 10 ? "0" + nowDay : nowDay);
  187. nowDate.setMonth(nowDate.getMonth() - 1);
  188. nowYear = nowDate.getFullYear();
  189. nowMonth = nowDate.getMonth() + 1;
  190. nowDay = nowDate.getDate();
  191. this.start_time =
  192. nowYear +
  193. "-" +
  194. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  195. "-" +
  196. (nowDay < 10 ? "0" + nowDay : nowDay);
  197. this.GetCancelStock();
  198. this.GetConfigInfo();
  199. this.fetchAllAdminUsers();
  200. this.goodUnit = this.$store.getters.good_unit
  201. },
  202. data() {
  203. return {
  204. orderTypeArr: [
  205. { value: 1, label: "耗材入库单" },
  206. { value: 2, label: "其他入库单" }
  207. ],
  208. manufacturer_id: "",
  209. dealer_id: "",
  210. order_type: "",
  211. searchKey: "",
  212. type: 4,
  213. page: 1,
  214. limit: 10,
  215. checked: false,
  216. total: 0,
  217. pageTotal: 0,
  218. pageSelect: 0,
  219. adminUserOptions: [],
  220. multipleSelection: [],
  221. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  222. start_time: "",
  223. cancelStockDate: [],
  224. end_time: "",
  225. goodType: [],
  226. goodInfo: [],
  227. manufacturer: [],
  228. selectedTableData: [],
  229. dealer: [],
  230. tableList:[],
  231. goodUnit:[]
  232. };
  233. },
  234. methods: {
  235. PrintAction: function() {
  236. this.$router.push({
  237. path: "/stock/print",
  238. query: {
  239. type: 4,
  240. start_time: this.start_time,
  241. end_time: this.end_time,
  242. limit:this.limit,
  243. page:this.page
  244. }
  245. });
  246. },
  247. changeType: function(val) {
  248. this.order_type = val;
  249. this.GetCancelStock();
  250. },
  251. changeManufacturer: function(val) {
  252. this.manufacturer_id = val;
  253. this.GetCancelStock();
  254. },
  255. getTypeName: function(row) {
  256. let name = "";
  257. const name2 = "";
  258. if (row.type == 1) {
  259. name = "耗材退库单";
  260. } else if (row.type == 2) {
  261. name = "其他退库单";
  262. }
  263. return name;
  264. },
  265. typeName: function(good_type_id) {
  266. let name = "";
  267. for (let i = 0; i < this.goodType.length; i++) {
  268. if (this.goodType[i].id == good_type_id) {
  269. name = this.goodType[i].type_name;
  270. }
  271. }
  272. return name;
  273. },
  274. typeNameOne: function(good_id) {
  275. let name = "";
  276. for (let i = 0; i < this.goodInfo.length; i++) {
  277. if (this.goodInfo[i].id == good_id) {
  278. name = this.goodInfo[i].good_name;
  279. }
  280. }
  281. return name;
  282. },
  283. specificationName: function(good_info_id) {
  284. let name = "";
  285. for (let i = 0; i < this.goodInfo.length; i++) {
  286. if (this.goodInfo[i].id == good_info_id) {
  287. name = this.goodInfo[i].specification_name;
  288. }
  289. }
  290. return name;
  291. },
  292. search: function() {
  293. const Params = {
  294. page: this.page,
  295. limit: this.limit,
  296. start_time: this.start_time,
  297. end_time: this.end_time,
  298. type: this.type,
  299. keywords: this.searchKey
  300. };
  301. this.cancelStockDate = [];
  302. getStockDetail(Params).then(response => {
  303. if (response.data.state == 0) {
  304. this.$message.error(response.data.msg);
  305. return false;
  306. } else {
  307. this.total = response.data.data.total;
  308. for (let i = 0; i < response.data.data.list.length; i++) {
  309. this.cancelStockDate.push(response.data.data.list[i]);
  310. }
  311. }
  312. });
  313. },
  314. AddNewOrder: function() {
  315. this.$router.push({
  316. name: "cancelStockOrderAdd",
  317. query: { type: this.type }
  318. });
  319. },
  320. GetCancelStock: function() {
  321. const Params = {
  322. page: this.page,
  323. limit: this.limit,
  324. start_time: this.start_time,
  325. end_time: this.end_time,
  326. type: this.type,
  327. manufacturer: this.manufacturer_id,
  328. order_type: this.order_type,
  329. dealer: this.dealer_id
  330. };
  331. this.cancelStockDate = [];
  332. getStockDetail(Params).then(response => {
  333. if (response.data.state == 0) {
  334. this.$message.error(response.data.msg);
  335. return false;
  336. } else {
  337. this.total = response.data.data.total;
  338. console.log("数据源头",response.data.data.list)
  339. for (let i = 0; i < response.data.data.list.length; i++) {
  340. this.cancelStockDate.push(response.data.data.list[i]);
  341. this.tableList.push(response.data.data.list[i])
  342. }
  343. }
  344. });
  345. },
  346. getXuserName(id) {
  347. if (id <= 0) {
  348. return "";
  349. }
  350. var name = "";
  351. if (
  352. this.adminUserOptions == null ||
  353. typeof this.adminUserOptions.length === "undefined"
  354. ) {
  355. return name;
  356. }
  357. var leng = this.adminUserOptions.length;
  358. if (leng == 0) {
  359. return name;
  360. }
  361. for (let index = 0; index < leng; index++) {
  362. if (this.adminUserOptions[index].id == id) {
  363. name = this.adminUserOptions[index].name;
  364. break;
  365. }
  366. }
  367. return name;
  368. },
  369. fetchAllAdminUsers() {
  370. fetchAllAdminUsers().then(response => {
  371. console.log(response);
  372. if (response.data.state == 1) {
  373. this.adminUserOptions = response.data.data.users;
  374. var alen = this.adminUserOptions.length;
  375. for (let index = 0; index < alen; index++) {
  376. if (this.adminUserOptions[index].user_type == 2) {
  377. // this.doctorOptions.push(this.adminUserOptions[index]);
  378. }
  379. }
  380. }
  381. });
  382. },
  383. handleSelectionChange: function(val) {
  384. this.multipleSelection = val;
  385. },
  386. handleSizeChange(val) {
  387. this.limit = val;
  388. this.GetCancelStock();
  389. },
  390. handleCurrentChange(val) {
  391. this.page = val;
  392. this.GetCancelStock();
  393. },
  394. startTimeChange(val) {
  395. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  396. if (time > 0) {
  397. this.$message.error("结束时间不能小于开始时间");
  398. this.start_time = "";
  399. } else {
  400. this.GetCancelStock();
  401. }
  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. this.goodInfo = response.data.data.goodInfo;
  428. this.goodType = response.data.data.goodType;
  429. }
  430. });
  431. },
  432. getManufactuerName: function(manufacturer_id) {
  433. for (let i = 0; i < this.manufacturer.length; i++) {
  434. if (this.manufacturer[i].id == manufacturer_id) {
  435. return this.manufacturer[i].manufacturer_name;
  436. }
  437. }
  438. },
  439. getDealerName: function(dealer_id) {
  440. for (let i = 0; i < this.dealer.length; i++) {
  441. if (this.dealer[i].id == dealer_id) {
  442. return this.dealer[i].dealer_name;
  443. }
  444. }
  445. },
  446. handleEdit: function(index, row) {
  447. this.$router.push({
  448. name: "cancelStockDetail",
  449. query: { id: row.id, type: this.type }
  450. });
  451. },
  452. handleDelete: function(index, row) {
  453. const ids = [];
  454. ids.push(row.id);
  455. const idStr = ids.join(",");
  456. const params = {
  457. ids: idStr
  458. };
  459. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  460. confirmButtonText: "确定",
  461. cancelButtonText: "取消",
  462. type: "warning"
  463. })
  464. .then(() => {
  465. deleteCancelStock(params).then(response => {
  466. if (response.data.state == 0) {
  467. this.$message.error(response.data.msg);
  468. return false;
  469. } else {
  470. this.$notify({
  471. title: "成功",
  472. message: "删除成功",
  473. type: "success",
  474. duration: 2000
  475. });
  476. for (let i = 0; i < ids.length; i++) {
  477. for (let y = 0; y < this.cancelStockDate.length; y++) {
  478. if (ids[i] == this.cancelStockDate[y].id) {
  479. this.cancelStockDate.splice(y, 1);
  480. }
  481. }
  482. }
  483. }
  484. });
  485. })
  486. .catch(() => {});
  487. },
  488. changeAllSelected: function(val) {
  489. if (val) {
  490. this.$refs.multipleTable.toggleAllSelection();
  491. } else {
  492. this.$refs.multipleTable.clearSelection();
  493. }
  494. },
  495. select(selection) {
  496. this.selectedTableData = selection;
  497. },
  498. batchDelete() {
  499. if (this.selectedTableData.length <= 0) {
  500. this.$message.error("请选择要删除的记录");
  501. return;
  502. }
  503. const ids = [];
  504. for (let i = 0; i < this.selectedTableData.length; i++) {
  505. ids.push(this.selectedTableData[i].id);
  506. }
  507. const idStr = ids.join(",");
  508. const params = {
  509. ids: idStr
  510. };
  511. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  512. confirmButtonText: "确定",
  513. cancelButtonText: "取消",
  514. type: "warning"
  515. })
  516. .then(() => {
  517. deleteCancelStock(params).then(response => {
  518. if (response.data.state == 0) {
  519. this.$message.error(response.data.msg);
  520. return false;
  521. } else {
  522. this.$notify({
  523. title: "成功",
  524. message: "删除成功",
  525. type: "success",
  526. duration: 2000
  527. });
  528. for (let i = 0; i < ids.length; i++) {
  529. for (let y = 0; y < this.cancelStockDate.length; y++) {
  530. if (ids[i] == this.cancelStockDate[y].id) {
  531. this.cancelStockDate.splice(y, 1);
  532. }
  533. }
  534. }
  535. }
  536. });
  537. })
  538. .catch(() => {});
  539. },
  540. exportList(){
  541. for(let i=0;i<this.tableList.length;i++){
  542. this.tableList[i].index = i+1
  543. this.tableList[i].good_name = this.tableList[i].GoodInfo.good_name
  544. this.tableList[i].specification_name = this.tableList[i].GoodInfo.specification_name
  545. this.tableList[i].packing_unit = this.tableList[i].GoodInfo.packing_unit
  546. this.tableList[i].total_price = (this.tableList[i].count * this.tableList[i].price).toFixed(2)
  547. }
  548. import('@/vendor/Export2Excel').then(excel => {
  549. const tHeader = ['序号','耗材名称', '规格型号', '单位','数量','退库价','总价','备注']
  550. const filterVal = ['index','good_name', 'specification_name', 'packing_unit','count','price','total_price','remark']
  551. const data = this.formatJson(filterVal, this.tableList)
  552. console.log("data",data)
  553. excel.export_json_to_excel({
  554. header: tHeader,
  555. data,
  556. filename: '耗材退库明细'
  557. })
  558. this.downloadLoading = false
  559. })
  560. },
  561. formatJson(filterVal, jsonData) {
  562. return jsonData.map(v => filterVal.map(j => v[j]));
  563. },
  564. getUnit(id){
  565. var name = ""
  566. for(let i=0;i<this.goodUnit.length;i++){
  567. if(this.goodUnit[i].id == id){
  568. name = this.goodUnit[i].name
  569. }
  570. }
  571. return name
  572. },
  573. }
  574. };
  575. </script>
  576. <style rel="stylesheet/css" lang="scss" scoped>
  577. .information {
  578. border: 1px #dcdfe6 solid;
  579. padding: 30px 20px 30px 20px;
  580. .border {
  581. border-bottom: 1px #dcdfe6 solid;
  582. margin: 0px 0 20px 0;
  583. }
  584. }
  585. .edit_separater {
  586. border-top: 1px solid rgb(233, 233, 233);
  587. margin-top: 15px;
  588. margin-bottom: 15px;
  589. }
  590. </style>
  591. <style>
  592. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  593. font-size: 12px;
  594. }
  595. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  596. background: #6fb5fa;
  597. }
  598. .count {
  599. color: #bd2c00;
  600. }
  601. .el-table td,
  602. .el-table th.is-leaf,
  603. .el-table--border,
  604. .el-table--group {
  605. border-color: #d0d3da;
  606. }
  607. .el-table--border::after,
  608. .el-table--group::after,
  609. .el-table::before {
  610. background-color: #d0d3da;
  611. }
  612. </style>