index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. :cell-style="cellStyle"
  20. >
  21. <template slot-scope="{ row }" slot="updateUser">
  22. <span>{{ row.updateUserName }}</span>
  23. </template>
  24. <template slot-scope="{ row, index }" slot="menu">
  25. <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  26. 查看
  27. </el-button>
  28. <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  29. 编辑
  30. </el-button>
  31. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  32. 删除
  33. </el-button>
  34. </template>
  35. </avue-crud>
  36. </basic-container>
  37. </div>
  38. </template>
  39. <script>
  40. import { getList, remove } from "@/api/salaryManagement/primarySchool";
  41. export default {
  42. name: "index",
  43. data() {
  44. return {
  45. form: {},
  46. dataList: [],
  47. loading: false,
  48. isShow: true,
  49. detailData: {},
  50. page: {
  51. pageSize: 10,
  52. currentPage: 1
  53. },
  54. option: {
  55. searchShow: true,
  56. searchMenuSpan: 16,
  57. align: "center",
  58. searchSpan: 8,
  59. border: true,
  60. index: true,
  61. addBtn: false,
  62. viewBtn: false,
  63. editBtn: false,
  64. delBtn: false,
  65. menuWidth: 120,
  66. searchLabelWidth: 100,
  67. searchIcon: true,
  68. searchIndex: 2,
  69. column: [
  70. {
  71. label: "合同号",
  72. prop: "",
  73. overHidden: true,
  74. width: 100,
  75. search: true
  76. },
  77. {
  78. label: "客户名称",
  79. prop: "",
  80. overHidden: true,
  81. width: 100,
  82. search: true
  83. },
  84. {
  85. label: "合同日期",
  86. prop: "",
  87. type: "date",
  88. valueFormat: "yyyy-MM-dd",
  89. overHidden: true,
  90. width: 100
  91. },
  92. {
  93. label: "合同日期开始",
  94. prop: "DateStart",
  95. type: "date",
  96. valueFormat: "yyyy-MM-dd",
  97. search: true,
  98. hide: true,
  99. showColumn: false,
  100. span: 8
  101. },
  102. {
  103. label: "合同日期结束",
  104. prop: "DateEnd",
  105. type: "date",
  106. valueFormat: "yyyy-MM-dd",
  107. search: true,
  108. hide: true,
  109. showColumn: false,
  110. span: 8
  111. },
  112. {
  113. label: "起运港",
  114. prop: "",
  115. overHidden: true,
  116. width: 100
  117. },
  118. {
  119. label: "目的港",
  120. prop: "",
  121. overHidden: true,
  122. width: 100
  123. },
  124. {
  125. label: "运输条款",
  126. prop: "",
  127. overHidden: true,
  128. width: 100
  129. },
  130. {
  131. label: "采购报价",
  132. prop: "",
  133. overHidden: true,
  134. width: 100
  135. },
  136. {
  137. label: "销售金额",
  138. prop: "",
  139. overHidden: true,
  140. width: 100
  141. },
  142. {
  143. label: "产品毛利",
  144. prop: "",
  145. overHidden: true,
  146. width: 100
  147. },
  148. {
  149. label: "产品利率",
  150. prop: "",
  151. overHidden: true,
  152. width: 100
  153. },
  154. {
  155. label: "单票利润",
  156. prop: "",
  157. overHidden: true,
  158. width: 100
  159. }
  160. ]
  161. }
  162. };
  163. },
  164. methods: {
  165. cellStyle() {
  166. return "padding:0;height:40px;";
  167. },
  168. //点击搜索按钮触发
  169. searchChange(params, done) {
  170. this.page.currentPage = 1;
  171. this.onLoad(this.page, params);
  172. done();
  173. },
  174. refreshChange() {
  175. this.onLoad(this.page, this.search);
  176. },
  177. currentChange(val) {
  178. this.page.currentPage = val;
  179. },
  180. sizeChange(val) {
  181. this.page.currentPage = 1;
  182. this.page.pageSize = val;
  183. },
  184. onLoad(page, params) {
  185. this.loading = true;
  186. getList(page.currentPage, page.pageSize, params)
  187. .then(res => {
  188. this.dataList = res.data.data.records ? res.data.data.records : [];
  189. this.page.total = res.data.data.total;
  190. if (this.page.total) {
  191. this.option.height = window.innerHeight - 260;
  192. }
  193. })
  194. .finally(() => {
  195. this.loading = false;
  196. });
  197. },
  198. //新增跳转页面
  199. beforeOpen() {
  200. this.isShow = false;
  201. },
  202. editOpen(row, status) {
  203. this.detailData = {
  204. id: row.id,
  205. status: status
  206. };
  207. this.isShow = false;
  208. },
  209. rowDel(row, index, done) {
  210. this.$confirm("确定删除数据?", {
  211. confirmButtonText: "确定",
  212. cancelButtonText: "取消",
  213. type: "warning"
  214. }).then(() => {
  215. remove(row.id).then(res => {
  216. if (res.data.code == 200) {
  217. this.$message({
  218. type: "success",
  219. message: "删除成功!"
  220. });
  221. this.onLoad(this.page, this.search);
  222. }
  223. });
  224. });
  225. },
  226. goBack() {
  227. this.detailData = this.$options.data().detailData;
  228. this.isShow = true;
  229. }
  230. }
  231. };
  232. </script>
  233. <style scoped>
  234. .page-crad ::v-deep .basic-container__card {
  235. height: 94.2vh;
  236. }
  237. </style>