合同
This commit is contained in:
@@ -70,13 +70,10 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="11">
|
<el-col :span="11">
|
||||||
<el-form-item label="总计">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- <el-form-item label="物料信息" prop="materialJson">
|
|
||||||
<el-input v-model="dataForm.materialJson" placeholder="物料信息"></el-input>
|
|
||||||
</el-form-item> -->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table
|
||||||
:data="materData"
|
:data="materData"
|
||||||
@@ -103,22 +100,31 @@
|
|||||||
label="物料类型">
|
label="物料类型">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="isOn"
|
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
|
width="120"
|
||||||
label="单价">
|
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>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="createTime"
|
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
|
width="120"
|
||||||
label="价格系数">
|
label="价格系数">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input size="mini" v-model="scope.row.coefficient" placeholder="请输入价格系数"></el-input>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="createTime"
|
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
|
width="120"
|
||||||
label="对外价格">
|
label="对外价格">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input size="mini" v-model="scope.row.externalPrice" placeholder="请输入对外价格"></el-input>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
header-align="center"
|
header-align="center"
|
||||||
@@ -126,14 +132,16 @@
|
|||||||
width="120"
|
width="120"
|
||||||
label="数量">
|
label="数量">
|
||||||
<template slot-scope="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="createTime"
|
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
label="总价">
|
label="总价">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.total }}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
fixed="right"
|
fixed="right"
|
||||||
@@ -244,9 +252,9 @@
|
|||||||
isMaster: 0,
|
isMaster: 0,
|
||||||
contractNumber: '',
|
contractNumber: '',
|
||||||
clientId: '',
|
clientId: '',
|
||||||
materialJson: '',
|
|
||||||
isAcceptance: 0,
|
isAcceptance: 0,
|
||||||
remarks: ''
|
remarks: '',
|
||||||
|
totalSum: 0
|
||||||
},
|
},
|
||||||
dataRule: {
|
dataRule: {
|
||||||
contractType: [
|
contractType: [
|
||||||
@@ -257,9 +265,6 @@
|
|||||||
],
|
],
|
||||||
clientId: [
|
clientId: [
|
||||||
{ required: true, message: '客户不能为空', trigger: 'blur' }
|
{ required: true, message: '客户不能为空', trigger: 'blur' }
|
||||||
],
|
|
||||||
materialJson: [
|
|
||||||
{ required: true, message: '物料信息不能为空', trigger: 'blur' }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
innerDataForm: {
|
innerDataForm: {
|
||||||
@@ -271,7 +276,15 @@
|
|||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
dataListLoading: false,
|
dataListLoading: false,
|
||||||
dataListSelections: [],
|
dataListSelections: [],
|
||||||
materData: [{materialName: 'aaa'}]
|
materData: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
materData: {
|
||||||
|
deep: true,
|
||||||
|
handler() {
|
||||||
|
this.calculateTotalSum()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -297,9 +310,10 @@
|
|||||||
this.visible = true
|
this.visible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['dataForm'].resetFields()
|
this.$refs['dataForm'].resetFields()
|
||||||
|
this.materData = []
|
||||||
if (this.dataForm.contractId) {
|
if (this.dataForm.contractId) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/tickets/contract/info/${this.dataForm.contractId}`),
|
url: this.$http.adornUrl(`/flow/contract/list/${this.dataForm.contractId}`),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams()
|
params: this.$http.adornParams()
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
@@ -320,12 +334,21 @@
|
|||||||
this.innerVisible = true
|
this.innerVisible = true
|
||||||
this.getDataList()
|
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 () {
|
dataFormSubmit () {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$http({
|
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',
|
method: 'post',
|
||||||
data: this.$http.adornData({
|
data: this.$http.adornData({
|
||||||
'contractId': this.dataForm.contractId || undefined,
|
'contractId': this.dataForm.contractId || undefined,
|
||||||
@@ -333,9 +356,10 @@
|
|||||||
'isMaster': this.dataForm.isMaster,
|
'isMaster': this.dataForm.isMaster,
|
||||||
'contractNumber': this.dataForm.contractNumber,
|
'contractNumber': this.dataForm.contractNumber,
|
||||||
'clientId': this.dataForm.clientId,
|
'clientId': this.dataForm.clientId,
|
||||||
'materialJson': this.dataForm.materialJson,
|
'materialJson': JSON.stringify(this.materData),
|
||||||
'isAcceptance': this.dataForm.isAcceptance,
|
'isAcceptance': this.dataForm.isAcceptance,
|
||||||
'remarks': this.dataForm.remarks
|
'remarks': this.dataForm.remarks,
|
||||||
|
'totalSum': this.dataForm.totalSum
|
||||||
})
|
})
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
|
|||||||
@@ -193,7 +193,7 @@
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/tickets/contract/delete'),
|
url: this.$http.adornUrl('/flow/contract/delete'),
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: this.$http.adornData(ids, false)
|
data: this.$http.adornData(ids, false)
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
|
|||||||
@@ -102,12 +102,14 @@ export default {
|
|||||||
addAndPrint () {
|
addAndPrint () {
|
||||||
const LODOP = getLodop()
|
const LODOP = getLodop()
|
||||||
LODOP.PRINT_INITA("0mm", "0mm", "213mm", "297mm", "打印合同模板")
|
LODOP.PRINT_INITA("0mm", "0mm", "213mm", "297mm", "打印合同模板")
|
||||||
LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4")
|
LODOP.SET_PRINT_PAGESIZE(1, 2100, 2970, "A4")
|
||||||
LODOP.ADD_PRINT_TEXT(0, 0, 700, 50, "产品供应合同")
|
LODOP.ADD_PRINT_TEXT(0, 0, '0', '0', '')
|
||||||
// 获取弹窗内容并转换为 HTML 字符串
|
// 获取弹窗内容并转换为 HTML 字符串
|
||||||
|
const h1Content = `<h1>产品供销合同</h1>`
|
||||||
const popupContent = document.getElementById('popupContent').innerHTML
|
const popupContent = document.getElementById('popupContent').innerHTML
|
||||||
const printHtml = `
|
const printHtml = `
|
||||||
<style>
|
<style>
|
||||||
|
h1 {font-size: 14px;line-height: 1;font-weight: 700;text-align: center;margin-bottom: 30px;}
|
||||||
.zd-row {width: 100%;display: flex;}
|
.zd-row {width: 100%;display: flex;}
|
||||||
.zd-col-12 {width: 50%;}
|
.zd-col-12 {width: 50%;}
|
||||||
.dialog_content {width: 100%;}
|
.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 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}
|
.det_table_1 th, .det_table_1 td {text-align:left}
|
||||||
</style>
|
</style>
|
||||||
|
${h1Content}
|
||||||
${popupContent}
|
${popupContent}
|
||||||
`
|
`
|
||||||
// 添加弹窗内容到打印任务
|
// 添加弹窗内容到打印任务
|
||||||
LODOP.ADD_PRINT_HTM("30mm", "10mm", "RightMargin:10mm", "BottomMargin:10mm", printHtml)
|
LODOP.ADD_PRINT_HTM(0, '5%', '90%', '90%', printHtml)
|
||||||
LODOP.PREVIEW()// 预览
|
LODOP.PREVIEW()// 预览
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user