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

stockCancel.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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>
  33. <div class="cell clearfix">
  34. <label class="title"><span class="name">退库时间</span> : </label>
  35. <el-date-picker
  36. size="small"
  37. v-model="start_time"
  38. prefix-icon="el-icon-date"
  39. :editable="false"
  40. style="width: 196px;"
  41. type="date"
  42. placeholder="选择日期时间"
  43. align="right"
  44. format="yyyy-MM-dd"
  45. value-format="yyyy-MM-dd"
  46. @change="startTimeChange"
  47. ></el-date-picker>
  48. <span class="cellLine"> - </span>
  49. <el-date-picker
  50. size="small"
  51. v-model="end_time"
  52. prefix-icon="el-icon-date"
  53. :editable="false"
  54. style="width: 196px;"
  55. type="date"
  56. placeholder="选择日期时间"
  57. align="right"
  58. format="yyyy-MM-dd"
  59. value-format="yyyy-MM-dd"
  60. @change="endTimeChange"
  61. ></el-date-picker>
  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"
  71. >删除</el-button
  72. >
  73. </div>
  74. <el-row :gutter="12" style="margin-top: 10px">
  75. <el-table
  76. :data="cancelStockDate"
  77. :class="signAndWeighBoxPatients"
  78. border
  79. highlight-current-row
  80. ref="multipleTable"
  81. @selection-change="select"
  82. :row-style="{ color: '#303133' }"
  83. :header-cell-style="{
  84. backgroundColor: 'rgb(245, 247, 250)',
  85. color: '#606266'
  86. }"
  87. >
  88. <el-table-column type="selection" width="55"> </el-table-column>
  89. <el-table-column label="单据日期" align="center">
  90. <template slot-scope="scope">
  91. {{ scope.row.return_time | parseTime("{y}-{m}-{d}") }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="单据编号" align="center">
  95. <template slot-scope="scope">
  96. {{ scope.row.order_number }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="制单人" align="center">
  100. <template slot-scope="scope">
  101. {{ getXuserName(scope.row.creater) }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="厂家" align="center">
  105. <template slot-scope="scope">
  106. {{ getManufactuerName(scope.row.manufacturer) }}
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="经销商" align="center">
  110. <template slot-scope="scope">
  111. {{ getDealerName(scope.row.dealer) }}
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="操作" align="center">
  115. <template slot-scope="scope">
  116. <el-tooltip
  117. class="item"
  118. effect="dark"
  119. content="编辑"
  120. placement="top"
  121. >
  122. <el-button
  123. size="mini"
  124. type="primary"
  125. icon="el-icon-edit-outline"
  126. @click="handleEdit(scope.$index, scope.row)"
  127. >
  128. </el-button>
  129. </el-tooltip>
  130. <el-tooltip
  131. class="item"
  132. effect="dark"
  133. content="删除"
  134. placement="top"
  135. >
  136. <el-button
  137. size="mini"
  138. type="danger"
  139. icon="el-icon-delete"
  140. @click="handleDelete(scope.$index, scope.row)"
  141. >
  142. </el-button>
  143. </el-tooltip>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. <el-pagination
  148. @size-change="handleSizeChange"
  149. @current-change="handleCurrentChange"
  150. :page-sizes="[10, 50, 100]"
  151. :page-size="10"
  152. background
  153. style="margin-top:20px;float: right"
  154. layout="total, sizes, prev, pager, next, jumper"
  155. :total="total"
  156. >
  157. </el-pagination>
  158. </el-row>
  159. </div>
  160. </div>
  161. </template>
  162. <script>
  163. import { uParseTime } from "@/utils/tools";
  164. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  165. import {
  166. deleteCancelStock,
  167. GetAllConfig,
  168. getCancelStockList
  169. } from "@/api/stock";
  170. import BreadCrumb from "../../components/bread-crumb";
  171. export default {
  172. name: "salesReturnOrder",
  173. components: { BreadCrumb },
  174. created() {
  175. var nowDate = new Date();
  176. var nowYear = nowDate.getFullYear();
  177. var nowMonth = nowDate.getMonth() + 1;
  178. var nowDay = nowDate.getDate();
  179. this.end_time =
  180. nowYear +
  181. "-" +
  182. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  183. "-" +
  184. (nowDay < 10 ? "0" + nowDay : nowDay);
  185. nowDate.setMonth(nowDate.getMonth() - 1);
  186. nowYear = nowDate.getFullYear();
  187. nowMonth = nowDate.getMonth() + 1;
  188. nowDay = nowDate.getDate();
  189. this.start_time =
  190. nowYear +
  191. "-" +
  192. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  193. "-" +
  194. (nowDay < 10 ? "0" + nowDay : nowDay);
  195. this.GetCancelStock();
  196. this.GetConfigInfo();
  197. this.fetchAllAdminUsers();
  198. },
  199. data() {
  200. return {
  201. crumbs: [
  202. { path: false, name: "库存管理" },
  203. { path: false, name: "出库退库单" }
  204. ],
  205. searchKey: "",
  206. type: 1,
  207. page: 1,
  208. limit: 10,
  209. checked: false,
  210. total: 0,
  211. pageTotal: 0,
  212. pageSelect: 0,
  213. adminUserOptions: [],
  214. multipleSelection: [],
  215. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  216. start_time: "",
  217. cancelStockDate: [],
  218. end_time: "",
  219. goodType: [],
  220. goodInfo: [],
  221. manufacturer: [],
  222. selectedTableData: [],
  223. dealer: []
  224. };
  225. },
  226. methods: {
  227. search: function() {
  228. const Params = {
  229. page: this.page,
  230. limit: this.limit,
  231. start_time: this.start_time,
  232. end_time: this.end_time,
  233. type: this.type,
  234. keywords: this.searchKey
  235. };
  236. this.cancelStockDate = [];
  237. getCancelStockList(Params).then(response => {
  238. if (response.data.state == 0) {
  239. this.$message.error(response.data.msg);
  240. return false;
  241. } else {
  242. this.total = response.data.data.total;
  243. for (let i = 0; i < response.data.data.list.length; i++) {
  244. this.cancelStockDate.push(response.data.data.list[i]);
  245. }
  246. }
  247. });
  248. },
  249. AddNewOrder: function() {
  250. this.$router.push({
  251. name: "cancelStockOrderAdd",
  252. query: { type: this.type }
  253. });
  254. },
  255. GetCancelStock: function() {
  256. const Params = {
  257. page: this.page,
  258. limit: this.limit,
  259. start_time: this.start_time,
  260. end_time: this.end_time,
  261. type: this.type
  262. };
  263. this.cancelStockDate = [];
  264. getCancelStockList(Params).then(response => {
  265. if (response.data.state == 0) {
  266. this.$message.error(response.data.msg);
  267. return false;
  268. } else {
  269. this.total = response.data.data.total;
  270. for (let i = 0; i < response.data.data.list.length; i++) {
  271. this.cancelStockDate.push(response.data.data.list[i]);
  272. }
  273. }
  274. });
  275. },
  276. getXuserName(id) {
  277. if (id <= 0) {
  278. return "";
  279. }
  280. var name = "";
  281. if (
  282. this.adminUserOptions == null ||
  283. typeof this.adminUserOptions.length === "undefined"
  284. ) {
  285. return name;
  286. }
  287. var leng = this.adminUserOptions.length;
  288. if (leng == 0) {
  289. return name;
  290. }
  291. for (let index = 0; index < leng; index++) {
  292. if (this.adminUserOptions[index].id == id) {
  293. name = this.adminUserOptions[index].name;
  294. break;
  295. }
  296. }
  297. return name;
  298. },
  299. fetchAllAdminUsers() {
  300. fetchAllAdminUsers().then(response => {
  301. console.log(response);
  302. if (response.data.state == 1) {
  303. this.adminUserOptions = response.data.data.users;
  304. var alen = this.adminUserOptions.length;
  305. for (let index = 0; index < alen; index++) {
  306. if (this.adminUserOptions[index].user_type == 2) {
  307. // this.doctorOptions.push(this.adminUserOptions[index]);
  308. }
  309. }
  310. }
  311. });
  312. },
  313. handleSelectionChange: function(val) {
  314. this.multipleSelection = val;
  315. },
  316. handleSizeChange(val) {
  317. this.limit = val;
  318. this.GetCancelStock();
  319. },
  320. handleCurrentChange(val) {
  321. this.page = val;
  322. this.GetCancelStock();
  323. },
  324. startTimeChange(val) {
  325. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  326. if (time > 0) {
  327. this.$message.error("结束时间不能小于开始时间");
  328. this.start_time = "";
  329. } else {
  330. this.GetCancelStock();
  331. }
  332. this.GetCancelStock();
  333. },
  334. endTimeChange(val) {
  335. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  336. if (time < 0) {
  337. this.$message.error("结束时间不能小于开始时间");
  338. this.end_time = "";
  339. } else {
  340. this.GetCancelStock();
  341. }
  342. },
  343. getTimestamp(time) {
  344. // 把时间日期转成时间戳
  345. return new Date(time).getTime() / 1000;
  346. },
  347. calculate: function(val) {
  348. return Math.round(parseFloat(val) * 100) / 100;
  349. },
  350. GetConfigInfo: function() {
  351. GetAllConfig().then(response => {
  352. if (response.data.state == 0) {
  353. this.$message.error(response.data.msg);
  354. return false;
  355. } else {
  356. this.manufacturer = response.data.data.manufacturer;
  357. this.dealer = response.data.data.dealer;
  358. }
  359. });
  360. },
  361. getManufactuerName: function(manufacturer_id) {
  362. for (let i = 0; i < this.manufacturer.length; i++) {
  363. if (this.manufacturer[i].id == manufacturer_id) {
  364. return this.manufacturer[i].manufacturer_name;
  365. }
  366. }
  367. },
  368. getDealerName: function(dealer_id) {
  369. for (let i = 0; i < this.dealer.length; i++) {
  370. if (this.dealer[i].id == dealer_id) {
  371. return this.dealer[i].dealer_name;
  372. }
  373. }
  374. },
  375. handleEdit: function(index, row) {
  376. this.$router.push({
  377. name: "cancelStockDetail",
  378. query: { id: row.id, type: this.type }
  379. });
  380. },
  381. handleDelete: function(index, row) {
  382. const ids = [];
  383. ids.push(row.id);
  384. const idStr = ids.join(",");
  385. const params = {
  386. ids: idStr
  387. };
  388. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  389. confirmButtonText: "确定",
  390. cancelButtonText: "取消",
  391. type: "warning"
  392. })
  393. .then(() => {
  394. deleteCancelStock(params).then(response => {
  395. if (response.data.state == 0) {
  396. this.$message.error(response.data.msg);
  397. return false;
  398. } else {
  399. this.$notify({
  400. title: "成功",
  401. message: "删除成功",
  402. type: "success",
  403. duration: 2000
  404. });
  405. for (let i = 0; i < ids.length; i++) {
  406. for (let y = 0; y < this.cancelStockDate.length; y++) {
  407. if (ids[i] == this.cancelStockDate[y].id) {
  408. this.cancelStockDate.splice(y, 1);
  409. }
  410. }
  411. }
  412. }
  413. });
  414. })
  415. .catch(() => {});
  416. },
  417. changeAllSelected: function(val) {
  418. if (val) {
  419. this.$refs.multipleTable.toggleAllSelection();
  420. } else {
  421. this.$refs.multipleTable.clearSelection();
  422. }
  423. },
  424. select(selection) {
  425. this.selectedTableData = selection;
  426. },
  427. batchDelete() {
  428. if (this.selectedTableData.length <= 0) {
  429. this.$message.error("请选择要删除的记录");
  430. return;
  431. }
  432. const ids = [];
  433. for (let i = 0; i < this.selectedTableData.length; i++) {
  434. ids.push(this.selectedTableData[i].id);
  435. }
  436. const idStr = ids.join(",");
  437. const params = {
  438. ids: idStr
  439. };
  440. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  441. confirmButtonText: "确定",
  442. cancelButtonText: "取消",
  443. type: "warning"
  444. })
  445. .then(() => {
  446. deleteCancelStock(params).then(response => {
  447. if (response.data.state == 0) {
  448. this.$message.error(response.data.msg);
  449. return false;
  450. } else {
  451. this.$notify({
  452. title: "成功",
  453. message: "删除成功",
  454. type: "success",
  455. duration: 2000
  456. });
  457. for (let i = 0; i < ids.length; i++) {
  458. for (let y = 0; y < this.cancelStockDate.length; y++) {
  459. if (ids[i] == this.cancelStockDate[y].id) {
  460. this.cancelStockDate.splice(y, 1);
  461. }
  462. }
  463. }
  464. }
  465. });
  466. })
  467. .catch(() => {});
  468. }
  469. }
  470. };
  471. </script>
  472. <style rel="stylesheet/css" lang="scss" scoped>
  473. .information {
  474. border: 1px #dcdfe6 solid;
  475. padding: 30px 20px 30px 20px;
  476. .border {
  477. border-bottom: 1px #dcdfe6 solid;
  478. margin: 0px 0 20px 0;
  479. }
  480. }
  481. .edit_separater {
  482. border-top: 1px solid rgb(233, 233, 233);
  483. margin-top: 15px;
  484. margin-bottom: 15px;
  485. }
  486. </style>
  487. <style>
  488. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  489. font-size: 12px;
  490. }
  491. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  492. background: #6fb5fa;
  493. }
  494. .count {
  495. color: #bd2c00;
  496. }
  497. .el-table td,
  498. .el-table th.is-leaf,
  499. .el-table--border,
  500. .el-table--group {
  501. border-color: #d0d3da;
  502. }
  503. .el-table--border::after,
  504. .el-table--group::after,
  505. .el-table::before {
  506. background-color: #d0d3da;
  507. }
  508. </style>