index.vue 6.5 KB

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