index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newAdd()">新增
  10. </el-button>
  11. </template>
  12. <template slot-scope="{ row,index}" slot="sysNo">
  13. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.sysNo }}</span>
  14. </template>
  15. <template slot-scope="{ row,index}" slot="corpId">
  16. <span>{{ row.corpName }}</span>
  17. </template>
  18. <template slot="corpIdSearch">
  19. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  20. </template>
  21. <template slot="financingDateSearch">
  22. <el-date-picker v-model="search.financingDate" type="daterange" start-placeholder="开始日期"
  23. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
  24. </el-date-picker>
  25. </template>
  26. <template slot-scope="{ row, index }" slot="menu">
  27. <el-button type="text" size="small" :disabled="row.status>0" @click.stop="rowDel(row, index)">
  28. 删除
  29. </el-button>
  30. </template>
  31. </avue-crud>
  32. </basic-container>
  33. <details-page v-if="!show" @goBack="backToList" :detailData="detailData" />
  34. </div>
  35. </template>
  36. <script>
  37. import detailsPage from "./detailsPage";
  38. import { option } from "./js/optionList";
  39. import { getList, remove } from "@/api/basicData/financing";
  40. export default {
  41. name: "index",
  42. data() {
  43. return {
  44. show: true,
  45. loading: false,
  46. form: {},
  47. search: {},
  48. detailData: {},
  49. dataList: [],
  50. selectionList: [],
  51. page: {
  52. pageSize: 10,
  53. currentPage: 1,
  54. total: 0,
  55. pageSizes: [10, 50, 100, 200, 300, 400, 500]
  56. },
  57. option: {},
  58. };
  59. },
  60. components: {
  61. detailsPage
  62. },
  63. async created() {
  64. this.option = await this.getColumnData(this.getColumnName(198), option);
  65. this.option.height = window.innerHeight - 210;
  66. this.getAllWorkDicts()
  67. },
  68. activated() {
  69. setTimeout(() => {
  70. if (this.$route.query.check && this.show) {
  71. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  72. this.show = false;
  73. }
  74. if (this.$route.query.generateId){
  75. this.editOpen({ id: this.$route.query.generateId }, 1)
  76. this.show = false;
  77. }
  78. if (this.$route.query.generateId){
  79. }
  80. }, 100);
  81. },
  82. methods: {
  83. getAllWorkDicts() {
  84. this.getWorkDicts("financing_status").then(res => {
  85. this.findObject(this.option.column, "status").dicData =
  86. res.data.data;
  87. });
  88. this.getWorkDicts("financing_type").then(res => {
  89. this.findObject(this.option.column, "financingType").dicData =
  90. res.data.data;
  91. });
  92. },
  93. searchCriteriaSwitch(type) {
  94. if (type) {
  95. this.option.height = this.option.height - 46;
  96. } else {
  97. this.option.height = this.option.height + 46;
  98. }
  99. this.$refs.crud.getTableHeight();
  100. },
  101. cellStyle() {
  102. return "padding:0;height:40px;";
  103. },
  104. //点击搜索按钮触发
  105. searchChange(params, done) {
  106. this.page.currentPage = 1;
  107. this.onLoad(this.page, params);
  108. done();
  109. },
  110. refreshChange() {
  111. this.onLoad(this.page, this.search);
  112. },
  113. newAdd() {
  114. this.show = false;
  115. },
  116. onLoad(page, params = {}) {
  117. this.loading = true;
  118. if (this.search.financingDate && this.search.financingDate.length > 0) {
  119. params = {
  120. ...params,
  121. financingStartDate: this.search.financingDate[0] + ' ' + "00:00:00",
  122. financingEndDate: this.search.financingDate[1] + ' ' + "23:59:59"
  123. };
  124. }
  125. let data = this.deepClone(Object.assign({}, params, this.search));
  126. delete data.financingDate;
  127. getList(
  128. page.currentPage,
  129. page.pageSize,
  130. data
  131. )
  132. .then(res => {
  133. this.dataList = res.data.data.records ? res.data.data.records : [];
  134. this.page.total = res.data.data.total;
  135. })
  136. .finally(() => {
  137. this.loading = false;
  138. });
  139. },
  140. editOpen(row, status) {
  141. this.detailData = {
  142. id: row.id,
  143. status: status
  144. };
  145. this.show = false;
  146. },
  147. currentChange(val) {
  148. this.page.currentPage = val;
  149. },
  150. sizeChange(val) {
  151. this.page.currentPage = 1;
  152. this.page.pageSize = val;
  153. },
  154. rowDel(row, index, done) {
  155. this.$confirm("确定删除数据?", {
  156. confirmButtonText: "确定",
  157. cancelButtonText: "取消",
  158. type: "warning"
  159. }).then(() => {
  160. remove(row.id).then(res => {
  161. if (res.data.code == 200) {
  162. this.$message({
  163. type: "success",
  164. message: "删除成功!"
  165. });
  166. this.onLoad(this.page, this.search);
  167. }
  168. });
  169. });
  170. },
  171. async saveColumn() {
  172. const inSave = await this.saveColumnData(
  173. this.getColumnName(198),
  174. this.option
  175. );
  176. if (inSave) {
  177. this.$nextTick(() => {
  178. this.$refs.crud.doLayout();
  179. });
  180. this.$message.success("保存成功");
  181. //关闭窗口
  182. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  183. }
  184. },
  185. async resetColumn() {
  186. this.option = option;
  187. const inSave = await this.delColumnData(this.getColumnName(198), option);
  188. if (inSave) {
  189. this.$nextTick(() => {
  190. this.$refs.crud.doLayout();
  191. });
  192. this.getAllWorkDicts()
  193. this.$message.success("重置成功");
  194. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  195. }
  196. },
  197. //返回列表
  198. backToList() {
  199. if (this.$route.query.check) {
  200. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  201. this.$router.push({
  202. path: "/financing/financingManagement/index"
  203. });
  204. }
  205. this.detailData = this.$options.data().detailData;
  206. this.show = true;
  207. this.onLoad(this.page, this.search);
  208. }
  209. }
  210. };
  211. </script>
  212. <style scoped>
  213. .page-crad ::v-deep .basic-container__card {
  214. height: 94.2vh;
  215. }
  216. </style>