123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- <template>
- <a-card size="small" :bordered="false" class="allocateBillList-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="调往对象">
- <a-input id="allocateBillList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调往对象"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="费用/调拨类型">
- <AllocateType id="allocateBillList-costTypeName" v-model="allocateTypeVal" :changeOnSelect="true" placeholder="请选择费用/调拨类型" @change="changeAllocatype"></AllocateType>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="收货客户名称">
- <dealerSubareaScopeList ref="receiverSn" defValKey="buyerSn" @change="custChange" v-model="queryParam.receiverSn" />
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="业务状态">
- <v-select
- v-model="queryParam.state"
- ref="state"
- id="allocateBillList-state"
- code="ALLOCATE_STATUS"
- placeholder="请选择业务状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="调拨单号">
- <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="打印状态">
- <v-select
- v-model="queryParam.printState"
- ref="printState"
- id="allocateBillList-printState"
- code="PRINT_STATUS"
- placeholder="请选择打印状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="对单状态">
- <v-select
- v-model="queryParam.checkStatus"
- ref="checkStatus"
- id="allocateBillList-checkStatus"
- code="CHECK_STATUS"
- placeholder="请选择对单状态"
- allowClear
- ></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- v-if="$hasPermissions('B_transferOut_export')"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="allocateBillList-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 5px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button v-if="$hasPermissions('B_transferOut_add')" id="allocateBillList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :scroll="{ y: tableHeight }"
- bordered>
- <!-- 单号 -->
- <template slot="allocateNo" slot-scope="text, record">
- <span v-if="$hasPermissions('M_transferOut_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
- <span v-else>{{ record.allocateNo }}</span>
- </template>
- <!-- 起止时间 -->
- <template slot="promoDate" slot-scope="text, record">
- <span v-if="record.promoStartDate || record.promoEndDate">{{ record.promoStartDate }} ~ {{ record.promoEndDate }}</span>
- <span v-else>--</span>
- </template>
- <!-- 调拨类型 -->
- <template slot="allocateType" slot-scope="text, record">
- <div>
- <span v-if="record.allocateSortName">{{ record.allocateSortName }}</span>
- <span v-if="record.allocateSortName&&record.allocateTypeName">/</span>
- <span v-if="record.allocateTypeName">{{ record.allocateTypeName }}</span>
- </div>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.state == 'WAIT_AUDIT'&&record.printState=='UNABLE_PRINT' && $hasPermissions('B_tfo_yxPrint')"
- class="button-warning"
- @click="handleYxPrint(record)"
- id="allocateBillList-examine-btn">允许打印</a-button>
- <a-button
- size="small"
- type="link"
- v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_transferOut_audit')"
- class="button-warning"
- @click="handleExamine(record)"
- id="allocateBillList-examine-btn">审核</a-button>
- <a-button
- size="small"
- type="link"
- v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('M_transferOut_edit')"
- class="button-info"
- @click="handleEdit(record)"
- id="allocateBillList-edit-btn">编辑</a-button>
- <a-button
- size="small"
- type="link"
- v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('B_transferOut_del')"
- class="button-error"
- @click="handleDel(record)"
- id="allocateBillList-del-btn">删除</a-button>
- <span v-if="((record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT') && (record.state != 'AUDIT_REJECT'))||(!$hasPermissions('B_transferOut_audit') && !$hasPermissions('M_transferOut_edit') && !$hasPermissions('B_transferOut_del'))">--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 新增 -->
- <basic-info-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
- <!-- 审核 -->
- <auditModal
- v-drag
- :openModal="visibleAudit"
- :spinning="spinningAudit"
- @close="visibleAudit=false"
- @ok="auditOrder('WAIT_OUT_WAREHOUSE')"
- @fail="auditOrder('AUDIT_REJECT')" />
- </a-card>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import moment from 'moment'
- import getDate from '@/libs/getDate.js'
- import { STable, VSelect } from '@/components'
- import basicInfoModal from './basicInfoModal.vue'
- import rangeDate from '@/views/common/rangeDate.vue'
- import auditModal from '@/views/common/auditModal.vue'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport, allocateBillAblePrint } from '@/api/allocateBill'
- import AllocateType from '@/views/common/allocateType.js'
- import { hdExportExcel } from '@/libs/exportExcel'
- export default {
- name: 'TransferOutList',
- mixins: [commonMixin],
- components: { STable, VSelect, basicInfoModal, rangeDate, auditModal, AllocateType, dealerSubareaScopeList },
- data () {
- return {
- spinning: false,
- advanced: true, // 高级搜索 展开/关闭
- tableHeight: 0,
- time: [
- moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
- moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
- ],
- allocateTypeVal: [],
- queryParam: { // 查询条件
- beginDate: getDate.getThreeMonthDays().starttime,
- endDate: getDate.getCurrMonthDays().endtime,
- targetName: '', // 调往对象
- costTypeSn: undefined, // 费用类型
- allocateSortSn: undefined, // 调拨类型1
- allocateTypeSn: undefined, // 调拨类型2
- state: undefined, // 业务状态
- allocateNo: '', // 调拨单号
- receiverSn: undefined,
- checkStatus: undefined,
- printState: undefined
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- 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
- })
- },
- visibleAudit: false,
- auditInfo: null,
- spinningAudit: false,
- openModal: false // 新增编辑 弹框
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
- { title: '起止时间', scopedSlots: { customRender: 'promoDate' }, align: 'center', width: '6%' },
- { title: '调往对象', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '客户类型', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- // { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '审核时间', dataIndex: 'auditTime', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '费用类型', dataIndex: 'costTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '调拨类型', scopedSlots: { customRender: 'allocateType' }, width: '6%', align: 'center' },
- { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '打印状态', dataIndex: 'printStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '打印次数', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
- ]
- if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
- arr.splice(8, 0, { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- const ind = this.$hasPermissions('B_isShowCost') ? 10 : 9
- arr.splice(ind, 0, { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
- }
- return arr
- }
- },
- methods: {
- custChange (val) {
- this.queryParam.receiverSn = val.key || ''
- // this.queryParam.receiverName = val.name || ''
- },
- // 创建时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- changeAllocatype (val, opts) {
- this.allocateTypeVal = val || []
- this.queryParam.costTypeSn = val && val[0] ? val[0] : ''
- this.queryParam.allocateSortSn = val && val[1] ? val[1] : ''
- this.queryParam.allocateTypeSn = val && val[2] ? val[2] : ''
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate(this.time)
- this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
- this.queryParam.endDate = getDate.getCurrMonthDays().endtime
- this.queryParam.targetName = ''
- this.queryParam.costTypeSn = undefined
- this.queryParam.allocateSortSn = undefined
- this.queryParam.allocateTypeSn = undefined
- this.queryParam.state = undefined
- this.queryParam.checkStatus = undefined
- this.queryParam.printState = undefined
- this.queryParam.allocateNo = ''
- this.queryParam.receiverSn = undefined
- this.allocateTypeVal = []
- this.$refs.receiverSn.resetForm()
- this.$refs.table.refresh(true)
- },
- // 基本信息 保存
- handleOk (data) {
- this.$router.push({ path: `/allocationManagement/transferOut/add/${data.allocateSn}/${data.dealerLevel}` })
- },
- // 删除
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '删除后不可恢复,确定要进行删除吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- allocateBillDel({ sn: row.allocateSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 允许打印
- handleYxPrint (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确定要允许打印吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- allocateBillAblePrint({ sn: row.allocateSn }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 审核
- handleExamine (row) {
- this.auditInfo = row
- this.visibleAudit = true
- },
- // 审核
- auditOrder (state) {
- const _this = this
- _this.spinningAudit = true
- allocateBillAudit({ sn: this.auditInfo.allocateSn, state: state }).then(res => {
- if (res.status == 200) {
- _this.visibleAudit = false
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinningAudit = false
- } else {
- _this.visibleAudit = false
- _this.spinningAudit = false
- }
- })
- },
- // 详情
- handleDetail (row) {
- if (this.$hasPermissions('M_transferOut_detail')) {
- this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.allocateSn}` })
- }
- },
- // 编辑
- handleEdit (row) {
- this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.allocateSn}/${row.dealerLevel}` })
- },
- // 导出
- handleExport () {
- const _this = this
- const params = this.queryParam
- this.exportLoading = true
- this.spinning = true
- hdExportExcel(allocateBillExport, params, '调拨列表', function () {
- _this.exportLoading = false
- _this.spinning = false
- })
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- this.openModal = false
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 238
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .active{
- color: #ed1c24;
- cursor: pointer;
- }
- .common{
- color: rgba(0, 0, 0);
- }
- </style>
|