123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- <template>
- <a-card size="small" :bordered="false" class="outboundOrderList-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" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="客户名称">
- <a-input id="outboundOrderList-demanderName" v-model.trim="queryParam.demanderName" allowClear placeholder="请输入客户名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="出库类型">
- <v-select
- v-model="queryParam.outBizType"
- ref="outBizType"
- id="outboundOrderList-outBizType"
- code="OUT_STOCK_TYPE"
- placeholder="请选择出库类型"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="出库状态">
- <v-select
- v-model="queryParam.state"
- ref="state"
- id="outboundOrderList-state"
- code="OUT_STATE"
- placeholder="请选择出库状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="业务单号">
- <a-input id="outboundOrderList-outBizNo" v-model.trim="queryParam.outBizNo" allowClear placeholder="请输入业务单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="出库单号">
- <a-input id="outboundOrderList-stockOutNo" v-model.trim="queryParam.stockOutNo" allowClear placeholder="请输入出库单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所在区域">
- <subarea id="outboundOrderList-subarea" v-model="queryParam.subareaSn"></subarea>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="地区">
- <a-form-model-item prop="shippingAddrProvinceSn">
- <a-select id="outboundOrderList-shippingAddrProvinceSn" allowClear v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省">
- <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-form-model-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="outboundOrderList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</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 style="margin-bottom: 10px" v-if="$hasPermissions('B_stockOut')">
- <a-button type="primary" class="button-error" id="outboundOrder-export" :loading="loading" @click="handleOutbound()">批量出库</a-button>
- <span style="margin-left: 5px">
- <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
- </span>
- </div>
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :row-selection="$hasPermissions('B_stockOut')?rowSelection:null"
- :rowKey="(record) => record.stockOutSn"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1440, y: tableHeight }"
- bordered>
- <!-- 单号 -->
- <template slot="stockOutNo" slot-scope="text, record">
- <span v-if="record.stockOutNo" :class="detailPermissions(record)?'active':'common'" @click="handleDetail(record)">{{ record.stockOutNo }}</span>
- <span v-else>--</span>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.state=='WAIT'&&$hasPermissions('B_stockOut')"
- class="button-primary"
- @click="handleOutbound(record)"
- id="outboundOrderList-out-btn">出库</a-button>
- <span v-else>--</span>
- </template>
- </s-table>
- </a-spin>
- <!-- 详情 -->
- <a-modal
- centered
- class="outboundOrderDetail-modal"
- :footer="null"
- :maskClosable="false"
- title="详情"
- v-model="openModal"
- v-if="openModal"
- @cancle="cancleModal"
- width="80%">
- <div style="max-height: 700px;overflow-y: scroll;">
- <pushOrderDetailModal v-if="outBizType=='SALES'" :outBizSubSn="orderSn" />
- <allocationDetailModal v-if="outBizType=='ALLOCATE'" :outBizSn="orderSn" />
- </div>
- </a-modal>
- </a-card>
- </template>
- <script>
- import rangeDate from '@/views/common/rangeDate.vue'
- import subarea from '@/views/common/subarea.js'
- import { getArea } from '@/api/data'
- import pushOrderDetailModal from '@/views/salesManagement/pushOrderManagement/detail.vue'
- import allocationDetailModal from '@/views/allocationManagement/transferOut/detail.vue'
- import { STable, VSelect } from '@/components'
- import { stockOutList, stockOutOut } from '@/api/stockOut'
- export default {
- components: { STable, VSelect, rangeDate, pushOrderDetailModal, allocationDetailModal, subarea },
- data () {
- return {
- spinning: false,
- advanced: false, // 高级搜索 展开/关闭
- tableHeight: 0,
- queryParam: { // 查询条件
- beginDate: '',
- endDate: '',
- demanderName: '', // 客户名称
- outBizType: undefined, // 出库类型
- stockOutNo: '',
- outBizNo: '',
- state: undefined, // 状态
- subareaSn: undefined,
- shippingAddrProvinceSn: undefined
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [
- { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '审核时间', dataIndex: 'auditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库单号', scopedSlots: { customRender: 'stockOutNo' }, width: 180, align: 'center' },
- { title: '业务单号', dataIndex: 'outBizNo', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '客户名称', dataIndex: 'demanderName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '数量', dataIndex: 'productTotalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '售价', dataIndex: 'productTotalPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '出库时间', dataIndex: 'outTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库状态', dataIndex: 'stateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
- ],
- selectedRowKeys: [], // Check here to configure the default column
- selectedRows: [],
- loading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return stockOutList(Object.assign(parameter, this.queryParam)).then(res => {
- const 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
- })
- },
- addrProvinceList: [], // 省下拉
- openModal: false,
- orderSn: undefined,
- outBizType: null // 当前单子类型 SALES销售出库 ALLOCATE调拨出库
- }
- },
- computed: {
- hasSelected () {
- return this.selectedRowKeys.length > 0
- },
- rowSelection () {
- return {
- selectedRowKeys: this.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.onChange(selectedRowKeys, selectedRows)
- },
- onSelect: (record, selected, selectedRows, nativeEvent) => {
- this.onSelectChange(record, selected, selectedRows, nativeEvent)
- },
- onSelectAll: (selected, selectedRows, changeRows) => {
- this.onSelectAllChange(selected, selectedRows, changeRows)
- },
- getCheckboxProps: record => ({
- props: {
- disabled: record.state == 'FINISH' // Column configuration not to be checked
- }
- })
- }
- }
- },
- methods: {
- detailPermissions (row) {
- let state = false
- // 根据出库类型和对应功能权限 判断是否有查看详情的权限
- if (row.outBizType == 'SALES' && this.$hasPermissions('B_dispatchDetail')) { // 销售出库
- state = true
- } else if (row.outBizType == 'ALLOCATE' && this.$hasPermissions('M_transferOut_detail')) { // 调拨出库
- state = true
- }
- return state
- },
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.demanderName = ''
- this.queryParam.outBizType = undefined
- this.queryParam.state = undefined
- this.queryParam.stockOutNo = ''
- this.queryParam.outBizNo = ''
- this.queryParam.subareaSn = undefined
- this.queryParam.shippingAddrProvinceSn = undefined
- this.$refs.table.refresh(true)
- },
- // 详情
- handleDetail (row) {
- this.outBizType = row.outBizType
- // 根据出库类型跳转对应页面
- if (row.outBizType == 'SALES' && this.$hasPermissions('B_dispatchDetail')) { // 销售出库
- // this.$router.push({ path: `/salesManagement/pushOrderManagement/detail/${row.outBizSubSn}/stockOut` })
- this.orderSn = row.outBizSubSn
- this.openModal = true
- } else if (row.outBizType == 'ALLOCATE' && this.$hasPermissions('M_transferOut_detail')) { // 调拨出库
- // this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.outBizSn}` })
- this.orderSn = row.outBizSn
- this.openModal = true
- } else if (row.outBizType == 'CHECK_ORDER_OUT') { // 库存盘点盘亏
- }
- },
- // 关闭弹框
- cancleModal () {
- this.outBizType = null
- this.orderSn = undefined
- this.openModal = false
- },
- // 出库/批量出库
- handleOutbound (row) {
- const _this = this
- let content = ''
- let params = []
- if (row) { // 单个出库
- content = '确认要出库吗?'
- params = [{
- stockOutSn: row.stockOutSn,
- outBizSn: row.outBizSn,
- outBizSubSn: row.outBizSubSn,
- outBizType: row.outBizType
- }]
- } else { // 批量出库
- content = '确认要批量出库吗?'
- if (this.selectedRowKeys.length < 1) {
- this.$message.warning('请在列表勾选后再进行批量操作!')
- return
- }
- params = []
- this.selectedRows.map(item => {
- params.push({
- stockOutSn: item.stockOutSn,
- outBizSn: item.outBizSn,
- outBizSubSn: item.outBizSubSn,
- outBizType: item.outBizType
- })
- })
- }
- this.$confirm({
- title: '提示',
- content: content,
- centered: true,
- onOk () {
- if (!row) { // 批量出库
- _this.loading = true
- }
- _this.spinning = true
- stockOutOut(params).then(res => {
- _this.loading = false
- if (res.status == 200) {
- if (!row) { // 批量出库
- _this.selectedRowKeys = []
- _this.selectedRows = []
- }
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- onChange (selectedRowKeys, selectedRows) {
- this.selectedRowKeys = selectedRowKeys
- },
- onSelectChange (record, selected, selectedRows, nativeEvent) {
- const _this = this
- if (selected) { // 选择
- this.selectedRows.push(record)
- } else { // 取消
- const arrId = []
- this.selectedRows.map((item, index) => {
- if (item.stockOutSn == record.stockOutSn) {
- arrId.push(index)
- }
- })
- arrId.map((item, index) => {
- _this.selectedRows = _this.selectedRows.slice(item, item + 1)
- })
- }
- },
- // 本页全选/取消全选
- onSelectAllChange (selected, selectedRows, changeRows) {
- const _this = this
- if (selected) { // 选择
- this.selectedRows = [...this.selectedRows, ...changeRows]
- } else { // 取消
- const arrId = []
- this.selectedRows.map((item, index) => {
- this.selectedRows.map((subItem, ind) => {
- if (item.stockOutSn == subItem.stockOutSn) {
- arrId.push(index)
- }
- })
- })
- arrId.map((item, index) => {
- _this.selectedRows = _this.selectedRows.slice(item, item + 1)
- })
- }
- },
- // 省/市/区
- getArea (leve, sn) {
- let params
- if (leve == 'province') {
- params = { type: '2' }
- } else {
- params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
- }
- getArea(params).then(res => {
- if (res.status == 200) {
- if (leve == 'province') {
- this.addrProvinceList = res.data || []
- } else if (leve == 'city') {
- this.addrCityList = res.data || []
- } else if (leve == 'district') {
- this.addrDistrictList = res.data || []
- }
- } else {
- if (leve == 'province') {
- this.addrProvinceList = []
- } else if (leve == 'city') {
- this.addrCityList = []
- } else if (leve == 'district') {
- this.addrDistrictList = []
- }
- }
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 235
- }
- },
- mounted () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- setTimeout(() => {
- _this.setTableH()
- }, 400)
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- vm.getArea('province')
- })
- }
- }
- </script>
- <style lang="less">
- .outboundOrderList-wrap{
- .active{
- color: #ed1c24;
- cursor: pointer;
- }
- .common{
- color: rgba(0, 0, 0, 0.65);
- }
- }
- </style>
|