index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. :table-loading="loading"
  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. <template slot="cornIdSearch">
  18. <select-component
  19. v-model="search.cornId"
  20. :configuration="configuration"
  21. ></select-component>
  22. </template>
  23. <template slot-scope="scope" slot="cornId">
  24. {{ scope.row.cornName }}
  25. </template>
  26. <template slot="menuLeft">
  27. <el-button
  28. icon="el-icon-printer"
  29. size="small"
  30. type="primary"
  31. @click.stop="downFile"
  32. >报 表
  33. </el-button>
  34. </template>
  35. <template slot-scope="scope" slot="menu">
  36. <el-button
  37. type="text"
  38. icon="el-icon-view"
  39. size="small"
  40. @click.stop=""
  41. >发送
  42. </el-button>
  43. <el-button
  44. type="text"
  45. icon="el-icon-edit"
  46. :disabled="scope.row.status != 1"
  47. size="small"
  48. @click.stop="completion(scope.row)"
  49. >完工
  50. </el-button>
  51. </template>
  52. </avue-crud>
  53. </basic-container>
  54. </template>
  55. <script>
  56. import option from "./configuration/mainList.json";
  57. import { getFlowList } from "@/api/workManagement/mainProject";
  58. import { updateItemStatus } from "@/api/workManagement/mainProject";
  59. export default {
  60. name: "customerInformation",
  61. data() {
  62. return {
  63. loading : false,
  64. form: {},
  65. search:{},
  66. configuration:{
  67. multipleChoices:false,
  68. multiple:false,
  69. disabled:false,
  70. searchShow:true,
  71. collapseTags:false,
  72. clearable:true,
  73. placeholder:'请点击右边按钮选择',
  74. dicData:[]
  75. },
  76. option: option,
  77. parentId:0,
  78. dataList: [],
  79. page: {
  80. currentPage: 1,
  81. total: 0,
  82. pageSize: 10
  83. },
  84. query:{}
  85. }
  86. },
  87. created() {
  88. },
  89. mounted() {
  90. // option.height = window.innerHeight - 350 ;
  91. },
  92. methods: {
  93. downFile(){
  94. let searchParams = Object.assign({},this.search);
  95. let param = this.paramsAdjustment(searchParams)
  96. getFlowList(1, 10000,param).then(res =>{
  97. const fileData = this.deepClone(res.data.data.records)
  98. fileData.map(item =>{
  99. item.cornId = item.cornName
  100. })
  101. const fileColumn = this.deepClone(option.column)
  102. fileColumn.shift();
  103. this.$Export.excel({
  104. title: "任务",
  105. columns: fileColumn,
  106. data: fileData,
  107. });
  108. })
  109. },
  110. //完工
  111. completion(row){
  112. this.$confirm("确认将此任务完工?", {
  113. confirmButtonText: "确定",
  114. cancelButtonText: "取消",
  115. type: "warning"
  116. }).then(() => {
  117. updateItemStatus(row.id,4).then(res =>{
  118. if(res.data.success){
  119. this.$message({
  120. type: "success",
  121. message: "操作成功!"
  122. });
  123. this.onLoad(this.page);
  124. }
  125. })
  126. });
  127. },
  128. //点击搜索按钮触发
  129. searchChange(params, done) {
  130. this.query = params;
  131. this.page.currentPage = 1;
  132. this.onLoad(this.page, params);
  133. done()
  134. },
  135. searchReset() {
  136. console.log('1')
  137. },
  138. selectionChange() {
  139. console.log('1')
  140. },
  141. currentChange(val) {
  142. this.page.currentPage = val
  143. this.onLoad(this.page)
  144. },
  145. sizeChange() {
  146. console.log('1')
  147. },
  148. refreshChange() {
  149. this.onLoad(this.page)
  150. },
  151. paramsAdjustment(params){
  152. params = Object.assign({},this.search);
  153. if (params.beginTime && params.beginTime.length !=0) { //发货
  154. params.beginStartTime = params.beginTime[0]+ " " + "00:00:00";
  155. params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
  156. this.$delete(params,'beginTime')
  157. }
  158. if(!params.status){
  159. params.status = "1,4,5";
  160. }
  161. return params
  162. },
  163. onLoad(page, params = {}) {
  164. params = this.paramsAdjustment(params)
  165. this.loading = true
  166. getFlowList(page.currentPage, page.pageSize,params).then(res =>{
  167. this.dataList = res.data.data.records
  168. this.page.total = res.data.data.total
  169. }).finally(()=>{
  170. this.loading = false
  171. })
  172. },
  173. }
  174. }
  175. </script>
  176. <style scoped>
  177. </style>