index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" size="mini" @click.stop="newAdd()">新建产品
  10. </el-button>
  11. </template>
  12. <template slot-scope="{ row, index }" slot="id">
  13. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.cname }}
  14. </span>
  15. </template>
  16. <template slot-scope="{ row, index }" slot="menu">
  17. <!-- <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
  18. <i class="tradingIcon icon-add" />
  19. </el-tooltip>
  20. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  21. <i class="tradingIcon icon-del" />
  22. </el-tooltip>
  23. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  24. <i class="tradingIcon icon-edit" />
  25. </el-tooltip>
  26. <el-tooltip class="item" effect="dark" content="收款" placement="top">
  27. <i class="tradingIcon icon-proceeds" />
  28. </el-tooltip>
  29. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  30. <i class="tradingIcon icon-deliver" />
  31. </el-tooltip>
  32. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  33. <i class="tradingIcon icon-reconciliation" />
  34. </el-tooltip> -->
  35. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  36. 查看
  37. </el-button>
  38. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  39. 删除
  40. </el-button> -->
  41. </template>
  42. </avue-crud>
  43. </basic-container>
  44. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  45. </div>
  46. </template>
  47. <script>
  48. import detailsPage from "./detailsPage";
  49. import { option } from "./js/optionList";
  50. import { getList, getCorpsAll, pageStatistics } from "@/api/basicData/client";
  51. export default {
  52. name: "index",
  53. data() {
  54. return {
  55. src: '',
  56. show: true,
  57. loading: false,
  58. search: {},
  59. detailData: {},
  60. dataList: [],
  61. selectionList: [],
  62. page: {
  63. pageSize: 20,
  64. currentPage: 1,
  65. total: 0,
  66. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  67. },
  68. option: {},
  69. };
  70. },
  71. components: {
  72. detailsPage
  73. },
  74. async created() {
  75. this.option = await this.getColumnData(this.getColumnName(217), option);
  76. this.option.height = window.innerHeight - 210;
  77. this.getAllWorkDicts()
  78. },
  79. methods: {
  80. getAllWorkDicts() {
  81. getCorpsAll().then(res => {
  82. this.findObject(this.option.column, "id").dicData = res.data.data;
  83. this.findObject(this.option.column, "ids").dicData = res.data.data;
  84. })
  85. this.$refs.crud.init();
  86. },
  87. searchCriteriaSwitch(type) {
  88. if (type) {
  89. this.option.height = this.option.height - 46;
  90. } else {
  91. this.option.height = this.option.height + 46;
  92. }
  93. this.$refs.crud.getTableHeight();
  94. },
  95. cellStyle() {
  96. return "padding:0;height:40px;";
  97. },
  98. //点击搜索按钮触发
  99. searchChange(params, done) {
  100. this.page.currentPage = 1;
  101. this.onLoad(this.page, params);
  102. done();
  103. },
  104. refreshChange() {
  105. this.onLoad(this.page, this.search);
  106. },
  107. newAdd() {
  108. this.show = false;
  109. },
  110. onLoad(page, params = {}) {
  111. let data = this.deepClone(Object.assign(params, this.search));
  112. this.loading = true;
  113. getList(
  114. page.currentPage,
  115. page.pageSize,
  116. data
  117. )
  118. .then(res => {
  119. this.dataList = res.data.data.records ? res.data.data.records : [];
  120. this.page.total = res.data.data.total;
  121. })
  122. .finally(() => {
  123. pageStatistics(data).then(res => {
  124. this.form = res.data.data
  125. })
  126. this.loading = false;
  127. });
  128. },
  129. editOpen(row, status) {
  130. this.detailData = {
  131. id: row.id,
  132. status: status
  133. };
  134. this.show = false;
  135. },
  136. currentChange(val) {
  137. this.page.currentPage = val;
  138. },
  139. sizeChange(val) {
  140. this.page.currentPage = 1;
  141. this.page.pageSize = val;
  142. },
  143. rowDel(row, index, done) {
  144. this.$confirm("确定删除数据?", {
  145. confirmButtonText: "确定",
  146. cancelButtonText: "取消",
  147. type: "warning"
  148. }).then(() => {
  149. // remove(row.id).then(res => {
  150. // if (res.data.code == 200) {
  151. // this.$message({
  152. // type: "success",
  153. // message: "删除成功!"
  154. // });
  155. // this.onLoad(this.page, this.search);
  156. // }
  157. // });
  158. });
  159. },
  160. async saveColumn() {
  161. const inSave = await this.saveColumnData(
  162. this.getColumnName(217),
  163. this.option
  164. );
  165. if (inSave) {
  166. this.$nextTick(() => {
  167. this.$refs.crud.doLayout();
  168. });
  169. this.$message.success("保存成功");
  170. //关闭窗口
  171. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  172. }
  173. },
  174. async resetColumn() {
  175. this.option = option;
  176. const inSave = await this.delColumnData(this.getColumnName(217), option);
  177. if (inSave) {
  178. this.$nextTick(() => {
  179. this.$refs.crud.doLayout();
  180. });
  181. this.getAllWorkDicts()
  182. this.$message.success("重置成功");
  183. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  184. }
  185. },
  186. //返回列表
  187. goBack() {
  188. this.detailData = this.$options.data().detailData;
  189. this.show = true;
  190. this.onLoad(this.page, this.search);
  191. },
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .page-crad ::v-deep .basic-container__card {
  197. height: 94.2vh;
  198. }
  199. .stat-td {
  200. text-align: center;
  201. position: relative;
  202. }
  203. .stat-img {
  204. width: 95%;
  205. height: 100px;
  206. }
  207. .stat-tip {
  208. position: absolute;
  209. left: 15px;
  210. top: 5px;
  211. .money {
  212. color: #fff;
  213. font-size: 28px;
  214. text-align: left;
  215. font-weight: 600;
  216. }
  217. .title {
  218. color: #fff;
  219. font-size: 14px;
  220. text-align: left;
  221. margin-top: 5px;
  222. margin-bottom: 0px;
  223. }
  224. }
  225. </style>