settleAccounts.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div>
  3. <basic-container v-show="show">
  4. <avue-crud
  5. ref="crud"
  6. :data="data"
  7. :option="option"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :table-loading="loading"
  11. @row-del="rowDel"
  12. @size-change="sizeChange"
  13. @current-change="currentChange"
  14. @search-change="searchChange"
  15. @refresh-change="refreshChange"
  16. @on-load="getList"
  17. @saveColumn="saveColumn"
  18. >
  19. <template slot="corpIdSearch">
  20. <select-component
  21. v-model="search.corpId"
  22. :configuration="configuration"
  23. ></select-component>
  24. </template>
  25. <template slot-scope="scope" slot="corpId">
  26. {{ scope.row.corpNames }}
  27. </template>
  28. <template slot="corpAttnSearch">
  29. <el-select v-model="search.corpAttn"
  30. remote
  31. filterable
  32. clearable
  33. :remote-method="remoteMethod"
  34. >
  35. <el-option
  36. v-for="item in options"
  37. :key="item.value"
  38. :label="item.realName"
  39. :value="item.realName">
  40. </el-option>
  41. </el-select>
  42. </template>
  43. <template slot-scope="{row,index}" slot="menuLeft">
  44. <el-button
  45. icon="el-icon-printer"
  46. size="small"
  47. type="primary"
  48. @click.stop="downFile"
  49. >报 表
  50. </el-button>
  51. </template>
  52. <template slot-scope="scope" slot="menu">
  53. <el-button
  54. type="text"
  55. icon="el-icon-edit"
  56. size="small"
  57. @click.stop="settleAccounts(scope.row, scope.index)"
  58. >编 辑
  59. </el-button>
  60. </template>
  61. </avue-crud>
  62. </basic-container>
  63. <detail-page
  64. v-if="!show"
  65. ref="detail"
  66. @goBack="goBack"
  67. :detailData="detailData"
  68. ></detail-page>
  69. </div>
  70. </template>
  71. <script>
  72. import option from "./configuration/settleAccounts.json";
  73. import { getList } from "@/api/workManagement/mainProject";
  74. import detailPage from "./settleAccountsDetailsPage.vue";
  75. import { getUserList } from "@/api/workManagement/mainProject";
  76. export default {
  77. data() {
  78. return {
  79. loading: false,
  80. show:true,
  81. detailData:{},
  82. data: [],
  83. options:[],
  84. option: option,
  85. search:{},
  86. configuration:{
  87. multipleChoices:false,
  88. multiple:false,
  89. disabled:false,
  90. searchShow:true,
  91. collapseTags:false,
  92. clearable:true,
  93. placeholder:'请点击右边按钮选择',
  94. dicData:[]
  95. },
  96. page: {
  97. currentPage: 1,
  98. total: 0,
  99. pageSize: 10
  100. }
  101. };
  102. },
  103. components:{
  104. detailPage
  105. },
  106. created() {
  107. if(this.$route.query.itemId){
  108. this.detailData={
  109. itemId:this.$route.query.itemId
  110. }
  111. this.show = false;
  112. this.$store.commit("MAIN_IN_DETAIL");
  113. }
  114. getUserList().then(res=>{
  115. res.data.data.map((item,index)=>{
  116. if(index <= 20){
  117. this.options.push(item)
  118. }
  119. })
  120. })
  121. },
  122. mounted() {
  123. // option.height = window.innerHeight - 340 ;
  124. },
  125. methods: {
  126. downFile(){
  127. let searchParams = Object.assign({},this.search);
  128. let param = this.paramsAdjustment(searchParams)
  129. getList(1, 10000,param).then(res =>{
  130. const fileData = this.deepClone(res.data.data.records)
  131. fileData.map(item =>{
  132. item.corpId = item.corpNames
  133. })
  134. this.$Export.excel({
  135. title: "结算",
  136. columns: option.column,
  137. data: fileData,
  138. });
  139. })
  140. },
  141. //远程模糊
  142. remoteMethod(query){
  143. let params = {
  144. realName : query
  145. }
  146. getUserList(params).then(res=>{
  147. this.options = res.data.data
  148. })
  149. },
  150. paramsAdjustment(params){
  151. params = Object.assign({},this.search);
  152. if (params.createTime && params.createTime.length !=0) { //发货
  153. params.createStartDate = params.createTime[0]+ " " + "00:00:00";
  154. params.createEndDate = params.createTime[1] + " " + "23:59:59";
  155. this.$delete(params,'createTime')
  156. }
  157. params.flag = 1;
  158. return params
  159. },
  160. getList(page,params) {
  161. params = this.paramsAdjustment(params)
  162. this.loading = true;
  163. getList(page.currentPage, page.pageSize,params).then(res =>{
  164. this.data = res.data.data.records
  165. this.page.total = res.data.data.total
  166. }).finally(()=>{
  167. this.loading = false
  168. })
  169. },
  170. //结算
  171. settleAccounts(row){
  172. this.detailData = {
  173. id: row.id
  174. };
  175. this.show = false;
  176. this.$store.commit("MAIN_IN_DETAIL");
  177. },
  178. searchChange(params, done) {
  179. this.getList(this.page, params);
  180. done();
  181. },
  182. sizeChange(val) {
  183. this.page.pageSize = val;
  184. this.getList();
  185. },
  186. currentChange(val) {
  187. this.page.currentPage = val;
  188. this.getList(this.page);
  189. },
  190. refreshChange() {
  191. this.getList(this.page);
  192. },
  193. //删除列表后面的删除按钮触发触发(row, index, done)
  194. rowDel(row, index, done) {
  195. this.$confirm("确定将选择数据删除?", {
  196. confirmButtonText: "确定",
  197. cancelButtonText: "取消",
  198. type: "warning"
  199. }).then(() => {
  200. this.$message({
  201. type: "success",
  202. message: "操作成功!"
  203. });
  204. // 数据回调进行刷新
  205. done(row);
  206. });
  207. },
  208. saveColumn(row, column) {
  209. console.log(row, column);
  210. },
  211. goBack() {
  212. this.detailData=this.$options.data().detailData
  213. this.show = true;
  214. this.getList(this.page,this.search)
  215. },
  216. }
  217. };
  218. </script>
  219. <style></style>