123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- <template>
- <a-card size="small" :bordered="false" class="storeTransferOutList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="创建时间">
- <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="审核时间">
- <rangeDate ref="auditRangeDate" :value="auditTime" @change="auditDateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="出库时间">
- <rangeDate ref="outWareRangeDate" :value="outWareTime" @change="outWareDateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="调往对象名称">
- <a-input id="storeTransferOutList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象名称"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="调拨类型">
- <a-select id="storeTransferOutList-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
- <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="业务状态">
- <v-select
- v-model="queryParam.state"
- ref="state"
- id="storeTransferOutList-state"
- code="STORE_CALL_OUT_STATE"
- placeholder="请选择业务状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="财务状态">
- <v-select
- v-model="queryParam.settleState"
- ref="settleState"
- id="storeTransferOutList-settleState"
- code="FINANCIAL_RECEIVE_STATUS"
- placeholder="请选择财务状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="是否有库存">
- <a-select @change="handleHasQty" allowClear :value="queryParam.stockEmptyFlag" placeholder="请选择查看是否有库存">
- <a-select-option value="0">
- 是
- </a-select-option>
- <a-select-option value="1">
- 否
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="storeTransferOutList-add" v-if="$hasPermissions('B_storeTransferOutNews')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
- <a-checkbox style="margin-left:10px;" v-model="isByCustQuery" id="sales-byCustQuery">包括禁用产品</a-checkbox>
- </div>
- <!-- 统计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 总款数: <strong>{{ countData&&(countData.productTotalCategory || countData.productTotalCategory==0) ? countData.productTotalCategory : '--' }}</strong> ,
- 总数量: <strong>{{ countData&&(countData.productTotalQty || countData.productTotalQty==0) ? countData.productTotalQty : '--' }}</strong>
- <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
- ,总成本: <strong>{{ countData&&(countData.productTotalCost) ? toThousands(countData.productTotalCost,2) : '--' }}</strong>
- </div>
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <!-- 店内调出单号 -->
- <template slot="storeCallOutNo" slot-scope="text, record">
- <span class="table-td-link" v-if="$hasPermissions('B_storeCallOutDetail')" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
- <span v-else>{{ record.storeCallOutNo }}</span>
- </template>
- <!-- 审核 -->
- <template slot="audit" slot-scope="text, record">
- <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'||record.state == 'WAIT_OUT_WAREHOUSE'?'1':'2'"></stateIcon>
- </template>
- <!-- 结算 -->
- <template slot="financial" slot-scope="text, record">
- <stateIcon :title="record.settleStateDictValue" :state="record.settleState == 'FINISH'?'1':'2'"></stateIcon>
- </template>
- <!-- 出库 -->
- <template slot="waitOut" slot-scope="text, record">
- <stateIcon :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_storeCallOutAudit')"
- class="button-primary"
- @click="handleExamine(record)"
- id="storeTransferOutList-examine-btn">审核</a-button>
- <a-button
- size="small"
- type="link"
- v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')) &&$hasPermissions('B_storeCallOutEdit')"
- class="button-primary"
- @click="handleEdit(record)"
- id="storeTransferOutList-edit-btn">编辑</a-button>
- <a-button
- size="small"
- type="link"
- v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_storeCallStockOut')"
- class="button-primary"
- @click="handleOut(record)"
- id="storeTransferOutList-out-btn">出库</a-button>
- <a-button
- size="small"
- type="link"
- v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'WAIT_OUT_WAREHOUSE'))&&$hasPermissions('B_storeCallOutDel')"
- class="button-error"
- @click="handleDel(record)"
- id="storeTransferOutList-del-btn">删除</a-button>
- <span v-if="!(record.state == 'WAIT_AUDIT'&&$hasPermissions('B_storeCallOutAudit')) && !(((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')) &&$hasPermissions('B_storeCallOutEdit')) && !(record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_storeCallStockOut')) && !(((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'WAIT_OUT_WAREHOUSE'))&&$hasPermissions('B_storeCallOutDel'))">--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 新增/编辑 -->
- <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import getDate from '@/libs/getDate.js'
- import basicInfoModal from './basicInfoModal.vue'
- import stateIcon from '@/views/common/stateIcon'
- import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut, storeCallOutQueryCount } from '@/api/storeCallOut'
- import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
- export default {
- name: 'StoreCallOutList',
- components: { STable, VSelect, basicInfoModal, rangeDate, stateIcon },
- mixins: [commonMixin],
- data () {
- return {
- spinning: false,
- advanced: true, // 高级搜索 展开/关闭
- tableHeight: 0,
- time: [
- getDate.getCurrMonthDays().starttime,
- getDate.getCurrMonthDays().endtime
- ],
- auditTime: [],
- outWareTime: [],
- queryParam: { // 查询条件
- beginDate: getDate.getCurrMonthDays().starttime,
- endDate: getDate.getCurrMonthDays().endtime,
- auditBeginDate: '',
- auditEndDate: '',
- outWarehouseBeginDate: '',
- outWarehouseEndDate: '',
- putPersonName: undefined, // 调往对象
- callOutType: undefined, // 调拨类型
- state: undefined, // 业务状态
- settleState: undefined // 财务状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- const params = Object.assign(parameter, this.queryParam)
- return storeCallOutList(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
- })
- },
- storeCallOutTypeList: [], // 调拨类型
- openModal: false, // 新增编辑 弹框
- itemId: '', // 当前品牌id
- countData: null // 统计
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: '14%', align: 'center' },
- { title: '调往对象名称', dataIndex: 'putPersonName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- // { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
- { title: '收款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
- { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
- ]
- if (this.$hasPermissions('M_ShowAllCost')) {
- arr.splice(7, 0, { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 统计
- getCount (params) {
- storeCallOutQueryCount(params).then(res => {
- if (res.status == 200) {
- this.countData = res.data
- } else {
- this.countData = null
- }
- })
- },
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- auditDateChange (date) {
- this.queryParam.auditBeginDate = date[0]
- this.queryParam.auditEndDate = date[1]
- },
- outWareDateChange (date) {
- this.queryParam.outWarehouseBeginDate = date[0]
- this.queryParam.outWarehouseEndDate = date[1]
- },
- // 重置
- resetSearchForm () {
- this.resetData()
- this.$refs.table.refresh(true)
- },
- // 重置数据
- resetData (flag) {
- this.$refs.rangeDate.resetDate(flag ? '' : this.time)
- this.queryParam.beginDate = flag ? '' : getDate.getCurrMonthDays().starttime
- this.queryParam.endDate = flag ? '' : getDate.getCurrMonthDays().endtime
- this.$refs.auditRangeDate.resetDate('')
- this.queryParam.auditBeginDate = ''
- this.queryParam.auditEndDate = ''
- this.$refs.outWareRangeDate.resetDate('')
- this.queryParam.outWarehouseBeginDate = ''
- this.queryParam.outWarehouseEndDate = ''
- this.queryParam.putPersonName = undefined
- this.queryParam.callOutType = undefined
- this.queryParam.state = undefined
- this.queryParam.settleState = undefined
- if (!flag) {
- this.setIsHomeNav(this.$route.name, null)
- }
- },
- // 基本信息 保存
- handleOk (data) {
- this.resetData()
- this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
- },
- // 删除
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '删除后不可恢复,确定要进行删除吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- storeCallOutDel({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 出库
- handleOut (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认要出库吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 审核
- handleExamine (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确认要审核通过吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- storeCallOutAudit({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 详情
- handleDetail (row) {
- this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
- },
- // 新增/编辑
- handleEdit (row) {
- this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
- },
- // 调拨类型
- getStoreCallOutTypeAllList () {
- storeCallOutTypeAllList().then(res => {
- if (res.status == 200) {
- this.storeCallOutTypeList = res.data
- } else {
- this.storeCallOutTypeList = []
- }
- })
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- this.openModal = false
- this.getStoreCallOutTypeAllList()
- // 是否打开的页签
- const a = this.$store.state.app.isNewTab
- // 是否要刷新列表
- const b = this.$store.state.app.updateList
- // 是否从首页点击进入
- const isHomeNav = this.getIsHomeNav()[this.$route.name]
- console.log(a, b, this.getIsHomeNav(), isHomeNav, this.$route.name, '店内调出')
- // 从首页进入,判断式新建还式待办查询
- if (isHomeNav) {
- // 新增
- if (isHomeNav.type == 'new') {
- this.resetSearchForm()
- this.openModal = true
- }
- // 待办
- if (isHomeNav.type == 'todo') {
- this.resetData(true)
- this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
- this.$refs.rangeDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
- this.$refs.table.refresh(true)
- }
- } else {
- // 如果是新页签打开,则重置当前页面
- if (a && !b) {
- this.resetSearchForm()
- }
- }
- // 仅刷新列表,不重置页面
- if (b || a == b) {
- this.$refs.table.refresh()
- }
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 235
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- },
- activated () {
- this.pageInit()
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|