index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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">
  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. // 遮罩层
  123. loading: true,
  124. queryParams: {
  125. pageNum: 1,
  126. pageSize: 10,
  127. },
  128. total: 0,
  129. stockDate: [],
  130. showSearch: true,
  131. showSetting: false,
  132. drag: false,
  133. setRowList: [],
  134. getRowList: [],
  135. tableDate: [
  136. {
  137. surface: "1",
  138. label: "userName",
  139. name: "对账人",
  140. checked: 0,
  141. width: 100,
  142. },
  143. {
  144. surface: "2",
  145. label: "corpName",
  146. name: "客户",
  147. checked: 0,
  148. width: 120,
  149. },
  150. {
  151. surface: "3",
  152. label: "feelMonth",
  153. name: "月份",
  154. checked: 0,
  155. width: 120,
  156. },
  157. {
  158. surface: "4",
  159. label: "ccf",
  160. name: "仓储费",
  161. checked: 0,
  162. width: 120,
  163. },
  164. {
  165. surface: "5",
  166. label: "fAmount",
  167. name: "出入库费",
  168. checked: 0,
  169. width: 120,
  170. },
  171. {
  172. surface: "6",
  173. label: "totalAmount",
  174. name: "合计人民币",
  175. checked: 0,
  176. width: 120,
  177. },
  178. {
  179. surface: "7",
  180. label: "accountPeriod",
  181. name: "账期",
  182. checked: 0,
  183. width: 120,
  184. },
  185. {
  186. surface: "8",
  187. label: "maturity",
  188. name: "协议到期日",
  189. checked: 0,
  190. width: 120,
  191. },
  192. {
  193. surface: "9",
  194. label: "isInvoice",
  195. name: "开发票情况",
  196. checked: 0,
  197. width: 150,
  198. },
  199. {
  200. surface: "10",
  201. label: "isAccountPeriod",
  202. name: "是否超账期",
  203. checked: 0,
  204. width: 150,
  205. },
  206. {
  207. surface: "11",
  208. label: "collectionResult",
  209. name: "应收款催收结果",
  210. checked: 0,
  211. width: 150,
  212. },
  213. ],
  214. allCheck: false,
  215. };
  216. },
  217. created() {
  218. this.setRowList = this.tableDate;
  219. this.getRowList = this.tableDate;
  220. this.getList();
  221. this.getRow();
  222. },
  223. methods: {
  224. //列设置全选
  225. allChecked() {
  226. if (this.allCheck == true) {
  227. this.setRowList.map((e) => {
  228. return (e.checked = 0);
  229. });
  230. } else {
  231. this.setRowList.map((e) => {
  232. return (e.checked = 1);
  233. });
  234. }
  235. },
  236. //查询列数据
  237. getRow() {
  238. let that = this;
  239. this.data = {
  240. tableName: "总账统计",
  241. userId: Cookies.get("userName"),
  242. };
  243. select(this.data).then((res) => {
  244. if (res.data.length != 0) {
  245. this.getRowList = res.data.filter((e) => e.checked == 0);
  246. this.setRowList = res.data;
  247. this.setRowList = this.setRowList.reduce((res, item) => {
  248. res.push({
  249. surface: item.surface,
  250. label: item.label,
  251. name: item.name,
  252. checked: item.checked,
  253. width: item.width,
  254. fixed: item.fixed,
  255. });
  256. return res;
  257. }, []);
  258. }
  259. });
  260. },
  261. //重置列表
  262. delRow() {
  263. this.data = {
  264. tableName: "总账统计",
  265. userId: Cookies.get("userName"),
  266. };
  267. resetModule(this.data).then((res) => {
  268. if (res.code == 200) {
  269. this.showSetting = false;
  270. this.setRowList = this.tableDate;
  271. this.getRowList = this.tableDate;
  272. }
  273. });
  274. },
  275. //保存列设置
  276. save() {
  277. this.showSetting = false;
  278. this.data = {
  279. tableName: "总账统计",
  280. userId: Cookies.get("userName"),
  281. sysTableSetList: this.setRowList,
  282. };
  283. addSet(this.data).then((res) => {
  284. if (res.code == 200) {
  285. this.showSetting = false;
  286. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  287. }
  288. });
  289. },
  290. //开始拖拽事件
  291. onStart() {
  292. this.drag = true;
  293. },
  294. //拖拽结束事件
  295. onEnd() {
  296. this.drag = false;
  297. },
  298. getList() {
  299. financialStatistics(this.queryParams).then((res) => {
  300. if (res.code == 200) {
  301. this.stockDate = res.rows;
  302. this.total = res.total;
  303. this.loading = false;
  304. }
  305. });
  306. },
  307. /** 导出按钮操作 */
  308. handleExport() {
  309. const queryParams = this.queryParams;
  310. this.$confirm("是否确认导出所有订单主数据项?", "警告", {
  311. confirmButtonText: "确定",
  312. cancelButtonText: "取消",
  313. type: "warning",
  314. })
  315. .then(function () {
  316. return feesExport(queryParams);
  317. })
  318. .then((response) => {
  319. this.download(response.msg);
  320. });
  321. },
  322. },
  323. };
  324. </script>
  325. <style lang="scss" scoped>
  326. .tabSetting {
  327. display: flex;
  328. justify-content: space-between;
  329. margin-bottom: 10px;
  330. }
  331. .listStyle {
  332. display: flex;
  333. border-top: 1px solid #dcdfe6;
  334. border-left: 1px solid #dcdfe6;
  335. border-right: 1px solid #dcdfe6;
  336. }
  337. .listStyle:last-child {
  338. border-bottom: 1px solid #dcdfe6;
  339. }
  340. .progress {
  341. display: flex;
  342. align-items: center;
  343. padding: 2px;
  344. background-color: rgba(0, 0, 0, 0.05);
  345. height: 100%;
  346. }
  347. </style>