list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <a-card size="small" :bordered="false" class="regionalPromotionCostStatisticsList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. ref="ruleForm"
  7. class="form-model-con"
  8. layout="inline"
  9. :rules="rules"
  10. :model="queryParam"
  11. @keyup.enter.native="$refs.table.refresh(true)">
  12. <a-row :gutter="15">
  13. <a-col :md="6" :sm="24">
  14. <a-form-model-item label="创建时间" prop="time">
  15. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  16. </a-form-model-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-model-item label="区域">
  20. <a-select id="regionalPromotionCostStatisticsList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
  21. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  22. </a-select>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="regionalPromotionCostStatisticsList-refresh">查询</a-button>
  27. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="regionalPromotionCostStatisticsList-reset">重置</a-button>
  28. </a-col>
  29. </a-row>
  30. </a-form-model>
  31. </div>
  32. <!-- 列表 -->
  33. <s-table
  34. class="sTable"
  35. ref="table"
  36. size="small"
  37. :rowKey="(record) => record.id"
  38. :columns="columns"
  39. :showPagination="false"
  40. :data="loadData"
  41. :scroll="{ x: 2500 }"
  42. :defaultLoadData="false"
  43. bordered>
  44. </s-table>
  45. </a-card>
  46. </template>
  47. <script>
  48. import { STable, VSelect } from '@/components'
  49. import reportData from '@/libs/reportData'
  50. import rangeDate from '@/views/common/rangeDate.vue'
  51. import getDate from '@/libs/getDate.js'
  52. // import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
  53. // import { allocateTypeAllList } from '@/api/allocateType'
  54. export default {
  55. components: { STable, VSelect, rangeDate },
  56. data () {
  57. return {
  58. advanced: false, // 高级搜索 展开/关闭
  59. tableHeight: 0,
  60. queryParam: { // 查询条件
  61. time: [
  62. getDate.getCurrMonthDays().starttime,
  63. getDate.getCurrMonthDays().endtime
  64. ],
  65. beginDate: getDate.getCurrMonthDays().starttime,
  66. endDate: getDate.getCurrMonthDays().endtime,
  67. targetName: '', // 调往对象
  68. allocateTypeSn: undefined, // 调拨类型
  69. state: undefined, // 业务状态
  70. allocateNo: '' // 调拨单号
  71. },
  72. disabled: false, // 查询、重置按钮是否可操作
  73. exportLoading: false,
  74. rules: {
  75. 'time': [{ required: true, message: '请选择创建时间', trigger: 'change' }]
  76. },
  77. columns: [
  78. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  79. { title: '省份', dataIndex: 'province', align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '所属调拨类列', dataIndex: 'targetName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '1月', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '2月', dataIndex: 'totalQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '3月', dataIndex: 'totalCost', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  84. { title: '4月', dataIndex: 'totalPrice', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  85. { title: '5月', dataIndex: 'auditTime', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  86. { title: '6月', dataIndex: 'allocateTypeName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  87. { title: '7月', dataIndex: 'stateDictValue', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  88. { title: '8月', dataIndex: 'printStateDictValue', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  89. { title: '9月', dataIndex: 'printCount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  90. { title: '10月', dataIndex: 'printCounts', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  91. { title: '11月', dataIndex: 'printCsounts', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  92. { title: '12月', dataIndex: 'printdCounts', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  93. { title: '1-12月费用合计', dataIndex: 'prfintCounts', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  94. {
  95. title: '实际销售额合计',
  96. dataIndex: 'printCogunts',
  97. width: 140,
  98. align: 'center',
  99. customRender: (value, row, index) => {
  100. const obj = {
  101. children: value,
  102. attrs: {}
  103. }
  104. if (index === 0) { obj.attrs.rowSpan = 6 }
  105. if (index === 1) { obj.attrs.rowSpan = 0 }
  106. if (index === 2) { obj.attrs.rowSpan = 0 }
  107. if (index === 3) { obj.attrs.rowSpan = 0 }
  108. if (index === 4) { obj.attrs.rowSpan = 0 }
  109. if (index === 5) { obj.attrs.rowSpan = 0 }
  110. return obj
  111. }
  112. },
  113. { title: '费用占比(%)', dataIndex: 'phrintCounts', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. { title: '正常费用', dataIndex: 'printCsountss', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  115. { title: '特殊申请费用', dataIndex: 'prinftCounts', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  116. ],
  117. // 加载数据方法 必须为 Promise 对象
  118. loadData: parameter => {
  119. this.disabled = true
  120. // return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  121. // const data = res.data
  122. // const no = (data.pageNo - 1) * data.pageSize
  123. // for (var i = 0; i < data.list.length; i++) {
  124. // data.list[i].no = no + i + 1
  125. // }
  126. // this.disabled = false
  127. // return data
  128. // })
  129. const _this = this
  130. return new Promise(function (resolve, reject) {
  131. const data = {
  132. pageNo: 1,
  133. pageSize: 10,
  134. list: reportData.regionalPromotionCostStatisticsList,
  135. count: 10
  136. }
  137. for (var i = 0; i < data.list.length; i++) {
  138. data.list[i].no = i + 1
  139. }
  140. _this.disabled = false
  141. resolve(data)
  142. })
  143. },
  144. allocateTypeList: [], // 调拨类型
  145. openModal: false // 新增编辑 弹框
  146. }
  147. },
  148. methods: {
  149. // 创建时间 change
  150. dateChange (date) {
  151. if (date[0] && date[1]) {
  152. this.queryParam.time = date
  153. } else {
  154. this.queryParam.time = []
  155. }
  156. this.queryParam.beginDate = date[0] || ''
  157. this.queryParam.endDate = date[1] || ''
  158. },
  159. // 重置
  160. resetSearchForm () {
  161. this.$refs.rangeDate.resetDate(this.queryParam.time)
  162. this.queryParam.time = [
  163. getDate.getCurrMonthDays().starttime,
  164. getDate.getCurrMonthDays().endtime
  165. ]
  166. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  167. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  168. this.queryParam.targetName = ''
  169. this.queryParam.allocateTypeSn = undefined
  170. this.queryParam.state = undefined
  171. this.queryParam.allocateNo = ''
  172. this.$refs.table.refresh(true)
  173. },
  174. pageInit () {
  175. }
  176. },
  177. mounted () {
  178. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  179. this.pageInit()
  180. this.resetSearchForm()
  181. }
  182. },
  183. activated () {
  184. // 如果是新页签打开,则重置当前页面
  185. if (this.$store.state.app.isNewTab) {
  186. this.pageInit()
  187. this.resetSearchForm()
  188. }
  189. },
  190. beforeRouteEnter (to, from, next) {
  191. next(vm => {})
  192. }
  193. }
  194. </script>