123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form-model
- id="storeTransOutDetailReport-form"
- ref="ruleForm"
- class="form-model-con"
- layout="inline"
- :model="queryParam"
- :rules="rules"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- @keyup.enter.native="handleSearch" >
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="入库时间" prop="time">
- <rangeDate ref="rangeDate" @change="dateChange" />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="连锁调入单号">
- <a-input id="chainTransferInReport-allocationLinkagePutNo" v-model.trim="queryParam.allocationLinkagePutNo" allowClear placeholder="请输入连锁调入单号"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="调出对象">
- <getTenantList id="chainTransferInReport-outTenantSn" state="FINISH" v-model="queryParam.outTenantSn"></getTenantList>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="4" :sm="24">
- <a-form-item label="调拨产品类型">
- <v-select
- v-model="queryParam.allocationType"
- ref="allocationType"
- id="chainTransferInReport-allocationType"
- code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
- placeholder="请选择调拨产品类型"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-model-item label="产品编码">
- <a-input id="chainTransferInReport-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-model-item label="产品名称">
- <a-input id="chainTransferInReport-name" v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="产品品牌">
- <ProductBrand id="chainTransferInReport-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productEntity.productBrandSn"></ProductBrand>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-model-item label="产品分类">
- <ProductType id="chainTransferInReport-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="queryParam.productType"></ProductType>
- </a-form-model-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainTransferInReport-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInReport-reset">重置</a-button>
- <a-button
- type="primary"
- style="margin-left: 5px"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- v-if="$hasPermissions('M_chainTransferInReportExport')"
- class="button-warning"
- id="chainTransferInReport-export-btn">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 5px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- <!-- 合计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div class="ftext" slot="message">
- 产品总数量:<strong>{{ (totalData && (totalData.putQty || totalData.putQty==0)) ? totalData.putQty : '--' }}</strong>;
- <div v-if="$hasPermissions('M_ShowAllCost')" style="display: inline-block;">
- 调入总成本:<strong>{{ (totalData && (totalData.putCost || totalData.putCost==0)) ? toThousands(totalData.putCost) : '--' }}</strong>;
- </div>
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- bordered>
- </s-table>
- </a-spin>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { downloadExcel } from '@/libs/JGPrint.js'
- import ProductType from '../../common/productType.js'
- import ProductBrand from '../../common/productBrand.js'
- import supplier from '@/views/common/supplier'
- import getTenantList from '@/views/common/getTenantList.js'
- import { reportAllocLinkagePutDetailList, reportAllocLinkagePutDetailCount, reportAllocLinkagePutDetailExport } from '@/api/reportData'
- export default {
- components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier, getTenantList },
- mixins: [commonMixin],
- data () {
- return {
- spinning: false,
- labelCol: { span: 8 },
- wrapperCol: { span: 16 },
- advanced: false, // 高级搜索 展开/关闭
- tableHeight: 0,
- outWareTime: [],
- queryParam: { // 查询条件
- time:[],
- beginDate: '',
- endDate: '',
- productEntity: {
- productBrandSn: undefined, // 产品品牌
- productTypeSn1: '', // 产品一级分类
- productTypeSn2: '', // 产品二级分类
- productTypeSn3: '', // 产品三级分类
- code: '', // 产品编码
- name: '' // 产品名称
- },
- productType: undefined,
- outTenantSn:undefined,
- allocationType: undefined,
- allocationLinkagePutNo: ''
- },
- rules: {
- 'time': [{ required: true, message: '请选择入库时间', trigger: 'change' }]
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- const params = Object.assign(parameter, this.queryParam)
- this.spinning = true
- delete params.time
- return reportAllocLinkagePutDetailList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- // 总计
- this.getCount(params)
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- totalData: null, // 合计
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '连锁调入单号', dataIndex: 'allocationLinkagePutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '调出对象', dataIndex: 'outTenantName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '数量', dataIndex: 'putQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '成本', dataIndex: 'putCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '入库时间', dataIndex: 'putWarehouseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
- ]
- if (this.$hasPermissions('M_ShowAllCost')) {
- arr.splice(7, 0, { title: '成本', dataIndex: 'putCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 合计
- getCount (params) {
- reportAllocLinkagePutDetailCount(params).then(res => {
- if (res.status == 200) {
- this.totalData = res.data
- } else {
- this.totalData = null
- }
- })
- },
- // 创建时间 change
- dateChange (date) {
- this.queryParam.time = date
- this.queryParam.beginDate = date[0] || ''
- this.queryParam.endDate = date[1] || ''
- },
- // 查询
- handleSearch () {
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- this.$refs.table.refresh(true)
- } else {
- return false
- }
- })
- },
- // 重置
- resetSearchForm () {
- this.queryParam.time = []
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.allocationType = undefined
- this.queryParam.outTenantSn = undefined
- this.queryParam.allocationLinkagePutNo = ''
- this.queryParam.productEntity.productBrandSn = undefined
- this.queryParam.productEntity.productTypeSn1 = ''
- this.queryParam.productEntity.productTypeSn2 = ''
- this.queryParam.productEntity.productTypeSn3 = ''
- this.queryParam.productType = []
- this.queryParam.productEntity.code = ''
- this.queryParam.productEntity.name = ''
- this.$refs.ruleForm.resetFields()
- this.totalData = null
- this.$refs.table.clearTable()
- },
- // 导出
- handleExport () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const params = _this.queryParam
- params.costFlag = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
- _this.exportLoading = true
- _this.spinning = true
- reportAllocLinkagePutDetailExport(params).then(res => {
- downloadExcel(res, '连锁调入明细报表')
- _this.exportLoading = false
- _this.spinning = false
- })
- } else {
- return false
- }
- })
- },
- // 产品分类 change
- changeProductType (val, opt) {
- this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
- },
- pageInit () {
- this.disabled = false
- this.spinning = false
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|