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

stockInOrder.vue 19KB

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