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

stockOutDetail.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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. <div class="cell clearfix">
  12. <el-input
  13. size="small"
  14. style="width: 400px;"
  15. class="filter-item"
  16. v-model.trim="searchKey"
  17. placeholder="单据编码/制单人/规格名称"
  18. />
  19. <el-button
  20. size="small"
  21. class="filter-item"
  22. type="primary"
  23. icon="el-icon-search"
  24. @click="search"
  25. >搜索</el-button
  26. >
  27. </div>
  28. <div class="cell clearfix">
  29. <label class="title"><span class="name">日期查询</span> : </label>
  30. <el-date-picker
  31. size="small"
  32. v-model="start_time"
  33. prefix-icon="el-icon-date"
  34. :editable="false"
  35. style="width: 196px;"
  36. type="date"
  37. placeholder="选择日期时间"
  38. align="right"
  39. format="yyyy-MM-dd"
  40. value-format="yyyy-MM-dd"
  41. @change="startTimeChange"
  42. ></el-date-picker>
  43. <span class="cellLine"> - </span>
  44. <el-date-picker
  45. size="small"
  46. v-model="end_time"
  47. prefix-icon="el-icon-date"
  48. :editable="false"
  49. style="width: 196px;"
  50. type="date"
  51. placeholder="选择日期时间"
  52. align="right"
  53. format="yyyy-MM-dd"
  54. value-format="yyyy-MM-dd"
  55. @change="endTimeChange"
  56. ></el-date-picker>
  57. </div>
  58. <div class="cell clearfix">
  59. <label class="title"><span class="name">单据类型</span> : </label>
  60. <el-select
  61. size="small"
  62. v-model="order_type"
  63. clearable
  64. placeholder="单据类型"
  65. @change="changeType"
  66. >
  67. <el-option
  68. v-for="item in orderTypeArr"
  69. :key="item.value"
  70. :label="item.label"
  71. :value="item.value"
  72. >
  73. </el-option>
  74. </el-select>
  75. </div>
  76. <div class="cell clearfix">
  77. <label class="title"><span class="name">其它</span> : </label>
  78. <el-select
  79. size="small"
  80. v-model="manufacturer_id"
  81. clearable
  82. placeholder="厂商"
  83. @change="changeManufacturer"
  84. >
  85. <el-option
  86. v-for="item in manufacturer"
  87. :key="item.id"
  88. :label="item.manufacturer_name"
  89. :value="item.id"
  90. >
  91. </el-option>
  92. </el-select>
  93. </div>
  94. <el-row :gutter="12" style="margin-top: 10px">
  95. <el-table
  96. :data="cancelStockDate"
  97. :class="signAndWeighBoxPatients"
  98. border
  99. highlight-current-row
  100. ref="multipleTable"
  101. @selection-change="select"
  102. :row-style="{ color: '#303133' }"
  103. :header-cell-style="{
  104. backgroundColor: 'rgb(245, 247, 250)',
  105. color: '#606266'
  106. }"
  107. >
  108. <el-table-column label="单据编号" align="center" width="200">
  109. <template slot-scope="scope">
  110. {{ scope.row.warehouse_out_order_number }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="商品类型" align="center">
  114. <template slot-scope="scope">
  115. {{ typeName(scope.row.good_type_id) }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="规格名称" align="center">
  119. <template slot-scope="scope">
  120. {{ specificationName(scope.row.good_id) }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="单据类型" align="center">
  124. <template slot-scope="scope">
  125. {{ getTypeName(scope.row) }}
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="操作时间" align="center">
  129. <template slot-scope="scope">
  130. {{ getTime(scope.row.WarehouseOut.warehouse_out_time) }}
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="制单人" align="center">
  134. <template slot-scope="scope">
  135. {{ getXuserName(scope.row.WarehouseOut.creater) }}
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="单价" align="center">
  139. <template slot-scope="scope">
  140. {{ scope.row.price }}
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="数量" align="center">
  144. <template slot-scope="scope">
  145. {{ scope.row.count }}
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="总价" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.is_total == 0">{{
  151. getTotal(scope.row.price, scope.row.count)
  152. }}</span>
  153. <span v-else>{{ scope.row.total }}</span>
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. <el-pagination
  158. @size-change="handleSizeChange"
  159. @current-change="handleCurrentChange"
  160. :page-sizes="[10, 50, 100]"
  161. :page-size="10"
  162. background
  163. style="margin-top:20px;float: right"
  164. layout="total, sizes, prev, pager, next, jumper"
  165. :total="total"
  166. >
  167. </el-pagination>
  168. </el-row>
  169. </div>
  170. </template>
  171. <script>
  172. import { uParseTime } from "@/utils/tools";
  173. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  174. import { deleteCancelStock, GetAllConfig, getStockDetail } from "@/api/stock";
  175. export default {
  176. name: "stockOutDetail",
  177. created() {
  178. var nowDate = new Date();
  179. var nowYear = nowDate.getFullYear();
  180. var nowMonth = nowDate.getMonth() + 1;
  181. var nowDay = nowDate.getDate();
  182. this.end_time =
  183. nowYear +
  184. "-" +
  185. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  186. "-" +
  187. (nowDay < 10 ? "0" + nowDay : nowDay);
  188. nowDate.setMonth(nowDate.getMonth() - 1);
  189. nowYear = nowDate.getFullYear();
  190. nowMonth = nowDate.getMonth() + 1;
  191. nowDay = nowDate.getDate();
  192. this.start_time =
  193. nowYear +
  194. "-" +
  195. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  196. "-" +
  197. (nowDay < 10 ? "0" + nowDay : nowDay);
  198. this.GetCancelStock();
  199. this.GetConfigInfo();
  200. this.fetchAllAdminUsers();
  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: 2,
  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. };
  231. },
  232. methods: {
  233. changeType: function(val) {
  234. this.order_type = val;
  235. this.GetCancelStock();
  236. },
  237. changeManufacturer: function(val) {
  238. this.manufacturer_id = val;
  239. this.GetCancelStock();
  240. },
  241. getTypeName: function(row) {
  242. let name = "";
  243. const name2 = "";
  244. if (row.type == 1) {
  245. name = "耗材出库单";
  246. } else if (row.type == 2) {
  247. name = "其他出库单";
  248. }
  249. return name;
  250. },
  251. specificationName: function(good_info_id) {
  252. let name = "";
  253. for (let i = 0; i < this.goodInfo.length; i++) {
  254. if (this.goodInfo[i].id == good_info_id) {
  255. name = this.goodInfo[i].specification_name;
  256. }
  257. }
  258. return name;
  259. },
  260. typeName: function(good_type_id) {
  261. let name = "";
  262. for (let i = 0; i < this.goodType.length; i++) {
  263. if (this.goodType[i].id == good_type_id) {
  264. name = this.goodType[i].type_name;
  265. }
  266. }
  267. return name;
  268. },
  269. search: function() {
  270. const Params = {
  271. page: this.page,
  272. limit: this.limit,
  273. start_time: this.start_time,
  274. end_time: this.end_time,
  275. type: this.type,
  276. keywords: this.searchKey
  277. };
  278. this.cancelStockDate = [];
  279. getStockDetail(Params).then(response => {
  280. if (response.data.state == 0) {
  281. this.$message.error(response.data.msg);
  282. return false;
  283. } else {
  284. this.total = response.data.data.total;
  285. for (let i = 0; i < response.data.data.list.length; i++) {
  286. var obj = response.data.data.list[i];
  287. obj["is_total"] = 0;
  288. this.cancelStockDate.push(obj);
  289. }
  290. this.cancelStockDate.push({
  291. warehouse_out_order_number: "合计",
  292. is_total: 1,
  293. total: response.data.data.total_price,
  294. WarehouseOut: {
  295. warehouse_out_time: 0
  296. }
  297. });
  298. }
  299. });
  300. },
  301. AddNewOrder: function() {
  302. this.$router.push({
  303. name: "cancelStockOrderAdd",
  304. query: { type: this.type }
  305. });
  306. },
  307. GetCancelStock: function() {
  308. const Params = {
  309. page: this.page,
  310. limit: this.limit,
  311. start_time: this.start_time,
  312. end_time: this.end_time,
  313. type: this.type,
  314. manufacturer: this.manufacturer_id,
  315. order_type: this.order_type,
  316. dealer: this.dealer_id
  317. };
  318. this.cancelStockDate = [];
  319. getStockDetail(Params).then(response => {
  320. if (response.data.state == 0) {
  321. this.$message.error(response.data.msg);
  322. return false;
  323. } else {
  324. this.total = response.data.data.total;
  325. for (let i = 0; i < response.data.data.list.length; i++) {
  326. var obj = response.data.data.list[i];
  327. obj["is_total"] = 0;
  328. this.cancelStockDate.push(obj);
  329. }
  330. this.cancelStockDate.push({
  331. warehouse_out_order_number: "合计",
  332. is_total: 1,
  333. total: response.data.data.total_price,
  334. WarehouseOut: {
  335. warehouse_out_time: 0
  336. }
  337. });
  338. }
  339. });
  340. },
  341. getXuserName(id) {
  342. if (id <= 0) {
  343. return "";
  344. }
  345. var name = "";
  346. if (
  347. this.adminUserOptions == null ||
  348. typeof this.adminUserOptions.length === "undefined"
  349. ) {
  350. return name;
  351. }
  352. var leng = this.adminUserOptions.length;
  353. if (leng == 0) {
  354. return name;
  355. }
  356. for (let index = 0; index < leng; index++) {
  357. if (this.adminUserOptions[index].id == id) {
  358. name = this.adminUserOptions[index].name;
  359. break;
  360. }
  361. }
  362. return name;
  363. },
  364. fetchAllAdminUsers() {
  365. fetchAllAdminUsers().then(response => {
  366. console.log(response);
  367. if (response.data.state == 1) {
  368. this.adminUserOptions = response.data.data.users;
  369. var alen = this.adminUserOptions.length;
  370. for (let index = 0; index < alen; index++) {
  371. if (this.adminUserOptions[index].user_type == 2) {
  372. // this.doctorOptions.push(this.adminUserOptions[index]);
  373. }
  374. }
  375. }
  376. });
  377. },
  378. handleSelectionChange: function(val) {
  379. this.multipleSelection = val;
  380. },
  381. handleSizeChange(val) {
  382. this.limit = val;
  383. this.GetCancelStock();
  384. },
  385. handleCurrentChange(val) {
  386. this.page = val;
  387. this.GetCancelStock();
  388. },
  389. startTimeChange(val) {
  390. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  391. if (time > 0) {
  392. this.$message.error("结束时间不能小于开始时间");
  393. this.start_time = "";
  394. } else {
  395. this.GetCancelStock();
  396. }
  397. },
  398. endTimeChange(val) {
  399. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  400. if (time < 0) {
  401. this.$message.error("结束时间不能小于开始时间");
  402. this.end_time = "";
  403. } else {
  404. this.GetCancelStock();
  405. }
  406. },
  407. getTimestamp(time) {
  408. // 把时间日期转成时间戳
  409. return new Date(time).getTime() / 1000;
  410. },
  411. calculate: function(val) {
  412. return Math.round(parseFloat(val) * 100) / 100;
  413. },
  414. GetConfigInfo: function() {
  415. GetAllConfig().then(response => {
  416. if (response.data.state == 0) {
  417. this.$message.error(response.data.msg);
  418. return false;
  419. } else {
  420. this.manufacturer = response.data.data.manufacturer;
  421. this.dealer = response.data.data.dealer;
  422. this.goodInfo = response.data.data.goodInfo;
  423. this.goodType = response.data.data.goodType;
  424. }
  425. });
  426. },
  427. getManufactuerName: function(manufacturer_id) {
  428. for (let i = 0; i < this.manufacturer.length; i++) {
  429. if (this.manufacturer[i].id == manufacturer_id) {
  430. return this.manufacturer[i].manufacturer_name;
  431. }
  432. }
  433. },
  434. getDealerName: function(dealer_id) {
  435. for (let i = 0; i < this.dealer.length; i++) {
  436. if (this.dealer[i].id == dealer_id) {
  437. return this.dealer[i].dealer_name;
  438. }
  439. }
  440. },
  441. handleEdit: function(index, row) {
  442. this.$router.push({
  443. name: "cancelStockDetail",
  444. query: { id: row.id, type: this.type }
  445. });
  446. },
  447. handleDelete: function(index, row) {
  448. const ids = [];
  449. ids.push(row.id);
  450. const idStr = ids.join(",");
  451. const params = {
  452. ids: idStr
  453. };
  454. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  455. confirmButtonText: "确定",
  456. cancelButtonText: "取消",
  457. type: "warning"
  458. })
  459. .then(() => {
  460. deleteCancelStock(params).then(response => {
  461. if (response.data.state == 0) {
  462. this.$message.error(response.data.msg);
  463. return false;
  464. } else {
  465. this.$notify({
  466. title: "成功",
  467. message: "删除成功",
  468. type: "success",
  469. duration: 2000
  470. });
  471. for (let i = 0; i < ids.length; i++) {
  472. for (let y = 0; y < this.cancelStockDate.length; y++) {
  473. if (ids[i] == this.cancelStockDate[y].id) {
  474. this.cancelStockDate.splice(y, 1);
  475. }
  476. }
  477. }
  478. }
  479. });
  480. })
  481. .catch(() => {});
  482. },
  483. changeAllSelected: function(val) {
  484. if (val) {
  485. this.$refs.multipleTable.toggleAllSelection();
  486. } else {
  487. this.$refs.multipleTable.clearSelection();
  488. }
  489. },
  490. select(selection) {
  491. this.selectedTableData = selection;
  492. },
  493. batchDelete() {
  494. if (this.selectedTableData.length <= 0) {
  495. this.$message.error("请选择要删除的记录");
  496. return;
  497. }
  498. const ids = [];
  499. for (let i = 0; i < this.selectedTableData.length; i++) {
  500. ids.push(this.selectedTableData[i].id);
  501. }
  502. const idStr = ids.join(",");
  503. const params = {
  504. ids: idStr
  505. };
  506. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  507. confirmButtonText: "确定",
  508. cancelButtonText: "取消",
  509. type: "warning"
  510. })
  511. .then(() => {
  512. deleteCancelStock(params).then(response => {
  513. if (response.data.state == 0) {
  514. this.$message.error(response.data.msg);
  515. return false;
  516. } else {
  517. this.$notify({
  518. title: "成功",
  519. message: "删除成功",
  520. type: "success",
  521. duration: 2000
  522. });
  523. for (let i = 0; i < ids.length; i++) {
  524. for (let y = 0; y < this.cancelStockDate.length; y++) {
  525. if (ids[i] == this.cancelStockDate[y].id) {
  526. this.cancelStockDate.splice(y, 1);
  527. }
  528. }
  529. }
  530. }
  531. });
  532. })
  533. .catch(() => {});
  534. },
  535. getTotal: function(price, total) {
  536. var m = 0,
  537. r1,
  538. r2;
  539. var s1 = price.toString();
  540. var s2 = total.toString();
  541. try {
  542. m += s1.split(".")[1].length;
  543. } catch (e) {}
  544. try {
  545. } catch (e) {
  546. m += s2.split(".")[1].length;
  547. }
  548. r1 = Number(price.toString().replace(".", ""));
  549. r2 = Number(total.toString().replace(".", ""));
  550. return (r1 * r2) / Math.pow(10, m);
  551. },
  552. getTime: function(val) {
  553. if (val == 0) {
  554. return "";
  555. } else {
  556. return uParseTime(val, "{y}-{m}-{d}");
  557. }
  558. },
  559. PrintAction: function() {
  560. this.$router.push({
  561. path: "/stock/print",
  562. query: {
  563. type: 3,
  564. start_time: this.start_time,
  565. end_time: this.end_time
  566. }
  567. });
  568. }
  569. }
  570. };
  571. </script>
  572. <style rel="stylesheet/css" lang="scss" scoped>
  573. .information {
  574. border: 1px #dcdfe6 solid;
  575. padding: 30px 20px 30px 20px;
  576. .border {
  577. border-bottom: 1px #dcdfe6 solid;
  578. margin: 0px 0 20px 0;
  579. }
  580. }
  581. .edit_separater {
  582. border-top: 1px solid rgb(233, 233, 233);
  583. margin-top: 15px;
  584. margin-bottom: 15px;
  585. }
  586. </style>
  587. <style>
  588. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  589. font-size: 12px;
  590. }
  591. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  592. background: #6fb5fa;
  593. }
  594. .count {
  595. color: #bd2c00;
  596. }
  597. .el-table td,
  598. .el-table th.is-leaf,
  599. .el-table--border,
  600. .el-table--group {
  601. border-color: #d0d3da;
  602. }
  603. .el-table--border::after,
  604. .el-table--group::after,
  605. .el-table::before {
  606. background-color: #d0d3da;
  607. }
  608. </style>