Commit 27cee777 authored by 高宇's avatar 高宇

完成销售合同;

parent d83b3ce2
......@@ -26,7 +26,8 @@
<el-progress :percentage="progress" v-if="progress > 0 && progress < 100"></el-progress>
</div>
</el-upload>
<span class="tips"><em>{{tips}}</em></span>
<span class="tips">{{tips}}
<span class="text-danger">当有新文件上传时, 之前上传的文件将会被删除</span></span>
</el-col>
<el-col :span="6">
<slot name="formError"></slot>
......
......@@ -13,12 +13,12 @@
</template>
<script>
// import {
// requestAPI,
// api
// } from '@/lib/commonMixin'
import {
requestAPI,
api
} from '@/lib/commonMixin'
import operationContract from './operationContract'
// import {setModule} from '../../../lib/viewHelper'
import {setModule} from '../../../lib/viewHelper'
export default {
name: '',
components: {
......@@ -32,7 +32,20 @@
methods: {
saveContract () {
let form = this.$refs.operationContract.getForm()
console.log(form)
let subData = setModule(form.SalesContracts, 'SalesContracts')
requestAPI(api.saveContractAdd, {
data: {...subData}
}).then(res => {
this.$message({
message: '保存成功!',
type: 'success'
})
this.close(true)
}, error => {
error.msg.forEach(item => {
this.$set(this.errorData, item.name, item.error)
})
})
},
close (getList) {
this.$emit('close', getList)
......
......@@ -13,12 +13,12 @@
</template>
<script>
// import {
// requestAPI,
// api
// } from '@/lib/commonMixin'
import {
requestAPI,
api
} from '@/lib/commonMixin'
import operationContract from './operationContract'
// import {setModule} from '../../../lib/viewHelper'
import {setModule} from '../../../lib/viewHelper'
export default {
name: '',
components: {
......@@ -30,7 +30,23 @@
}
},
methods: {
saveContract () {},
saveContract () {
let form = this.$refs.operationContract.getForm()
let subData = setModule(form.SalesContracts, 'SalesContracts')
requestAPI(api.saveContractEdit, {
data: {...subData}
}).then(res => {
this.$message({
message: '保存成功!',
type: 'success'
})
this.close(true)
}, error => {
error.msg.forEach(item => {
this.$set(this.errorData, item.name, item.error)
})
})
},
close (getList) {
this.$emit('close', getList)
},
......
......@@ -86,7 +86,7 @@
<el-form-item :show-message="false" :error="errorData['contract_scan'] ? errorData['contract_scan'] : ''">
<single-upload
label="上传合同"
tips="只能上传 jpg,png,pdf 类型文件, 文件不能超过50M, 当有新文件上传时, 之前上传的文件将会被删除"
tips="只能上传 jpg,png,pdf 类型文件, 文件不能超过50M"
:form-item="SalesContracts.contract_scan"
:file-name="getFileName('contractScan')"
@update:item="val => {SalesContracts.contract_scan = val}">
......@@ -99,7 +99,7 @@
<single-upload
label="上传签收单"
:file-name="getFileName('receiptScan')"
tips="只能上传 jpg,png,pdf 类型文件, 文件不能超过50M, 当有新文件上传时, 之前上传的文件将会被删除"
tips="只能上传 jpg,png,pdf 类型文件, 文件不能超过50M"
:form-item="SalesContracts.receipt_scan"
@update:item="val => {SalesContracts.receipt_scan = val}">
<span slot="formError" class="el-form-item__error">
......@@ -259,7 +259,7 @@
description: '',
contract_scan: '',
receipt_scan: '',
contract_type: 2,
contract_type: 1,
project_id: '',
// 服务截止
expire_date: '',
......@@ -379,10 +379,7 @@
initAdd () {
requestAPI(api.getContractNewOptions).then(res => {
Object.keys(res.options).forEach(key => {
console.log(this.options[key], key)
// res.options[key].value.forEach(i => {
// this.options[key].value.push(i)
// })
this.$set(this.options, key, res.options[key])
})
})
},
......@@ -392,12 +389,23 @@
id
}
}).then(res => {
if (res.model.client) {
Object.keys(res.model.client).forEach(item => {
this.$set(this.client, item, res.model.client[item])
})
}
this.options['SalesContracts[project_id]'].value.push(res.model.project)
this.searchText = this.client.name
Object.keys(res.options).forEach(key => {
this.$set(this.options, key, res.options[key])
})
Object.keys(this.SalesContracts).forEach(item => {
this.SalesContracts[item] = res.model[item]
})
Object.keys(this.files).forEach(item => {
this.files[item].name = res.model[item].orig_name
})
console.log(this.files)
})
}
},
......
......@@ -33,6 +33,8 @@ export let setModule = (obj, key, options) => {
} else {
ob[key + '[' + item + '][' + arr.key + ']'] = arr.name
}
} else if (arr.name) {
ob[key + '[' + item + '][' + arr.name + ']'] = arr.value
} else if (Object.keys(arr).length > 0) {
Object.keys(arr).forEach(i => {
ob[key + '[' + item + '][' + i + ']'] = arr[i]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment