supplierDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <!-- 耗材退货管理————待确认 -->
  3. <div>
  4. <el-card>
  5. <div style="text-align: right">
  6. <el-button type="primary" @click.stop="prDataView()">打印</el-button>
  7. <el-button
  8. type="primary"
  9. v-if="isShow"
  10. @click="handleConfirm"
  11. :loading="sureLoading"
  12. >确 认</el-button
  13. >
  14. </div>
  15. </el-card>
  16. <div class="common-card">
  17. <h3>基本信息</h3>
  18. <el-form
  19. :model="listForm"
  20. ref="listform"
  21. label-width="180px"
  22. class="grid-form-class"
  23. >
  24. <div class="form-body">
  25. <div class="flex-css">
  26. <el-form-item label="对账单号" prop="stmtNo">
  27. <div class="content">
  28. {{ listForm.stmtNo }}
  29. </div>
  30. </el-form-item>
  31. <el-form-item label="客户名称" prop="branchName">
  32. <div class="content">
  33. {{ listForm.branchName }}
  34. </div>
  35. </el-form-item>
  36. <el-form-item label="对账类型" prop="isFas">
  37. <div class="content">
  38. {{ listForm.isFas }}
  39. </div>
  40. </el-form-item>
  41. </div>
  42. <div class="flex-css">
  43. <el-form-item label="对账周期" prop="stmtPrd">
  44. <div class="content">
  45. {{ listForm.stmtPrd }}
  46. </div>
  47. </el-form-item>
  48. <el-form-item label="对账金额" prop="amt">
  49. <div class="content">
  50. {{ listForm.amt }}
  51. </div>
  52. </el-form-item>
  53. <el-form-item label="状态" prop="stas">
  54. <div class="content">
  55. {{ listForm.stas }}
  56. </div>
  57. </el-form-item>
  58. </div>
  59. </div>
  60. </el-form>
  61. </div>
  62. <div class="common-card">
  63. <h3>明细信息</h3>
  64. <div class="right-btn">
  65. <el-button type="primary" @click.stop="exportExal()">导出</el-button>
  66. </div>
  67. <div>
  68. <el-table
  69. ref="table"
  70. v-loading="listLoading"
  71. element-loading-text="加载中"
  72. :data="list"
  73. show-summary
  74. :summary-method="getSummaries"
  75. :span-method="arraySpanMethod"
  76. :header-cell-style="getRowClass"
  77. class="print-table"
  78. >
  79. <template slot="empty">
  80. <img src="@/assets/nopage.png" alt />
  81. <p>暂无数据</p>
  82. </template>
  83. <el-table-column :label="tableLabel" align="center">
  84. <!-- :header-cell-style="{background:'#ccc',borderColor:'#000'}" -->
  85. <el-table-column type="index" label="序号" border align="center" />
  86. <el-table-column label="耗材名称" prop="prodName" align="center" />
  87. <el-table-column label="规格" prop="spec" align="center" />
  88. <el-table-column label="型号" prop="mol" align="center">
  89. </el-table-column>
  90. <el-table-column label="数量" prop="cnt" align="center" />
  91. <el-table-column label="单位" prop="unt" align="center" />
  92. <el-table-column label="单价" prop="pric" align="center" />
  93. <el-table-column label="总计" prop="amt" align="center" />
  94. <el-table-column label="类别" prop="mcsType" align="center">
  95. <!-- <template #default="{ row }">
  96. <span v-if="row.mcsType == '0'">普通耗材</span>
  97. <span v-if="row.mcsType == '1'">高值耗材</span>
  98. <span v-if="row.mcsType == '2'">试剂</span>
  99. </template> -->
  100. </el-table-column>
  101. <el-table-column label="是否集采" prop="isFas" align="center">
  102. <template #default="{ row }">
  103. <span v-if="row.isFas == '0'">非集采</span>
  104. <span v-if="row.isFas == '1'">集采</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="批次" prop="lotNum" align="center">
  108. </el-table-column>
  109. <el-table-column label="生产日期" prop="manuDate" align="center" />
  110. <el-table-column label="有效期" prop="prodExpy" align="center" />
  111. <el-table-column label="厂商" prop="prodEntp" align="center" />
  112. </el-table-column>
  113. <p class="price-css">共计{{ total }}条</p>
  114. </el-table>
  115. <el-dialog
  116. title="预览"
  117. :visible.sync="comModal"
  118. width="70%"
  119. :before-close="comhandleClose"
  120. destroy-on-close
  121. append-to-body
  122. >
  123. <div class="prWrap">
  124. <div id="printMe" class="print-container">
  125. <printTable :tableHeader="tableHeader" :tableData="list" />
  126. </div>
  127. </div>
  128. <span slot="footer" class="dialog-footer">
  129. <el-button type="primary" v-print="printObj">打印</el-button>
  130. </span>
  131. </el-dialog>
  132. </div>
  133. <div class="foot-button">
  134. <el-button type="info" @click="handleBack">返 回</el-button>
  135. </div>
  136. <!-- <p class="price-css">合计数量:{{}} <span></span>合计金额: {{}}</p> -->
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import ylStep from "@/components/yl-step";
  142. import ylPagination from "@/components/yl-pagination";
  143. import mcsInfo from "@/views/components/mcs-info.vue";
  144. import printTable from "@/views/components/printTable.vue";
  145. import {
  146. selectRetnDetl,
  147. acpRetnOrd
  148. } from "@/api/productreturnmanage-sup/returnList";
  149. import {
  150. selectSetlStmtDetlD,
  151. updateSetlStmtDStas,
  152. exportAllSetlExcel
  153. } from "@/api/procurement-settlement/index";
  154. import { exportData } from "../../consumCataManage-sup/const.js";
  155. const printCSS = `
  156. @media print{.print-header{position: fixed !important;top: 0 !important;left:10px; !important;height: 51px !important;background: #fff !important;margin-left:1px;}
  157. table{page-break-inside: auto;}
  158. tr{page-break-inside: avoid;}
  159. thead{display: table-header-group;}
  160. @page{@bottom-right{content: "第" counter(page) "页/共" counter(pages) "页";font-family: Arial;font-size: 10pt;}}
  161. body{counter-reset: page;}
  162. `;
  163. export default {
  164. components: {
  165. ylStep,
  166. ylPagination,
  167. mcsInfo,
  168. printTable
  169. },
  170. data() {
  171. return {
  172. tableHeader: [
  173. {
  174. label: "序号",
  175. value: "serial"
  176. },
  177. {
  178. label: "耗材名称",
  179. value: "prodName"
  180. },
  181. {
  182. label: "规格",
  183. value: "spec"
  184. },
  185. // {
  186. // label: "型号",
  187. // value: "mol"
  188. // },
  189. {
  190. label: "数量",
  191. value: "cnt"
  192. },
  193. {
  194. label: "单位",
  195. value: "unt"
  196. },
  197. {
  198. label: "单价",
  199. value: "pric"
  200. },
  201. {
  202. label: "总计(元)",
  203. value: "amt"
  204. },
  205. {
  206. label: "类别",
  207. value: "mcsType"
  208. },
  209. {
  210. label: "是否集采",
  211. value: "iFas"
  212. },
  213. {
  214. label: "批次",
  215. value: "lotNum"
  216. },
  217. {
  218. label: "生产日期",
  219. value: "manuDate"
  220. },
  221. {
  222. label: "有效期至",
  223. value: "prodExpy"
  224. },
  225. {
  226. label: "厂商",
  227. value: "prodEntp"
  228. }
  229. ],
  230. total: "",
  231. comModal: false,
  232. listForm: {
  233. stmtNo: "",
  234. branchName: "",
  235. isFas: "",
  236. amt: "",
  237. stmtPrd: "",
  238. stas: ""
  239. },
  240. stasOptions: [
  241. { value: "A", lable: "待确认" },
  242. { value: "B", lable: "已确认" }
  243. ],
  244. isFasOptions: [
  245. { value: "0", lable: "非集采" },
  246. { value: "1", lable: "集采" }
  247. ],
  248. listLoading: false,
  249. list: [],
  250. isShow: false,
  251. sureLoading: false,
  252. printLoading: false,
  253. tableLabel: "",
  254. // 打印
  255. printObj: {
  256. id: "printMe",
  257. popTitle: "", // 打印配置页上方标题
  258. extraHead: `<style>${printCSS}</style>`, //最上方的头部文字,附加在head标签上的额外标签,使用逗号分隔
  259. preview: "", // 是否启动预览模式,默认是false(开启预览模式,可以先预览后打印)
  260. previewTitle: "", // 打印预览的标题(开启预览模式后出现),
  261. previewPrintBtnLabel: "", // 打印预览的标题的下方按钮文本,点击可进入打印(开启预览模式后出现)
  262. zIndex: "", // 预览的窗口的z-index,默认是 20002(此值要高一些,这涉及到预览模式是否显示在最上面)
  263. previewBeforeOpenCallback() {
  264. console.log("执行了吗");
  265. }, //预览窗口打开之前的callback(开启预览模式调用)
  266. previewOpenCallback() {}, // 预览窗口打开之后的callback(开启预览模式调用)
  267. beforeOpenCallback: () => {}, // 开启打印前的回调事件
  268. beforePrintCallback: () => {},
  269. openCallback() {}, // 调用打印之后的回调事件
  270. closeCallback() {}, //关闭打印的回调事件(无法确定点击的是确认还是取消)
  271. url: "",
  272. standard: "",
  273. extraCss: printCSS
  274. }
  275. };
  276. },
  277. created() {
  278. if (this.$route.query.stas == "A") {
  279. this.isShow = true;
  280. } else {
  281. this.isShow = false;
  282. }
  283. this.tableLabel = this.$route.query.branchName + "对账明细";
  284. this.listForm.stmtNo = this.$route.query.stmtNo;
  285. this.listForm.branchName = this.$route.query.branchName;
  286. this.listForm.amt = this.$route.query.amt;
  287. this.listForm.stmtPrd = this.$route.query.stmtPrd;
  288. this.stasOptions.forEach(i => {
  289. if (i.value == this.$route.query.stas) {
  290. this.listForm.stas = i.lable;
  291. }
  292. });
  293. this.isFasOptions.forEach(i => {
  294. if (i.value == this.$route.query.isFas) {
  295. this.listForm.isFas = i.lable;
  296. }
  297. });
  298. },
  299. mounted() {
  300. this.getData();
  301. },
  302. methods: {
  303. //导出
  304. exportExal() {
  305. exportAllSetlExcel({
  306. stmtNo: this.$route.query.stmtNo,
  307. spdName: this.$route.query.branchName,
  308. stmtPrd: this.$route.query.stmtPrd
  309. }).then(res => {
  310. const _res = res.data;
  311. exportData(_res, "对账明细");
  312. });
  313. },
  314. prDataView() {
  315. this.comModal = true;
  316. },
  317. comhandleClose() {
  318. this.comModal = false;
  319. },
  320. arraySpanMethod() {
  321. //table合计行合并单元格
  322. setTimeout(() => {
  323. if (this.$refs.table.$el) {
  324. let current = this.$refs.table.$el
  325. .querySelector(".el-table__footer-wrapper")
  326. .querySelector(".el-table__footer");
  327. let cell = current.rows[0].cells;
  328. cell[1].colSpan = "13";
  329. }
  330. }, 50);
  331. },
  332. getSummaries(param) {
  333. //table自定义合计行方法summary-method
  334. const { columns, data } = param;
  335. const sums = [];
  336. columns.forEach((column, index) => {
  337. if (index === 0) {
  338. sums[index] = "合计";
  339. return;
  340. }
  341. if (index === 7) {
  342. const values = data.map(item => Number(item[column.property]));
  343. sums[1] = values.reduce((prev, curr) => {
  344. return prev + curr;
  345. }, 0);
  346. sums[1] = sums[1].toFixed(2) + "元";
  347. }
  348. });
  349. return sums;
  350. },
  351. getData() {
  352. this.listLoading = true;
  353. selectSetlStmtDetlD({ stmtNo: this.$route.query.stmtNo })
  354. .then(res => {
  355. this.list = res.data;
  356. this.total = this.$route.query.detlCnt;
  357. this.listLoading = false;
  358. })
  359. .catch(err => {
  360. this.listLoading = false;
  361. });
  362. },
  363. // 确认
  364. handleConfirm() {
  365. this.$confirm("确认对账", "提示", {
  366. confirmButtonText: "确定",
  367. cancelButtonText: "取消",
  368. type: "warning"
  369. }).then(() => {
  370. this.sureLoading = true;
  371. let data = {
  372. stmtNo: this.$route.query.stmtNo,
  373. spdId: this.$route.query.spdId,
  374. stas: "B"
  375. };
  376. updateSetlStmtDStas(data)
  377. .then(res => {
  378. if (res.success == true) {
  379. this.sureLoading = false;
  380. this.$message.success("操作成功");
  381. this.$router.push({
  382. name: "Reconciliation",
  383. query: {
  384. spdId: this.$route.query.spdId,
  385. activeNameTab: this.$route.query.activeNameTab
  386. }
  387. });
  388. } else {
  389. this.sureLoading = false;
  390. this.$message.error("确认失败");
  391. }
  392. })
  393. .catch(err => {
  394. this.sureLoading = false;
  395. });
  396. });
  397. },
  398. handleBack() {
  399. this.$router.push({
  400. name: "Reconciliation",
  401. query: {
  402. spdId: this.$route.query.spdId,
  403. activeNameTab: this.$route.query.activeNameTab
  404. }
  405. });
  406. }
  407. }
  408. };
  409. </script>
  410. <style lang="scss" scoped>
  411. #printMe {
  412. ::v-deep .print-table {
  413. border: 1px solid #999;
  414. td,
  415. th {
  416. border-right: 1px solid #999;
  417. border-bottom: 1px solid #999;
  418. }
  419. }
  420. ::v-deep .price-css {
  421. margin-left: 94%;
  422. }
  423. }
  424. .el-card {
  425. ::v-deep .el-card__body {
  426. padding: 10px 0px 10px 0px;
  427. border: none;
  428. margin-right: 20px;
  429. }
  430. }
  431. .right-btn {
  432. width: 100%;
  433. height: 50px;
  434. padding-right: 20px;
  435. position: absolute;
  436. left: 0;
  437. top: 0;
  438. display: flex;
  439. align-items: center;
  440. justify-content: flex-end;
  441. }
  442. .prWrap {
  443. height: 400px;
  444. overflow: auto;
  445. }
  446. </style>