|
@@ -18,7 +18,7 @@
|
|
|
<a-collapse-panel key="1" header="选择产品">
|
|
|
<!-- 筛选条件 -->
|
|
|
<div class="table-page-search-wrapper">
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="getProductList(1)">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品编码" prop="productCode">
|
|
@@ -72,7 +72,7 @@
|
|
|
</a-col>
|
|
|
</template>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 24px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutEdit-refresh">查询</a-button>
|
|
|
+ <a-button type="primary" @click="getProductList(1)" :disabled="disabled" id="chainTransferOutEdit-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutEdit-reset">重置</a-button>
|
|
|
<a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
@@ -89,6 +89,7 @@
|
|
|
size="small"
|
|
|
:rowKey="(record) => record.stockSn+record.productSn+record.warehouseSn+record.warehouseLocationSn"
|
|
|
:columns="columns"
|
|
|
+ :customRow="handleClickRow"
|
|
|
:dataSource="loadData"
|
|
|
:scroll="{ x: 1610, y: 300 }"
|
|
|
bordered>
|
|
@@ -117,7 +118,7 @@
|
|
|
<a-collapse-panel key="1" header="已选产品">
|
|
|
<!-- 总计 -->
|
|
|
<a-alert type="info" showIcon style="margin-bottom:15px">
|
|
|
- <div slot="message">总成本:¥<strong>6.33</strong>,总数量: <strong>6</strong> ,总款数: <strong>6</strong> </div>
|
|
|
+ <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
|
|
|
</a-alert>
|
|
|
<!-- 筛选条件 -->
|
|
|
<a-row :gutter="15" justify="space-between">
|
|
@@ -126,18 +127,18 @@
|
|
|
<a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="9" :sm="24">
|
|
|
- <a-form-item label="产品编码" prop="name">
|
|
|
- <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品编码" allowClear />
|
|
|
+ <a-form-item label="产品编码" prop="productCode">
|
|
|
+ <a-input id="chainTransferOutEdit-productCode" v-model="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="9" :sm="24">
|
|
|
- <a-form-item label="产品名称" prop="name">
|
|
|
- <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品名称" allowClear />
|
|
|
+ <a-form-item label="产品名称" prop="productName">
|
|
|
+ <a-input id="chainTransferOutEdit-productName" v-model="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 24px;">
|
|
|
- <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
|
|
|
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
|
|
|
+ <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="chainTransferOutList-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="chainTransferOutList-reset">重置</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
@@ -145,7 +146,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="7">
|
|
|
<a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button>
|
|
|
- <a-button size="small" type="danger" style="margin-left: 8px" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
|
|
|
+ <a-button size="small" type="danger" style="margin-left: 8px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<!-- 列表 -->
|
|
@@ -182,7 +183,8 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { allocLinkageOutDetailSn, allocLinkageOutDetailList } from '@/api/allocLinkageOut'
|
|
|
+import { getOperationalPrecision } from '@/libs/tools.js'
|
|
|
+import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailSave, allocLinkageOutDetailDel, allocLinkageOutDetailCount, allocLinkageOutSubmit, allocLinkageOutDetailDelAll } from '@/api/allocLinkageOut'
|
|
|
import { productQuery } from '@/api/allocWarehouse'
|
|
|
import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
@@ -206,6 +208,7 @@ export default {
|
|
|
productType: [],
|
|
|
warehouseList: [], // 仓库 下拉数据
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ chooseDisabled: false,
|
|
|
advanced: false, // 高级搜索 展开/关闭
|
|
|
// 表头
|
|
|
columns: [
|
|
@@ -239,28 +242,32 @@ export default {
|
|
|
// 表头
|
|
|
chooseColumns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'custNahme', align: 'center', ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '品牌', dataIndex: 'custsNsame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓库', dataIndex: 'custsNdame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓位', dataIndex: 'custsNafme', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '成本价(¥)', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '单位', dataIndex: 'custsNsagme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
|
|
|
+ { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '成本价', dataIndex: 'outCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '调出数量', dataIndex: 'outQty', width: 150, align: 'center' },
|
|
|
- { title: '成本小计(¥)', dataIndex: 'custsNagme', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '成本小计', dataIndex: 'costSubtotal', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
chooseLoadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- return allocLinkageOutDetailList(Object.assign(parameter, this.chooseQueryParam, { allocationLinkageOutSn: this.$route.params.sn })).then(res => {
|
|
|
+ this.chooseDisabled = true
|
|
|
+ const params = Object.assign(parameter, this.chooseQueryParam, { allocationLinkageOutSn: this.$route.params.sn })
|
|
|
+ return allocLinkageOutDetailList(params).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
|
|
|
+ // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
|
|
|
+ data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
|
|
|
}
|
|
|
- this.disabled = false
|
|
|
+ this.chooseDisabled = false
|
|
|
+ this.getDetailCount(params)
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
@@ -271,30 +278,111 @@ export default {
|
|
|
methods: {
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
- this.queryParam.orderBundleNo = ''
|
|
|
- this.queryParam.orderBundle.custMobile = ''
|
|
|
- this.queryParam.bundleName = ''
|
|
|
- this.queryParam.itemName = ''
|
|
|
- this.oldTime = undefined
|
|
|
- this.newTime = undefined
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ this.queryParam.productCode = ''
|
|
|
+ this.queryParam.productName = ''
|
|
|
+ this.queryParam.productOrigCode = ''
|
|
|
+ this.queryParam.warehouseSn = undefined
|
|
|
+ this.queryParam.brandSn = undefined
|
|
|
+ this.queryParam.productTypeSn1 = undefined
|
|
|
+ this.queryParam.productTypeSn2 = undefined
|
|
|
+ this.queryParam.productTypeSn3 = undefined
|
|
|
+ this.getProductList(1)
|
|
|
+ },
|
|
|
+ // 已选产品 重置
|
|
|
+ chooseResetSearchForm () {
|
|
|
+ this.chooseQueryParam.productCode = ''
|
|
|
+ this.chooseQueryParam.productName = ''
|
|
|
+ this.$refs.chooseTable.refresh(true)
|
|
|
+ },
|
|
|
+ // 双击快速添加
|
|
|
+ handleClickRow (record) {
|
|
|
+ return {
|
|
|
+ on: {
|
|
|
+ dblclick: (event) => {
|
|
|
+ this.handleAdd(record)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 基本信息
|
|
|
getDetail () {
|
|
|
allocLinkageOutDetailSn({ sn: this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.basicInfoData = res.data
|
|
|
+ this.getProductList(1)
|
|
|
+ this.getProductBrand()
|
|
|
+ this.getProductType()
|
|
|
} else {
|
|
|
this.basicInfoData = null
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 添加
|
|
|
- handleAdd (row) {},
|
|
|
+ // 添加/编辑
|
|
|
+ handleAdd (row, isEdit) {
|
|
|
+ if (!isEdit && !row.outQty) {
|
|
|
+ this.$message.warning('请输入调出数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const params = {
|
|
|
+ id: isEdit ? row.id : undefined,
|
|
|
+ allocationLinkageOutSn: this.$route.params.sn,
|
|
|
+ outCost: isEdit ? row.outCost : row.putCost,
|
|
|
+ outQty: row.outQty,
|
|
|
+ productSn: row.productSn,
|
|
|
+ productProduceDate: row.productProduceDate,
|
|
|
+ productExpiryDate: row.productExpiryDate,
|
|
|
+ warehouseSn: row.warehouseSn,
|
|
|
+ warehouseLocationSn: row.warehouseLocationSn
|
|
|
+ }
|
|
|
+ allocLinkageOutDetailSave(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.getProductList()
|
|
|
+ this.$refs.chooseTable.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 删除
|
|
|
- handleDel (row) {},
|
|
|
+ handleDel (row, isAll) {
|
|
|
+ const _this = this
|
|
|
+ const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: content,
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ if (isAll) { // 整单删除
|
|
|
+ allocLinkageOutDetailDelAll({ allocationLinkageOutSn: _this.$route.params.sn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.getProductList()
|
|
|
+ _this.$refs.chooseTable.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else { // 单个删除
|
|
|
+ allocLinkageOutDetailDel({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.getProductList()
|
|
|
+ _this.$refs.chooseTable.refresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 提交
|
|
|
- handleSubmit () {},
|
|
|
+ handleSubmit () {
|
|
|
+ const _this = this
|
|
|
+ allocLinkageOutSubmit({ sn: this.$route.params.sn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.handleBack()
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 导入明细
|
|
|
handleImport () {
|
|
|
console.log(333)
|
|
@@ -312,11 +400,12 @@ export default {
|
|
|
getProductList (pageNo) {
|
|
|
this.disabled = true
|
|
|
this.pageNo = pageNo || this.pageNo
|
|
|
+ // 箭冠品牌 sysFlag传1,非箭冠品牌传0。与新增时所选调出产品类型有关
|
|
|
+ this.queryParam.sysFlag = this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0'
|
|
|
const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
|
|
|
productQuery(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
const data = res.data
|
|
|
- console.log(data)
|
|
|
this.paginationProps.total = Number(res.data.count) || 0
|
|
|
this.paginationProps.current = data.pageNo
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
@@ -332,12 +421,15 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 已选产品 调出数量 blur
|
|
|
- outQtyBlur (val, record) {
|
|
|
- // 光标移出,值发生改变再调用编辑接口
|
|
|
- if (val != record.outQtyBackups) {
|
|
|
- this.handleAdd(record, 'edit')
|
|
|
- }
|
|
|
+ // 合计
|
|
|
+ getDetailCount (params) {
|
|
|
+ allocLinkageOutDetailCount(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.productTotal = res.data
|
|
|
+ } else {
|
|
|
+ this.productTotal = null
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
@@ -347,8 +439,8 @@ export default {
|
|
|
},
|
|
|
// 产品品牌 列表
|
|
|
getProductBrand () {
|
|
|
- // sysFlag不传,此处应查询所有产品
|
|
|
- dealerProductBrandQuery({}).then(res => {
|
|
|
+ // sysFlag为1查询箭冠产品,为0查询非箭冠产品
|
|
|
+ dealerProductBrandQuery({ sysFlag: this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0' }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.productBrandList = res.data
|
|
|
} else {
|
|
@@ -358,7 +450,7 @@ export default {
|
|
|
},
|
|
|
// 产品分类 列表
|
|
|
getProductType () {
|
|
|
- dealerProductTypeList({}).then(res => {
|
|
|
+ dealerProductTypeList({ sysFlag: this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0' }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.productTypeList = res.data
|
|
|
} else {
|
|
@@ -380,10 +472,7 @@ export default {
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
vm.getDetail()
|
|
|
- vm.getProductList(1)
|
|
|
vm.getWarehouseList()
|
|
|
- vm.getProductBrand()
|
|
|
- vm.getProductType()
|
|
|
})
|
|
|
}
|
|
|
}
|