index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :page.sync="page"
  9. :search.sync="search"
  10. @search-change="searchChange"
  11. @current-change="currentChange"
  12. @size-change="sizeChange"
  13. @refresh-change="refreshChange"
  14. @on-load="onLoad"
  15. :table-loading="loading"
  16. @saveColumn="saveColumn"
  17. :cell-style="cellStyle"
  18. @expand-change="expandChange"
  19. @selection-change="selectionChange"
  20. >
  21. <template slot-scope="{ row }" slot="expand">
  22. <avue-crud
  23. :data="row.itemData"
  24. :option="itemOption"
  25. :table-loading="row.itemLoading"
  26. :cell-style="cellStyle"
  27. class="itemTable"
  28. ></avue-crud>
  29. </template>
  30. <template slot="menuLeft">
  31. <el-button
  32. type="primary"
  33. icon="el-icon-plus"
  34. size="small"
  35. @click.stop="newAdd()"
  36. >新增
  37. </el-button>
  38. <el-button
  39. type="success"
  40. size="small"
  41. @click.stop="copyDoc()"
  42. :disabled="selectionList.length != 1"
  43. >复制新单</el-button
  44. >
  45. </template>
  46. <template slot-scope="{ row, index }" slot="menu">
  47. <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  48. 查看
  49. </el-button>
  50. <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  51. 编辑
  52. </el-button>
  53. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  54. 删除
  55. </el-button>
  56. </template>
  57. </avue-crud>
  58. </basic-container>
  59. <details-page
  60. v-if="!show"
  61. @goBack="backToList"
  62. @copyOrder="copyOrder"
  63. :detailData="detailData"
  64. />
  65. </div>
  66. </template>
  67. <script>
  68. import detailsPage from "./detailsPage";
  69. import {
  70. getList,
  71. remove,
  72. detailItem
  73. } from "@/api/basicData/salaryConfiguration";
  74. export default {
  75. name: "index",
  76. data() {
  77. return {
  78. show: true,
  79. loading: false,
  80. form: {},
  81. search: {},
  82. detailData: {},
  83. dataList: [],
  84. selectionList: [],
  85. page: {
  86. pageSize: 10,
  87. currentPage: 1,
  88. total: 0,
  89. pageSizes: [10, 50, 100, 200, 300, 400, 500]
  90. },
  91. option: {
  92. searchShow: true,
  93. searchMenuSpan: 8,
  94. align: "center",
  95. searchSpan: 8,
  96. tip: false,
  97. border: true,
  98. index: true,
  99. addBtn: false,
  100. viewBtn: false,
  101. editBtn: false,
  102. delBtn: false,
  103. menuWidth: 140,
  104. dialogClickModal: false,
  105. searchLabelWidth: 100,
  106. searchIcon: true,
  107. searchIndex: 2,
  108. selection: true,
  109. stripe: true,
  110. expand: true,
  111. expandWidth: 38,
  112. column: [
  113. {
  114. label: "部门",
  115. prop: "inSection",
  116. type: "select",
  117. dicUrl: "/api/blade-system/dict-biz/dictionary?code=in_section",
  118. props: {
  119. label: "dictValue",
  120. value: "dictValue"
  121. },
  122. filterable: true,
  123. width: "100",
  124. search: true,
  125. overHidden: true,
  126. span: 8
  127. },
  128. {
  129. label: "教师类别",
  130. prop: "salaryWithdrawalStandardName",
  131. type: "select",
  132. dicUrl:
  133. "/api/blade-system/dict-biz/dictionary?code=Salary_allocation_standard",
  134. props: {
  135. label: "dictValue",
  136. value: "dictValue"
  137. },
  138. filterable: true,
  139. width: "100",
  140. search: true,
  141. overHidden: true,
  142. span: 8
  143. },
  144. {
  145. label: "标准类别",
  146. prop: "normType",
  147. type: "select",
  148. dicUrl: "/api/blade-system/dict-biz/dictionary?code=norm_type",
  149. props: {
  150. label: "dictValue",
  151. value: "dictValue"
  152. },
  153. filterable: true,
  154. width: "100",
  155. search: true,
  156. overHidden: true,
  157. span: 8
  158. },
  159. {
  160. label: "计算类别",
  161. prop: "resultType",
  162. type: "select",
  163. dicUrl: "/api/blade-system/dict-biz/dictionary?code=result_type",
  164. props: {
  165. label: "dictValue",
  166. value: "dictValue"
  167. },
  168. filterable: true,
  169. width: "100",
  170. overHidden: true,
  171. search: true
  172. },
  173. {
  174. label: "职位",
  175. prop: "compileCategory",
  176. type: "select",
  177. dicUrl:
  178. "/api/blade-system/dict-biz/dictionary?code=compile_category",
  179. props: {
  180. label: "dictValue",
  181. value: "dictValue"
  182. },
  183. filterable: true,
  184. width: "100",
  185. search: true,
  186. span: 8
  187. },
  188. {
  189. label: "创建人",
  190. prop: "createUserName",
  191. width: "100",
  192. overHidden: true
  193. },
  194. {
  195. label: "创建时间",
  196. prop: "createTime",
  197. width: "150",
  198. overHidden: true
  199. },
  200. {
  201. label: "备注",
  202. prop: "remarks",
  203. overHidden: true
  204. }
  205. ]
  206. },
  207. itemOption: {
  208. align: "center",
  209. header: false,
  210. menu: false,
  211. column: [
  212. {
  213. label: "类别",
  214. prop: "parameter",
  215. overHidden: true
  216. },
  217. {
  218. label: "工资标准",
  219. prop: "salary",
  220. overHidden: true
  221. },
  222. {
  223. label: "备注",
  224. prop: "remarks",
  225. overHidden: true
  226. }
  227. ]
  228. }
  229. };
  230. },
  231. components: {
  232. detailsPage
  233. },
  234. methods: {
  235. cellStyle() {
  236. return "padding:0;height:40px;";
  237. },
  238. expandChange(row) {
  239. if (!row.itemData) {
  240. detailItem(row.id)
  241. .then(res => {
  242. this.dataList[row.$index].itemData = res.data.data.records;
  243. })
  244. .finally(() => {
  245. this.dataList[row.$index].itemLoading = false;
  246. });
  247. }
  248. },
  249. //点击搜索按钮触发
  250. searchChange(params, done) {
  251. this.page.currentPage = 1;
  252. this.onLoad(this.page, params);
  253. done();
  254. },
  255. refreshChange() {
  256. this.onLoad(this.page, this.search);
  257. },
  258. newAdd() {
  259. this.show = false;
  260. },
  261. onLoad(page, params) {
  262. this.loading = true;
  263. getList(page.currentPage, page.pageSize, params)
  264. .then(res => {
  265. if (res.data.data.records) {
  266. res.data.data.records.forEach(e => {
  267. e.itemLoading = true;
  268. });
  269. }
  270. this.dataList = res.data.data.records ? res.data.data.records : [];
  271. this.page.total = res.data.data.total;
  272. if (this.page.total) {
  273. this.option.height = window.innerHeight - 350;
  274. }
  275. })
  276. .finally(() => {
  277. this.loading = false;
  278. });
  279. },
  280. selectionChange(list) {
  281. this.selectionList = list;
  282. },
  283. copyDoc() {
  284. this.selectionList.forEach(e => {
  285. this.detailData = {
  286. id: e.id,
  287. status: "copy"
  288. };
  289. this.show = false;
  290. });
  291. },
  292. copyOrder(id) {
  293. this.show = true;
  294. this.detailData = {
  295. id: id,
  296. status: "copy"
  297. };
  298. this.$nextTick(() => {
  299. this.show = false;
  300. });
  301. },
  302. editOpen(row, status) {
  303. this.detailData = {
  304. id: row.id,
  305. status: status
  306. };
  307. this.show = false;
  308. },
  309. currentChange(val) {
  310. this.page.currentPage = val;
  311. },
  312. sizeChange(val) {
  313. this.page.currentPage = 1;
  314. this.page.pageSize = val;
  315. },
  316. rowDel(row, index, done) {
  317. this.$confirm("确定删除数据?", {
  318. confirmButtonText: "确定",
  319. cancelButtonText: "取消",
  320. type: "warning"
  321. }).then(() => {
  322. remove(row.id).then(res => {
  323. if (res.data.code == 200) {
  324. this.$message({
  325. type: "success",
  326. message: "删除成功!"
  327. });
  328. this.onLoad(this.page, this.search);
  329. }
  330. });
  331. });
  332. },
  333. //返回列表
  334. backToList() {
  335. this.detailData = this.$options.data().detailData;
  336. this.show = true;
  337. this.onLoad(this.page, this.search);
  338. }
  339. }
  340. };
  341. </script>
  342. <style scoped>
  343. .page-crad ::v-deep .basic-container__card {
  344. height: 94.2vh;
  345. }
  346. ::v-deep .el-table__expanded-cell[class*="cell"] {
  347. padding: 0px;
  348. }
  349. .itemTable ::v-deep .el-table {
  350. width: 738px;
  351. }
  352. </style>