|
@@ -0,0 +1,168 @@
|
|
|
|
+<!-- 委外新增、修改 -->
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <div class="my-title">{{ !id?'新增':'修改' }}</div>
|
|
|
|
+ <!-- 表单 -->
|
|
|
|
+ <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
|
+ <el-row class="my-row">
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="合同编码" prop="contractCode">
|
|
|
|
+ <el-input v-model="dataForm.contractCode" disabled placeholder="合同编码由系统生成"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="合同类别" prop="contractType">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="dataForm.contractType"
|
|
|
|
+ remote
|
|
|
|
+ placeholder="请选择">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in optionsType"
|
|
|
|
+ :key="item.code"
|
|
|
|
+ :label="item.value"
|
|
|
|
+ :value="item.code">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="采购/委外单据" prop="contractNumber">
|
|
|
|
+ <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="my-row">
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="合同号" prop="contractNumber">
|
|
|
|
+ <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="8">
|
|
|
|
+ <el-form-item label="合同金额" prop="actualDeliveryTime">
|
|
|
|
+ <el-input-number v-model="dataForm.actualDeliveryTime" :step="1" :min="0" :precision="1"></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="my-row" style="margin-top: 20px">
|
|
|
|
+ <el-form-item label="备注" prop="notes">
|
|
|
|
+ <el-input type="textarea" v-model="dataForm.notes"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="my-row">
|
|
|
|
+ <upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
|
|
|
|
+ </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>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import UploadComponent from '../common/upload-component'
|
|
|
|
+ import { getContractDetail } from '@/api/sale'
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: 'contract-add-or-update',
|
|
|
|
+ components: {
|
|
|
|
+ UploadComponent
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ orgId: {
|
|
|
|
+ get () { return this.$store.state.user.orgId }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ id: 0,
|
|
|
|
+ dataForm: {},
|
|
|
|
+ dataRule: {
|
|
|
|
+ // reCode: [{ required: true, message: '请选择合同评审编码', trigger: 'change' }],
|
|
|
|
+ // contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
|
|
|
|
+ // deliveryTime: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
|
|
|
|
+ },
|
|
|
|
+ optionsType: [],
|
|
|
|
+ fileList: []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ onChose () {
|
|
|
|
+ this.$emit('onChose')
|
|
|
|
+ },
|
|
|
|
+ async init (id) {
|
|
|
|
+ this.fileList = []
|
|
|
|
+ this.dataForm = {}
|
|
|
|
+ this.id = id || 0
|
|
|
|
+ // 详情
|
|
|
|
+ if (!id) return
|
|
|
|
+ await getContractDetail(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
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ uploadSuccess (fileList) {
|
|
|
|
+ this.fileList = fileList
|
|
|
|
+ },
|
|
|
|
+ validateField (type) {
|
|
|
|
+ this.$refs.dataForm.validateField(type)
|
|
|
|
+ },
|
|
|
|
+ // 表单提交
|
|
|
|
+ dataFormSubmit () {
|
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ // 附件
|
|
|
|
+ let fList = this.fileList
|
|
|
|
+ if (fList.length > 0) {
|
|
|
|
+ this.dataForm.attachList = []
|
|
|
|
+ for (let i = 0; i < fList.length; i++) {
|
|
|
|
+ this.dataForm.attachList.push({
|
|
|
|
+ fileName: fList[i].name,
|
|
|
|
+ url: fList[i].url
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('请上传文件')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 产品明细
|
|
|
|
+ this.$http({
|
|
|
|
+ url: this.$http.adornUrl(`/biz-service/purPurchaseContract/${!this.id ? 'save' : 'update'}`),
|
|
|
|
+ method: 'post',
|
|
|
|
+ data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
|
|
|
|
+ }).then(({data}) => {
|
|
|
|
+ if (data && data.code === '200') {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '操作成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 1500,
|
|
|
|
+ onClose: () => {
|
|
|
|
+ this.onChose()
|
|
|
|
+ this.$emit('refreshDataList')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(data.msg)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+
|
|
|
|
+</style>
|