index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <div class="tabSetting">
  5. <div>
  6. <el-button
  7. type="warning"
  8. icon="el-icon-download"
  9. size="mini"
  10. @click="handleExport"
  11. >导出
  12. </el-button>
  13. </div>
  14. <div style="display:flex">
  15. <right-toolbar
  16. :showSearch.sync="showSearch"
  17. @queryTable="getList"
  18. ></right-toolbar>
  19. <div style="margin: 0 12px">
  20. <el-tooltip
  21. class="item"
  22. effect="dark"
  23. content="列设置"
  24. placement="top"
  25. >
  26. <el-button
  27. icon="el-icon-setting"
  28. size="mini"
  29. circle
  30. @click="showSetting = !showSetting"
  31. ></el-button>
  32. </el-tooltip>
  33. </div>
  34. </div>
  35. </div>
  36. </el-row>
  37. <el-dialog title="自定义列显示" :visible.sync="showSetting" width="700px">
  38. <div>配置排序列数据(拖动调整顺序)</div>
  39. <div style="margin-left: 17px">
  40. <el-checkbox
  41. v-model="allCheck"
  42. label="全选"
  43. @change="allChecked"
  44. ></el-checkbox>
  45. </div>
  46. <div style="padding: 4px; display: flex; justify-content: center">
  47. <draggable
  48. v-model="setRowList"
  49. group="site"
  50. animation="300"
  51. @start="onStart"
  52. @end="onEnd"
  53. handle=".indraggable"
  54. >
  55. <transition-group>
  56. <div
  57. v-for="item in setRowList"
  58. :key="item.surface"
  59. class="listStyle"
  60. >
  61. <div style="width: 500px" class="indraggable">
  62. <div class="progress" :style="{ width: item.width + 'px' }">
  63. <el-checkbox
  64. :label="item.name"
  65. v-model="item.checked"
  66. :true-label="0"
  67. :false-label="1"
  68. >{{ item.name }}
  69. </el-checkbox>
  70. </div>
  71. </div>
  72. <el-input-number
  73. v-model.number="item.width"
  74. controls-position="right"
  75. :min="1"
  76. :max="500"
  77. size="mini"
  78. ></el-input-number>
  79. </div>
  80. </transition-group>
  81. </draggable>
  82. </div>
  83. <span slot="footer" class="dialog-footer">
  84. <el-button @click="showSetting = false">取 消</el-button>
  85. <el-button @click="delRow" type="danger">重 置</el-button>
  86. <el-button type="primary" @click="save()">确 定</el-button>
  87. </span>
  88. </el-dialog>
  89. <el-table v-loading="loading" :data="stockDate" ref="table" :height="tableHeight">
  90. <el-table-column type="index" label="序号" align="center" />
  91. <el-table-column
  92. v-for="(item, index) in getRowList"
  93. :key="index"
  94. :label="item.name"
  95. :width="item.width"
  96. :prop="item.label"
  97. align="center"
  98. :show-overflow-tooltip="true"
  99. sortable
  100. :fixed="item.fixed"
  101. />
  102. </el-table>
  103. <pagination
  104. v-show="total > 0"
  105. :total="total"
  106. :page.sync="queryParams.pageNum"
  107. :limit.sync="queryParams.pageSize"
  108. @pagination="getList"
  109. />
  110. </div>
  111. </template>
  112. <script>
  113. import { financialStatistics, feesExport } from "@/api/outExcel/outExcel";
  114. import { addSet, select, resetModule } from "@/api/system/set";
  115. import Cookies from "js-cookie";
  116. import draggable from "vuedraggable";
  117. export default {
  118. name: "Warehousebills",
  119. components: {},
  120. data() {
  121. return {
  122. tableHeight: '0',
  123. // 遮罩层
  124. loading: true,
  125. queryParams: {
  126. pageNum: 1,
  127. pageSize: 10,
  128. },
  129. total: 0,
  130. stockDate: [],
  131. showSearch: true,
  132. showSetting: false,
  133. drag: false,
  134. setRowList: [],
  135. getRowList: [],
  136. tableDate: [
  137. {
  138. surface: "1",
  139. label: "userName",
  140. name: "对账人",
  141. checked: 0,
  142. width: 100,
  143. },
  144. {
  145. surface: "2",
  146. label: "corpName",
  147. name: "客户",
  148. checked: 0,
  149. width: 120,
  150. },
  151. {
  152. surface: "3",
  153. label: "feelMonth",
  154. name: "月份",
  155. checked: 0,
  156. width: 120,
  157. },
  158. {
  159. surface: "4",
  160. label: "ccf",
  161. name: "仓储费",
  162. checked: 0,
  163. width: 120,
  164. },
  165. {
  166. surface: "5",
  167. label: "fAmount",
  168. name: "出入库费",
  169. checked: 0,
  170. width: 120,
  171. },
  172. {
  173. surface: "6",
  174. label: "totalAmount",
  175. name: "合计人民币",
  176. checked: 0,
  177. width: 120,
  178. },
  179. {
  180. surface: "7",
  181. label: "accountPeriod",
  182. name: "账期",
  183. checked: 0,
  184. width: 120,
  185. },
  186. {
  187. surface: "8",
  188. label: "maturity",
  189. name: "协议到期日",
  190. checked: 0,
  191. width: 120,
  192. },
  193. {
  194. surface: "9",
  195. label: "isInvoice",
  196. name: "开发票情况",
  197. checked: 0,
  198. width: 150,
  199. },
  200. {
  201. surface: "10",
  202. label: "isAccountPeriod",
  203. name: "是否超账期",
  204. checked: 0,
  205. width: 150,
  206. },
  207. {
  208. surface: "11",
  209. label: "collectionResult",
  210. name: "应收款催收结果",
  211. checked: 0,
  212. width: 150,
  213. },
  214. ],
  215. allCheck: false,
  216. };
  217. },
  218. created() {
  219. this.setRowList = this.tableDate;
  220. this.getRowList = this.tableDate;
  221. this.getList();
  222. this.getRow();
  223. },
  224. mounted() {
  225. this.$nextTick(() => {
  226. // 根据浏览器高度设置初始高度
  227. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  228. // 监听浏览器高度变化,改变表格高度
  229. window.onresize = () => {
  230. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  231. }
  232. })
  233. },
  234. methods: {
  235. //列设置全选
  236. allChecked() {
  237. if (this.allCheck == true) {
  238. this.setRowList.map((e) => {
  239. return (e.checked = 0);
  240. });
  241. } else {
  242. this.setRowList.map((e) => {
  243. return (e.checked = 1);
  244. });
  245. }
  246. },
  247. //查询列数据
  248. getRow() {
  249. let that = this;
  250. this.data = {
  251. tableName: "总账统计",
  252. userId: Cookies.get("userName"),
  253. };
  254. select(this.data).then((res) => {
  255. if (res.data.length != 0) {
  256. this.getRowList = res.data.filter((e) => e.checked == 0);
  257. this.setRowList = res.data;
  258. this.setRowList = this.setRowList.reduce((res, item) => {
  259. res.push({
  260. surface: item.surface,
  261. label: item.label,
  262. name: item.name,
  263. checked: item.checked,
  264. width: item.width,
  265. fixed: item.fixed,
  266. });
  267. return res;
  268. }, []);
  269. }
  270. });
  271. },
  272. //重置列表
  273. delRow() {
  274. this.data = {
  275. tableName: "总账统计",
  276. userId: Cookies.get("userName"),
  277. };
  278. resetModule(this.data).then((res) => {
  279. if (res.code == 200) {
  280. this.showSetting = false;
  281. this.setRowList = this.tableDate;
  282. this.getRowList = this.tableDate;
  283. }
  284. });
  285. },
  286. //保存列设置
  287. save() {
  288. this.showSetting = false;
  289. this.data = {
  290. tableName: "总账统计",
  291. userId: Cookies.get("userName"),
  292. sysTableSetList: this.setRowList,
  293. };
  294. addSet(this.data).then((res) => {
  295. if (res.code == 200) {
  296. this.showSetting = false;
  297. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  298. }
  299. });
  300. },
  301. //开始拖拽事件
  302. onStart() {
  303. this.drag = true;
  304. },
  305. //拖拽结束事件
  306. onEnd() {
  307. this.drag = false;
  308. },
  309. getList() {
  310. financialStatistics(this.queryParams).then((res) => {
  311. if (res.code == 200) {
  312. this.stockDate = res.rows;
  313. this.total = res.total;
  314. this.loading = false;
  315. }
  316. });
  317. },
  318. /** 导出按钮操作 */
  319. handleExport() {
  320. const queryParams = this.queryParams;
  321. this.$confirm("是否确认导出所有订单主数据项?", "警告", {
  322. confirmButtonText: "确定",
  323. cancelButtonText: "取消",
  324. type: "warning",
  325. })
  326. .then(function () {
  327. return feesExport(queryParams);
  328. })
  329. .then((response) => {
  330. this.download(response.msg);
  331. });
  332. },
  333. },
  334. };
  335. </script>
  336. <style lang="scss" scoped>
  337. .tabSetting {
  338. display: flex;
  339. justify-content: space-between;
  340. margin-bottom: 10px;
  341. }
  342. .listStyle {
  343. display: flex;
  344. border-top: 1px solid #dcdfe6;
  345. border-left: 1px solid #dcdfe6;
  346. border-right: 1px solid #dcdfe6;
  347. }
  348. .listStyle:last-child {
  349. border-bottom: 1px solid #dcdfe6;
  350. }
  351. .progress {
  352. display: flex;
  353. align-items: center;
  354. padding: 2px;
  355. background-color: rgba(0, 0, 0, 0.05);
  356. height: 100%;
  357. }
  358. </style>