amount.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="flex flex-justify-start flex-col">
  3. <span class="font-16 bold full-width text-left"
  4. >各部门/乡镇投资完成情况总览</span
  5. >
  6. <div class="full-width flex-justify-end flex">
  7. <el-select
  8. v-model="month"
  9. class="m-2"
  10. placeholder="请选择"
  11. ref="month"
  12. clearable
  13. @change="changeMonth"
  14. >
  15. <el-option
  16. v-for="item in selectOption"
  17. :key="item.value"
  18. :label="item.label"
  19. :value="item.value"
  20. />
  21. </el-select>
  22. </div>
  23. <avue-crud :option="option" :data="data" ref="crud" v-model="form">
  24. </avue-crud>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'amount',
  30. props: {
  31. type: {
  32. type: Number,
  33. default: 0
  34. },
  35. deptId: {
  36. type: String,
  37. default: ''
  38. },
  39. year: {
  40. type: String,
  41. default: ''
  42. }
  43. },
  44. watch: {
  45. type: {
  46. handler(val) {
  47. this.initOption(val)
  48. },
  49. immediate: true
  50. },
  51. deptId: {
  52. handler(val) {
  53. this.onLoad()
  54. },
  55. immediate: true
  56. },
  57. year: {
  58. handler(val) {
  59. this.onLoad()
  60. },
  61. immediate: true
  62. }
  63. },
  64. data() {
  65. return {
  66. month: '',
  67. quarter: '',
  68. form: {},
  69. data: [],
  70. option: {
  71. height: '550',
  72. align: 'center',
  73. menuAlign: 'center',
  74. menu: false,
  75. size: 'mini',
  76. addBtn: false,
  77. refreshBtn: false,
  78. columnBtn: false,
  79. border: true,
  80. index: true,
  81. column: [
  82. {
  83. label: '部门/乡镇',
  84. prop: 'deptName'
  85. },
  86. {
  87. label: '责任目标',
  88. prop: 'planCompleteAmount',
  89. sortable: true,
  90. formatter: (row, value) => {
  91. return value.toLocaleString()
  92. }
  93. },
  94. {
  95. label: '完成投资(万元)',
  96. prop: 'totalCompleteAmount',
  97. sortable: true,
  98. formatter: (row, value) => {
  99. return Number.parseFloat(value).toLocaleString()
  100. }
  101. },
  102. {
  103. label: '完成率',
  104. prop: 'completionRate',
  105. sortable: true
  106. },
  107. {
  108. label: '计划入库',
  109. prop: 'storageNum',
  110. sortable: true
  111. }
  112. ]
  113. },
  114. selectOption: []
  115. }
  116. },
  117. methods: {
  118. onLoad() {
  119. this.$api.invest
  120. .list({
  121. deptId: this.deptId === null ? '' : this.deptId,
  122. year: this.year === null ? '' : this.year,
  123. month: this.month,
  124. quarter: this.quarter
  125. })
  126. .then(res => {
  127. if (res.code === 200) {
  128. this.data = res.data
  129. }
  130. })
  131. },
  132. initOption(res) {
  133. this.month = ''
  134. this.selectOption.length = 0
  135. switch (res.value) {
  136. case 1:
  137. for (let i = 1; i <= 3; i++) {
  138. const item = { label: i + '月', value: i }
  139. this.selectOption.push(item)
  140. }
  141. this.quarter = 1
  142. break
  143. case 2:
  144. for (let i = 4; i <= 6; i++) {
  145. const item = { label: i + '月', value: i }
  146. this.selectOption.push(item)
  147. }
  148. this.quarter = 2
  149. break
  150. case 3:
  151. for (let i = 7; i <= 9; i++) {
  152. const item = { label: i + '月', value: i }
  153. this.selectOption.push(item)
  154. }
  155. this.quarter = 3
  156. break
  157. case 4:
  158. for (let i = 10; i <= 12; i++) {
  159. const item = { label: i + '月', value: i }
  160. this.selectOption.push(item)
  161. }
  162. this.quarter = 4
  163. break
  164. default:
  165. for (let i = 1; i <= 12; i++) {
  166. const item = { label: i + '月', value: i }
  167. this.selectOption.push(item)
  168. this.month = ''
  169. this.quarter = ''
  170. }
  171. break
  172. }
  173. this.onLoad()
  174. },
  175. changeMonth(res) {
  176. this.month = res
  177. this.onLoad()
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .m-2 {
  184. }
  185. </style>