|
@@ -37,71 +37,241 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+ <div class="title"><span style="color: red">*</span> 委外产品明细</div>
|
|
|
|
+ <el-row class="my-row">
|
|
|
|
+ <el-table
|
|
|
|
+ :data="productDetails"
|
|
|
|
+ border
|
|
|
|
+ style="width: 100%;">
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="序号"
|
|
|
|
+ type="index"
|
|
|
|
+ width="50"
|
|
|
|
+ align="center">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="detailId"
|
|
|
|
+ label="ID"
|
|
|
|
+ v-if="false">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="productName"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="120"
|
|
|
|
+ label="产品名称">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="prodCode"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="120"
|
|
|
|
+ label="产品编号">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="productSpec"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="120"
|
|
|
|
+ label="型号及规格">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="cnt"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="数量">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="unitName"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="单位">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="deadline"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="140"
|
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
|
+ label="委外期限">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="batchNumber"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="120"
|
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
|
+ label="批次号">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="specificationExplian"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="120"
|
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
|
+ label="要求说明">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="arrivedTime"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="140"
|
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
|
+ label="到料时间">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="qualifiedCnt"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="合格数量">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="technologyFile"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="160"
|
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
|
+ label="工艺文件">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="attachList"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="附件">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="price"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ min-width="100"
|
|
|
|
+ label="不含税单价">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="taxPrice"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="含税单价">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="taxAmount"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="含税总价">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="taxRate"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ :formatter="formatPercent"
|
|
|
|
+ label="税率">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="notes"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ label="备注">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ fixed="right"
|
|
|
|
+ header-align="center"
|
|
|
|
+ align="center"
|
|
|
|
+ width="150"
|
|
|
|
+ label="操作">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" size="small" @click="addProductHandle(scope.row, false)">编辑</el-button>
|
|
|
|
+ <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.detailId)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <span>合计(含税): {{totalAmount}}</span>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row style="text-align: center; margin-top: 10px;">
|
|
|
|
+ <el-button type="primary" icon="el-icon-plus" @click="addMaterial"></el-button>
|
|
|
|
+ </el-row>
|
|
</el-form>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="onChose">取消</el-button>
|
|
<el-button @click="onChose">取消</el-button>
|
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
</span>
|
|
</span>
|
|
|
|
+ <!-- 新增物品 -->
|
|
|
|
+ <Add v-show="addProductVisible" ref="comAddProduct" @addItem="addProductCallback"/>
|
|
|
|
+ <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import UploadComponent from '../common/upload-component'
|
|
|
|
- import { getOutsourceDetail, getOutsourceDetailByProId } from '@/api/sale'
|
|
|
|
|
|
+ import { getOutsourceDetail, getOutsourceDetailByScheduleId } from '@/api/sale'
|
|
import { getDictList } from '@/api/dict'
|
|
import { getDictList } from '@/api/dict'
|
|
|
|
+ import Add from './add-product'
|
|
|
|
+ import AttachDetail from '../common/attach-detail'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'outsource-add-or-update',
|
|
name: 'outsource-add-or-update',
|
|
components: {
|
|
components: {
|
|
- UploadComponent
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- orgId: {
|
|
|
|
- get () { return this.$store.state.user.orgId }
|
|
|
|
- }
|
|
|
|
|
|
+ Add, AttachDetail
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
id: 0,
|
|
id: 0,
|
|
- idType: 0, // ID类型:1 委外ID,2 排产ID
|
|
|
|
dataForm: {},
|
|
dataForm: {},
|
|
dataRule: {
|
|
dataRule: {
|
|
- // reCode: [{ required: true, message: '请选择合同评审编码', trigger: 'change' }],
|
|
|
|
- // contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
|
|
|
|
- // deliveryTime: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
|
|
|
|
|
|
+ payType: [{ required: true, message: '请选择付款方式', trigger: 'change' }],
|
|
|
|
+ commissionType: [{ required: true, message: '请选择委外类别', trigger: 'change' }]
|
|
},
|
|
},
|
|
optionsType: [],
|
|
optionsType: [],
|
|
- fileList: []
|
|
|
|
|
|
+ totalAmount: 0,
|
|
|
|
+ addProductVisible: false,
|
|
|
|
+ productDetails: [],
|
|
|
|
+ prodProductionIds: [], // 排产ID的集合
|
|
|
|
+ attachVisible: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
onChose () {
|
|
onChose () {
|
|
this.$emit('onChose')
|
|
this.$emit('onChose')
|
|
},
|
|
},
|
|
- async init (id, type) {
|
|
|
|
- this.idType = type || 1
|
|
|
|
- this.fileList = []
|
|
|
|
- this.dataForm = {}
|
|
|
|
|
|
+ async init (id, prodProductionIds) {
|
|
|
|
+ if (prodProductionIds) {
|
|
|
|
+ this.prodProductionIds = prodProductionIds
|
|
|
|
+ }
|
|
|
|
+ this.productDetails = []
|
|
|
|
+ this.dataForm = {
|
|
|
|
+ payType: '1'
|
|
|
|
+ }
|
|
this.id = id || 0
|
|
this.id = id || 0
|
|
// 获取委外类别列表
|
|
// 获取委外类别列表
|
|
this.getType()
|
|
this.getType()
|
|
// 详情
|
|
// 详情
|
|
if (!id) return
|
|
if (!id) return
|
|
- await (this.idType === 1 ? getOutsourceDetail(this.id) : getOutsourceDetailByProId(this.id)).then(({data}) => {
|
|
|
|
- if (data && data.code === '200') {
|
|
|
|
- this.dataForm = data.data
|
|
|
|
- // 附件
|
|
|
|
- if (data.data.attachList) {
|
|
|
|
- data.data.attachList.forEach((item) => {
|
|
|
|
- this.fileList.push({
|
|
|
|
- name: item.fileName,
|
|
|
|
- url: item.url,
|
|
|
|
- id: item.url
|
|
|
|
|
|
+ if (this.prodProductionIds.length > 0) {
|
|
|
|
+ await getOutsourceDetailByScheduleId({'prodProductionIds': this.prodProductionIds}).then(({data}) => {
|
|
|
|
+ if (data && data.code === '200' && data.data) {
|
|
|
|
+ this.productDetails = data.data
|
|
|
|
+ if (this.productDetails && this.productDetails.length > 0) {
|
|
|
|
+ this.productDetails.forEach((item) => {
|
|
|
|
+ item.detailId = Math.round(Math.random() * 1000000)
|
|
})
|
|
})
|
|
- })
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ await getOutsourceDetail(this.id).then(({data}) => {
|
|
|
|
+ if (data && data.code === '200' && data.data) {
|
|
|
|
+ this.dataForm = data.data
|
|
|
|
+ this.productDetails = data.data.purCommissionDetails
|
|
|
|
+ if (this.productDetails && this.productDetails.length > 0) {
|
|
|
|
+ this.productDetails.forEach((item) => {
|
|
|
|
+ item.detailId = Math.round(Math.random() * 1000000)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 获取类别
|
|
// 获取类别
|
|
getType () {
|
|
getType () {
|
|
@@ -111,9 +281,6 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- uploadSuccess (fileList) {
|
|
|
|
- this.fileList = fileList
|
|
|
|
- },
|
|
|
|
validateField (type) {
|
|
validateField (type) {
|
|
this.$refs.dataForm.validateField(type)
|
|
this.$refs.dataForm.validateField(type)
|
|
},
|
|
},
|
|
@@ -121,12 +288,22 @@ export default {
|
|
dataFormSubmit () {
|
|
dataFormSubmit () {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ let action = ''
|
|
|
|
+ if (this.prodProductionIds.length > 0) {
|
|
|
|
+ action = `/biz-service/purCommDetail/save`
|
|
|
|
+ } else {
|
|
|
|
+ action = `/biz-service/purCommDetail/${!this.id ? 'save' : 'update'}`
|
|
|
|
+ }
|
|
// 产品明细
|
|
// 产品明细
|
|
- //
|
|
|
|
this.$http({
|
|
this.$http({
|
|
- url: this.$http.adornUrl(`/biz-service/purCommDetail/${!this.id ? 'save' : 'update'}`),
|
|
|
|
|
|
+ url: this.$http.adornUrl(action),
|
|
method: 'post',
|
|
method: 'post',
|
|
- data: this.$http.adornData({...this.dataForm, applierId: this.$store.state.user.id, orgId: this.$store.state.user.orgId})
|
|
|
|
|
|
+ data: this.$http.adornData({
|
|
|
|
+ ...this.dataForm,
|
|
|
|
+ purCommissionDetails: this.productDetails,
|
|
|
|
+ applierId: this.$store.state.user.id,
|
|
|
|
+ orgId: this.$store.state.user.orgId
|
|
|
|
+ })
|
|
}).then(({data}) => {
|
|
}).then(({data}) => {
|
|
if (data && data.code === '200') {
|
|
if (data && data.code === '200') {
|
|
this.$message({
|
|
this.$message({
|
|
@@ -144,6 +321,56 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ addMaterial () {
|
|
|
|
+ this.addProductVisible = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.comAddProduct.init()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ addProductHandle (row, disable) {
|
|
|
|
+ this.addProductVisible = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.comAddProduct.init(row.detailId, disable, row)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ deleteProductHandle (detailId) {
|
|
|
|
+ if (!detailId) return
|
|
|
|
+ this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId))
|
|
|
|
+ this.calTotal()
|
|
|
|
+ },
|
|
|
|
+ addProductCallback (data) {
|
|
|
|
+ if (!data) return
|
|
|
|
+ this.addProductVisible = false
|
|
|
|
+ let i = this.productDetails.findIndex((item) => item.detailId === data.detailId)
|
|
|
|
+ if (i > -1) {
|
|
|
|
+ this.productDetails.splice(i)
|
|
|
|
+ }
|
|
|
|
+ this.productDetails.push(data)
|
|
|
|
+ this.calTotal()
|
|
|
|
+ },
|
|
|
|
+ calTotal () {
|
|
|
|
+ let total = 0
|
|
|
|
+ if (this.productDetails) {
|
|
|
|
+ this.productDetails.forEach((item) => {
|
|
|
|
+ total += item.taxAmount ? Number(item.taxAmount) : 0
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.totalAmount = total
|
|
|
|
+ },
|
|
|
|
+ // 百分比
|
|
|
|
+ formatPercent (row) {
|
|
|
|
+ if (!row.taxRate) return ''
|
|
|
|
+ let str = (Number(row.taxRate * 100)).toFixed(0)
|
|
|
|
+ str += '%'
|
|
|
|
+ return str
|
|
|
|
+ },
|
|
|
|
+ // 附件
|
|
|
|
+ attachDetails (row) {
|
|
|
|
+ this.attachVisible = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.attachDetail.init(row.attachList)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|