statisticalList.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. :table-loading="loading"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. @search-change="searchChange"
  11. @search-reset="searchReset"
  12. @selection-change="selectionChange"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad"
  17. @saveColumn="saveColumn"
  18. @resetColumn="resetColumn"
  19. >
  20. <template slot="menuLeft">
  21. <el-button
  22. icon="el-icon-printer"
  23. size="small"
  24. type="primary"
  25. :loading="exportLoading"
  26. @click.stop="downFile"
  27. >导 出
  28. </el-button>
  29. <el-button
  30. icon="el-icon-printer"
  31. size="small"
  32. type="primary"
  33. :loading="exportLoading"
  34. @click.stop="statement"
  35. >报表
  36. </el-button>
  37. </template>
  38. <template slot="cornIdSearch">
  39. <select-component
  40. v-model="search.cornId"
  41. :configuration="configuration"
  42. ></select-component>
  43. </template>
  44. <template slot-scope="scope" slot="cornId">
  45. <span style="color: #409EFF;cursor: pointer" @click.stop="check(scope.row,scope.index)">{{ scope.row.cornName }}</span>
  46. </template>
  47. <template slot-scope="scope" slot="deptid">
  48. {{ scope.row.deptName }}
  49. </template>
  50. <template slot="userNameSearch">
  51. <el-select v-model="search.userName"
  52. remote
  53. filterable
  54. clearable
  55. :remote-method="remoteMethod"
  56. >
  57. <el-option
  58. v-for="item in options"
  59. :key="item.value"
  60. :label="item.realName"
  61. :value="item.realName">
  62. </el-option>
  63. </el-select>
  64. </template>
  65. <template slot-scope="scope" slot="menu">
  66. <el-button
  67. type="text"
  68. size="small"
  69. @click.stop="check(scope.row, scope.index)"
  70. >查 看
  71. </el-button>
  72. </template>
  73. </avue-crud>
  74. <report-dialog
  75. :switchDialog="switchDialog"
  76. :searchValue="statementData"
  77. :reportName="'同海-统计列表'"
  78. @onClose="onClose()"
  79. ></report-dialog>
  80. </basic-container>
  81. </template>
  82. <script>
  83. import option from "./configuration/statisticalList.json";
  84. import reportDialog from "@/components/report-dialog/main";
  85. import { getFlowList,getUserList ,statisticalAnalysis} from "@/api/workManagement/mainProject";
  86. export default {
  87. name: "statisticalList",
  88. components:{
  89. reportDialog
  90. },
  91. data() {
  92. return {
  93. loading:false,
  94. form: {},
  95. search:{},
  96. statementData:{},
  97. exportLoading:false,
  98. option: option,
  99. parentId:0,
  100. dataList: [],
  101. options:[],
  102. switchDialog:false,
  103. page: {
  104. currentPage: 1,
  105. total: 0,
  106. pageSize: 10
  107. },
  108. configuration:{
  109. multipleChoices:false,
  110. multiple:false,
  111. disabled:false,
  112. searchShow:true,
  113. collapseTags:false,
  114. clearable:true,
  115. placeholder:'请点击右边按钮选择',
  116. dicData:[]
  117. },
  118. query:{}
  119. }
  120. },
  121. async created() {
  122. // this.option = await this.getColumnData(this.getColumnName(57), option);
  123. getUserList().then(res=>{
  124. res.data.data.map((item,index)=>{
  125. if(index <= 20){
  126. this.options.push(item)
  127. }
  128. })
  129. })
  130. },
  131. mounted() {
  132. // option.height = window.innerHeight - 320 ;
  133. },
  134. methods: {
  135. onClose(val) {
  136. this.switchDialog = val;
  137. },
  138. downFile(){
  139. this.exportLoading = true
  140. let searchParams = Object.assign({},this.search);
  141. let param = this.paramsAdjustment(searchParams)
  142. if(param.status === "0,1,2,3,4,5,6,7,8"){
  143. param.status = ""
  144. }
  145. statisticalAnalysis(param).then(res=>{
  146. const fileData = this.deepClone(res.data.data)
  147. fileData.map(item =>{
  148. item.cornId = item.cornName
  149. item.deptid = item.deptName
  150. item.status = item.strStatus
  151. if(item.projectType == 0){
  152. item.projectType = "正常"
  153. }else if(item.projectType == 1){
  154. item.projectType = "追加"
  155. }else if(item.projectType == 2){
  156. item.projectType = "退款"
  157. }
  158. })
  159. this.$Export.excel({
  160. title: "统计列表",
  161. columns: option.column,
  162. data: fileData,
  163. });
  164. }).finally(()=>{
  165. this.exportLoading = false
  166. })
  167. },
  168. statement(){
  169. this.statementData = this.paramsAdjustment(this.search)
  170. if(this.statementData.status === "0,1,2,3,4,5,6,7,8"){
  171. this.statementData.status = ""
  172. }
  173. if(this.statementData.payTime && this.statementData.payTime.length === 0){
  174. this.statementData.payStartTime = ""
  175. this.statementData.payEndTime = ""
  176. }
  177. this.statementData.tenantId = this.$store.getters.userInfo.tenant_id
  178. this.switchDialog =! this.switchDialog;
  179. },
  180. rowDel() {
  181. },
  182. //修改时的修改按钮点击触发
  183. rowUpdate() {
  184. },
  185. //新增修改时保存触发
  186. rowSave() {
  187. },
  188. remoteMethod(query){
  189. let params = {
  190. realName : query
  191. }
  192. getUserList(params).then(res=>{
  193. this.options = res.data.data
  194. })
  195. },
  196. check(row,index){
  197. if(this.$store.getters.mainItemStatus){
  198. this.$alert("主营业务页面已存在,请关闭页面再进行操作", "温馨提示", {
  199. confirmButtonText: "确定",
  200. type: 'warning',
  201. callback: action => {
  202. }
  203. });
  204. }else{
  205. //关闭一下存在的列表页
  206. this.$router.$avueRouter.closeTag('/workManagement/main-items/list');
  207. this.$router.push({
  208. path: "/workManagement/main-items/list",
  209. query: {itemId: row.pid},
  210. });
  211. }
  212. },
  213. //点击搜索按钮触发
  214. searchChange(params, done) {
  215. this.onLoad(this.page, params);
  216. done()
  217. },
  218. searchReset() {
  219. console.log('1')
  220. },
  221. selectionChange() {
  222. console.log('1')
  223. },
  224. currentChange(val) {
  225. this.page.currentPage = val;
  226. // this.onLoad(this.page,this.search)
  227. },
  228. sizeChange() {
  229. console.log('1')
  230. },
  231. refreshChange() {
  232. this.onLoad(this.page)
  233. },
  234. paramsAdjustment(params){
  235. params = Object.assign({},this.search);
  236. if (params.payTime && params.payTime.length !=0) { //结算
  237. params.payStartTime = params.payTime[0]+ " " + "00:00:00";
  238. params.payEndTime = params.payTime[1] + " " + "23:59:59";
  239. this.$delete(params,'payTime')
  240. }
  241. if(!params.status && params.status!==0){
  242. params.status = "0,1,2,3,4,5,6,7,8";
  243. }
  244. return params
  245. },
  246. onLoad(page, params) {
  247. let param = this.paramsAdjustment(params)
  248. this.loading = true
  249. getFlowList(page.currentPage, page.pageSize,param).then(res =>{
  250. this.dataList = res.data.data.records
  251. this.page.total = res.data.data.total
  252. }).finally(()=>{
  253. this.loading = false
  254. })
  255. },
  256. //列保存触发
  257. async saveColumn() {
  258. const inSave = await this.saveColumnData(
  259. this.getColumnName(57),
  260. this.option
  261. );
  262. if (inSave) {
  263. this.$message.success("保存成功");
  264. //关闭窗口
  265. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  266. }
  267. },
  268. async resetColumn() {
  269. const inSave = await this.delColumnData(
  270. this.getColumnName(57),
  271. option
  272. );
  273. if (inSave) {
  274. this.$message.success("重置成功");
  275. this.option = option;
  276. //关闭窗口
  277. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  278. }
  279. },
  280. },
  281. }
  282. </script>
  283. <style scoped>
  284. </style>