Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangzq
2026-03-18 11:31:10 +08:00
8 changed files with 984 additions and 568 deletions

View File

@@ -1,7 +1,7 @@
module.exports = {
NODE_ENV: '"development"',
ENV_CONFIG: '"dev"',
BASE_WMS_API: '"http://47.111.78.178:8011/api"',
BASE_WMS_FILE: '"http://47.111.78.178:8011/"'
BASE_WMS_API: '"http://127.0.0.1:8080/api"',
BASE_WMS_FILE: '"http://127.0.0.1:8080/"'
// 47.101.147.253
}

View File

@@ -1,8 +1,8 @@
module.exports = {
NODE_ENV: '"production"',
ENV_CONFIG: '"prod"',
BASE_WMS_API: '"http://47.111.78.178:8011/api"',
BASE_WMS_FILE: '"http://47.111.78.178:8011/"'
BASE_WMS_API: '"http://127.0.0.1:8080/api"',
BASE_WMS_FILE: '"http://127.0.0.1:8080/"'
////BASE_AGV_API: '"http://192.168.3.223:55200/v1"',
//BASE_WMS_API: '"http://169.254.71.103/api"',
//BASE_AGV_API: '"http://127.0.0.1:55200/v1"',

View File

@@ -90,5 +90,14 @@ export default {
method: 'post',
data: param
})
},
// 合同检索
searchContracts(param) {
return request({
url: `/Contract/searchContracts`,
method: 'post',
data: param
})
}
}

View File

@@ -8,53 +8,321 @@
<div>
<el-form :inline="true" :model="queryParam" class="form-inline" style="margin-left: 10px;margin-top: 10px;">
<el-form-item label="时间范围">
<el-date-picker style="width:100%" v-model="busTime" type="daterange" :editable="false"
range-separator="" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" clearable
:picker-options="executeTimeOptions">
</el-date-picker>
<el-date-picker
v-model="busTime"
:editable="false"
:picker-options="executeTimeOptions"
style="width:100%"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
clearable/>
</el-form-item>
<el-form-item label="合同类">
<el-select v-model="map_idx" filterable placeholder="合同类">
<el-option label="全部合同" value="0"></el-option>
<el-option label="项目合同" value="1"></el-option>
<el-option label="运营合同" value="2"></el-option>
<el-form-item label="合同类">
<el-select v-model="queryParam.contract_category" filterable placeholder="合同类">
<el-option label="全部合同" value="0"/>
<el-option label="销售合同" value="1"/>
<el-option label="销售技术协议" value="2"/>
<el-option label="采购合同" value="3"/>
<el-option label="采购及技术协议" value="4"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
</el-row>
<!-- 合同列表表格 -->
<el-row style="margin-top: 20px;">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>合同列表</span>
<span style="float: right;"> {{ total }} 条记录</span>
</div>
<el-table
v-loading="loading"
:data="contractList"
style="width: 100%"
stripe
border>
<el-table-column
prop="contract_number"
label="合同编号"
width="150"/>
<el-table-column
prop="contract_name"
label="合同名称"
width="200"/>
<el-table-column
prop="contract_type_name"
label="合同类型"
width="120"/>
<el-table-column
prop="contract_category_name"
label="合同分类"
width="120"/>
<el-table-column
prop="project_name"
label="所属项目"
width="150">
<template slot-scope="scope">
{{ scope.row.project_name || '-' }}
</template>
</el-table-column>
<el-table-column
prop="partner_name"
label="合作伙伴"
width="150">
<template slot-scope="scope">
{{ scope.row.partner_name || '-' }}
</template>
</el-table-column>
<el-table-column
prop="contract_price"
label="合同金额"
width="120">
<template slot-scope="scope">
¥{{ scope.row.contract_price | currency }}
</template>
</el-table-column>
<el-table-column
prop="create_time"
label="签署时间"
width="120"/>
<el-table-column
prop="contract_des"
label="合同描述"
min-width="200">
<template slot-scope="scope">
{{ scope.row.contract_des || '-' }}
</template>
</el-table-column>
<el-table-column
label="操作"
width="100"
fixed="right">
<template slot-scope="scope">
<el-button
v-if="scope.row.contract_url"
type="text"
size="small"
@click="viewContract(scope.row)">
查看
</el-button>
<span v-else>-</span>
</template>
</el-table-column>
<template slot="empty">
<div style="padding: 20px;">
<i class="el-icon-document" style="font-size: 48px; color: #ddd;"/>
<p style="margin-top: 10px; color: #999;">暂无合同数据</p>
</div>
</template>
</el-table>
<!-- 分页组件 -->
<div style="margin-top: 20px; text-align: right;">
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</el-row>
<!-- 显示文件对话框 -->
<el-dialog :visible.sync="dialogVisibleShowFile" title="文件信息" width="80%" append-to-body>
<img v-if="isImage" :src="previewUrl" alt="Preview" style="max-width: 40%; max-height: 30%;">
<iframe v-else-if="isPDF" :src="previewUrl" frameborder="0" style="width: 100%; height: 600px;"/>
<div v-else>
<p>该文件类型{{ fileExtension }}需要下载后查看</p>
<el-button type="primary" @click="downloadFile(previewUrl)">
立即下载 {{ fileExtension.toUpperCase() }} 文件
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
import contractApi from '@/api/contract'
export default {
filters: {
currency(value) {
if (!value) return '0.00'
return Number(value).toLocaleString('zh-CN', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
})
}
},
data() {
return {
queryParam:
{
busTime: [],
map_idx: "16",
lock: "2",
storage_type: "0",
work_type: "0"
}, //查询条件
};
queryParam: {
contract_category: '0'
},
busTime: [],
contractList: [],
loading: false,
// 分页相关
currentPage: 1,
pageSize: 10,
total: 0,
// 文件预览相关
dialogVisibleShowFile: false,
previewUrl: '',
currentFileName: '',
fileExtension: '',
isImage: false,
isPDF: false,
executeTimeOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
}
}
},
mounted() {
},
created() {
this.loadContracts()
},
methods: {
onSubmit() {
this.currentPage = 1
this.loadContracts()
},
onReset() {
this.queryParam.contract_category = '0'
this.busTime = []
this.currentPage = 1
this.loadContracts()
},
// 分页大小改变
handleSizeChange(val) {
this.pageSize = val
this.currentPage = 1 // 重置到第一页
this.loadContracts()
},
// 当前页改变
handleCurrentChange(val) {
this.currentPage = val
this.loadContracts()
},
async loadContracts() {
this.loading = true
try {
const params = {
contract_category: this.queryParam.contract_category,
page: this.currentPage,
pageSize: this.pageSize
}
// 添加时间范围参数
if (this.busTime && this.busTime.length === 2) {
params.start_date = this.busTime[0]
params.end_date = this.busTime[1]
}
const response = await contractApi.searchContracts(params)
// 处理响应数据 - 兼容两种可能的响应结构
const apiResponse = response.data || response
if (apiResponse.code === 20000) {
const data = apiResponse.data
this.contractList = Array.isArray(data.list) ? data.list : []
this.total = parseInt(data.total) || 0
if (this.contractList.length === 0) {
this.$message.info('未找到符合条件的合同数据')
}
} else {
this.$message.error(apiResponse.msg || '查询失败')
this.contractList = []
this.total = 0
}
} catch (error) {
console.error('查询合同失败:', error)
this.$message.error('查询失败,请稍后重试')
this.contractList = []
this.total = 0
} finally {
this.loading = false
}
},
viewContract(row) {
if (!row.contract_url) {
this.$message.warning('该合同暂无文件')
return
}
const url = row.contract_url
const ext = url.split('.').pop().toLowerCase()
this.currentFileName = row.contract_file_name || row.contract_name
this.isImage = false
this.isPDF = false
this.fileExtension = ext
// 构建完整的文件URL
const baseUrl = process.env.BASE_WMS_FILE || (
process.env.NODE_ENV === 'development'
? 'http://localhost/oms/back/public'
: window.location.origin + '/back/public'
)
if (['jpg', 'jpeg', 'png'].includes(ext)) {
this.previewUrl = baseUrl + url
this.isImage = true
} else if (ext === 'pdf') {
this.previewUrl = baseUrl + url
this.isPDF = true
} else {
this.previewUrl = baseUrl + url
}
this.dialogVisibleShowFile = true
},
downloadFile(url) {
const link = document.createElement('a')
link.href = url
link.setAttribute('download', this.currentFileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
}
}

File diff suppressed because it is too large Load Diff