index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="table pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <div style="padding: 10px 0 12px 0" class="clear">
  7. <!-- <div
  8. class="fl"
  9. style="height: 32px; line-height: 32px; padding: 0 20px 0 0"
  10. >
  11. 测试业绩达成报表(含退货)-产品确认单
  12. </div> -->
  13. <el-date-picker
  14. class="fl"
  15. style="width: 200px"
  16. v-model="date"
  17. :size="'small'"
  18. align="right"
  19. type="date"
  20. @change="searchList"
  21. :editable="false"
  22. :clearable="false"
  23. placeholder="选择日期"
  24. format="yyyy-MM-dd"
  25. value-format="yyyy-MM-dd"
  26. :picker-options="pickerOptions"
  27. >
  28. </el-date-picker>
  29. <el-col
  30. :span="4"
  31. style="width: 66px"
  32. >
  33. <el-button
  34. type="warning"
  35. class="fr"
  36. :size="searchSize"
  37. @click="restSearch"
  38. >
  39. 重置
  40. </el-button>
  41. </el-col>
  42. <el-col
  43. :span="4"
  44. style="width: 66px"
  45. class="fr"
  46. >
  47. <el-button
  48. :size="searchSize"
  49. type="primary"
  50. style="float: right"
  51. @click="searchList"
  52. >
  53. 刷新
  54. </el-button>
  55. </el-col>
  56. </div>
  57. <el-table
  58. :data="tableData"
  59. v-loading="loading"
  60. border
  61. :max-height="maxHeight"
  62. :size="'mini'"
  63. style="width: 100%"
  64. row-key="id"
  65. default-expand-all
  66. :row-class-name="tableRowClassName"
  67. :tree-props="{ children: 'child', hasChildren: 'hasChildren' }"
  68. >
  69. <el-table-column prop="p" label="业绩类型" fixed="left" width="120">
  70. </el-table-column>
  71. <el-table-column label="本日金额" width="120" align="center">
  72. <el-table-column show-overflow-tooltip label="销售" width="120">
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.dtotal | toThousandFilter }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column show-overflow-tooltip label="退款" width="120">
  78. <template slot-scope="scope">
  79. <span>{{ scope.row.thfee | toThousandFilter }}</span>
  80. </template>
  81. </el-table-column>
  82. </el-table-column>
  83. <el-table-column label="本周金额" width="120" align="center">
  84. <el-table-column show-overflow-tooltip label="销售" width="120">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.wtotal | toThousandFilter }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column show-overflow-tooltip label="退款" width="120">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.wthfee | toThousandFilter }}</span>
  92. </template>
  93. </el-table-column>
  94. </el-table-column>
  95. <el-table-column label="本月金额" width="120" align="center">
  96. <el-table-column show-overflow-tooltip label="销售指标" width="120">
  97. <template slot-scope="scope">
  98. <span>{{ scope.row.tips | toThousandFilter }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column show-overflow-tooltip label="销售" width="120">
  102. <template slot-scope="scope">
  103. <span>{{ scope.row.total | toThousandFilter }}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column show-overflow-tooltip label="销售完成率" width="95">
  107. <template slot-scope="scope">
  108. <span>{{ scope.row.rate ? scope.row.rate + "%" : "" }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column show-overflow-tooltip label="退款" width="120">
  112. <template slot-scope="scope">
  113. <span>{{ scope.row.mthfee | toThousandFilter }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column show-overflow-tooltip label="净销售" width="120">
  117. <template slot-scope="scope">
  118. <span>{{ scope.row.thtotal | toThousandFilter }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. show-overflow-tooltip
  123. label="净销售完成率"
  124. width="95"
  125. >
  126. <template slot-scope="scope">
  127. <span>{{ scope.row.thrate ? scope.row.thrate + "%" : "" }}</span>
  128. </template>
  129. </el-table-column>
  130. </el-table-column>
  131. </el-table>
  132. </div>
  133. <no-auth v-else></no-auth>
  134. </div>
  135. </template>
  136. <script>
  137. import asyncRequest from "@/apis/service/search/table";
  138. import { mapGetters } from "vuex";
  139. import resToken from "@/mixins/resToken";
  140. export default {
  141. name: "table",
  142. mixins: [resToken],
  143. computed: {
  144. //组件SIZE设置
  145. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  146. powers() {
  147. let tran =
  148. this.$store.getters.btnList.find(
  149. (item) => item.menu_route == "table"
  150. ) || {};
  151. if (tran && tran.action && tran.action.length > 0) {
  152. return tran.action;
  153. } else {
  154. return [];
  155. }
  156. },
  157. },
  158. data() {
  159. return {
  160. loading: true,
  161. date: "",
  162. pickerOptions: {
  163. disabledDate(time) {
  164. return time.getTime() > Date.now();
  165. },
  166. },
  167. // 表格 - 数据
  168. tableData: [],
  169. };
  170. },
  171. mounted() {
  172. this.restSearch();
  173. },
  174. methods: {
  175. tableRowClassName({ row, rowIndex }) {
  176. if ((row && row.child && row.child.length > 0) || rowIndex === 0) {
  177. return "warning-row";
  178. } else {
  179. return "";
  180. }
  181. },
  182. transformTime() {
  183. let time = new Date();
  184. let y = time.getFullYear();
  185. let M = time.getMonth() + 1;
  186. let d = time.getDate();
  187. return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
  188. },
  189. restSearch() {
  190. this.date = this.transformTime();
  191. this.searchList();
  192. },
  193. // 刷新表格
  194. async searchList() {
  195. this.loading = true;
  196. const res = await asyncRequest.list({
  197. date: this.date ? this.date : "",
  198. });
  199. if (res && res.code === 0 && res.data && res.data.length > 0) {
  200. this.tableData = res.data;
  201. this.tableData.map((v1, i1) => {
  202. v1.id = i1 + "";
  203. v1.p = v1.p ? v1.p : v1.depart;
  204. if (v1.child && v1.child.length > 0) {
  205. v1.child.map((v2, i2) => {
  206. v2.id = "" + v1 + i2;
  207. return v2;
  208. });
  209. }
  210. return v1;
  211. });
  212. } else if (res && res.code >= 100 && res.code <= 104) {
  213. await this.logout();
  214. } else {
  215. this.tableData = [];
  216. this.pageInfo.total = 0;
  217. }
  218. this.loading = false;
  219. },
  220. },
  221. };
  222. </script>
  223. <style lang="scss" scoped>
  224. </style>