index.vue 7.8 KB

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