|
@@ -8,19 +8,14 @@
|
|
|
label-position="left"
|
|
|
label-width="80px"
|
|
|
>
|
|
|
- <el-form-item v-if="formDisabled" label="单据编号" prop="sheetId">
|
|
|
- <el-input disabled :value="dataForm.sheetId" />
|
|
|
+ <el-form-item v-if="formDisabled" label="单据编号" prop="purchaseId">
|
|
|
+ <el-input disabled :value="dataForm.purchaseId" />
|
|
|
</el-form-item>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="网点" prop="shopId">
|
|
|
- <el-select v-model="dataForm.shopId" :disabled="formDisabled" placeholder="请选择网点" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="(item, index) in getAuthShop(null, dataForm)"
|
|
|
- :key="index"
|
|
|
- :label="shopLabelStrHandle(item)"
|
|
|
- :value="item.shopId"
|
|
|
- />
|
|
|
+ <el-form-item label="网点" prop="websitId">
|
|
|
+ <el-select v-model="dataForm.websitId" :disabled="formDisabled" placeholder="请选择网点" style="width: 100%">
|
|
|
+ <el-option v-for="(item, index) in authShop" :key="index" :label="item.name" :value="item.websitId" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -37,8 +32,9 @@
|
|
|
<el-option
|
|
|
v-for="(item, index) in venderList"
|
|
|
:key="index"
|
|
|
- :label="vendorLabelStrHandle(item)"
|
|
|
+ :label="item.venderName"
|
|
|
:value="item.venderId"
|
|
|
+ :disabled="item.status !== 'ON'"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -81,50 +77,47 @@
|
|
|
>
|
|
|
<el-table-column prop="goodsId" label="辅材编号" />
|
|
|
<el-table-column prop="goodsName" label="辅材名称" width="230" />
|
|
|
- <el-table-column prop="estimateCost" label="预估进价" header-align="left" align="center">
|
|
|
+ <el-table-column prop="applyCost" label="预估进价" header-align="left" align="center">
|
|
|
<template slot-scope="{ $index, row }">
|
|
|
- <label v-if="inputParam.openType === 'view'">{{ row.estimateCost + ' 元/' + row.measureUnit }}</label>
|
|
|
+ <label v-if="inputParam.openType === 'view'">{{ row.applyCost + ' 元/' + row.goodsStockUnit }}</label>
|
|
|
<el-form-item
|
|
|
v-else
|
|
|
style="margin: 18px 0"
|
|
|
label-width="0"
|
|
|
size="mini"
|
|
|
- :prop="'items.' + $index + '.estimateCost'"
|
|
|
- :rules="dataFormRules.estimateCost"
|
|
|
+ :prop="'items.' + $index + '.applyCost'"
|
|
|
+ :rules="dataFormRules.applyCost"
|
|
|
>
|
|
|
- <el-input v-model="row.estimateCost" size="mini" @change="changeCostValue($index, row)">
|
|
|
- <template slot="suffix">{{ ' 元/' + row.measureUnit }}</template>
|
|
|
+ <el-input v-model="row.applyCost" size="mini" @change="changeCostValue($index, row)">
|
|
|
+ <template slot="suffix">{{ ' 元/' + row.goodsStockUnit }}</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="purchaseQty" label="订货数量" header-align="left" align="center" width="120">
|
|
|
+ <el-table-column prop="applyQty" label="订货数量" header-align="left" align="center" width="120">
|
|
|
<template slot-scope="{ $index, row }">
|
|
|
- <label v-if="inputParam.openType === 'view'">{{ row.purchaseQty + ' /' + row.measureUnit }}</label>
|
|
|
+ <label v-if="inputParam.openType === 'view'">{{ row.applyQty + ' /' + row.goodsStockUnit }}</label>
|
|
|
<el-form-item
|
|
|
v-else
|
|
|
style="margin: 18px 0"
|
|
|
label-width="0"
|
|
|
size="mini"
|
|
|
- :prop="'items.' + $index + '.purchaseQty'"
|
|
|
- :rules="dataFormRules.purchaseQty"
|
|
|
+ :prop="'items.' + $index + '.applyQty'"
|
|
|
+ :rules="dataFormRules.applyQty"
|
|
|
>
|
|
|
- <el-input v-model="row.purchaseQty" size="mini" @change="changeCostValue($index, row)">
|
|
|
- <template slot="suffix">{{ ' /' + row.measureUnit }}</template>
|
|
|
+ <el-input v-model="row.applyQty" size="mini" @change="changeCostValue($index, row)">
|
|
|
+ <template slot="suffix">{{ ' /' + row.goodsStockUnit }}</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="estimateCostValue" label="预估金额" header-align="left" align="center">
|
|
|
+ <el-table-column prop="applyCostValue" label="预估金额" header-align="left" align="center">
|
|
|
<template slot-scope="{ $index, row }">
|
|
|
- <label>{{ row.estimateCostValue + ' 元' }}</label>
|
|
|
+ <label>{{ row.applyCostValue + ' 元' }}</label>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="measureUnit" label="采购单位" />
|
|
|
- <el-table-column prop="unitQty" label="转换系数" />
|
|
|
- <el-table-column prop="salesUnit" label="售卖单位" />
|
|
|
- <el-table-column prop="productModel" label="商品型号" min-width="100" />
|
|
|
- <el-table-column prop="specification" label="规格" min-width="80" />
|
|
|
+ <el-table-column prop="goodsStockUnit" label="采购单位" />
|
|
|
+ <el-table-column prop="goodsSpecification" label="规格" min-width="80" />
|
|
|
<el-table-column v-if="inputParam.openType !== 'view'" fixed="right" align="center" label="">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="text" @click="delItem(scope.$index)">删除</el-button>
|
|
@@ -140,11 +133,11 @@
|
|
|
</el-row>
|
|
|
<div style="text-align: right">
|
|
|
<el-button @click="cancelForm">取 消</el-button>
|
|
|
- <el-button v-if="checkBtn('add')" type="primary" :disabled="saveBtn" @click="submitForm('add')">保 存</el-button>
|
|
|
- <el-button v-if="checkBtn('edit')" type="primary" :disabled="saveBtn" @click="submitForm('edit')"
|
|
|
+ <el-button v-if="$restrict('add')" type="primary" :disabled="saveBtn" @click="submitForm('add')">保 存</el-button>
|
|
|
+ <el-button v-if="$restrict('edit')" type="primary" :disabled="saveBtn" @click="submitForm('edit')"
|
|
|
>保 存</el-button
|
|
|
>
|
|
|
- <el-button v-if="checkBtn('submit')" type="success" @click="submitSheet(dataForm.sheetId)">提 交</el-button>
|
|
|
+ <el-button v-if="$restrict('submit')" type="success" @click="submitSheet(dataForm.purchaseId)">提 交</el-button>
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
width="70%"
|
|
@@ -167,7 +160,7 @@
|
|
|
data =>
|
|
|
!searchGoods ||
|
|
|
data.goodsName.toLowerCase().includes(searchGoods.toLowerCase()) ||
|
|
|
- data.specification.toLowerCase().includes(searchGoods.toLowerCase())
|
|
|
+ data.goodsSpecification.toLowerCase().includes(searchGoods.toLowerCase())
|
|
|
)
|
|
|
"
|
|
|
:row-key="getRowKeys"
|
|
@@ -182,9 +175,7 @@
|
|
|
<el-table-column prop="goodsCode" label="辅材代码" />
|
|
|
<el-table-column prop="goodsName" label="辅材名称" />
|
|
|
<el-table-column prop="categoryName" label="小类名称" />
|
|
|
- <el-table-column prop="productModel" label="商品型号" />
|
|
|
- <el-table-column prop="specification" label="规格" />
|
|
|
- <el-table-column prop="qty" label="库存数量" />
|
|
|
+ <el-table-column prop="goodsSpecification" label="规格" />
|
|
|
</el-table>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="selGoods">确 定</el-button>
|
|
@@ -200,9 +191,11 @@ import {
|
|
|
editPurchaseApplySheet,
|
|
|
getPurchaseApplySheet
|
|
|
} from '@/api/material-system/shop/purchase-apply-sheet'
|
|
|
-import { getVenderGoodsList, getVenderList } from '@/api/material-system/vender'
|
|
|
+import { getVenderGoodsList } from '@/api/material-system/vender'
|
|
|
+import { getNewVenderGoodsList } from '@/api/material-system/vender'
|
|
|
import { computeVal } from '@/api/material-system/common'
|
|
|
-
|
|
|
+import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
|
|
|
+import { getWebsit } from '@/api/customerManagement.js'
|
|
|
export default {
|
|
|
name: 'PurchaseApplyArea',
|
|
|
props: {
|
|
@@ -211,13 +204,13 @@ export default {
|
|
|
default: function () {
|
|
|
return {
|
|
|
openType: 'add',
|
|
|
- sheetId: ''
|
|
|
+ purchaseId: ''
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- const validatePurchaseQty = (rule, value, callback) => {
|
|
|
+ const validateapplyQty = (rule, value, callback) => {
|
|
|
this.saveBtn = true
|
|
|
if (Number.isNaN(parseFloat(value))) {
|
|
|
return callback(new Error('请输入数字值'))
|
|
@@ -231,9 +224,9 @@ export default {
|
|
|
return {
|
|
|
loading: true,
|
|
|
dataForm: {
|
|
|
- sheetId: '', // 单据ID
|
|
|
- shopId: '', // 网点ID
|
|
|
- shopName: '', // 网点名称
|
|
|
+ purchaseId: '', // 单据ID
|
|
|
+ websitId: '', // 网点ID
|
|
|
+ websitName: '', // 网点名称
|
|
|
venderId: '', // 供应商ID
|
|
|
venderName: '', // 供应商名称
|
|
|
notes3: '', // 备注
|
|
@@ -241,19 +234,20 @@ export default {
|
|
|
items: [] // 关系辅材列表
|
|
|
},
|
|
|
dataFormRules: {
|
|
|
- shopId: [{ required: true, message: '请选择网点', trigger: 'change' }],
|
|
|
- purchaseQty: [{ validator: validatePurchaseQty, trigger: 'blur' }]
|
|
|
+ websitId: [{ required: true, message: '请选择网点', trigger: 'change' }],
|
|
|
+ applyQty: [{ validator: validateapplyQty, trigger: 'blur' }]
|
|
|
},
|
|
|
goodsList: [], // 商品列表
|
|
|
venderList: [], // 供应商列表
|
|
|
innerVisible: false,
|
|
|
searchGoods: '',
|
|
|
- saveBtn: false // 保存按钮状态
|
|
|
+ saveBtn: false, // 保存按钮状态
|
|
|
+ authShop: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
formDisabled() {
|
|
|
- return this.inputParam.openType === 'view' || this.dataForm.sheetId !== ''
|
|
|
+ return this.inputParam.openType === 'view' || this.dataForm.purchaseId !== ''
|
|
|
},
|
|
|
goodsTotalCount: function () {
|
|
|
return this.dataForm && this.dataForm.items ? this.dataForm.items.length : 0
|
|
@@ -261,7 +255,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
// 网点变动重新执行辅材获取资料
|
|
|
- 'shopPurchaseForm.shopId': function () {
|
|
|
+ 'shopPurchaseForm.websitId': function () {
|
|
|
this.getVenderGoodsList(this.dataForm.venderId)
|
|
|
},
|
|
|
searchGoods: function () {
|
|
@@ -271,14 +265,40 @@ export default {
|
|
|
mounted() {
|
|
|
this.getVenderList()
|
|
|
this.getDetail()
|
|
|
+ getWebsit({ type: 'C', status: true }).then(res => {
|
|
|
+ this.authShop = res.data
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
+ sheetFlagStr(type, val, filterArrays) {
|
|
|
+ const flag = [
|
|
|
+ { label: '保存', value: 'SAVE' },
|
|
|
+ { label: '提交', value: 'SUBMIT' },
|
|
|
+ { label: '作废', value: 'FAIL' },
|
|
|
+ { label: '已审核', value: 'OK' }
|
|
|
+ ].filter(obj => {
|
|
|
+ if (filterArrays) {
|
|
|
+ return filterArrays.indexOf(obj.value) >= 0
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ if (type === 'select') {
|
|
|
+ // 下拉选择返回数组
|
|
|
+ return flag
|
|
|
+ } else if (type === 'label') {
|
|
|
+ // 显示代号返回字符
|
|
|
+ if (val === null || val === '') return ''
|
|
|
+ const obj = flag.find(o => o.value === val)
|
|
|
+ return obj ? obj.label : ''
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
getDetail(id) {
|
|
|
this.loading = true
|
|
|
const openType = this.inputParam.openType
|
|
|
- const sheetId = id || this.inputParam.sheetId
|
|
|
+ const purchaseId = id || this.inputParam.purchaseId
|
|
|
if (openType !== 'add') {
|
|
|
- getPurchaseApplySheet({ sheetId }).then(res => {
|
|
|
+ getPurchaseApplySheet({ purchaseId }).then(res => {
|
|
|
this.setDataForm(res.data)
|
|
|
if (openType !== 'view') {
|
|
|
this.getVenderGoodsList(res.data.venderId, false)
|
|
@@ -305,8 +325,10 @@ export default {
|
|
|
this.$successMsg('保存成功')
|
|
|
})
|
|
|
} else {
|
|
|
- this.dataForm.shopName = this.getArraysName(this.authShop, this.dataForm, 'shopId', 'shopName')
|
|
|
- this.dataForm.venderName = this.getArraysName(this.venderList, this.dataForm, 'venderId', 'venderName')
|
|
|
+ this.dataForm.websitName = this.authShop.find(item => item.websitId === this.dataForm.websitId)?.websitName
|
|
|
+ this.dataForm.venderName = this.venderList.find(
|
|
|
+ item => item.venderId === this.dataForm.venderId
|
|
|
+ )?.venderName
|
|
|
addPurchaseApplySheet(this.dataForm).then(res => {
|
|
|
this.inputParam.openType = 'edit'
|
|
|
this.setDataForm(res.data)
|
|
@@ -318,27 +340,24 @@ export default {
|
|
|
},
|
|
|
setDataForm(data) {
|
|
|
this.dataForm = {
|
|
|
- sheetId: data.sheetId, // 单据编号
|
|
|
- shopId: data.shopId, // 网点ID
|
|
|
+ purchaseId: data.purchaseId, // 单据编号
|
|
|
+ websitId: data.websitId, // 网点ID
|
|
|
venderId: data.venderId, // 供应商Id
|
|
|
flag: data.flag,
|
|
|
notes: data.notes, // 备注
|
|
|
items: data.items // 关系商品列表
|
|
|
}
|
|
|
},
|
|
|
- checkBtn(type) {
|
|
|
- const typeMap = {
|
|
|
- add: this.inputParam.openType === type,
|
|
|
- edit: this.dataForm.flag === 0 && this.inputParam.openType === type,
|
|
|
- revoke: this.dataForm.flag === 1,
|
|
|
- submit: this.dataForm.flag === 0 && this.dataForm.sheetId !== ''
|
|
|
- }
|
|
|
- // 检查按钮权限
|
|
|
- return this.checkBtnRole(type) && typeMap[type]
|
|
|
- },
|
|
|
// 获取供应商列表
|
|
|
getVenderList() {
|
|
|
- getVenderList({ pageNum: 1, pageSize: -1, flag: 1 }).then(res => {
|
|
|
+ listPageV2({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: -1,
|
|
|
+ params: [
|
|
|
+ { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
+ { param: 'a.vender_type', compare: 'like', value: '辅材' }
|
|
|
+ ]
|
|
|
+ }).then(res => {
|
|
|
this.venderList = res.data.records
|
|
|
})
|
|
|
},
|
|
@@ -347,38 +366,34 @@ export default {
|
|
|
if (clear) {
|
|
|
this.dataForm.items = []
|
|
|
}
|
|
|
- getVenderGoodsList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- venderId: val,
|
|
|
- flag: 1,
|
|
|
- status: 1,
|
|
|
- shopId: this.dataForm.shopId
|
|
|
- }).then(res => {
|
|
|
- this.goodsList = res.data.records
|
|
|
- })
|
|
|
+ if (val) {
|
|
|
+ getNewVenderGoodsList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: -1,
|
|
|
+ params: [{ param: 'a.vender_id', compare: '=', value: val }]
|
|
|
+ }).then(res => {
|
|
|
+ this.goodsList = res.data.records
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 选中辅材添加到表单中
|
|
|
selGoods() {
|
|
|
this.searchGoods = ''
|
|
|
this.$refs.goodsTable.selection.forEach(value => {
|
|
|
- const index = this.dataForm.items.findIndex(item => {
|
|
|
- return item.goodsId === value.goodsId
|
|
|
- })
|
|
|
// 添加不在列表的商品
|
|
|
- if (index < 0) {
|
|
|
+ if (
|
|
|
+ !this.dataForm.items.find(item => {
|
|
|
+ return item.goodsId === value.goodsId
|
|
|
+ })
|
|
|
+ ) {
|
|
|
this.dataForm.items.push({
|
|
|
goodsId: value.goodsId,
|
|
|
goodsName: value.goodsName,
|
|
|
- ndays: value.ndays,
|
|
|
- purchaseQty: 0,
|
|
|
- estimateCost: 0,
|
|
|
- estimateCostValue: 0,
|
|
|
- measureUnit: value.measureUnit,
|
|
|
- unitQty: value.unitQty,
|
|
|
- salesUnit: value.salesUnit,
|
|
|
- productModel: value.productModel,
|
|
|
- specification: value.specification
|
|
|
+ goodsSpecification: value.goodsSpecification,
|
|
|
+ applyQty: 0,
|
|
|
+ applyCost: 0,
|
|
|
+ applyCostValue: 0,
|
|
|
+ goodsStockUnit: value.goodsStockUnit
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -393,9 +408,9 @@ export default {
|
|
|
return row.goodsId
|
|
|
},
|
|
|
// 提交 采购申请单
|
|
|
- submitSheet(sheetId) {
|
|
|
+ submitSheet(purchaseId) {
|
|
|
this.$confirm(
|
|
|
- `此操作将提交 ${sheetId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
|
|
|
+ `此操作将提交 ${purchaseId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
|
|
|
'提示',
|
|
|
{
|
|
|
confirmButtonText: '确定',
|
|
@@ -406,11 +421,11 @@ export default {
|
|
|
)
|
|
|
.then(() => {
|
|
|
this.loading = true
|
|
|
- submitPurchaseApplySheet({ sheetId: sheetId }).then(
|
|
|
+ submitPurchaseApplySheet({ purchaseId: purchaseId }).then(
|
|
|
() => {
|
|
|
setTimeout(() => {
|
|
|
this.inputParam.openType = 'view'
|
|
|
- this.getDetail(sheetId)
|
|
|
+ this.getDetail(purchaseId)
|
|
|
this.$successMsg('提交成功')
|
|
|
this.loading = false
|
|
|
}, 2000)
|
|
@@ -425,12 +440,12 @@ export default {
|
|
|
// 预估进价或申请数量变动
|
|
|
changeCostValue(index, row) {
|
|
|
computeVal({
|
|
|
- frontVal: row.purchaseQty,
|
|
|
- afterVal: row.estimateCost,
|
|
|
+ frontVal: row.applyQty,
|
|
|
+ afterVal: row.applyCost,
|
|
|
operator: '*',
|
|
|
- scale: 4
|
|
|
+ scale: 2
|
|
|
}).then(res => {
|
|
|
- this.dataForm.items[index].estimateCostValue = res.data
|
|
|
+ this.dataForm.items[index].applyCostValue = res.data
|
|
|
})
|
|
|
},
|
|
|
getSummaries(param) {
|
|
@@ -442,7 +457,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const values = data.map(item => Number(item[column.property]))
|
|
|
- if (column.property === 'estimateCostValue') {
|
|
|
+ if (column.property === 'applyCostValue') {
|
|
|
let count = 0
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
const suffix = (curr + '').split('.')
|