123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <template>
- <div ref="container">
- <a-modal
- :title="title"
- :width="1250"
- :visible="visible"
- :getContainer="() => $refs.container"
- :maskStyle="{ top: '93px', left: '154px' }"
- :wrapClassName="wrapClassNameInfo()"
- :mask="isDesktop()"
- :maskClosable="false"
- @ok="handleOk"
- @cancel="handleCancel"
- cancelText="关闭"
- style="top: 20px; height: 95%"
- >
- <!-- 查询区域 -->
- <div class="table-page-search-wrapper" v-if="selectType === 'list'">
- <!-- 搜索区域 -->
- <a-form layout="inline" @keyup.enter.native="searchQuery">
- <a-row :gutter="24">
- <a-col :md="6" :sm="24">
- <a-form-item label="单据编号" :labelCol="{ span: 5 }" :wrapperCol="{ span: 18, offset: 1 }">
- <a-input placeholder="请输入单据编号查询" v-model="queryParam.number"></a-input>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="商品信息" :labelCol="{ span: 5 }" :wrapperCol="{ span: 18, offset: 1 }">
- <a-input placeholder="条码|名称|规格|型号" v-model="queryParam.materialParam"></a-input>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="单据日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-range-picker
- style="width: 100%"
- v-model="queryParam.createTimeRange"
- format="YYYY-MM-DD"
- :placeholder="['开始时间', '结束时间']"
- @change="onDateChange"
- @ok="onDateOk"
- />
- </a-form-item>
- </a-col>
- <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="searchQuery">查询</a-button>
- <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
- </a-col>
- </span>
- </a-row>
- </a-form>
- </div>
- <!-- table区域-begin -->
- <a-table
- v-if="selectType === 'list'"
- bordered
- ref="table"
- size="middle"
- rowKey="id"
- :columns="columns"
- :dataSource="dataSource"
- :pagination="ipagination"
- :loading="loading"
- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType }"
- :customRow="rowAction"
- @change="handleTableChange"
- >
- <span slot="numberCustomRender" slot-scope="text, record">
- <a v-if="!queryParam.purchaseStatus" @click="myHandleDetail(record)">{{ record.number }}</a>
- <span v-if="queryParam.purchaseStatus">{{ record.number }}</span>
- </span>
- <template slot="customRenderStatus" slot-scope="text, record">
- <template v-if="!queryParam.purchaseStatus">
- <a-tag v-if="record.status === '0'" color="red">未审核</a-tag>
- <a-tag v-if="record.status === '1'" color="green">已审核</a-tag>
- <a-tag v-if="record.status === '2' && queryParam.subType === '请购单'" color="cyan">完成采购</a-tag>
- <a-tag v-if="record.status === '2' && queryParam.subType === '采购订单'" color="cyan">完成采购</a-tag>
- <a-tag v-if="record.status === '2' && queryParam.subType === '销售订单'" color="cyan">完成销售</a-tag>
- <a-tag v-if="record.status === '3' && queryParam.subType === '请购单'" color="blue">部分采购</a-tag>
- <a-tag v-if="record.status === '3' && queryParam.subType === '采购订单'" color="blue">部分采购</a-tag>
- <a-tag v-if="record.status === '3' && queryParam.subType === '销售订单'" color="blue">部分销售</a-tag>
- <a-tag
- v-if="record.status === '2' && (queryParam.subType === '采购' || queryParam.subType === '销售')"
- color="green"
- >已审核</a-tag
- >
- <a-tag
- v-if="record.status === '3' && (queryParam.subType === '采购' || queryParam.subType === '销售')"
- color="green"
- >已审核</a-tag
- >
- </template>
- <template v-if="queryParam.purchaseStatus">
- <a-tag v-if="record.purchaseStatus === '0'" color="red">未采购</a-tag>
- <a-tag v-if="record.purchaseStatus === '2' && queryParam.subType === '销售订单'" color="cyan"
- >完成采购</a-tag
- >
- <a-tag v-if="record.purchaseStatus === '3' && queryParam.subType === '销售订单'" color="blue"
- >部分采购</a-tag
- >
- </template>
- </template>
- </a-table>
- <a-table
- v-if="selectType === 'detail'"
- bordered
- ref="table"
- size="middle"
- rowKey="id"
- :pagination="false"
- :columns="columnsDetail"
- :dataSource="dataSourceDetail"
- :loading="loading"
- :rowSelection="{ selectedRowKeys: selectedDetailRowKeys, onChange: onSelectDetailChange, type: 'checkbox' }"
- @change="handleTableChange"
- >
- </a-table>
- <!-- table区域-end -->
- <!-- 表单区域 -->
- <bill-detail ref="billDetail"></bill-detail>
- </a-modal>
- </div>
- </template>
- <script>
- import BillDetail from './BillDetail'
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import { mixinDevice } from '@/utils/mixin'
- import { findBillDetailByNumber } from '@/api/api'
- import { getAction } from '@/api/manage'
- import Vue from 'vue'
- export default {
- name: 'LinkBillList',
- mixins: [JeecgListMixin, mixinDevice],
- components: {
- BillDetail,
- },
- data() {
- return {
- title: '操作',
- visible: false,
- disableMixinCreated: true,
- selectedRowKeys: [],
- selectedDetailRowKeys: [],
- selectBillRows: [],
- selectBillDetailRows: [],
- showType: 'basic',
- selectType: 'list',
- linkNumber: '',
- organId: '',
- accountId: '',
- salesMan: '',
- discountMoney: '',
- deposit: '',
- remark: '',
- depotId: '',
- queryParam: {
- number: '',
- materialParam: '',
- type: '',
- subType: '',
- status: '',
- },
- labelCol: {
- xs: { span: 24 },
- sm: { span: 8 },
- },
- wrapperCol: {
- xs: { span: 24 },
- sm: { span: 16 },
- },
- // 表头
- columns: [
- { title: '', dataIndex: 'organName', width: 120, ellipsis: true },
- { title: '单据编号', dataIndex: 'number', width: 130, scopedSlots: { customRender: 'numberCustomRender' } },
- {
- title: '商品信息',
- dataIndex: 'materialsList',
- width: 280,
- ellipsis: true,
- customRender: function (text, record, index) {
- if (text) {
- return text.replace(',', ',')
- }
- },
- },
- { title: '单据日期', dataIndex: 'operTimeStr', width: 145 },
- { title: '操作员', dataIndex: 'userName', width: 70 },
- { title: '数量', dataIndex: 'materialCount', width: 60 },
- { title: '金额合计', dataIndex: 'totalPrice', width: 70 },
- {
- title: '含税合计',
- dataIndex: 'totalTaxLastMoney',
- width: 70,
- customRender: function (text, record, index) {
- if (record.discountLastMoney) {
- return (record.discountMoney + record.discountLastMoney).toFixed(2)
- } else {
- return record.totalPrice
- }
- },
- },
- {
- title: '状态',
- dataIndex: 'status',
- width: 70,
- align: 'center',
- scopedSlots: { customRender: 'customRenderStatus' },
- },
- ],
- columnsDetail: [
- { title: '条码', dataIndex: 'barCode', width: 120 },
- { title: '名称', dataIndex: 'name', width: 100, ellipsis: true },
- { title: '规格', dataIndex: 'standard', width: 100, ellipsis: true },
- { title: '型号', dataIndex: 'model', width: 150, ellipsis: true },
- { title: '单位', dataIndex: 'unit', width: 50 },
- { title: '数量', dataIndex: 'operNumber', width: 80 },
- { title: '单价', dataIndex: 'unitPrice', width: 80 },
- { title: '金额', dataIndex: 'allPrice', width: 80 },
- { title: '税率(%)', dataIndex: 'taxRate', width: 80 },
- { title: '税额', dataIndex: 'taxMoney', width: 80 },
- { title: '价税合计', dataIndex: 'taxLastMoney', width: 80 },
- { title: '备注', dataIndex: 'remark', width: 100, ellipsis: true },
- ],
- dataSource: [],
- dataSourceDetail: [],
- url: {
- list: '/depotHead/list',
- },
- }
- },
- computed: {
- getType: function () {
- return 'radio'
- },
- },
- created() {},
- methods: {
- show(type, subType, organType, status) {
- this.selectType = 'list'
- this.showType = 'basic'
- this.queryParam.type = type
- this.queryParam.subType = subType
- this.queryParam.status = status
- this.model = Object.assign({}, {})
- this.visible = true
- this.initColumns(subType, organType)
- this.loadData(1)
- },
- purchaseShow(type, subType, organType, status, purchaseStatus) {
- this.selectType = 'list'
- this.showType = 'purchase'
- this.queryParam.type = type
- this.queryParam.subType = subType
- this.queryParam.status = status
- this.queryParam.purchaseStatus = purchaseStatus
- this.model = Object.assign({}, {})
- this.visible = true
- this.initColumns(subType, organType)
- this.loadData(1)
- },
- initColumns(subType, organType) {
- for (let i = 0; i < this.columns.length; i++) {
- if (this.columns[i].dataIndex === 'organName') {
- this.columns[i].title = organType
- }
- }
- if (subType === '请购单') {
- for (let i = 0; i < this.columns.length; i++) {
- if (this.columns[i].dataIndex === 'organName') {
- this.columns.splice(i, 1)
- }
- if (this.columns[i].dataIndex === 'totalPrice') {
- this.columns.splice(i, 1)
- }
- if (this.columns[i].dataIndex === 'totalTaxLastMoney') {
- this.columns.splice(i, 1)
- }
- }
- }
- },
- myHandleDetail(record) {
- findBillDetailByNumber({ number: record.number }).then((res) => {
- if (res && res.code === 200) {
- let type = res.data.depotHeadType
- type = type.replace('其它', '')
- this.$refs.billDetail.show(res.data, type)
- this.$refs.billDetail.title = type + '-详情'
- }
- })
- },
- close() {
- this.$emit('close')
- this.visible = false
- },
- handleCancel() {
- this.close()
- },
- onSelectChange(selectedRowKeys) {
- this.selectedRowKeys = selectedRowKeys
- },
- onSelectDetailChange(selectedRowKeys) {
- this.selectedDetailRowKeys = selectedRowKeys
- },
- handleOk() {
- if (this.selectType === 'list') {
- this.getSelectBillRows()
- this.selectType = 'detail'
- this.title = '请选择单据明细'
- if (this.selectBillRows && this.selectBillRows.length > 0) {
- let record = this.selectBillRows[0]
- console.log('this.selectBillRows======', this.selectBillRows)
- this.linkNumber = record.number
- this.organId = record.organId
- this.accountId = record.accountId
- this.salesMan = record.salesMan
- this.discountMoney = record.discountMoney
- this.deposit = record.changeAmount - record.finishDeposit
- this.remark = record.remark
- this.depotId = record.depotId
- this.initListColumns()
- this.loadDetailData(1)
- }
- } else {
- if (this.selectedDetailRowKeys.length) {
- this.getSelectBillDetailRows()
- this.$emit(
- 'ok',
- this.selectBillDetailRows,
- this.linkNumber,
- this.organId,
- this.discountMoney,
- this.deposit,
- this.remark,
- this.depotId,
- this.accountId,
- this.salesMan
- )
- this.close()
- } else {
- this.$message.warning('抱歉,请选择单据明细!')
- }
- }
- },
- initListColumns() {
- if (this.queryParam.subType === '请购单') {
- for (let i = 0; i < this.columnsDetail.length; i++) {
- if (this.columnsDetail[i].dataIndex === 'unitPrice') {
- this.columnsDetail.splice(i, 1)
- }
- if (this.columnsDetail[i].dataIndex === 'allPrice') {
- this.columnsDetail.splice(i, 1)
- }
- if (this.columnsDetail[i].dataIndex === 'taxRate') {
- this.columnsDetail.splice(i, 1)
- }
- if (this.columnsDetail[i].dataIndex === 'taxMoney') {
- this.columnsDetail.splice(i, 1)
- }
- if (this.columnsDetail[i].dataIndex === 'taxLastMoney') {
- this.columnsDetail.splice(i, 1)
- }
- }
- }
- },
- //查询明细列表
- loadDetailData(arg) {
- //加载数据 若传入参数1则加载第一页的内容
- if (arg === 1) {
- this.ipagination.current = 1
- }
- if (this.selectBillRows && this.selectBillRows.length > 0) {
- let record = this.selectBillRows[0]
- let param = {
- headerId: record.id,
- mpList: '',
- linkType: this.showType,
- }
- this.loading = true
- getAction('/depotItem/getDetailList', param).then((res) => {
- if (res.code === 200) {
- let list = res.data.rows
- let listEx = []
- for (let j = 0; j < list.length; j++) {
- let info = list[j]
- if (info.finishNumber < info.preNumber) {
- //去掉已经全部转换的明细,只加载未转换完的明细
- listEx.push(info)
- } else {
- if (
- this.queryParam.subType === '采购' ||
- this.queryParam.subType === '销售' ||
- this.queryParam.subType === '零售'
- ) {
- //针对退货单,不过滤明细
- listEx.push(info)
- }
- }
- }
- this.dataSourceDetail = listEx
- this.ipagination.total = res.data.total
- }
- if (res.code === 510) {
- this.$message.warning(res.data)
- }
- this.loading = false
- })
- }
- },
- onDateChange: function (value, dateString) {
- this.queryParam.beginTime = dateString[0]
- this.queryParam.endTime = dateString[1]
- },
- onDateOk(value) {
- console.log(value)
- },
- searchReset() {
- this.queryParam = {
- type: this.queryParam.type,
- subType: this.queryParam.subType,
- status: '1,3',
- }
- this.loadData(1)
- },
- getSelectBillRows() {
- let dataSource = this.dataSource
- this.selectBillRows = []
- for (let i = 0, len = dataSource.length; i < len; i++) {
- if (this.selectedRowKeys.includes(dataSource[i].id)) {
- this.selectBillRows.push(dataSource[i])
- }
- }
- },
- getSelectBillDetailRows() {
- let dataSource = this.dataSourceDetail
- this.selectBillDetailRows = []
- for (let i = 0, len = dataSource.length; i < len; i++) {
- if (this.selectedDetailRowKeys.includes(dataSource[i].id)) {
- this.selectBillDetailRows.push(dataSource[i])
- }
- }
- },
- rowAction(record, index) {
- return {
- on: {
- click: () => {
- let arr = []
- arr.push(record.id)
- this.selectedRowKeys = arr
- },
- dblclick: () => {
- let arr = []
- arr.push(record.id)
- this.selectedRowKeys = arr
- this.handleOk()
- },
- },
- }
- },
- },
- }
- </script>
- <style scoped></style>
|