<!DOCTYPE html>
|
<html lang="en">
|
|
<head>
|
<meta charset="utf-8">
|
<title>销售订单附件审核</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../static/evn/index.css">
|
</head>
|
|
<body>
|
<div id="app">
|
<el-card>
|
<!-- 搜索表单 -->
|
<el-form :inline="true">
|
<el-form-item label="生产单号">
|
<el-input v-model="tableSearchParam.orderCode" placeholder="请输入生产单号"></el-input>
|
</el-form-item>
|
|
<el-form-item label="">
|
<el-button type="primary" @click="search" circle>
|
<el-icon>
|
<Search />
|
</el-icon>
|
</el-button>
|
</el-form-item>
|
</el-form>
|
|
<!-- 数据表格 -->
|
<el-table :data="tableData" border style="width: 100%" max-height="600">
|
<el-table-column type="index" width="50"></el-table-column>
|
<el-table-column prop="orderCode" label="生产单号" width="120"></el-table-column>
|
<el-table-column prop="invName" label="物料名称" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="fieldLabel" label="附件类型" width="120"></el-table-column>
|
<el-table-column prop="filePath" label="附件" width="100">
|
<template #default="scope">
|
<el-button v-if="scope.row.filePath" size="small" type="primary"
|
@click="downloadFile(scope.row.filePath)">下载</el-button>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="status" label="当前状态" width="100">
|
<template #default="scope">
|
<el-tag :type="getStatusType(scope.row.status)">{{ formatStatus(scope.row.status) }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="180" fixed="right">
|
<template #default="scope">
|
<el-button size="small" type="success" @click="audit(scope.row, 1)"
|
:disabled="scope.row.status === 1">通过</el-button>
|
<el-button size="small" type="danger" @click="audit(scope.row, 2)"
|
:disabled="scope.row.status === 2">拒绝</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!-- 分页 -->
|
<div style="margin-top: 10px">
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
:current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize"
|
layout="total, sizes, prev, pager, next, jumper" :total="pageTotal">
|
</el-pagination>
|
</div>
|
|
</el-card>
|
</div>
|
|
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
|
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
|
<script src="../../static/evn/vue.global.js"></script>
|
<script src="../../static/evn/element-plus.js"></script>
|
<script src="../../static/evn/icons-vue.js"></script>
|
<script type="module">
|
import zhCn from '../../static/evn/zh-cn.js';
|
|
const { createApp, ref, onMounted } = Vue;
|
|
const app = createApp({
|
setup() {
|
const currentPage = ref(1)
|
const pageSizes = ref([20, 50, 100])
|
const pageSize = ref(20)
|
const pageTotal = ref(0)
|
const tableSearchParam = ref({
|
orderCode: null,
|
status: 0 // 默认筛选待审核
|
})
|
const tableData = ref([])
|
|
// 附件字段映射
|
const fieldMap = {
|
'temp1Path': { label: '包材版费', statusField: 'temp1Status' },
|
'temp2Path': { label: '退税资料', statusField: 'temp2Status' },
|
'temp3Path': { label: '开票', statusField: 'temp3Status' },
|
'temp4Path': { label: '内陆费', statusField: 'temp4Status' },
|
'temp5Path': { label: '收款', statusField: 'temp5Status' }
|
}
|
|
function search() {
|
currentPage.value = 1
|
page()
|
}
|
|
function page() {
|
let data = {
|
order_code: tableSearchParam.value.orderCode,
|
curr: currentPage.value,
|
limit: pageSize.value
|
}
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
$.ajax({
|
url: baseUrl + "/saleOrder/auditList/auth",
|
headers: { 'token': localStorage.getItem('token') },
|
data: data,
|
dataType: 'json',
|
method: 'GET',
|
success: function (res) {
|
if (res.code == 200) {
|
// 直接使用后端返回的展开数据
|
tableData.value = res.data.records
|
pageTotal.value = res.data.total
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({ message: res.msg, type: 'error' });
|
}
|
},
|
complete: function () {
|
loading.close()
|
}
|
});
|
}
|
|
function audit(row, newStatus) {
|
const statusText = newStatus === 1 ? '通过' : '拒绝'
|
ElementPlus.ElMessageBox.confirm(`确定${statusText}该附件吗?`)
|
.then(() => {
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
// 构建更新数据
|
const updateData = {
|
id: row.id
|
}
|
updateData[row.statusField] = newStatus
|
|
$.ajax({
|
url: baseUrl + "/saleOrder/update/auth",
|
headers: { 'token': localStorage.getItem('token') },
|
data: updateData,
|
method: 'POST',
|
success: function (res) {
|
if (res.code == 200) {
|
ElementPlus.ElMessage({ message: "审核成功", type: 'success' });
|
page()
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({ message: res.msg, type: 'error' });
|
}
|
},
|
complete: function () {
|
loading.close();
|
}
|
});
|
})
|
}
|
|
function downloadFile(filePath) {
|
if (!filePath) return;
|
const downloadUrl = baseUrl + '/saleOrder/downloadFile/auth?filePath=' + encodeURIComponent(filePath);
|
window.open(downloadUrl, '_blank');
|
}
|
|
function formatStatus(status) {
|
const statusMap = {
|
0: '待审核',
|
1: '已通过',
|
2: '已拒绝'
|
};
|
return statusMap[status] || '';
|
}
|
|
function getStatusType(status) {
|
const typeMap = {
|
0: 'warning',
|
1: 'success',
|
2: 'danger'
|
};
|
return typeMap[status] || 'info';
|
}
|
|
function handleSizeChange(val) {
|
pageSize.value = val
|
currentPage.value = 1
|
page()
|
}
|
|
function handleCurrentChange(val) {
|
currentPage.value = val
|
page()
|
}
|
|
onMounted(() => {
|
page()
|
})
|
|
return {
|
tableData,
|
currentPage,
|
pageSizes,
|
pageSize,
|
pageTotal,
|
tableSearchParam,
|
search,
|
page,
|
audit,
|
downloadFile,
|
formatStatus,
|
getStatusType,
|
handleSizeChange,
|
handleCurrentChange
|
}
|
}
|
});
|
|
app.use(ElementPlus, {
|
locale: zhCn.default || zhCn
|
});
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
app.component(key, component)
|
}
|
app.mount('#app');
|
</script>
|
|
</body>
|
|
</html>
|