index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  10. </template>
  11. <template slot="corpNameSearch">
  12. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  13. </template>
  14. <template slot="storageNameSearch">
  15. <warehouse-select v-model="search.storageId" :configuration="configurationWarehouse" />
  16. </template>
  17. </avue-crud>
  18. </basic-container>
  19. </div>
  20. </template>
  21. <script>
  22. import { getToken } from "@/util/auth";
  23. import {
  24. getListDetail
  25. } from "@/api/statisticAnalysis/salesReconciliation";
  26. import { micrometerFormat } from "@/util/validate";
  27. import _ from "lodash";
  28. export default {
  29. name: "index",
  30. data() {
  31. return {
  32. form: {},
  33. search: {},
  34. dataList: [],
  35. loading: false,
  36. detailData: {},
  37. page: {
  38. pageSize: 20,
  39. currentPage: 1,
  40. total: 0,
  41. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  42. },
  43. option: {},
  44. defaultOption: {
  45. searchShow: true,
  46. align: "center",
  47. searchMenuSpan: 8,
  48. searchSpan: 8,
  49. border: true,
  50. index: true,
  51. addBtn: false,
  52. viewBtn: false,
  53. editBtn: false,
  54. delBtn: false,
  55. showSummary: true,
  56. searchIcon: true,
  57. searchIndex: 2,
  58. menu: false,
  59. column: [
  60. {
  61. label: "系统编号",
  62. prop: "sysNo",
  63. search: true,
  64. overHidden: true
  65. },
  66. {
  67. label: "客户名称",
  68. prop: "corpName",
  69. search: true,
  70. overHidden: true
  71. },
  72. {
  73. label: "业务日期",
  74. prop: "createTime",
  75. search: true,
  76. type: "date",
  77. format: "yyyy-MM-dd",
  78. valueFormat: "yyyy-MM-dd",
  79. unlinkPanels: true,
  80. searchRange: true,
  81. overHidden: true
  82. },
  83. {
  84. label: "业务员",
  85. prop: "chargeMember",
  86. search: true,
  87. overHidden: true
  88. },
  89. {
  90. label: "商品名称",
  91. prop: "cname",
  92. search: true,
  93. overHidden: true
  94. },
  95. {
  96. label: "规格",
  97. prop: "typeno",
  98. search: false,
  99. overHidden: true
  100. },
  101. {
  102. label: "级别",
  103. prop: "specsTwo",
  104. search: false,
  105. overHidden: true
  106. },
  107. {
  108. label: "花纹",
  109. prop: "brandItem",
  110. search: false,
  111. overHidden: true
  112. },
  113. // {
  114. // label: "批号",
  115. // prop: "lotNo",
  116. // search: false,
  117. // overHidden: true
  118. // },
  119. {
  120. label: "销售数量",
  121. prop: "orderQuantity",
  122. search: false,
  123. overHidden: true
  124. },
  125. {
  126. label: "单价",
  127. prop: "price",
  128. search: false,
  129. overHidden: true
  130. },
  131. {
  132. label: "收入",
  133. prop: "debitAmount",
  134. search: false,
  135. overHidden: true
  136. },
  137. {
  138. label: "成本",
  139. prop: "purchaseAmount",
  140. search: false,
  141. overHidden: true
  142. },
  143. {
  144. label: "利润",
  145. prop: "profit",
  146. search: false,
  147. overHidden: true
  148. }
  149. ]
  150. },
  151. // 仓库配置
  152. configurationWarehouse: {
  153. multipleChoices: false,
  154. multiple: false,
  155. collapseTags: false,
  156. placeholder: "请点击右边按钮选择",
  157. dicData: []
  158. }
  159. };
  160. },
  161. filters: {
  162. decimalFormat(num) {
  163. return num ? Number(num).toFixed(2) : "0.00";
  164. }
  165. },
  166. async created() {
  167. this.option = await this.getColumnData(
  168. this.getColumnName(159),
  169. this.defaultOption
  170. );
  171. let i = 0;
  172. this.option.column.forEach(item => {
  173. if (item.search) i++;
  174. });
  175. if (i % 3 !== 0) {
  176. const num = 3 - Number(i % 3);
  177. this.option.searchMenuSpan = num * 8;
  178. this.option.searchMenuPosition = "right";
  179. }
  180. },
  181. methods: {
  182. cellStyle() {
  183. return "padding:0;height:40px;";
  184. },
  185. searchCriteriaSwitch(type) {
  186. if (type) {
  187. this.option.height = this.option.height - 46;
  188. } else {
  189. this.option.height = this.option.height + 46;
  190. }
  191. this.$refs.crud.getTableHeight();
  192. },
  193. //点击搜索按钮触发
  194. searchChange(params, done) {
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. refreshChange() {
  200. delete this.search.corpName;
  201. delete this.search.storageName;
  202. this.onLoad(this.page, this.search);
  203. },
  204. currentChange(val) {
  205. this.page.currentPage = val;
  206. },
  207. sizeChange(val) {
  208. this.page.currentPage = 1;
  209. this.page.pageSize = val;
  210. },
  211. onLoad(page, params) {
  212. let data = this.deepClone(Object.assign({}, params, this.search));
  213. if (data.createTime) {
  214. data.beginCreateTime = data.createTime[0]
  215. data.endCreateTime = data.createTime[1]
  216. delete data.createTime
  217. }
  218. data.id = this.$route.query.id
  219. this.loading = true;
  220. getListDetail(page.currentPage, page.pageSize, data)
  221. .then(res => {
  222. if (res.data.data.records) {
  223. res.data.data.records.forEach(e => {
  224. e.itemLoading = true;
  225. });
  226. }
  227. this.dataList = res.data.data.records ? res.data.data.records : [];
  228. this.page.total = res.data.data.total;
  229. if (this.page.total) {
  230. this.option.height = window.innerHeight - 210;
  231. }
  232. })
  233. .finally(() => {
  234. this.loading = false;
  235. });
  236. },
  237. editOpen(row) {
  238. if (row.billType == "BJ") {
  239. this.$router.push({
  240. path: "/exportTrade/customerInquiry/index",
  241. query: {
  242. id: row.id
  243. }
  244. });
  245. } else {
  246. this.$router.push({
  247. path: "/exportTrade/salesContract/index",
  248. query: {
  249. id: row.id
  250. }
  251. });
  252. }
  253. },
  254. outExport() {
  255. if (!this.search.corpId) this.$set(this.search, "corpId", "");
  256. if (this.search.createTime && this.search.createTime.length > 0) {
  257. this.search = {
  258. ...this.search,
  259. orderStartDate: this.search.createTime[0] + " 00:00:00",
  260. orderEndDate: this.search.createTime[1] + " 23:59:59"
  261. };
  262. } else {
  263. this.search = {
  264. ...this.search,
  265. beginCreateTime: "",
  266. endCreateTime: "",
  267. id:this.$route.query.id
  268. };
  269. }
  270. // return console.log(this.search)
  271. this.$confirm("是否导出销售对账详情信息?", "提示", {
  272. confirmButtonText: "确定",
  273. cancelButtonText: "取消",
  274. type: "warning"
  275. })
  276. .then(() => {
  277. window.open(
  278. `/api/blade-purchase-sales/exportOrder/orderDetailedExpor?${this.website.tokenHeader
  279. }=${getToken()}&corpId=${this.search.corpId}&chargeMember=${this.search.chargeMember}&cname=${this.search.cname}&sysNo=${this.search.sysNo
  280. }&beginCreateTime=${this.search.beginCreateTime}&endCreateTime =${this.search.endCreateTime
  281. }`
  282. );
  283. })
  284. .catch(() => {
  285. this.$message({
  286. type: "info",
  287. message: "已取消" //
  288. });
  289. });
  290. },
  291. //列保存触发
  292. async saveColumn() {
  293. const inSave = await this.saveColumnData(
  294. this.getColumnName(159),
  295. this.option
  296. );
  297. if (inSave) {
  298. this.$nextTick(() => {
  299. this.$refs.crud.doLayout();
  300. });
  301. this.$message.success("保存成功");
  302. //关闭窗口
  303. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  304. }
  305. },
  306. async resetColumn() {
  307. this.option = this.defaultOption;
  308. const inSave = await this.delColumnData(
  309. this.getColumnName(159),
  310. this.defaultOption
  311. );
  312. if (inSave) {
  313. this.$nextTick(() => {
  314. this.$refs.crud.doLayout();
  315. });
  316. this.$message.success("重置成功");
  317. //关闭窗口
  318. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  319. }
  320. }
  321. }
  322. };
  323. </script>
  324. <style scoped>
  325. .page-crad ::v-deep .basic-container__card {
  326. height: 94.2vh;
  327. }
  328. ::v-deep .el-table__expanded-cell[class*="cell"] {
  329. padding: 0px;
  330. }
  331. .itemTable ::v-deep .el-table {
  332. width: 100%;
  333. }
  334. </style>