合同\工单

This commit is contained in:
2025-03-18 14:48:46 +08:00
parent 6f889937b7
commit 3aa5342397
7 changed files with 208 additions and 199 deletions

View File

@@ -10,7 +10,7 @@
<el-form-item label="合同类型" prop="contractType">
<el-select v-model="dataForm.contractType" placeholder="合同类型" style="width: 100%;">
<el-option
v-for="item in contractTypeOpt"
v-for="item in dictData[0]"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -41,7 +41,7 @@
<el-form-item label="客户" prop="clientId">
<el-select v-model="dataForm.clientId" placeholder="客户" style="width: 100%;">
<el-option
v-for="item in clientIdOpt"
v-for="item in dictData[1]"
:key="item.clientId"
:label="item.clientName"
:value="item.clientId">
@@ -153,6 +153,24 @@
<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
header-align="center"
align="center"
width="120"
label="单位">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.unit" placeholder="请输入单位"></el-input>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
width="120"
label="备注">
<template slot-scope="scope">
<el-input size="mini" v-model="scope.row.remark" placeholder="请输入备注"></el-input>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
@@ -298,8 +316,7 @@
}
},
props: {
contractTypeOpt: Array,
clientIdOpt: Array
dictData: Array
},
watch: {
materData: {
@@ -323,14 +340,14 @@
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.contractType = data.contract.contractType
this.dataForm.contractType = String(data.contract.contractType)
this.dataForm.isMaster = data.contract.isMaster
this.dataForm.contractNumber = data.contract.contractNumber
this.dataForm.clientId = data.contract.clientId
this.dataForm.materialJson = data.contract.materialJson
this.dataForm.isAcceptance = data.contract.isAcceptance
this.dataForm.remarks = data.contract.remarks
this.materData = JSON.parse(data.contract.materialJson)
this.materData = JSON.parse(data.contract.materialJson).material
}
})
this.getFile()
@@ -376,7 +393,7 @@
'isMaster': this.dataForm.isMaster,
'contractNumber': this.dataForm.contractNumber,
'clientId': this.dataForm.clientId,
'materialJson': JSON.stringify(this.materData),
'materialJson': JSON.stringify({material: this.materData, total: this.dataForm.totalSum}),
'isAcceptance': this.dataForm.isAcceptance,
'remarks': this.dataForm.remarks,
'storageId': `${ids}${this.dataForm.storageId}`
@@ -389,6 +406,7 @@
duration: 1500,
onClose: () => {
this.$refs.upload.clearFiles()
this.activeName = 'first'
this.visible = false
this.$emit('refreshDataList')
}

View File

@@ -28,32 +28,13 @@
header-align="center"
align="center"
label="合同ID">
<template slot-scope="scope">
<el-popover
:content="'file/' + scope.row.type + '/' + scope.row.realName"
placement="top-start"
title="路径"
width="200"
trigger="hover"
>
<a
slot="reference"
:href="$baseUrl + '/file/' + scope.row.type + '/' + scope.row.realName"
class="el-link--primary"
style="word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color: #1890ff;font-size: 13px;"
target="_blank"
>
{{ scope.row.contractId }}
</a>
</el-popover>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="合同类型">
<template slot-scope="scope">
{{ scope.row.contractType | dictLabel(dictsOpt['contract_type']) }}
{{ dictData[0] | findByValue(scope.row.contractType) }}
</template>
</el-table-column>
<el-table-column
@@ -76,7 +57,7 @@
align="center"
label="客户">
<template slot-scope="scope">
{{ scope.row.clientId | dictLabel(clientIdOpt) }}
{{ dictData[1] | findByValue(scope.row.clientId) }}
</template>
</el-table-column>
<el-table-column
@@ -97,7 +78,7 @@
prop="acceptanceTime"
header-align="center"
align="center"
label="创建日期">
label="验收时间">
</el-table-column>
<el-table-column
prop="remarks"
@@ -128,7 +109,7 @@
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :clientIdOpt="clientIdOpt" :contractTypeOpt="dictsOpt['contract_type']" @refreshDataList="getDataList"></add-or-update>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :dictData="dictData" @refreshDataList="getDataList"></add-or-update>
<temp-add-or-update v-if="tempVisible" ref="tempAdd"></temp-add-or-update>
</div>
</template>
@@ -136,7 +117,7 @@
<script>
import AddOrUpdate from './contract-add-or-update'
import TempAddOrUpdate from './temp-add-or-update'
import { dictDetail } from '@/utils/dict'
import { apiUtils } from '@/utils/dict'
export default {
data () {
return {
@@ -151,31 +132,18 @@
dataListSelections: [],
addOrUpdateVisible: false,
tempVisible: false,
clientIdOpt: []
dictConfigs: [{type: 'dict', code: 'contract_type'}, {url: '/client/client/list', type: 'list', value: 'clientId', label: 'clientName'}],
}
},
mixins: [dictDetail(['contract_type'])],
mixins: [apiUtils],
components: {
AddOrUpdate,
TempAddOrUpdate
},
activated () {
this.getDictDetail()
this.getDataList()
},
methods: {
getDictDetail () {
this.$http({
url: this.$http.adornUrl('/client/client/list?page=0&limit=9999'),
method: 'get'
}).then(({data}) => {
this.clientIdOpt = data.page.list
this.clientIdOpt.map(el => {
this.$set(el, 'value', el.clientId)
this.$set(el, 'label', el.clientName)
})
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true

View File

@@ -6,40 +6,45 @@
<div class="dialog_content" id="popupContent">
<div style="width: 100%;">
<div class="zd-row">
<div class="zd-col-12 item_p">需方kooriookami</div>
<div class="zd-col-12 item_p">合同编号18100000000</div>
<div class="zd-col-12 item_p">需方{{ dataForm.clientId }}</div>
<div class="zd-col-12 item_p">合同编号{{ dataForm.contractNumber }}</div>
</div>
<div class="zd-row">
<div class="zd-col-12 item_p">供方上海诺力智能科技有限公司</div>
<div class="zd-col-12 item_p">签订时间2025年1月14日</div>
<div class="zd-col-12 item_p">签订时间</div>
</div>
<p class="tip_p">产品明细单</p>
<table class="det_table">
<tr>
<th width="18%">物料编</th>
<th width="18%">物料名称</th>
<th width="10%">型号</th>
<th width="10%">数量</th>
<th width="10%">单位</th>
<th width="10%">单价</th>
<th width="10%">总价</th>
<th width="10%">备注</th>
<th width="6.25%"></th>
<th width="25%">产品名称+订货代码</th>
<th width="25%">型号</th>
<th width="6.25%">数量</th>
<th width="6.25%">单位</th>
<th width="12.5%">单价()</th>
<th width="12.5%">总价()</th>
<th width="6.25%">备注</th>
</tr>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{ e.materialCode }}</td>
<td>直角减速机</td>
<td>SVX85-20</td>
<td>1</td>
<td></td>
<td>1000</td>
<td>1000</td>
<tr v-for="(e, i) in dataForm.materData" :key="i">
<td>{{ i+1 }}</td>
<td>{{ e.materialName }}<br/>{{ e.materialCode }}</td>
<td>{{ e.materialType }}</td>
<td>{{ e.quantity }}</td>
<td>{{ e.unit }}</td>
<td>{{ e.price }}</td>
<td>{{ e.total }}</td>
<td>{{ e.remark }}</td>
</tr>
<tr>
<td colspan="6" style="text-align: left">共计</td>
<td>{{ dataForm.totalSum }}</td>
<td></td>
</tr>
<tr>
<td colspan="6" style="text-align: left">共计人民币金额大写{{ dataForm.totalSumChina }}</td>
<td colspan="2">含13%增值税</td>
</tr>
</table>
<div class="zd-row">
<div class="zd-col-12 num_p">共计人民币金额大写 XXXXXXX</div>
<div class="zd-col-12 num_p">含13%增值税</div>
</div>
<p class="tip_p">质量要求技术标准供方对质量负责的条件和期限:技术标准符合行业标准</p>
<p class="tip_p">售后服务:保修期6个月人为造成的损坏不在质保范围内</p>
<p class="tip_p">交货时间地点:货期:待定;交货地:待客户通知</p>
@@ -76,9 +81,8 @@
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button type="primary" @click="addAndPrint">打印</el-button>
<el-button size="mini" @click="visible = false">取消</el-button>
<el-button size="mini" type="primary" @click="addAndPrint">打印</el-button>
</span>
</el-dialog>
</template>
@@ -89,42 +93,102 @@ export default {
data () {
return {
visible: false,
dataForm: {
contractId: 0,
clientId: null,
contractNumber: null,
materData: [],
totalSum: null,
totalSumChina: null
},
dataList: [{materialCode: 'S9410002000002'}, {materialCode: 'S9410002000003'}]
}
},
methods: {
init (id) {
this.dataForm.contractId = id || 0
this.visible = true
this.$nextTick(() => {
if (this.dataForm.contractId) {
this.$http({
url: this.$http.adornUrl(`/flow/contract/info/${this.dataForm.contractId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.contractNumber = data.contract.contractNumber
this.dataForm.clientId = data.contract.clientId
this.dataForm.materData = JSON.parse(data.contract.materialJson).material
this.dataForm.totalSum = JSON.parse(data.contract.materialJson).total
this.dataForm.totalSumChina = this.toChineseCurrency(this.dataForm.totalSum)
}
})
}
})
},
toChineseCurrency (amount) {
if (amount === 0) return '零元整'
const units = ['', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿']
const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
const result = []
// 将金额转换为整数部分和小数部分
const integerPart = Math.floor(amount) // 整数部分
const decimalPart = amount - integerPart // 小数部分
// 处理整数部分
let integerStr = integerPart.toString()
for (let i = 0; i < integerStr.length; i++) {
const digit = integerStr[integerStr.length - 1 - i];
if (digit !== '0') {
result.push(digits[digit], units[i])
} else if (!result.includes('零') && result.length > 0) {
result.push('零')
}
}
// 处理小数部分
if (decimalPart > 0) {
const decimalStr = (decimalPart * 100).toFixed(0).padStart(2, '0') // 小数部分乘以100并转为字符串
if (decimalStr !== '00') {
result.push('点')
for (let i = 0; i < decimalStr.length; i++) {
result.push(digits[decimalStr[i]])
}
}
}
// 去掉多余的零
while (result[0] === '零') {
result.shift()
}
return result.join('') + (decimalPart > 0 ? '元' : '元整')
},
// 表单提交
dataFormSubmit () {},
// 打印
addAndPrint () {
const LODOP = getLodop()
LODOP.PRINT_INITA("0mm", "0mm", "213mm", "297mm", "打印合同模板")
LODOP.SET_PRINT_PAGESIZE(1, 2100, 2970, "A4")
LODOP.PRINT_INITA('0mm', '0mm', '213mm', '297mm', '打印合同模板')
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;}
h1 {font-size: 14px;line-height: 1;text-align: center;margin-bottom: 30px;}
.zd-row {width: 100%;display: flex;}
.zd-col-12 {width: 50%;}
.dialog_content {width: 100%;}
.item_p {font-size: 14px;line-height: 1.5;padding-bottom: 12px;}
.tip_p {font-size: 14px;font-weight: 700;line-height: 1.5;margin: 0;}
.det_table {width: 100%; border-collapse: collapse;border: 1px solid #000;}
.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}
.dialog_content {width: 100%;font-family: '黑体'}
.item_p {font-size: 14px;color: #000;line-height: 1.5;padding-bottom: 12px;}
.tip_p {font-size: 14px;line-height: 1.5;margin: 0;}
.det_table {width: 100%;table-layout: fixed;width: 100%; border-collapse: collapse;border: 1px solid #000;}
.det_table th {font-size: 12px;color: #000;line-height: 23px;padding: 4px;border: 1px solid #000;text-align: center;}
.det_table td {font-size: 13px;color: #000;line-height: 23px;padding: 4px;border: 1px solid #000;text-align: center;}
.det_table_1 th, .det_table_1 td {text-align: left;}
</style>
${h1Content}
${popupContent}
`
// 添加弹窗内容到打印任务
LODOP.ADD_PRINT_HTM(0, '5%', '90%', '90%', printHtml)
LODOP.PREVIEW()// 预览
LODOP.PREVIEW()
LODOP.PRINT()
},
}
}
@@ -154,31 +218,28 @@ export default {
line-height: 1.5;
margin: 0;
}
.num_p {
font-size: 14px;
color: #606266;
line-height: 1.5;
margin: 10px 0;
}
.det_table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
border: 1px solid #EBEEF5;
margin-top: 10px;
}
.det_table th {
font-size: 12px;
font-size: 13px;
line-height: 23px;
color: #909399;
padding: 4px;
color: #515a6e;
padding: 6px 6px;
font-weight: 700;
border: 1px solid #EBEEF5;
text-align: center;
background-color: #f5f5f5;
}
.det_table td {
font-size: 13px;
font-size: 12px;
line-height: 23px;
color: #606266;
padding: 4px;
padding: 6px 6px;
border: 1px solid #EBEEF5;
text-align: center;
}

View File

@@ -8,7 +8,7 @@
<el-form-item label="小车类型" prop="carType">
<el-select v-model="dataForm.carType" placeholder="小车类型">
<el-option
v-for="item in cartypeOpt"
v-for="item in dictData[0]"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -18,7 +18,7 @@
<el-form-item label="异常类型" prop="errorType">
<el-select v-model="dataForm.errorType" placeholder="异常类型">
<el-option
v-for="item in dictsOpt['error_type']"
v-for="item in dictData[1]"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -28,7 +28,7 @@
<el-form-item label="合同编号" prop="contractNumber">
<el-select v-model="dataForm.contractNumber" placeholder="合同编号">
<el-option
v-for="item in contractOpt"
v-for="item in dictData[2]"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -38,7 +38,7 @@
<el-form-item label="客户" prop="clientId">
<el-select v-model="dataForm.clientId" placeholder="客户">
<el-option
v-for="item in clientIdOpt"
v-for="item in dictData[3]"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -87,13 +87,11 @@
}
},
props: {
cartypeOpt: Array,
contractOpt: Array,
clientIdOpt: Array,
dictsOpt: Object
dictData: Array
},
methods: {
init (id) {
console.log(this.dictData)
this.dataForm.ticketsId = id || 0
this.visible = true
this.$nextTick(() => {
@@ -106,8 +104,8 @@
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.carType = data.tickets.carType
this.dataForm.errorType = data.tickets.errorType
this.dataForm.contractNumber = data.tickets.contractNumber
this.dataForm.errorType = String(data.tickets.errorType)
this.dataForm.contractNumber = String(data.tickets.contractNumber)
this.dataForm.clientId = data.tickets.clientId
this.dataForm.description = data.tickets.description
this.dataForm.deptPhone = data.tickets.deptPhone

View File

@@ -30,28 +30,36 @@
label="工单ID">
</el-table-column>
<el-table-column
prop="carType"
header-align="center"
align="center"
label="小车类型">
<template slot-scope="scope">
{{ dictData[0] | findByValue(scope.row.carType) }}
</template>
</el-table-column>
<el-table-column
prop="errorType"
header-align="center"
align="center"
label="异常类型">
<template slot-scope="scope">
{{ dictData[1] | findByValue(scope.row.errorType) }}
</template>
</el-table-column>
<el-table-column
prop="contractNumber"
header-align="center"
align="center"
label="合同编号">
<template slot-scope="scope">
{{ dictData[2] | findByValue(scope.row.contractNumber) }}
</template>
</el-table-column>
<el-table-column
prop="clientId"
header-align="center"
align="center"
label="客户">
<template slot-scope="scope">
{{ dictData[3] | findByValue(scope.row.clientId) }}
</template>
</el-table-column>
<el-table-column
prop="description"
@@ -127,13 +135,13 @@
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :cartypeOpt="cartypeOpt" :contractOpt="contractOpt" :clientIdOpt="clientIdOpt" :dictsOpt="dictsOpt" @refreshDataList="getDataList"></add-or-update>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :dictData="dictData" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './tickets-add-or-update'
import { dictDetail } from '@/utils/dict'
import { apiUtils } from '@/utils/dict'
export default {
data () {
return {
@@ -147,52 +155,18 @@
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
cartypeOpt: [],
contractOpt: [],
clientIdOpt: []
dictConfigs: [{url: '/car/car/list', type: 'list', value: 'carId', label: 'carName'}, {type: 'dict', code: 'error_type'}, {url: '/flow/contract/list', type: 'list', value: 'contractId', label: 'contractNumber'}, {url: '/client/client/list', type: 'list', value: 'clientId', label: 'clientName'}],
dictData: []
}
},
mixins: [dictDetail(['error_type'])],
mixins: [apiUtils],
components: {
AddOrUpdate
},
activated () {
this.getDataList()
this.getDictDetail()
},
methods: {
getDictDetail () {
this.$http({
url: this.$http.adornUrl('/car/car/list?page=0&limit=9999'),
method: 'get'
}).then(({data}) => {
this.cartypeOpt = data.page.list
this.cartypeOpt.map(el => {
this.$set(el, 'value', el.carId)
this.$set(el, 'label', el.carName)
})
})
this.$http({
url: this.$http.adornUrl('/flow/contract/list?page=0&limit=9999'),
method: 'get'
}).then(({data}) => {
this.contractOpt = data.page.list
this.contractOpt.map(el => {
this.$set(el, 'value', el.contractId)
this.$set(el, 'label', el.contractNumber)
})
})
this.$http({
url: this.$http.adornUrl('/client/client/list?page=0&limit=9999'),
method: 'get'
}).then(({data}) => {
this.clientIdOpt = data.page.list
this.clientIdOpt.map(el => {
this.$set(el, 'value', el.clientId)
this.$set(el, 'label', el.clientName)
})
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true