index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. :option="option"
  5. :data="dataList"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :table-loading="loading"
  11. :before-open="beforeOpen"
  12. @row-update="rowUpdate"
  13. @row-save="rowSave"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @saveColumn="saveColumn"
  21. @resetColumn="resetColumn"
  22. @on-load="onLoad"
  23. >
  24. <template slot-scope="scope" slot="moduleName">
  25. <span>{{ scope.row.moduleName | moduleNameFormat(moduleOption) }}</span>
  26. </template>
  27. <template slot-scope="scope" slot="isEnable">
  28. <span>{{ scope.row.isEnable == "1" ? "是" : "否" }}</span>
  29. </template>
  30. </avue-crud>
  31. </basic-container>
  32. </template>
  33. <script>
  34. import option from "./config/mainList.json";
  35. import {
  36. lockConfigList,
  37. lockConfigSave,
  38. lockConfigUpdate,
  39. lockConfigDetail
  40. } from "@/api/lock/lock";
  41. import { customerList } from "@/api/basicData/inventoryAccount";
  42. export default {
  43. data() {
  44. return {
  45. loading: false,
  46. form: {},
  47. search: {},
  48. show: true,
  49. detailData: {},
  50. option: option,
  51. parentId: 0,
  52. dataList: [],
  53. page: {
  54. currentPage: 1,
  55. total: 0,
  56. pageSize: 10,
  57. pageSizes: [10, 50, 100, 200, 300, 400, 500, 1000]
  58. },
  59. query: {},
  60. moduleOption: [
  61. {
  62. label: "销售",
  63. value: "xs"
  64. },
  65. {
  66. label: "采购",
  67. value: "cg"
  68. },
  69. {
  70. label: "发货",
  71. value: "fh"
  72. },
  73. {
  74. label: "收货",
  75. value: "sh"
  76. },
  77. {
  78. label: "收费",
  79. value: "sf"
  80. },
  81. {
  82. label: "付费",
  83. value: "ff"
  84. },
  85. {
  86. label: "进项",
  87. value: "jx"
  88. },
  89. {
  90. label: "销项",
  91. value: "xx"
  92. },
  93. {
  94. label: "小学部",
  95. value: "xxb"
  96. },
  97. {
  98. label: "初中部",
  99. value: "czb"
  100. },
  101. {
  102. label: "高中部",
  103. value: "gzb"
  104. },
  105. {
  106. label: "后勤部",
  107. value: "hqb"
  108. },
  109. {
  110. label: "幼儿园",
  111. value: "yry"
  112. },
  113. {
  114. label: "幼儿园后勤",
  115. value: "yryhq"
  116. }
  117. ]
  118. };
  119. },
  120. async created() {
  121. // this.option = await this.getColumnData(this.getColumnName(65), option);
  122. },
  123. filters: {
  124. moduleNameFormat(row, moduleOption) {
  125. let name;
  126. moduleOption.map(e => {
  127. if (row == e.value) {
  128. name = e.label;
  129. }
  130. });
  131. return name;
  132. }
  133. },
  134. mounted() {},
  135. methods: {
  136. beforeOpen(done, type) {
  137. if (["edit", "view"].includes(type)) {
  138. lockConfigDetail(this.form.id).then(res => {
  139. res.data.data.isEnable = res.data.data.isEnable.toString();
  140. this.form = res.data.data;
  141. });
  142. }
  143. done();
  144. },
  145. rowSave(row, done, loading) {
  146. lockConfigSave(row).then(() => {
  147. this.onLoad(this.page, this.search);
  148. this.$message({
  149. type: "success",
  150. message: "操作成功!"
  151. });
  152. done();
  153. });
  154. },
  155. rowUpdate(row, index, done, loading) {
  156. lockConfigUpdate(row).then(() => {
  157. this.onLoad(this.page, this.search);
  158. this.$message({
  159. type: "success",
  160. message: "操作成功!"
  161. });
  162. done();
  163. });
  164. },
  165. rowDel(row, index, done) {
  166. if (row.id) {
  167. this.$confirm("确定将选择数据删除?", {
  168. confirmButtonText: "确定",
  169. cancelButtonText: "取消",
  170. type: "warning"
  171. }).then(() => {});
  172. }
  173. },
  174. //点击搜索按钮触发
  175. searchChange(params, done) {
  176. this.query = params;
  177. this.page.currentPage = 1;
  178. this.onLoad(this.page, params);
  179. done();
  180. },
  181. searchReset() {
  182. console.log("1");
  183. },
  184. selectionChange() {
  185. console.log("1");
  186. },
  187. sizeChange(val) {
  188. this.page.currentPage = 1;
  189. this.page.pageSize = val;
  190. },
  191. currentChange(val) {
  192. this.page.currentPage = val;
  193. this.onLoad(this.page);
  194. },
  195. refreshChange() {
  196. this.onLoad(this.page);
  197. },
  198. paramsAdjustment(params) {
  199. params = Object.assign({}, this.search);
  200. if (!params.tenantId) {
  201. params.tenantId = "000000";
  202. }
  203. return params;
  204. },
  205. onLoad(page, params) {
  206. this.loading = true;
  207. params = this.paramsAdjustment(params);
  208. lockConfigList(page.currentPage, page.pageSize, params).then(res => {
  209. this.dataList = res.data.data.records;
  210. this.page.total = res.data.data.total;
  211. this.loading = false;
  212. });
  213. },
  214. //列保存触发
  215. async saveColumn() {
  216. const inSave = await this.saveColumnData(
  217. this.getColumnName(65),
  218. this.option
  219. );
  220. if (inSave) {
  221. this.$message.success("保存成功");
  222. //关闭窗口
  223. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  224. }
  225. },
  226. async resetColumn() {
  227. const inSave = await this.delColumnData(this.getColumnName(65), option);
  228. if (inSave) {
  229. this.$message.success("重置成功");
  230. this.option = option;
  231. //关闭窗口
  232. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  233. }
  234. }
  235. }
  236. };
  237. </script>
  238. <style scoped></style>