index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <a-card size="small" :bordered="false" class="receivedSendStorageReport-wrap">
  3. <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
  4. <a-form layout="inline">
  5. <a-row :gutter="15">
  6. <a-col :md="5" :sm="24">
  7. <a-form-item label="选择月份">
  8. <div class="monthBox" style="display:flex;align-item:center;">
  9. <a-month-picker
  10. v-model="startMonthVal"
  11. :disabled-date="disabledStartDate"
  12. format="YYYY-MM"
  13. placeholder="开始月份"
  14. @openChange="handleStartOpenChange"
  15. />
  16. <span>~</span>
  17. <a-month-picker
  18. v-model="endMonthVal"
  19. :disabled-date="disabledEndDate"
  20. format="YYYY-MM"
  21. placeholder="结束月份"
  22. :open="endOpen"
  23. @openChange="handleEndOpenChange"
  24. />
  25. </div>
  26. <!-- <a-range-picker
  27. :placeholder="['开始月份', '结束月份']"
  28. format="YYYY-MM"
  29. :value="monthVal"
  30. :ranges="{'上月':[moment().add(-1, 'M'),moment().add(-1, 'M')], '本月': [moment(), moment().endOf('month')] }"
  31. :disabled-date="disabledDate"
  32. :mode="['month', 'month']"
  33. @panelChange="handlePanelChange"
  34. @change="handleChange"
  35. >
  36. <template slot="renderExtraFooter">
  37. <a-button type="primary">
  38. 确定
  39. </a-button>
  40. </template>
  41. </a-range-picker> -->
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="5" :sm="24">
  45. <a-form-item label="产品名称">
  46. <a-input id="receivedSendStorageReport-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="4" :sm="24">
  50. <a-form-item label="产品编码">
  51. <a-input id="receivedSendStorageReport-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码"/>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="5" :sm="24">
  55. <a-form-item label="产品品牌">
  56. <ProductBrand id="receivedSendStorageReport-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="5" :sm="24">
  60. <a-form-item label="产品分类">
  61. <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="receivedSendStorageReport-productType"></productTypeAll>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="24" :sm="24" style="margin-bottom: 10px;display:flex;align-item:center;justify-content:center;">
  65. <a-button type="primary" @click="searchForm" :disabled="disabled" id="receivedSendStorageReport-refresh">查询</a-button>
  66. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="receivedSendStorageReport-reset">重置</a-button>
  67. <a-button
  68. style="margin-left: 5px"
  69. type="primary"
  70. class="button-warning"
  71. @click="handleExport"
  72. :disabled="disabled"
  73. v-if="$hasPermissions('B_ProductPriceExoprt')"
  74. id="productInfoList-export">导出</a-button>
  75. </a-col>
  76. </a-row>
  77. </a-form>
  78. </div>
  79. <div :style="{ height: tableHeight+84.5+'px' }">
  80. <a-tabs default-active-key="1">
  81. <a-tab-pane key="1" tab="明细">
  82. <div class="detailCon">
  83. <!-- 列表 -->
  84. <s-table
  85. class="sTable"
  86. ref="table"
  87. size="small"
  88. :rowKey="(record) => record.id"
  89. :columns="columns"
  90. :data="loadData"
  91. :customRow="handleClickRow"
  92. :scroll="{ y: 149 }"
  93. :defaultLoadData="false"
  94. bordered>
  95. <template slot="footer">
  96. <a-row>
  97. <a-col span="2">合计:</a-col>
  98. <a-col span="22">
  99. <a-row>
  100. <a-col span="4">初期结存数量:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
  101. <a-col span="4">初期结存单价:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
  102. <a-col span="4">初期结存金额:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  103. <a-col span="4">本期收入数量:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  104. <a-col span="4">本期收入单价:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  105. <a-col span="4">本期收入金额:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  106. <a-col span="4">本期发出数量:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  107. <a-col span="4">本期发出单价:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  108. <a-col span="4">本期发出金额:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
  109. <a-col span="4">本期结存数量:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
  110. <a-col span="4">本期结存单价:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
  111. <a-col span="4">本期结存金额:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  112. </a-row>
  113. </a-col>
  114. </a-row>
  115. </template>
  116. </s-table>
  117. </div>
  118. </a-tab-pane>
  119. <a-tab-pane key="2" tab="汇总" force-render>
  120. <gatherList></gatherList>
  121. </a-tab-pane>
  122. </a-tabs>
  123. </div>
  124. </a-card>
  125. </template>
  126. <script>
  127. import { commonMixin } from '@/utils/mixin'
  128. import ProductBrand from '@/views/common/productBrand.js'
  129. import productTypeAll from '@/views/common/productTypeAll.js'
  130. import { STable, VSelect } from '@/components'
  131. import gatherList from './list'
  132. import moment from 'moment'
  133. export default {
  134. name: 'PriceDifferenceDetailReportList',
  135. mixins: [commonMixin],
  136. components: { STable, VSelect, ProductBrand, gatherList, productTypeAll },
  137. data () {
  138. return {
  139. moment,
  140. queryParam: {
  141. name: '',
  142. queryWord: '',
  143. productBrandSn: undefined,
  144. productTypeSn1: undefined,
  145. productTypeSn2: undefined,
  146. productTypeSn3: undefined
  147. },
  148. productType: undefined,
  149. disabled: false,
  150. tableHeight: 0,
  151. endOpen: false,
  152. startMonthVal: undefined,
  153. endMonthVal: undefined,
  154. columns: [
  155. { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '产品名称', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '原厂编码', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  159. { title: '二级分类', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '三级分类', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '单位', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '期初结存数量', dataIndex: 'currentStockQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  163. { title: '期初结存单价', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  164. { title: '期初结存金额', dataIndex: 'productPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  165. { title: '本期收入数量', dataIndex: 'productUnit', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '本期收入单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  167. { title: '本期收入金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  168. { title: '本期发出数量', dataIndex: 'packQtyV', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. { title: '本期发出单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  170. { title: '本期发出金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  171. { title: '期末结存数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '12%', align: 'center' },
  172. { title: '期末结存单价', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  173. { title: '期末结存金额', dataIndex: 'productPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
  174. ]
  175. }
  176. },
  177. methods: {
  178. // 选择月份限制
  179. disabledStartDate (startValue) {
  180. const endValue = this.endMonthVal
  181. if (!startValue || !endValue) {
  182. return startValue.valueOf() > this.moment().valueOf()
  183. }
  184. return startValue.valueOf() >= endValue.valueOf()
  185. },
  186. disabledEndDate (endValue) {
  187. const startValue = this.startMonthVal
  188. if (!startValue) {
  189. return endValue.valueOf() > this.moment().valueOf()
  190. }
  191. return endValue.valueOf() < startValue.valueOf() || endValue.valueOf() > this.moment().valueOf()
  192. },
  193. handleStartOpenChange (open) {
  194. if (!open) {
  195. this.endOpen = true
  196. }
  197. },
  198. handleEndOpenChange (open) {
  199. this.endOpen = open
  200. },
  201. // 产品分类 change
  202. changeProductType (val, opt) {
  203. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  204. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  205. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  206. },
  207. handleExport () {
  208. },
  209. searchForm () {
  210. console.log('1111:', this.startMonthVal)
  211. },
  212. resetSearchForm () {
  213. },
  214. pageInit () {
  215. const _this = this
  216. this.$nextTick(() => { // 页面渲染完成后的回调
  217. _this.setTableH()
  218. })
  219. },
  220. setTableH () {
  221. const tableSearchH = this.$refs.tableSearch.offsetHeight
  222. this.tableHeight = window.innerHeight - tableSearchH - 200
  223. }
  224. },
  225. mounted () {
  226. this.pageInit()
  227. }
  228. }
  229. </script>
  230. <style lang="less" scoped>
  231. .monthBox{
  232. /deep/.ant-calendar-picker-icon{
  233. display:none !important;
  234. }
  235. /deep/.ant-calendar-picker input{
  236. text-align:center;
  237. }
  238. }
  239. </style>