|
@@ -1,6 +1,5 @@
|
|
|
<template>
|
|
|
<div class="allocateBillEdit-wrap">
|
|
|
- <!-- <a-spin :spinning="spinning" tip="Loading..."> -->
|
|
|
<div class="ant-spin-nested-loading">
|
|
|
<a-page-header :ghost="false" :backIcon="false" class="allocateBillEdit-back" >
|
|
|
<!-- 自定义的二级文字标题 -->
|
|
@@ -62,8 +61,8 @@
|
|
|
</a-descriptions-item>
|
|
|
<a-descriptions-item label="调拨类型">
|
|
|
<div>
|
|
|
- <span v-if="basicInfoData.allocateTypeName">{{ basicInfoData.allocateTypeName || '--' }}</span>
|
|
|
- <span v-if="basicInfoData.allocateSortName">/{{ basicInfoData.allocateSortName || '--' }}</span>
|
|
|
+ <span v-if="basicInfoData.allocateSortName">{{ basicInfoData.allocateSortName || '--' }}</span>
|
|
|
+ <span v-if="basicInfoData.allocateTypeName">/{{ basicInfoData.allocateTypeName || '--' }}</span>
|
|
|
</div>
|
|
|
</a-descriptions-item>
|
|
|
<a-descriptions-item label="费用归属品牌">
|
|
@@ -72,6 +71,7 @@
|
|
|
<a-descriptions-item label="费用归属品类">
|
|
|
<div>
|
|
|
<span v-if="basicInfoData.productTypeName1">{{ basicInfoData.productTypeName1 || '--' }}</span>
|
|
|
+ <span v-else>--</span>
|
|
|
<span v-if="basicInfoData.productTypeName2">/{{ basicInfoData.productTypeName2 || '--' }}</span>
|
|
|
<span v-if="basicInfoData.productTypeName3">/{{ basicInfoData.productTypeName3 || '--' }}</span>
|
|
|
</div>
|
|
@@ -129,11 +129,16 @@
|
|
|
:customRow="handleClickRow"
|
|
|
:data="loadData"
|
|
|
:scroll="{ y: 300 }"
|
|
|
- :defaultLoadData="false"
|
|
|
bordered>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action1" slot-scope="text, record">
|
|
|
- <a-button size="small" type="link" class="button-primary" @click="handleAdd(record)" id="allocateBillEdit-add-btn">添加</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-primary"
|
|
|
+ :loading="spinning"
|
|
|
+ @click="handleAdd(record, false, 'noRefresh')"
|
|
|
+ >添加</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-collapse-panel>
|
|
@@ -153,7 +158,7 @@
|
|
|
</a-alert>
|
|
|
<!-- 筛选条件 -->
|
|
|
<a-row :gutter="15">
|
|
|
- <a-col :span="17">
|
|
|
+ <a-col :span="16">
|
|
|
<div class="table-page-search-wrapper">
|
|
|
<a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
|
|
|
<a-row :gutter="15">
|
|
@@ -175,7 +180,13 @@
|
|
|
</a-form>
|
|
|
</div>
|
|
|
</a-col>
|
|
|
- <a-col :span="7" style="text-align: right;">
|
|
|
+ <a-col :span="8" style="text-align: right;">
|
|
|
+ <span v-if="selNums">已选{{ selNums }}项</span>
|
|
|
+ <a-button
|
|
|
+ style="margin:0 15px;"
|
|
|
+ size="small"
|
|
|
+ id="salesEdit-plDel-btn"
|
|
|
+ @click="openPlSet">批量设置费用归属</a-button>
|
|
|
<a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
|
|
|
<a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
|
|
|
</a-col>
|
|
@@ -188,10 +199,11 @@
|
|
|
index="1"
|
|
|
tableId="table2"
|
|
|
:rowKey="(record) => record.id"
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
:columns="chooseColumns"
|
|
|
:data="chooseLoadData"
|
|
|
:scroll="{ y: 300 }"
|
|
|
- :defaultLoadData="false"
|
|
|
bordered>
|
|
|
<!-- 售价 -->
|
|
|
<template slot="price" slot-scope="text, record, index">
|
|
@@ -227,15 +239,35 @@
|
|
|
@blur="e => qtyBlur(e.target.value, record)"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
+ <!-- 费用归属部门 -->
|
|
|
+ <template slot="department" slot-scope="text, record">
|
|
|
+ <a-select
|
|
|
+ style="width:100%"
|
|
|
+ placeholder="请选择部门"
|
|
|
+ size="small"
|
|
|
+ allowClear
|
|
|
+ v-model="record.departmentSn"
|
|
|
+ :showSearch="true"
|
|
|
+ @change="e => handleChange(e, record)"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption">
|
|
|
+ <a-select-option v-for="item in departmentList" :key="item.departmentSn" :value="item.departmentSn">{{ item.name }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
- <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ :loading="spinning"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ id="allocateBillEdit-del-btn">删除</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-collapse-panel>
|
|
|
</a-collapse>
|
|
|
</a-card>
|
|
|
- <!-- </a-spin> -->
|
|
|
</div>
|
|
|
<div class="affix-cont" v-if="basicInfoData">
|
|
|
<a-button
|
|
@@ -247,6 +279,7 @@
|
|
|
@click="handleOpen"
|
|
|
style="padding: 0 60px;">提交</a-button>
|
|
|
</div>
|
|
|
+
|
|
|
<!-- 导入产品 -->
|
|
|
<importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
|
|
|
<!-- 打印导出 -->
|
|
@@ -261,6 +294,25 @@
|
|
|
<dsModal ref="dsModal" :dealerLevel="$route.params.dealerLevel" :openModal="showDsModal" @close="showDsModal=false" @ok="handleSubmit" />
|
|
|
<!-- 编辑基础信息 -->
|
|
|
<basic-info-modal :openModal="editRemark" :detailData="basicInfoData" @ok="getDetail" @close="editRemark=false" />
|
|
|
+ <!-- 批量设置部门 -->
|
|
|
+ <commonModal modalTit="批量设置费用归属部门" :openModal="showPlModal" @cancel="closePlSet" @ok="setPlSetOk">
|
|
|
+ <div style="text-align: center;">
|
|
|
+ <div style="margin-bottom: 15px;font-size: 14px;"><strong>请选择费用归属部门</strong></div>
|
|
|
+ <div style="line-height: 24px;">
|
|
|
+ <div>
|
|
|
+ <a-select
|
|
|
+ style="width:100%"
|
|
|
+ placeholder="请选择部门"
|
|
|
+ allowClear
|
|
|
+ v-model="plSetVal"
|
|
|
+ :showSearch="true"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption">
|
|
|
+ <a-select-option v-for="item in departmentList" :key="item.departmentSn" :value="item.departmentSn">{{ item.name }}</a-select-option>
|
|
|
+ </a-select></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </commonModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -271,20 +323,23 @@ import ImportGuideModal from './importGuideModal.vue'
|
|
|
import basicInfoModal from './basicInfoModal.vue'
|
|
|
import printModal from './printModal.vue'
|
|
|
import dsModal from './dsModal.vue'
|
|
|
+import commonModal from '@/views/common/commonModal.vue'
|
|
|
import { printFun, exportExcel } from '@/libs/JGPrint.js'
|
|
|
import { queryStockProductPage } from '@/api/stock'
|
|
|
import { productPriceInfo } from '@/api/product'
|
|
|
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel } from '@/api/allocateBill'
|
|
|
+import { departmentQueryList } from '@/api/expenseManagement'
|
|
|
+import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment } from '@/api/allocateBill'
|
|
|
|
|
|
export default {
|
|
|
name: 'TransferOutEdit',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect, ImportGuideModal, printModal, dsModal, basicInfoModal },
|
|
|
+ components: { STable, VSelect, ImportGuideModal, printModal, dsModal, basicInfoModal, commonModal },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
showDsModal: false,
|
|
|
editRemark: false,
|
|
|
+ showPlModal: false,
|
|
|
queryParam: {
|
|
|
productCode: '',
|
|
|
productName: '',
|
|
@@ -302,6 +357,7 @@ export default {
|
|
|
productTypeList: [], // 产品分类 下拉数据
|
|
|
productType: [],
|
|
|
warehouseList: [], // 仓库 下拉数据
|
|
|
+ departmentList: [], // 部门列表
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
@@ -324,16 +380,17 @@ export default {
|
|
|
this.chooseDisabled = true
|
|
|
const params = Object.assign(parameter, this.chooseQueryParam, { allocateSn: this.$route.params.sn })
|
|
|
return allocateBillDetailList(params).then(res => {
|
|
|
- this.getDetailCount()
|
|
|
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
|
|
|
data.list[i].qtyBackups = data.list[i].qty
|
|
|
data.list[i].priceBackups = data.list[i].price
|
|
|
+ data.list[i].departmentSn = data.list[i].departmentSn || undefined
|
|
|
}
|
|
|
this.localDataSource = data.list || []
|
|
|
this.chooseDisabled = false
|
|
|
+ this.getDetailCount(params)
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
@@ -341,10 +398,15 @@ export default {
|
|
|
basicInfoData: null, // 基本信息
|
|
|
openGuideModal: false, // 导入产品引导
|
|
|
openModal: false,
|
|
|
- nowType: null
|
|
|
+ nowType: null,
|
|
|
+ rowSelectionInfo: null,
|
|
|
+ plSetVal: undefined
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ selNums () {
|
|
|
+ return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
|
+ },
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
@@ -376,6 +438,7 @@ export default {
|
|
|
// { title: '售价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
|
|
|
{ title: '库存数量', dataIndex: 'currentStockQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '调出数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
|
|
|
+ { title: '费用归属部门', scopedSlots: { customRender: 'department' }, width: '10%', align: 'center' },
|
|
|
{ title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
|
|
|
]
|
|
@@ -390,19 +453,76 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ filterOption (input, option) {
|
|
|
+ return (
|
|
|
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ )
|
|
|
+ },
|
|
|
+ // 获取部门数据
|
|
|
+ getDepartmentList () {
|
|
|
+ departmentQueryList({}).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.departmentList = res.data
|
|
|
+ } else {
|
|
|
+ this.departmentList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ // 批量设置退货原因
|
|
|
+ openPlSet () {
|
|
|
+ if (this.selNums) {
|
|
|
+ this.showPlModal = true
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请先选择产品!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ closePlSet () {
|
|
|
+ this.showPlModal = false
|
|
|
+ this.plSetVal = undefined
|
|
|
+ },
|
|
|
+ setPlSetOk () {
|
|
|
+ if (!this.plSetVal) {
|
|
|
+ this.$message.warning('请选择费用归属部门!')
|
|
|
+ } else {
|
|
|
+ this.spinning = true
|
|
|
+ const snList = []
|
|
|
+ const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
|
|
|
+ const department = this.departmentList.find(item => item.departmentSn == this.plSetVal)
|
|
|
+ arr.map(item => {
|
|
|
+ snList.push({
|
|
|
+ 'allocateDetailSn': item.allocateDetailSn,
|
|
|
+ 'departmentSn': this.plSetVal,
|
|
|
+ 'departmentName': department ? department.name : ''
|
|
|
+ })
|
|
|
+ })
|
|
|
+ updateBatchDepartment(snList).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.showPlModal = false
|
|
|
+ this.refashPage()
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 重置
|
|
|
- resetSearchForm () {
|
|
|
+ resetSearchForm (flag) {
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
this.queryParam.productOrigCode = ''
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ if (!flag) {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ }
|
|
|
},
|
|
|
// 双击快速添加
|
|
|
handleClickRow (record) {
|
|
|
return {
|
|
|
on: {
|
|
|
dblclick: (event) => {
|
|
|
- this.handleAdd(record)
|
|
|
+ this.handleAdd(record, false, 'noRefresh')
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -416,10 +536,12 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 已选产品 重置
|
|
|
- chooseResetSearchForm () {
|
|
|
+ chooseResetSearchForm (flag) {
|
|
|
this.chooseQueryParam.productCode = ''
|
|
|
this.chooseQueryParam.productName = ''
|
|
|
- this.$refs.chooseTable.refresh(true)
|
|
|
+ if (!flag) {
|
|
|
+ this.$refs.chooseTable.refresh(true)
|
|
|
+ }
|
|
|
},
|
|
|
// 添加/编辑
|
|
|
handleAdd (row, isEdit, isRefresh) {
|
|
@@ -429,7 +551,8 @@ export default {
|
|
|
cost: isEdit ? row.cost : row.lastStockCost,
|
|
|
price: isEdit ? row.price : row.productPrice,
|
|
|
qty: isEdit ? row.qty : 1, // 添加时调出数量默认为1
|
|
|
- productSn: row.productSn
|
|
|
+ productSn: row.productSn,
|
|
|
+ departmentSn: row.departmentSn
|
|
|
}
|
|
|
if (isEdit) { // 编辑
|
|
|
// 清空数量时,值应保持未清空前的值,因数量不可为空
|
|
@@ -466,18 +589,22 @@ export default {
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
if (isAll) { // 整单删除
|
|
|
+ _this.spinning = true
|
|
|
allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.refashPage()
|
|
|
}
|
|
|
+ _this.spinning = false
|
|
|
})
|
|
|
} else { // 单个删除
|
|
|
+ _this.spinning = true
|
|
|
allocateBillDetailDel({ id: row.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.refashPage()
|
|
|
}
|
|
|
+ _this.spinning = false
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -525,8 +652,8 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 合计
|
|
|
- getDetailCount () {
|
|
|
- allocateBillDetailCount({ allocateSn: this.$route.params.sn }).then(res => {
|
|
|
+ getDetailCount (params) {
|
|
|
+ allocateBillDetailCount({ allocateSn: this.$route.params.sn, ...params }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.productTotal = res.data
|
|
|
} else {
|
|
@@ -545,6 +672,10 @@ export default {
|
|
|
this.handleAdd(record, 'edit', 'noRefresh')
|
|
|
}
|
|
|
},
|
|
|
+ // 已选产品 修改部门
|
|
|
+ handleChange (value, record) {
|
|
|
+ this.handleAdd(record, 'edit', 'noRefresh')
|
|
|
+ },
|
|
|
// 已选产品 售价 change
|
|
|
priceChange (val, record) {
|
|
|
// 光标移出,值发生改变再调用编辑接口
|
|
@@ -607,13 +738,15 @@ export default {
|
|
|
},
|
|
|
// 刷新当前页面
|
|
|
refashPage () {
|
|
|
- this.$refs.table.refresh()
|
|
|
+ // this.$refs.table.refresh()
|
|
|
+ this.$refs.chooseTable.clearSelected()
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
},
|
|
|
pageInit () {
|
|
|
+ this.getDepartmentList()
|
|
|
this.getDetail()
|
|
|
- this.resetSearchForm()
|
|
|
- this.chooseResetSearchForm()
|
|
|
+ // this.resetSearchForm(1)
|
|
|
+ // this.chooseResetSearchForm(1)
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
@@ -638,10 +771,11 @@ export default {
|
|
|
position: relative;
|
|
|
height: 100%;
|
|
|
box-sizing: border-box;
|
|
|
- >.ant-spin-nested-loading{
|
|
|
- overflow-y: scroll;
|
|
|
- height: 100%;
|
|
|
- padding-bottom: 51px;
|
|
|
+ > .ant-spin-nested-loading {
|
|
|
+ position: relative;
|
|
|
+ height: 100%;
|
|
|
+ overflow: auto;
|
|
|
+ padding-bottom: 50px;
|
|
|
}
|
|
|
.allocateBillEdit-back{
|
|
|
margin-bottom: 10px;
|