|
@@ -60,11 +60,116 @@
|
|
|
<el-row class="my-row">
|
|
|
<upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
|
|
|
</el-row>
|
|
|
+ <el-row style="margin-top: 10px" class="my-row">
|
|
|
+ <div class="title"><span style="color: red">*</span> 采购物品明细</div>
|
|
|
+ <el-table
|
|
|
+ :data="materialList"
|
|
|
+ border
|
|
|
+ style="width: 100%;">
|
|
|
+ <el-table-column
|
|
|
+ label="序号"
|
|
|
+ type="index"
|
|
|
+ width="50"
|
|
|
+ align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="procurementCode"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="180"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="采购编码">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="materialName"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="160"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="物品名称">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="specification"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="120"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="型号及规格">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="cnt"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ label="数量">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="qualifiedCnt"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ label="合格数量">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="unitName"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="100"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="单位">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="deadline"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="160"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="采购期限">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="arrivedTime"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="160"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="到料时间">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="batchNumber"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="160"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="批次号/用途">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="notes"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="180"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ label="备注">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="100"
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="small" @click="updateItemHandle(scope.row)">编辑</el-button>
|
|
|
+ <el-button style="color: red" type="text" size="small" @click="deleteItemHandle(scope.row.recordId)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-row style="text-align: center; margin-top: 10px;">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" @click="addItemHandle"></el-button>
|
|
|
+ </el-row>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="onChose">取消</el-button>
|
|
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
+ <add-purchase v-if="addPurchaseVisible" ref="addPurchase" @addItems="addMaterialItems"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -72,12 +177,14 @@
|
|
|
import UploadComponent from '../common/upload-component'
|
|
|
import { getContractDetail } from '@/api/sale'
|
|
|
import SupplierComponent from '../common/supplier-component'
|
|
|
+ import AddPurchase from '../purchase/purchase-chose'
|
|
|
|
|
|
export default {
|
|
|
name: 'contract-add-or-update',
|
|
|
components: {
|
|
|
SupplierComponent,
|
|
|
- UploadComponent
|
|
|
+ UploadComponent,
|
|
|
+ AddPurchase
|
|
|
},
|
|
|
computed: {
|
|
|
orgId: {
|
|
@@ -87,7 +194,10 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
id: 0,
|
|
|
+ addPurchaseVisible: false,
|
|
|
dataForm: {},
|
|
|
+ materialList: [],
|
|
|
+ optionsPurchaseType: [],
|
|
|
dataRule: {
|
|
|
type: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
|
|
|
contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
|
|
@@ -109,7 +219,8 @@ export default {
|
|
|
onChose () {
|
|
|
this.$emit('onChose')
|
|
|
},
|
|
|
- async init (id) {
|
|
|
+ async init (id, optionsType) {
|
|
|
+ this.optionsPurchaseType = optionsType
|
|
|
this.fileList = []
|
|
|
this.dataForm = {}
|
|
|
this.id = id || 0
|
|
@@ -156,6 +267,16 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
// 产品明细
|
|
|
+ // console.log(JSON.stringify(this.materialList))
|
|
|
+ this.dataForm.purPurchaseContractDetailsList = []
|
|
|
+ if (this.materialList) {
|
|
|
+ this.materialList.forEach((item) => {
|
|
|
+ this.dataForm.purPurchaseContractDetailsList.push({
|
|
|
+ contractId: this.id || 0,
|
|
|
+ dataId: item.purchaseDetailId
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl(`/biz-service/purPurchaseContract/${!this.id ? 'save' : 'update'}`),
|
|
|
method: 'post',
|
|
@@ -177,6 +298,51 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 新增项目
|
|
|
+ addItemHandle () {
|
|
|
+ if (Number(this.dataForm.type) === 1) {
|
|
|
+ this.addPurchaseVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addPurchase.init()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 编辑项目
|
|
|
+ updateItemHandle (row) {
|
|
|
+ if (Number(this.dataForm.type) === 1) {
|
|
|
+ this.productListVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addPurchase.init(row)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除项目
|
|
|
+ deleteItemHandle (recordId) {
|
|
|
+ this.materialList.splice(this.materialList.findIndex((item) => item.recordId === recordId))
|
|
|
+ },
|
|
|
+ addItem (item) {
|
|
|
+ if (!item.recordId) {
|
|
|
+ item.recordId = Math.round(Math.random() * 1000000)
|
|
|
+ }
|
|
|
+ if (this.materialList.findIndex(item1 => item1.recordId === item.recordId) === -1) {
|
|
|
+ this.materialList.push({
|
|
|
+ ...item
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 转换属性“类别”
|
|
|
+ formatType (row) {
|
|
|
+ if (this.optionsPurchaseType && row.purchaseType) {
|
|
|
+ const item1 = this.optionsPurchaseType.find((item) => item.code === row.purchaseType.toString())
|
|
|
+ return item1 ? item1.value : ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addMaterialItems (items) {
|
|
|
+ this.materialList = []
|
|
|
+ items.forEach((item) => {
|
|
|
+ this.addItem(item)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|