index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :before-open="beforeOpen"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. @resetColumn="resetColumn"
  19. @selection-change="selectionChange"
  20. :cell-style="cellStyle"
  21. @search-criteria-switch="searchCriteriaSwitch"
  22. >
  23. <template slot="menuLeft">
  24. <el-button
  25. type="success"
  26. size="small"
  27. @click.stop="copyDoc()"
  28. :disabled="selectionList.length != 1"
  29. >复制新单</el-button
  30. >
  31. </template>
  32. <template slot-scope="{ row }" slot="updateUser">
  33. <span>{{ row.updateUserName }}</span>
  34. </template>
  35. <template slot-scope="{ row, index }" slot="menu">
  36. <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  37. 查看
  38. </el-button>
  39. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  40. 编辑
  41. </el-button> -->
  42. <el-button
  43. type="text"
  44. size="small"
  45. @click.stop="rowDel(row, index)"
  46. :disabled="row.status > 0"
  47. v-if="permission.highSchool_edit"
  48. >
  49. 删除
  50. </el-button>
  51. </template>
  52. </avue-crud>
  53. </basic-container>
  54. <detailPage
  55. v-if="!isShow"
  56. ref="detail"
  57. @goBack="goBack"
  58. @copyOrder="copyOrder"
  59. :detailData="detailData"
  60. ></detailPage>
  61. </div>
  62. </template>
  63. <script>
  64. import detailPage from "./detailsPage";
  65. import { option } from "./js/optionList";
  66. import {
  67. getList,
  68. remove,
  69. gainUser
  70. } from "@/api/salaryManagement/primarySchool";
  71. import { mapGetters } from "vuex";
  72. export default {
  73. name: "index",
  74. components: {
  75. detailPage
  76. },
  77. data() {
  78. return {
  79. selectionList: [],
  80. form: {},
  81. dataList: [],
  82. loading: false,
  83. isShow: true,
  84. detailData: {},
  85. page: {
  86. pageSize: 10,
  87. currentPage: 1
  88. },
  89. option: {}
  90. };
  91. },
  92. async created() {
  93. this.option = await this.getColumnData(this.getColumnName(112), option);
  94. this.getWorkDicts("month").then(res => {
  95. this.findObject(this.option.column, "moon").dicData = res.data.data;
  96. this.$refs.crud.init();
  97. });
  98. gainUser().then(res => {
  99. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  100. this.$refs.crud.init();
  101. });
  102. this.option.height = window.innerHeight - 210;
  103. },
  104. activated() {
  105. if (this.$route.query.check) {
  106. this.isShow = true;
  107. setTimeout(() => {
  108. this.editOpen({ id: this.$route.query.check.billId }, 1);
  109. }, 100);
  110. }
  111. },
  112. methods: {
  113. searchCriteriaSwitch(type) {
  114. if (type) {
  115. this.option.height = this.option.height - 46;
  116. } else {
  117. this.option.height = this.option.height + 46;
  118. }
  119. this.$refs.crud.getTableHeight();
  120. },
  121. cellStyle() {
  122. return "padding:0;height:40px;";
  123. },
  124. copyDoc() {
  125. this.selectionList.forEach(e => {
  126. this.detailData = {
  127. id: e.id,
  128. status: "copy"
  129. };
  130. this.isShow = false;
  131. });
  132. },
  133. copyOrder(id) {
  134. this.isShow = true;
  135. this.detailData = {
  136. id: id,
  137. status: "copy"
  138. };
  139. this.$nextTick(() => {
  140. this.isShow = false;
  141. });
  142. },
  143. selectionChange(list) {
  144. this.selectionList = list;
  145. },
  146. //点击搜索按钮触发
  147. searchChange(params, done) {
  148. this.page.currentPage = 1;
  149. this.onLoad(this.page, params);
  150. done();
  151. },
  152. refreshChange() {
  153. this.onLoad(this.page, this.search);
  154. },
  155. currentChange(val) {
  156. this.page.currentPage = val;
  157. },
  158. sizeChange(val) {
  159. this.page.currentPage = 1;
  160. this.page.pageSize = val;
  161. },
  162. onLoad(page, params = {}) {
  163. this.loading = true;
  164. params.salaryType = "高中部";
  165. getList(
  166. page.currentPage,
  167. page.pageSize,
  168. Object.assign(params, this.search)
  169. )
  170. .then(res => {
  171. this.dataList = res.data.data.records ? res.data.data.records : [];
  172. this.page.total = res.data.data.total;
  173. })
  174. .finally(() => {
  175. this.loading = false;
  176. });
  177. },
  178. //新增跳转页面
  179. beforeOpen() {
  180. this.isShow = false;
  181. },
  182. editOpen(row, status) {
  183. this.detailData = {
  184. id: row.id,
  185. status: status
  186. };
  187. this.isShow = false;
  188. },
  189. rowDel(row, index, done) {
  190. this.$confirm("确定删除数据?", {
  191. confirmButtonText: "确定",
  192. cancelButtonText: "取消",
  193. type: "warning"
  194. }).then(() => {
  195. remove(row.id).then(res => {
  196. if (res.data.code == 200) {
  197. this.$message({
  198. type: "success",
  199. message: "删除成功!"
  200. });
  201. this.onLoad(this.page, this.search);
  202. }
  203. });
  204. });
  205. },
  206. async saveColumn() {
  207. const inSave = await this.saveColumnData(
  208. this.getColumnName(112),
  209. this.option
  210. );
  211. if (inSave) {
  212. this.$nextTick(() => {
  213. this.$refs.crud.doLayout();
  214. });
  215. this.$message.success("保存成功");
  216. //关闭窗口
  217. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  218. }
  219. },
  220. async resetColumn() {
  221. this.option = option;
  222. const inSave = await this.delColumnData(this.getColumnName(112), option);
  223. if (inSave) {
  224. this.$nextTick(() => {
  225. this.$refs.crud.doLayout();
  226. });
  227. this.$message.success("重置成功");
  228. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  229. }
  230. },
  231. goBack() {
  232. if (this.$route.query.check) {
  233. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  234. this.$router.push({
  235. path: "/salaryManagement/highSchool/index"
  236. });
  237. }
  238. this.detailData = this.$options.data().detailData;
  239. this.onLoad(this.page, this.search);
  240. this.isShow = true;
  241. }
  242. },
  243. computed: {
  244. ...mapGetters(["permission"])
  245. }
  246. };
  247. </script>
  248. <style scoped>
  249. .page-crad ::v-deep .basic-container__card {
  250. height: 94.2vh;
  251. }
  252. </style>