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

cancelStockDetail.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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. icon="el-icon-printer"
  15. @click="exportList"
  16. type="primary"
  17. >导出
  18. </el-button>
  19. <div class="cell clearfix">
  20. <el-input
  21. size="small"
  22. style="width: 400px;"
  23. class="filter-item"
  24. v-model.trim="searchKey"
  25. placeholder="单据编码/制单人/规格名称"
  26. />
  27. <el-button
  28. size="small"
  29. class="filter-item"
  30. type="primary"
  31. icon="el-icon-search"
  32. @click="search"
  33. >搜索</el-button
  34. >
  35. </div>
  36. <div class="cell clearfix">
  37. <label class="title"><span class="name">日期查询</span> : </label>
  38. <el-date-picker
  39. size="small"
  40. v-model="start_time"
  41. prefix-icon="el-icon-date"
  42. :editable="false"
  43. style="width: 196px;"
  44. type="date"
  45. placeholder="选择日期时间"
  46. align="right"
  47. format="yyyy-MM-dd"
  48. value-format="yyyy-MM-dd"
  49. @change="startTimeChange"
  50. ></el-date-picker>
  51. <span class="cellLine"> - </span>
  52. <el-date-picker
  53. size="small"
  54. v-model="end_time"
  55. prefix-icon="el-icon-date"
  56. :editable="false"
  57. style="width: 196px;"
  58. type="date"
  59. placeholder="选择日期时间"
  60. align="right"
  61. format="yyyy-MM-dd"
  62. value-format="yyyy-MM-dd"
  63. @change="endTimeChange"
  64. ></el-date-picker>
  65. </div>
  66. <div class="cell clearfix">
  67. <label class="title"><span class="name">单据类型</span> : </label>
  68. <el-select
  69. size="small"
  70. v-model="order_type"
  71. clearable
  72. placeholder="单据类型"
  73. @change="changeType"
  74. >
  75. <el-option
  76. v-for="item in orderTypeArr"
  77. :key="item.value"
  78. :label="item.label"
  79. :value="item.value"
  80. >
  81. </el-option>
  82. </el-select>
  83. </div>
  84. <div class="cell clearfix">
  85. <label class="title"><span class="name">其它</span> : </label>
  86. <el-select
  87. size="small"
  88. v-model="manufacturer_id"
  89. clearable
  90. placeholder="厂商"
  91. @change="changeManufacturer"
  92. >
  93. <el-option
  94. v-for="item in manufacturer"
  95. :key="item.id"
  96. :label="item.manufacturer_name"
  97. :value="item.id"
  98. >
  99. </el-option>
  100. </el-select>
  101. </div>
  102. <el-row :gutter="12" style="margin-top: 10px">
  103. <el-table
  104. :data="cancelStockDate"
  105. :class="signAndWeighBoxPatients"
  106. border
  107. highlight-current-row
  108. ref="multipleTable"
  109. @selection-change="select"
  110. :row-style="{ color: '#303133' }"
  111. :header-cell-style="{
  112. backgroundColor: 'rgb(245, 247, 250)',
  113. color: '#606266'
  114. }"
  115. >
  116. <el-table-column label="单据编号" align="center" width="200">
  117. <template slot-scope="scope">
  118. {{ scope.row.order_number }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="耗材类型" align="center">
  122. <template slot-scope="scope">
  123. {{ typeName(scope.row.good_type_id) }}
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="耗材名称" align="center">
  127. <template slot-scope="scope">
  128. {{ typeNameOne(scope.row.good_id) }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="规格型号" align="center">
  132. <template slot-scope="scope">
  133. {{ specificationName(scope.row.good_id) }}
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="单据类型" align="center">
  137. <template slot-scope="scope">
  138. {{ getTypeName(scope.row) }}
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="操作时间" align="center">
  142. <template slot-scope="scope">
  143. {{ scope.row.CancelStock.return_time | parseTime("{y}-{m}-{d}") }}
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="制单人" align="center">
  147. <template slot-scope="scope">
  148. {{ getXuserName(scope.row.CancelStock.creater) }}
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="数量" align="center">
  152. <template slot-scope="scope">
  153. {{ scope.row.count }}
  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: "cancelStockDetail",
  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. this.goodUnit = this.$store.getters.good_unit
  202. },
  203. data() {
  204. return {
  205. orderTypeArr: [
  206. { value: 1, label: "耗材入库单" },
  207. { value: 2, label: "其他入库单" }
  208. ],
  209. manufacturer_id: "",
  210. dealer_id: "",
  211. order_type: "",
  212. searchKey: "",
  213. type: 4,
  214. page: 1,
  215. limit: 10,
  216. checked: false,
  217. total: 0,
  218. pageTotal: 0,
  219. pageSelect: 0,
  220. adminUserOptions: [],
  221. multipleSelection: [],
  222. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  223. start_time: "",
  224. cancelStockDate: [],
  225. end_time: "",
  226. goodType: [],
  227. goodInfo: [],
  228. manufacturer: [],
  229. selectedTableData: [],
  230. dealer: [],
  231. tableList:[],
  232. goodUnit:[]
  233. };
  234. },
  235. methods: {
  236. PrintAction: function() {
  237. this.$router.push({
  238. path: "/stock/print",
  239. query: {
  240. type: 4,
  241. start_time: this.start_time,
  242. end_time: this.end_time
  243. }
  244. });
  245. },
  246. changeType: function(val) {
  247. this.order_type = val;
  248. this.GetCancelStock();
  249. },
  250. changeManufacturer: function(val) {
  251. this.manufacturer_id = val;
  252. this.GetCancelStock();
  253. },
  254. getTypeName: function(row) {
  255. let name = "";
  256. const name2 = "";
  257. if (row.type == 1) {
  258. name = "耗材退库单";
  259. } else if (row.type == 2) {
  260. name = "其他退库单";
  261. }
  262. return name;
  263. },
  264. typeName: function(good_type_id) {
  265. let name = "";
  266. for (let i = 0; i < this.goodType.length; i++) {
  267. if (this.goodType[i].id == good_type_id) {
  268. name = this.goodType[i].type_name;
  269. }
  270. }
  271. return name;
  272. },
  273. typeNameOne: function(good_id) {
  274. let name = "";
  275. for (let i = 0; i < this.goodInfo.length; i++) {
  276. if (this.goodInfo[i].id == good_id) {
  277. name = this.goodInfo[i].good_name;
  278. }
  279. }
  280. return name;
  281. },
  282. specificationName: function(good_info_id) {
  283. let name = "";
  284. for (let i = 0; i < this.goodInfo.length; i++) {
  285. if (this.goodInfo[i].id == good_info_id) {
  286. name = this.goodInfo[i].specification_name;
  287. }
  288. }
  289. return name;
  290. },
  291. search: function() {
  292. const Params = {
  293. page: this.page,
  294. limit: this.limit,
  295. start_time: this.start_time,
  296. end_time: this.end_time,
  297. type: this.type,
  298. keywords: this.searchKey
  299. };
  300. this.cancelStockDate = [];
  301. getStockDetail(Params).then(response => {
  302. if (response.data.state == 0) {
  303. this.$message.error(response.data.msg);
  304. return false;
  305. } else {
  306. this.total = response.data.data.total;
  307. for (let i = 0; i < response.data.data.list.length; i++) {
  308. this.cancelStockDate.push(response.data.data.list[i]);
  309. }
  310. }
  311. });
  312. },
  313. AddNewOrder: function() {
  314. this.$router.push({
  315. name: "cancelStockOrderAdd",
  316. query: { type: this.type }
  317. });
  318. },
  319. GetCancelStock: function() {
  320. const Params = {
  321. page: this.page,
  322. limit: this.limit,
  323. start_time: this.start_time,
  324. end_time: this.end_time,
  325. type: this.type,
  326. manufacturer: this.manufacturer_id,
  327. order_type: this.order_type,
  328. dealer: this.dealer_id
  329. };
  330. this.cancelStockDate = [];
  331. getStockDetail(Params).then(response => {
  332. if (response.data.state == 0) {
  333. this.$message.error(response.data.msg);
  334. return false;
  335. } else {
  336. this.total = response.data.data.total;
  337. console.log("数据源头",response.data.data.list)
  338. for (let i = 0; i < response.data.data.list.length; i++) {
  339. this.cancelStockDate.push(response.data.data.list[i]);
  340. this.tableList.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. },
  402. endTimeChange(val) {
  403. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  404. if (time < 0) {
  405. this.$message.error("结束时间不能小于开始时间");
  406. this.end_time = "";
  407. } else {
  408. this.GetCancelStock();
  409. }
  410. },
  411. getTimestamp(time) {
  412. // 把时间日期转成时间戳
  413. return new Date(time).getTime() / 1000;
  414. },
  415. calculate: function(val) {
  416. return Math.round(parseFloat(val) * 100) / 100;
  417. },
  418. GetConfigInfo: function() {
  419. GetAllConfig().then(response => {
  420. if (response.data.state == 0) {
  421. this.$message.error(response.data.msg);
  422. return false;
  423. } else {
  424. this.manufacturer = response.data.data.manufacturer;
  425. this.dealer = response.data.data.dealer;
  426. this.goodInfo = response.data.data.goodInfo;
  427. this.goodType = response.data.data.goodType;
  428. }
  429. });
  430. },
  431. getManufactuerName: function(manufacturer_id) {
  432. for (let i = 0; i < this.manufacturer.length; i++) {
  433. if (this.manufacturer[i].id == manufacturer_id) {
  434. return this.manufacturer[i].manufacturer_name;
  435. }
  436. }
  437. },
  438. getDealerName: function(dealer_id) {
  439. for (let i = 0; i < this.dealer.length; i++) {
  440. if (this.dealer[i].id == dealer_id) {
  441. return this.dealer[i].dealer_name;
  442. }
  443. }
  444. },
  445. handleEdit: function(index, row) {
  446. this.$router.push({
  447. name: "cancelStockDetail",
  448. query: { id: row.id, type: this.type }
  449. });
  450. },
  451. handleDelete: function(index, row) {
  452. const ids = [];
  453. ids.push(row.id);
  454. const idStr = ids.join(",");
  455. const params = {
  456. ids: idStr
  457. };
  458. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  459. confirmButtonText: "确定",
  460. cancelButtonText: "取消",
  461. type: "warning"
  462. })
  463. .then(() => {
  464. deleteCancelStock(params).then(response => {
  465. if (response.data.state == 0) {
  466. this.$message.error(response.data.msg);
  467. return false;
  468. } else {
  469. this.$notify({
  470. title: "成功",
  471. message: "删除成功",
  472. type: "success",
  473. duration: 2000
  474. });
  475. for (let i = 0; i < ids.length; i++) {
  476. for (let y = 0; y < this.cancelStockDate.length; y++) {
  477. if (ids[i] == this.cancelStockDate[y].id) {
  478. this.cancelStockDate.splice(y, 1);
  479. }
  480. }
  481. }
  482. }
  483. });
  484. })
  485. .catch(() => {});
  486. },
  487. changeAllSelected: function(val) {
  488. if (val) {
  489. this.$refs.multipleTable.toggleAllSelection();
  490. } else {
  491. this.$refs.multipleTable.clearSelection();
  492. }
  493. },
  494. select(selection) {
  495. this.selectedTableData = selection;
  496. },
  497. batchDelete() {
  498. if (this.selectedTableData.length <= 0) {
  499. this.$message.error("请选择要删除的记录");
  500. return;
  501. }
  502. const ids = [];
  503. for (let i = 0; i < this.selectedTableData.length; i++) {
  504. ids.push(this.selectedTableData[i].id);
  505. }
  506. const idStr = ids.join(",");
  507. const params = {
  508. ids: idStr
  509. };
  510. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  511. confirmButtonText: "确定",
  512. cancelButtonText: "取消",
  513. type: "warning"
  514. })
  515. .then(() => {
  516. deleteCancelStock(params).then(response => {
  517. if (response.data.state == 0) {
  518. this.$message.error(response.data.msg);
  519. return false;
  520. } else {
  521. this.$notify({
  522. title: "成功",
  523. message: "删除成功",
  524. type: "success",
  525. duration: 2000
  526. });
  527. for (let i = 0; i < ids.length; i++) {
  528. for (let y = 0; y < this.cancelStockDate.length; y++) {
  529. if (ids[i] == this.cancelStockDate[y].id) {
  530. this.cancelStockDate.splice(y, 1);
  531. }
  532. }
  533. }
  534. }
  535. });
  536. })
  537. .catch(() => {});
  538. },
  539. exportList(){
  540. for(let i=0;i<this.tableList.length;i++){
  541. this.tableList[i].index = i+1
  542. this.tableList[i].drug_name = this.typeNameOne(this.tableList[i].good_id)
  543. this.tableList[i].drug_spec = this.specificationName(this.tableList[i].good_id)
  544. this.tableList[i].min_unit = this.getUnit(this.tableList[i].GoodInfo.good_unit)
  545. this.tableList[i].remark = this.tableList[i].GoodInfo.remark
  546. }
  547. import('@/vendor/Export2Excel').then(excel => {
  548. const tHeader = ['序号','耗材名称', '规格型号', '单位','数量','备注']
  549. const filterVal = ['index','drug_name', 'drug_spec', 'min_unit','count','remark']
  550. const data = this.formatJson(filterVal, this.tableList)
  551. console.log("data",data)
  552. excel.export_json_to_excel({
  553. header: tHeader,
  554. data,
  555. filename: '耗材出库明细'
  556. })
  557. this.downloadLoading = false
  558. })
  559. },
  560. formatJson(filterVal, jsonData) {
  561. return jsonData.map(v => filterVal.map(j => v[j]));
  562. },
  563. getUnit(id){
  564. var name = ""
  565. for(let i=0;i<this.goodUnit.length;i++){
  566. if(this.goodUnit[i].id == id){
  567. name = this.goodUnit[i].name
  568. }
  569. }
  570. return name
  571. },
  572. }
  573. };
  574. </script>
  575. <style rel="stylesheet/css" lang="scss" scoped>
  576. .information {
  577. border: 1px #dcdfe6 solid;
  578. padding: 30px 20px 30px 20px;
  579. .border {
  580. border-bottom: 1px #dcdfe6 solid;
  581. margin: 0px 0 20px 0;
  582. }
  583. }
  584. .edit_separater {
  585. border-top: 1px solid rgb(233, 233, 233);
  586. margin-top: 15px;
  587. margin-bottom: 15px;
  588. }
  589. </style>
  590. <style>
  591. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  592. font-size: 12px;
  593. }
  594. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  595. background: #6fb5fa;
  596. }
  597. .count {
  598. color: #bd2c00;
  599. }
  600. .el-table td,
  601. .el-table th.is-leaf,
  602. .el-table--border,
  603. .el-table--group {
  604. border-color: #d0d3da;
  605. }
  606. .el-table--border::after,
  607. .el-table--group::after,
  608. .el-table::before {
  609. background-color: #d0d3da;
  610. }
  611. </style>