add:新增知识库功能
This commit is contained in:
@@ -52,19 +52,14 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="clause-item">
|
||||
<strong>三、 售后服务:</strong>
|
||||
<span v-text="dataForm.after_sales" @input="this.dataForm.after_sales = $event.target.innerText" class="editable-clause" contenteditable="true" style="text-decoration: underline;">
|
||||
</span>
|
||||
</div>
|
||||
<div class="clause-item">
|
||||
<strong>四、 交货时间、地点:</strong>
|
||||
<strong>三、 服务时间、地点:</strong>
|
||||
货期:
|
||||
<span v-text="dataForm.delivery" @input="this.dataForm.delivery = $event.target.innerText" class="editable-clause" contenteditable="true" style="text-decoration: underline;"/>
|
||||
。交货地:
|
||||
<span v-text="dataForm.place" @input="this.dataForm.place = $event.target.innerText" class="editable-clause" contenteditable="true" style="text-decoration: underline;"/>
|
||||
</div>
|
||||
<div class="clause-item">
|
||||
<strong>五、 运输方式及到达站和费用负担:</strong>
|
||||
<strong>四、 运输方式及到达站和费用负担:</strong>
|
||||
<span v-text="dataForm.transport" @input="this.dataForm.transport = $event.target.innerText" class="editable-clause" contenteditable="true" style="text-decoration: underline;"/>
|
||||
</div>
|
||||
<div class="clause-item">
|
||||
@@ -285,193 +280,33 @@ export default {
|
||||
return result
|
||||
},
|
||||
exportToExcel () {
|
||||
// 获取客户名称
|
||||
let clientName = ''
|
||||
if (this.dictData && this.dictData[1]) {
|
||||
const client = this.dictData[1].find(item => item.value === this.dataForm.clientId)
|
||||
clientName = client ? client.label : ''
|
||||
// 检查contractId是否存在
|
||||
if (!this.dataForm.contractId) {
|
||||
this.$message.error('合同ID不存在,无法导出')
|
||||
return
|
||||
}
|
||||
|
||||
// 构建Excel HTML内容
|
||||
let excelHtml = `
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!--[if gte mso 9]>
|
||||
<xml>
|
||||
<x:ExcelWorkbook>
|
||||
<x:ExcelWorksheets>
|
||||
<x:ExcelWorksheet>
|
||||
<x:Name>产品购销合同</x:Name>
|
||||
<x:WorksheetOptions>
|
||||
<x:DisplayGridlines/>
|
||||
</x:WorksheetOptions>
|
||||
</x:ExcelWorksheet>
|
||||
</x:ExcelWorksheets>
|
||||
</x:ExcelWorkbook>
|
||||
</xml>
|
||||
<![endif]-->
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #000;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
th {
|
||||
background-color: #f5f5f5;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
.title-row {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
padding: 10px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="8" style="font-size: 18px; font-weight: bold; text-align: center; padding: 15px;">产品购销合同</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-left">需方:${clientName}</td>
|
||||
<td colspan="4" class="text-left">合同编号:${this.dataForm.contractCode || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="text-left">供方:上海诺力智能科技有限公司</td>
|
||||
<td colspan="4" class="text-left">生效日期:${this.dataForm.effectiveTime || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left title-row">一、产品明细单</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>产品名称</th>
|
||||
<th>订货代码</th>
|
||||
<th>型号</th>
|
||||
<th>数量</th>
|
||||
<th>单位</th>
|
||||
<th>单价(元)</th>
|
||||
<th>总价(元)</th>
|
||||
</tr>
|
||||
`
|
||||
|
||||
// 添加产品明细
|
||||
this.materData.forEach((item, index) => {
|
||||
excelHtml += `
|
||||
<tr>
|
||||
<td>${index + 1}</td>
|
||||
<td>${item.materialName || ''}</td>
|
||||
<td>${item.materialCode || ''}</td>
|
||||
<td>${item.materialSpec || ''}</td>
|
||||
<td>${item.qty || ''}</td>
|
||||
<td>${item.unitName || ''}</td>
|
||||
<td>${item.salePrice || ''}</td>
|
||||
<td>${item.amount || ''}</td>
|
||||
</tr>
|
||||
`
|
||||
// 调用后端接口导出Excel
|
||||
const url = this.$http.adornUrl('/flow/contract/export')
|
||||
const params = this.$http.adornParams({
|
||||
contractId: this.dataForm.contractId
|
||||
})
|
||||
|
||||
// 添加合计行
|
||||
excelHtml += `
|
||||
<tr>
|
||||
<td colspan="7" class="text-left">共计:</td>
|
||||
<td>${this.dataForm.totalPrice || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="text-left">共计人民币金额:(大写)${this.toChineseCurrency(this.dataForm.totalPrice)}</td>
|
||||
<td colspan="2">含13%增值税</td>
|
||||
</tr>
|
||||
`
|
||||
// 构建完整的URL
|
||||
const fullUrl = `${url}?${new URLSearchParams(params).toString()}`
|
||||
|
||||
// 添加合同条款
|
||||
excelHtml += `
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">二、质量要求、技术标准、供方对质量负责的条件和期限:${this.dataForm.qc || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">三、售后服务:${this.dataForm.afterSales || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">四、交货时间、地点:货期:${this.dataForm.delivery || ''},交货地:${this.dataForm.place || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">五、运输方式及到达站和费用负担:${this.dataForm.transport || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">六、包装标准:${this.dataForm.packaging || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">七、结算方式:${this.dataForm.pay || ''},付款方式:${this.dataForm.payment || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">八、违约责任:${this.dataForm.breach || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">九、解决合同纠纷的方式:${this.dataForm.solveDispute || ''}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" class="text-left">十、其它约定事项:${this.dataForm.supplement || ''}</td>
|
||||
</tr>
|
||||
`
|
||||
// 创建隐藏的iframe来下载文件
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style.display = 'none'
|
||||
iframe.src = fullUrl
|
||||
document.body.appendChild(iframe)
|
||||
|
||||
// 添加双方信息
|
||||
excelHtml += `
|
||||
<tr>
|
||||
<td colspan="4" class="text-left" style="vertical-align: top;">
|
||||
<div><strong>需方:</strong></div>
|
||||
<div>单位名称:${this.client.clientName || ''}</div>
|
||||
<div>地址:${this.client.address || ''}</div>
|
||||
<div>委托代理电话:${this.client.tel || ''}</div>
|
||||
<div>传真:${this.client.fax || ''}</div>
|
||||
<div>开户银行:${this.client.bank || ''}</div>
|
||||
<div>帐号:${this.client.card || ''}</div>
|
||||
</td>
|
||||
<td colspan="4" class="text-left" style="vertical-align: top;">
|
||||
<div><strong>供方:</strong></div>
|
||||
<div>单位名称:上海诺力智能科技有限公司(盖章)</div>
|
||||
<div>地址:上海青浦区徐泾镇高光路215弄99号4号楼302室</div>
|
||||
<div>委托代理电话:</div>
|
||||
<div>传真:</div>
|
||||
<div>开户银行:招商银行虹桥支行</div>
|
||||
<div>帐号:12191702501091</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
// 延迟移除iframe
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(iframe)
|
||||
}, 3000)
|
||||
|
||||
// 创建Blob对象
|
||||
const blob = new Blob(['\ufeff', excelHtml], {
|
||||
type: 'application/vnd.ms-excel;charset=utf-8'
|
||||
})
|
||||
|
||||
// 生成文件名
|
||||
const fileName = `产品购销合同_${this.dataForm.contractCode || new Date().getTime()}.xls`
|
||||
|
||||
// 创建下载链接
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = fileName
|
||||
|
||||
// 触发下载
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
|
||||
// 清理
|
||||
document.body.removeChild(link)
|
||||
URL.revokeObjectURL(link.href)
|
||||
|
||||
this.$message.success('Excel文件导出成功')
|
||||
this.$message.success('正在导出Excel文件,请稍候...')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +151,26 @@
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="170"
|
||||
width="220"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.ticketsId)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.ticketsId)">删除</el-button>
|
||||
<el-button type="text" size="small" @click="startFlowHandle(scope.row.processInstance)">流程进度</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
type="text" size="small" @click="addOrUpdateHandle(scope.row.ticketsId)">修改</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
type="text" size="small" @click="deleteHandle(scope.row.ticketsId)">删除</el-button>
|
||||
<!-- 只有未开始状态才显示发起流程按钮 -->
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
type="text"
|
||||
size="small"
|
||||
@click="initiateFlowHandle(scope.row.ticketsId)">
|
||||
发起流程
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status !== 0"
|
||||
type="text" size="small" @click="startFlowHandle(scope.row.processInstance)">流程进度</el-button>
|
||||
<el-button type="text" size="small" @click="$router.push(`/tickets-detail?id=${scope.row.ticketsId}`)">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -389,6 +403,37 @@
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 发起流程
|
||||
initiateFlowHandle(ticketsId) {
|
||||
this.$confirm('确定要发起流程吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/tickets/tickets/initiate'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
ticketsId: ticketsId
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 200) {
|
||||
this.$message({
|
||||
message: '流程发起成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg || '流程发起失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error('流程发起失败,请稍后重试')
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user