index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. @get-list="getList"
  12. @clickReset="clickReset"
  13. @changeRadioGroup="changeRadioGroup">
  14. </byTable>
  15. </el-card>
  16. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="94%">
  17. <el-tabs v-model="activeName" class="demo-tabs">
  18. <el-tab-pane label="SKU对账单" name="sku">
  19. <PrintSKU :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintSKU>
  20. </el-tab-pane>
  21. <el-tab-pane label="BOM对账单" name="bom">
  22. <PrintBOM :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintBOM>
  23. </el-tab-pane>
  24. <el-tab-pane label="订单对账单" name="order">
  25. <PrintOrder :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintOrder>
  26. </el-tab-pane>
  27. </el-tabs>
  28. </el-dialog>
  29. </div>
  30. </template>
  31. <script setup>
  32. import byTable from "/src/components/byTable/index";
  33. import PrintSKU from "/src/views/group/finance/summary/printSKU.vue";
  34. import PrintBOM from "/src/views/group/finance/summary/printBOM.vue";
  35. import PrintOrder from "/src/views/group/finance/summary/printOrder.vue";
  36. import { copyText } from "vue3-clipboard";
  37. import { ElMessage } from "element-plus";
  38. const { proxy } = getCurrentInstance();
  39. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  40. const sourceList = ref({
  41. data: [],
  42. pagination: {
  43. total: 0,
  44. pageNum: 1,
  45. pageSize: 10,
  46. type: 1,
  47. departmentId: "",
  48. beginTime: "",
  49. endTime: "",
  50. },
  51. });
  52. const loading = ref(false);
  53. const searchConfig = computed(() => {
  54. return [
  55. {
  56. type: "radio-group",
  57. prop: "type",
  58. label: "维度",
  59. data: [
  60. {
  61. dictKey: 1,
  62. dictValue: "月度",
  63. },
  64. {
  65. dictKey: 2,
  66. dictValue: "季度",
  67. },
  68. {
  69. dictKey: 3,
  70. dictValue: "年度",
  71. },
  72. ],
  73. },
  74. {
  75. type: "date",
  76. propList: ["beginTime", "endTime"],
  77. label: "日期",
  78. },
  79. {
  80. type: "select",
  81. prop: "departmentId",
  82. data: departmentList.value,
  83. label: "事业部",
  84. },
  85. ];
  86. });
  87. const config = computed(() => {
  88. return [
  89. {
  90. attrs: {
  91. label: "维度",
  92. prop: "dimensionality",
  93. },
  94. },
  95. {
  96. attrs: {
  97. label: "客户",
  98. prop: "departmentName",
  99. },
  100. },
  101. {
  102. attrs: {
  103. label: "对账金额",
  104. prop: "reconcilingAmount",
  105. align: "right",
  106. },
  107. render(val) {
  108. return proxy.moneyFormat(val);
  109. },
  110. },
  111. {
  112. attrs: {
  113. label: "对账单数量",
  114. prop: "quantityOfStatement",
  115. },
  116. },
  117. {
  118. attrs: {
  119. label: "合同数量",
  120. prop: "orderQuantity",
  121. },
  122. },
  123. {
  124. attrs: {
  125. label: "操作",
  126. width: 140,
  127. align: "center",
  128. fixed: "right",
  129. },
  130. renderHTML(row) {
  131. return [
  132. {
  133. attrs: {
  134. label: "复制单号",
  135. type: "primary",
  136. text: true,
  137. },
  138. el: "button",
  139. click() {
  140. clickCopyWLNCode(row);
  141. },
  142. },
  143. {
  144. attrs: {
  145. label: "打印",
  146. type: "primary",
  147. text: true,
  148. },
  149. el: "button",
  150. click() {
  151. clickPrint(row);
  152. },
  153. },
  154. ];
  155. },
  156. },
  157. ];
  158. });
  159. const getDemandData = () => {
  160. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  161. if (res.rows && res.rows.length > 0) {
  162. departmentList.value = res.rows.map((item) => {
  163. return {
  164. dictKey: item.id,
  165. dictValue: item.name,
  166. };
  167. });
  168. }
  169. });
  170. };
  171. getDemandData();
  172. const getList = async (req, status) => {
  173. if (status) {
  174. sourceList.value.pagination = {
  175. pageNum: sourceList.value.pagination.pageNum,
  176. pageSize: sourceList.value.pagination.pageSize,
  177. };
  178. } else {
  179. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  180. }
  181. if (sourceList.value.pagination.beginTime || sourceList.value.pagination.endTime) {
  182. sourceList.value.pagination.type = 4;
  183. }
  184. loading.value = true;
  185. proxy.post("/statementOfAccountMerge/page", sourceList.value.pagination).then((res) => {
  186. if (res.rows && res.rows.length > 0) {
  187. sourceList.value.data = res.rows.map((item) => {
  188. return {
  189. ...item,
  190. isCheck: true,
  191. };
  192. });
  193. } else {
  194. sourceList.value.data = [];
  195. }
  196. sourceList.value.pagination.total = res.total;
  197. setTimeout(() => {
  198. loading.value = false;
  199. }, 200);
  200. });
  201. };
  202. getList();
  203. const clickReset = () => {
  204. getList("", true);
  205. };
  206. const changeRadioGroup = () => {
  207. getList({ beginTime: "", endTime: "" });
  208. };
  209. const openPrint = ref(false);
  210. const rowData = ref({});
  211. const activeName = ref("sku");
  212. const clickPrint = (row) => {
  213. activeName.value = "sku";
  214. rowData.value = row;
  215. openPrint.value = true;
  216. };
  217. const clickCopyWLNCode = (row) => {
  218. if (row.idGroupConcat) {
  219. ElMessage("复制数据中,请稍后");
  220. proxy.post("/statementOfAccount/getOrderWlnCodeStr", row.idGroupConcat.split(",")).then((res) => {
  221. copyText(res, undefined, (error) => {
  222. if (error) {
  223. ElMessage.error(`复制失败: ${error} !`);
  224. } else {
  225. ElMessage.success(`复制成功!`);
  226. }
  227. });
  228. });
  229. }
  230. };
  231. </script>
  232. <style lang="scss" scoped>
  233. :deep(.el-dialog) {
  234. margin-top: 10px !important;
  235. margin-bottom: 10px !important;
  236. }
  237. </style>