Browse Source

合同

master
蔡玲玲 2 weeks ago
parent
commit
f932a49602
  1. 62
      base-vue/src/views/modules/contract/contract-add-or-update.vue
  2. 2
      base-vue/src/views/modules/contract/contract.vue
  3. 9
      base-vue/src/views/modules/contract/temp-add-or-update.vue

62
base-vue/src/views/modules/contract/contract-add-or-update.vue

@ -70,13 +70,10 @@
</el-col>
<el-col :span="11">
<el-form-item label="总计">
<el-input v-model="dataForm.code" placeholder="总计"></el-input>
<el-input v-model="dataForm.totalSum" placeholder="总计" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- <el-form-item label="物料信息" prop="materialJson">
<el-input v-model="dataForm.materialJson" placeholder="物料信息"></el-input>
</el-form-item> -->
</el-form>
<el-table
:data="materData"
@ -103,22 +100,31 @@
label="物料类型">
</el-table-column>
<el-table-column
prop="isOn"
header-align="center"
align="center"
width="120"
label="单价">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.price" placeholder="请输入单价" @input="calculateTotal(scope.$index)" @blur="calculateTotal(scope.$index)"></el-input>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="120"
label="价格系数">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.coefficient" placeholder="请输入价格系数"></el-input>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="120"
label="对外价格">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.externalPrice" placeholder="请输入对外价格"></el-input>
</template>
</el-table-column>
<el-table-column
header-align="center"
@ -126,14 +132,16 @@
width="120"
label="数量">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.num"></el-input>
<el-input size="mini" v-model="scope.row.quantity" placeholder="请输入数量" @input="calculateTotal(scope.$index)" @blur="calculateTotal(scope.$index)"></el-input>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="总价">
<template slot-scope="scope">
{{ scope.row.total }}
</template>
</el-table-column>
<el-table-column
fixed="right"
@ -244,9 +252,9 @@
isMaster: 0,
contractNumber: '',
clientId: '',
materialJson: '',
isAcceptance: 0,
remarks: ''
remarks: '',
totalSum: 0
},
dataRule: {
contractType: [
@ -257,9 +265,6 @@
],
clientId: [
{ required: true, message: '客户不能为空', trigger: 'blur' }
],
materialJson: [
{ required: true, message: '物料信息不能为空', trigger: 'blur' }
]
},
innerDataForm: {
@ -271,7 +276,15 @@
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
materData: [{materialName: 'aaa'}]
materData: []
}
},
watch: {
materData: {
deep: true,
handler() {
this.calculateTotalSum()
}
}
},
created () {
@ -297,9 +310,10 @@
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.materData = []
if (this.dataForm.contractId) {
this.$http({
url: this.$http.adornUrl(`/tickets/contract/info/${this.dataForm.contractId}`),
url: this.$http.adornUrl(`/flow/contract/list/${this.dataForm.contractId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
@ -320,12 +334,21 @@
this.innerVisible = true
this.getDataList()
},
calculateTotal(index) {
const row = this.materData[index]
const price = parseFloat(row.price) || 0
const quantity = parseFloat(row.quantity) || 0
row.total = price * quantity
},
calculateTotalSum() {
this.dataForm.totalSum = this.materData.reduce((sum, row) => sum + parseFloat(row.total || 0), 0)
},
//
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/tickets/contract/${!this.dataForm.contractId ? 'save' : 'update'}`),
url: this.$http.adornUrl(`/flow/contract/${!this.dataForm.contractId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'contractId': this.dataForm.contractId || undefined,
@ -333,9 +356,10 @@
'isMaster': this.dataForm.isMaster,
'contractNumber': this.dataForm.contractNumber,
'clientId': this.dataForm.clientId,
'materialJson': this.dataForm.materialJson,
'materialJson': JSON.stringify(this.materData),
'isAcceptance': this.dataForm.isAcceptance,
'remarks': this.dataForm.remarks
'remarks': this.dataForm.remarks,
'totalSum': this.dataForm.totalSum
})
}).then(({data}) => {
if (data && data.code === 0) {

2
base-vue/src/views/modules/contract/contract.vue

@ -193,7 +193,7 @@
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/tickets/contract/delete'),
url: this.$http.adornUrl('/flow/contract/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {

9
base-vue/src/views/modules/contract/temp-add-or-update.vue

@ -102,12 +102,14 @@ export default {
addAndPrint () {
const LODOP = getLodop()
LODOP.PRINT_INITA("0mm", "0mm", "213mm", "297mm", "打印合同模板")
LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4")
LODOP.ADD_PRINT_TEXT(0, 0, 700, 50, "产品供应合同")
LODOP.SET_PRINT_PAGESIZE(1, 2100, 2970, "A4")
LODOP.ADD_PRINT_TEXT(0, 0, '0', '0', '')
// HTML
const h1Content = `<h1>产品供销合同</h1>`
const popupContent = document.getElementById('popupContent').innerHTML
const printHtml = `
<style>
h1 {font-size: 14px;line-height: 1;font-weight: 700;text-align: center;margin-bottom: 30px;}
.zd-row {width: 100%;display: flex;}
.zd-col-12 {width: 50%;}
.dialog_content {width: 100%;}
@ -117,10 +119,11 @@ export default {
.det_table th, .det_table td {border: 1px solid #000;font-size: 10px; line-height: 23px; padding: 0; text-align: center}
.det_table_1 th, .det_table_1 td {text-align:left}
</style>
${h1Content}
${popupContent}
`
//
LODOP.ADD_PRINT_HTM("30mm", "10mm", "RightMargin:10mm", "BottomMargin:10mm", printHtml)
LODOP.ADD_PRINT_HTM(0, '5%', '90%', '90%', printHtml)
LODOP.PREVIEW()//
},
}

Loading…
Cancel
Save