index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. >
  48. 删除
  49. </el-button>
  50. </template>
  51. </avue-crud>
  52. </basic-container>
  53. <detailPage
  54. v-if="!isShow"
  55. ref="detail"
  56. @goBack="goBack"
  57. @copyOrder="copyOrder"
  58. :detailData="detailData"
  59. ></detailPage>
  60. </div>
  61. </template>
  62. <script>
  63. import detailPage from "./detailsPage";
  64. import { getList, remove } from "@/api/salaryManagement/primarySchool";
  65. export default {
  66. name: "index",
  67. components: {
  68. detailPage
  69. },
  70. data() {
  71. return {
  72. selectionList: [],
  73. form: {},
  74. dataList: [],
  75. loading: false,
  76. isShow: true,
  77. detailData: {},
  78. page: {
  79. pageSize: 10,
  80. currentPage: 1
  81. },
  82. option: {
  83. searchShow: true,
  84. searchMenuSpan: 16,
  85. align: "center",
  86. searchSpan: 8,
  87. border: true,
  88. index: true,
  89. viewBtn: false,
  90. editBtn: false,
  91. delBtn: false,
  92. menuWidth: 120,
  93. tip: false,
  94. selection: true,
  95. searchIcon: true,
  96. searchIndex: 2,
  97. addBtnText: "新单",
  98. stripe: true,
  99. column: [
  100. {
  101. label: "年",
  102. prop: "annual",
  103. type: "year",
  104. valueFormat: "yyyy",
  105. overHidden: true,
  106. width: 100,
  107. search: true
  108. },
  109. {
  110. label: "月",
  111. prop: "moon",
  112. type: "select",
  113. filterable: true,
  114. dicUrl: "/api/blade-system/dict-biz/dictionary?code=month",
  115. props: {
  116. label: "dictValue",
  117. value: "dictKey"
  118. },
  119. overHidden: true,
  120. width: 100,
  121. search: true
  122. },
  123. {
  124. label: "制单人",
  125. prop: "createUser",
  126. type: "select",
  127. filterable: true,
  128. dicUrl: "/api/blade-user/client/gainUser",
  129. props: {
  130. label: "name",
  131. value: "id"
  132. },
  133. overHidden: true,
  134. width: 100,
  135. search: true
  136. },
  137. {
  138. label: "制单日期",
  139. prop: "createTime",
  140. type: "date",
  141. overHidden: true,
  142. width: 200
  143. },
  144. {
  145. label: "更新人",
  146. prop: "updateUser",
  147. overHidden: true,
  148. width: 100
  149. },
  150. {
  151. label: "更新日期",
  152. prop: "updateTime",
  153. type: "date",
  154. overHidden: true,
  155. width: 200
  156. },
  157. {
  158. label: "状态",
  159. prop: "status",
  160. type: "select",
  161. props: {
  162. label: "name",
  163. value: "code"
  164. },
  165. dicData: [
  166. {
  167. name: "录入",
  168. code: 0
  169. },
  170. {
  171. name: "申请审批",
  172. code: 1
  173. },
  174. {
  175. name: "审批中",
  176. code: 2
  177. },
  178. {
  179. name: "审批通过",
  180. code: 3
  181. }
  182. ]
  183. },
  184. {
  185. label: "备注",
  186. prop: "remarks",
  187. overHidden: true,
  188. search: true
  189. }
  190. ]
  191. }
  192. };
  193. },
  194. created() {
  195. this.option.height = window.innerHeight - 210;
  196. },
  197. activated() {
  198. if (this.$route.query.check) {
  199. this.isShow = true;
  200. setTimeout(() => {
  201. this.editOpen({ id: this.$route.query.check.billId }, 1);
  202. }, 100);
  203. }
  204. },
  205. methods: {
  206. searchCriteriaSwitch(type) {
  207. if (type) {
  208. this.option.height = this.option.height - 46;
  209. } else {
  210. this.option.height = this.option.height + 46;
  211. }
  212. this.$refs.crud.getTableHeight();
  213. },
  214. cellStyle() {
  215. return "padding:0;height:40px;";
  216. },
  217. copyDoc() {
  218. this.selectionList.forEach(e => {
  219. this.detailData = {
  220. id: e.id,
  221. status: "copy"
  222. };
  223. this.isShow = false;
  224. });
  225. },
  226. copyOrder(id) {
  227. this.isShow = true;
  228. this.detailData = {
  229. id: id,
  230. status: "copy"
  231. };
  232. this.$nextTick(() => {
  233. this.isShow = false;
  234. });
  235. },
  236. selectionChange(list) {
  237. this.selectionList = list;
  238. },
  239. //点击搜索按钮触发
  240. searchChange(params, done) {
  241. this.page.currentPage = 1;
  242. this.onLoad(this.page, params);
  243. done();
  244. },
  245. refreshChange() {
  246. this.onLoad(this.page, this.search);
  247. },
  248. currentChange(val) {
  249. this.page.currentPage = val;
  250. },
  251. sizeChange(val) {
  252. this.page.currentPage = 1;
  253. this.page.pageSize = val;
  254. },
  255. onLoad(page, params = {}) {
  256. this.loading = true;
  257. params.salaryType = "高中部";
  258. getList(
  259. page.currentPage,
  260. page.pageSize,
  261. Object.assign(params, this.search)
  262. )
  263. .then(res => {
  264. this.dataList = res.data.data.records ? res.data.data.records : [];
  265. this.page.total = res.data.data.total;
  266. })
  267. .finally(() => {
  268. this.loading = false;
  269. });
  270. },
  271. //新增跳转页面
  272. beforeOpen() {
  273. this.isShow = false;
  274. },
  275. editOpen(row, status) {
  276. this.detailData = {
  277. id: row.id,
  278. status: status
  279. };
  280. this.isShow = false;
  281. },
  282. rowDel(row, index, done) {
  283. this.$confirm("确定删除数据?", {
  284. confirmButtonText: "确定",
  285. cancelButtonText: "取消",
  286. type: "warning"
  287. }).then(() => {
  288. remove(row.id).then(res => {
  289. if (res.data.code == 200) {
  290. this.$message({
  291. type: "success",
  292. message: "删除成功!"
  293. });
  294. this.onLoad(this.page, this.search);
  295. }
  296. });
  297. });
  298. },
  299. goBack() {
  300. if (this.$route.query.check) {
  301. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  302. this.$router.push({
  303. path: "/salaryManagement/highSchool/index"
  304. });
  305. }
  306. this.detailData = this.$options.data().detailData;
  307. this.onLoad(this.page, this.search);
  308. this.isShow = true;
  309. }
  310. }
  311. };
  312. </script>
  313. <style scoped>
  314. .page-crad ::v-deep .basic-container__card {
  315. height: 94.2vh;
  316. }
  317. </style>