123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="page-detail">
- <view class="page-center">
- <uni-section title="清单名称" type="line" style="margin-top: 0" />
- <text style="padding-left: 20rpx">{{ detail.name }}</text>
- <!-- 表单数据 -->
- <template v-if="formList.length > 0">
- <uni-section title="表单数据" type="line" />
- <uni-forms class="form" label-align="right" :labelWidth="100">
- <uni-forms-item
- v-for="item in formList"
- :label="item.name"
- name="email"
- >
- <view class="content">{{ item.value.join(",") }}</view>
- </uni-forms-item>
- </uni-forms>
- </template>
- <!-- 附件信息 -->
- <template v-if="attachments.length > 0">
- <uni-section title="附件信息" type="line" />
- <view class="attachment" v-for="item in attachments" :key="item.id">
- <!-- {{item.name}} -->
- <previewFile :src="item.url" :name="item.name" />
- </view>
- </template>
- <!-- 审批信息 -->
- <uni-section title="审批信息" type="line" />
- <uni-steps
- :options="auditList"
- :active="currentStep"
- :active-color="detail.audit_status === 2 ? 'red' : '#2979FF'"
- :active-icon="detail.audit_status === 2 ? 'clear' : 'checkbox-filled'"
- direction="column"
- />
- </view>
- </view>
- </template>
- <script>
- import { getOAAuditDetail } from "@/services/oa";
- export default {
- computed: {
- formList() {
- const form = this.detail?.form;
- if (!form) {
- return [];
- }
- try {
- const formDatas = JSON.parse(form);
- if (formDatas && formDatas.length) {
- return formDatas.filter((item) => item.type !== "DIYTable");
- }
- return [];
- } catch {
- return [];
- }
- },
- attachments() {
- if (this.detail?.Files?.length) {
- return this.detail.Files;
- }
- return [];
- },
- },
- data() {
- return {
- id: -1,
- detail: {},
- auditList: [],
- currentStep: 0,
- isMobile: true,
- };
- },
- onLoad(query) {
- if (query?.id !== undefined) {
- this.id = Number(query.id);
- } else {
- return;
- }
- if (!uni.getStorageSync("token")) {
- if (query["JWT-TOKEN"]) {
- uni.setStorageSync("token", query["JWT-TOKEN"]);
- }
- }
- this.query = query;
- this.checkDeviceType();
- this.getDetail();
- },
- methods: {
- checkDeviceType() {
- const userAgent = navigator.userAgent.toLowerCase();
- const mobileKeywords = ["android", "iphone", "ipad", "ipod", "mobile"];
- this.isMobile = mobileKeywords.some((keyword) =>
- userAgent.includes(keyword)
- );
- if (!this.isMobile) {
- // 如果是在电脑上打开,转到PC端的页面去https://work.greentech.com.cn/profile/detail?id=852
- window.location.href = `https://work.greentech.com.cn/profile/detail?id=${this.id}&JWT-TOKEN=${this.query["JWT-TOKEN"]}`;
- }
- return this.isMobile;
- },
- getDetail() {
- getOAAuditDetail(this.id)
- .then((result) => {
- this.detail = result;
- this.getAuditList(result.OaAuditList, result.AuditorInfo);
- })
- .catch((err) => {
- console.log(err);
- });
- },
- getAuditList(list, currentAuditor) {
- // 填充审核人列表
- if (list && list.length) {
- this.auditList = list.map((item, index) => {
- if (currentAuditor.ID === item.auditor) {
- this.currentStep = index;
- }
- return {
- title: item.seq_name,
- desc: `审核人:${item.AuditorUser.CName || "-"}`,
- };
- });
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .page-detail {
- min-height: 100vh;
- padding: 20rpx 30rpx 40rpx;
- background: url("~@/static/index/bg.png") no-repeat center;
- background-size: cover;
- background-attachment: fixed;
- .page-center {
- padding: 30rpx;
- padding-top: 0;
- background-color: #fff;
- }
- }
- .btns {
- display: flex;
- margin-top: 40rpx;
- }
- .excel-detail {
- color: #2f42ca;
- text-decoration: underline;
- padding-left: 20rpx;
- }
- .form {
- width: 90%;
- margin: 0 auto;
- .content {
- line-height: 44rpx;
- padding: 14rpx;
- word-break: break-all;
- }
- }
- .attachment {
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- }
- </style>
|