index.vue 9.5 KB

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