<template>
|
<view class="sales-accoun">
|
<!-- 使用通用页面头部组件 -->
|
<PageHeader title="用印管理"
|
@back="goBack" />
|
<!-- 搜索和筛选区域 -->
|
<view class="search-section">
|
<view class="search-bar">
|
<view class="search-input">
|
<up-input class="search-text"
|
placeholder="请输入申请标题"
|
v-model="name"
|
@blur="getList"
|
clearable />
|
</view>
|
<view class="filter-button"
|
@click="getList">
|
<u-icon name="search"
|
size="24"
|
color="#999"></u-icon>
|
</view>
|
</view>
|
</view>
|
<!-- 拜访记录列表 -->
|
<view class="ledger-list"
|
v-if="visitList.length > 0">
|
<view v-for="(item, index) in visitList"
|
:key="index">
|
<view class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="file-text"
|
size="16"
|
color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">申请标题:{{ item.title || '-' }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">申请编号</text>
|
<text class="detail-value">{{ item.applicationNum || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">申请人</text>
|
<text class="detail-value">{{ item.createUserName || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">所属部门</text>
|
<text class="detail-value">{{ item.department || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">用印类型</text>
|
<text class="detail-value">{{ formatReceiptType(item.sealType) }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">申请时间</text>
|
<text class="detail-value">{{ item.createTime || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">状态</text>
|
<u-tag size="mini"
|
:type="getTagClass(item.status)">{{ formatReceiptType1(item.status) }}</u-tag>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">申请原因</text>
|
<text class="detail-value"><span style="display: block;height: auto;word-break: break-word;">{{ item.reason || '-' }}</span></text>
|
</view>
|
</view>
|
<!-- 按钮区域 -->
|
<view class="action-buttons">
|
<u-button type="info"
|
size="small"
|
class="action-btn"
|
@click="viewDetail(item,3)">
|
查看
|
</u-button>
|
<u-button type="primary"
|
size="small"
|
class="action-btn"
|
v-if="item.status === 'pending'"
|
@click="confirmApprove(item,true)">
|
审批
|
</u-button>
|
<u-button type="error"
|
size="small"
|
class="action-btn"
|
v-if="item.status === 'pending'"
|
@click="confirmApprove(item,false)">
|
拒绝
|
</u-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view v-else
|
class="no-data">
|
<text>暂无会议室记录</text>
|
</view>
|
<!-- 浮动新增按钮 -->
|
<view class="fab-button"
|
@click="addVisit">
|
<up-icon name="plus"
|
size="24"
|
color="#ffffff"></up-icon>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref, onMounted, computed } from "vue";
|
import { onShow } from "@dcloudio/uni-app";
|
import { useDict } from "@/utils/dict";
|
import PageHeader from "@/components/PageHeader.vue";
|
import {
|
listSealApplication,
|
updateSealApplication,
|
} from "@/api/managementMeetings/sealManagement";
|
import useUserStore from "@/store/modules/user";
|
// 替换 toast 方法
|
defineOptions({ name: "client-visit-index" });
|
const showToast = message => {
|
uni.showToast({
|
title: message,
|
icon: "none",
|
});
|
};
|
|
import dayjs from "dayjs";
|
|
const userStore = useUserStore();
|
|
// 搜索关键词
|
const name = ref("");
|
|
// 拜访记录数据
|
const visitList = ref([]);
|
|
// 返回上一页
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
const { knowledge_type } = useDict("knowledge_type");
|
// 格式化回款方式
|
const formatReceiptType = params => {
|
if (params == "official") {
|
return "公章";
|
} else if (params == "contract") {
|
return "合同专用章";
|
} else if (params == "finance") {
|
return "财务专用章";
|
} else if (params == "tegal") {
|
return "法人章";
|
} else {
|
return "未知";
|
}
|
};
|
const formatReceiptType1 = params => {
|
if (params == "pending") {
|
return "待审批";
|
} else if (params == "approved") {
|
return "已通过";
|
} else if (params == "rejected") {
|
return "已拒绝";
|
} else {
|
return "未知";
|
}
|
};
|
const getTagClass = type => {
|
if (type == "pending") {
|
return "warning";
|
} else if (type == "approved") {
|
return "success";
|
} else if (type == "rejected") {
|
return "danger";
|
} else {
|
return "info";
|
}
|
};
|
const knowledgeTypeOptions = computed(() => knowledge_type?.value || []);
|
// 获取知识类型标签
|
const getKnowledgeTypeLabel = val => {
|
console.log(knowledgeTypeOptions, "knowledgeTypeOptions");
|
const item = knowledgeTypeOptions.value.find(
|
i => String(i.value) === String(val)
|
);
|
return item ? item.label : val;
|
};
|
|
// 查询列表
|
const getList = () => {
|
showLoadingToast("加载中...");
|
const params = {
|
current: -1,
|
size: -1,
|
title: name.value,
|
};
|
listSealApplication(params)
|
.then(res => {
|
const currentFactoryName = userStore.currentFactoryName;
|
if (currentFactoryName) {
|
visitList.value = res.data.records.filter(
|
item => item.department === currentFactoryName
|
);
|
} else {
|
visitList.value = res.data.records;
|
}
|
closeToast();
|
})
|
.catch(() => {
|
closeToast();
|
showToast("获取数据失败");
|
});
|
};
|
|
// 显示加载提示
|
const showLoadingToast = message => {
|
uni.showLoading({
|
title: message,
|
mask: true,
|
});
|
};
|
|
// 关闭提示
|
const closeToast = () => {
|
uni.hideLoading();
|
};
|
|
// 新增拜访 - 跳转到登记页面
|
const addVisit = () => {
|
uni.navigateTo({
|
url: "/pages/managementMeetings/sealManagement/detail?detailType=1",
|
});
|
};
|
const confirmApprove = (item, isApprove) => {
|
if (isApprove) {
|
uni.showModal({
|
title: "审批确认",
|
content: `确定要审批该用印申请吗?`,
|
success: res => {
|
item.status = "approved";
|
updateSealApplication(item).then(res => {
|
if (res.code == 200) {
|
showToast("审批通过");
|
}
|
});
|
},
|
});
|
} else {
|
uni.showModal({
|
title: "审批确认",
|
content: `确定要拒绝该用印申请吗?`,
|
success: res => {
|
item.status = "rejected";
|
updateSealApplication(item).then(res => {
|
if (res.code == 200) {
|
showToast("审批拒绝");
|
}
|
});
|
},
|
});
|
}
|
};
|
// 编辑
|
const viewDetail = (item, detailType) => {
|
uni.setStorageSync("knowledgeBase", item);
|
uni.navigateTo({
|
url:
|
"/pages/managementMeetings/sealManagement/detail?detailType=" +
|
detailType +
|
"&id=" +
|
item.id,
|
});
|
};
|
|
// 删除确认
|
const confirmDelete = item => {
|
uni.showModal({
|
title: "删除确认",
|
content: `确定要删除知识 "${item.title}" 吗?`,
|
success: res => {
|
if (res.confirm) {
|
// deleteKnowledge(item.id);
|
}
|
},
|
});
|
};
|
|
onMounted(() => {
|
getList();
|
});
|
|
onShow(() => {
|
getList();
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "../../../styles/sales-common.scss";
|
|
// 页面特定的样式覆盖
|
.sales-accoun {
|
min-height: 100vh;
|
background: #f8f9fa;
|
position: relative;
|
padding-bottom: 80px;
|
}
|
|
// 特定的图标样式
|
.document-icon {
|
background: #667eea; // 保持页面特有的背景色
|
}
|
|
// 特有样式
|
.visit-status {
|
display: flex;
|
align-items: center;
|
}
|
|
.detail-value {
|
word-break: break-all; // 保留页面特有的文本换行样式
|
color: #333; // 保持页面特有的文本颜色
|
}
|
|
// 状态样式
|
.status-enabled {
|
color: #28a745; // 保持页面特有的成功颜色
|
}
|
|
.status-disabled {
|
color: #dc3545; // 保持页面特有的错误颜色
|
}
|
|
// 特定的浮动按钮样式
|
.fab-button {
|
background: #667eea; // 保持页面特有的背景色
|
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // 保持页面特有的阴影效果
|
}
|
</style>
|