index.vue 6.6 KB

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