267 lines
8.1 KiB
Vue
267 lines
8.1 KiB
Vue
<template>
|
||
<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
|
||
<uni-card margin="0" :is-shadow="true">
|
||
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model">
|
||
<u-form-item label="名称:" prop="NAME" borderBottom>
|
||
<u--input v-model="model.NAME" border="none" inputAlign="right" disabled
|
||
disabledColor="#ffffff"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="需求类别 :" prop="Nav_LawType" borderBottom>
|
||
<u--input v-if="model.Nav_LawType" v-model="model.Nav_LawType.NAME" border="none" slot="right"
|
||
inputAlign="right" disabled disabledColor="#ffffff"></u--input>
|
||
</u-form-item>
|
||
</u--form>
|
||
</uni-card>
|
||
<u-sticky offset-top="20">
|
||
<view class="sub-form">
|
||
<view class="sub-form-wrap">
|
||
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom"
|
||
ref="sForm">
|
||
<u-collapse :border="false" :value="['0']">
|
||
<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
|
||
v-for="(item, index) in model.Nav_LawVersion">
|
||
<u-collapse-item :title="index + 1 + '. '+item.VERSION_NUM" :name="index">
|
||
<u-form-item label="入库时间:" prop="ENTER_TIME" borderBottom>
|
||
<u--input disabled disabledColor="#fff"
|
||
v-model="item.ENTER_TIME.substring(0,10)" border="none" slot="right"
|
||
inputAlign="right"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="制修订日期:" prop="EXECUTE_TIME" borderBottom>
|
||
<u--input disabled disabledColor="#fff"
|
||
v-model="item.EXECUTE_TIME.substring(0,10)" border="none" slot="right"
|
||
inputAlign="right"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="施行日期:" prop="UPDATE_TIME" borderBottom>
|
||
<u--input disabled disabledColor="#fff"
|
||
v-model="item.UPDATE_TIME.substring(0,10)" border="none" slot="right"
|
||
inputAlign="right"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="状态:" prop="VERSION_STATUS" borderBottom>
|
||
<u--input disabled disabledColor="#fff" v-model="item.VERSION_STATUSName"
|
||
border="none" slot="right" inputAlign="right"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="附件" prop="flowFiles" borderBottom>
|
||
<view class="link-content">
|
||
<view class="link-content-border" v-for="itemChild in item.Files">
|
||
<u-link :href="itemChild.url" :text="itemChild.name" color="#005BEA">
|
||
</u-link>
|
||
</view>
|
||
</view>
|
||
</u-form-item>
|
||
</u-collapse-item>
|
||
</uni-card>
|
||
</u-collapse>
|
||
</u--form>
|
||
</view>
|
||
</view>
|
||
</u-sticky>
|
||
<view class="bottom-button">
|
||
<button type="primary" class="bottom" v-if='isLoadOK&&tableKey==1&&!isApprove'
|
||
@click="onTableBtnAgree">签到</button>
|
||
<button type="primary" class="bottom" v-if='isLoadOK&&tableKey==1&&isApprove'
|
||
@click="onTableBtnApprove">审阅</button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
initFilter,
|
||
extendRule,
|
||
extendInclude
|
||
} from '../../../../utils/common'
|
||
import {
|
||
getRequest,
|
||
} from '../../../../services/apply/FOServices/FOServices'
|
||
import {
|
||
getEnum
|
||
} from '../../../../services/common';
|
||
import '../../../../utils/showMsg.js'
|
||
import color from '../../../../uni_modules/uview-ui/libs/config/color'
|
||
import config from '../../../../config/common'
|
||
export default {
|
||
data() {
|
||
return {
|
||
ID: "",
|
||
model: {},
|
||
TaskID: "",
|
||
tableKey: '0',
|
||
isLoadOK: false,
|
||
paddingBottom: '170',
|
||
orgId: uni.getStorageSync('orgId'),
|
||
isApprove: false,
|
||
enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表)
|
||
enumsText: {} // 存储枚举文本列表(用于下拉选择等场景)
|
||
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
this.ID = option.ID;
|
||
this.TaskID = option.taskID;
|
||
this.tableKey = option.tableKey ? option.tableKey : '0'
|
||
this.fetchEnums(['BSLawStatusEnum']);
|
||
},
|
||
methods: {
|
||
async fetchEnums(enumNames) {
|
||
try {
|
||
// 存储所有枚举请求的Promise
|
||
const enumPromises = enumNames.map(name => {
|
||
return getEnum({
|
||
name
|
||
}).then(res => {
|
||
// 统一处理枚举格式:添加name/code字段,便于后续映射
|
||
return {
|
||
enumName: name,
|
||
data: res.map(item => ({
|
||
...item,
|
||
name: item.NAME, // 统一显示名称字段
|
||
code: item.ID // 统一值字段
|
||
}))
|
||
};
|
||
});
|
||
});
|
||
|
||
// 等待所有枚举请求完成
|
||
const results = await Promise.all(enumPromises);
|
||
// 存储枚举结果到data中(键为枚举名称,值为处理后的数据)
|
||
results.forEach(({
|
||
enumName,
|
||
data
|
||
}) => {
|
||
this.enumsData[enumName] = data;
|
||
// 生成文本列表(如需要)
|
||
this.enumsText[enumName] = data.map(item => item.name);
|
||
});
|
||
// 所有枚举获取完成后,执行loadData
|
||
this.loadData();
|
||
} catch (error) {
|
||
console.error('枚举请求失败:', error);
|
||
uni.showToast({
|
||
title: '枚举数据加载失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
},
|
||
loadData() {
|
||
const json = initFilter(this.orgId, "", "CODE", 1)
|
||
extendRule(json, 'ID', 1, this.ID);
|
||
extendInclude(json, 'Nav_LawType');
|
||
extendInclude(json, 'Nav_LawVersion');
|
||
extendInclude(json, 'Nav_LawVersion.Nav_Files.Nav_ImgFile');
|
||
extendInclude(json, 'Nav_LawSCSystem.Nav_SCSystem');
|
||
getRequest(json, "/LR/Law/Get").then(res => {
|
||
|
||
this.model = res
|
||
let strUserFiles = [{
|
||
url: '',
|
||
name: ''
|
||
}]
|
||
if (res.Nav_LawVersion && res.Nav_LawVersion.length > 0) {
|
||
for (let i = 0; i < res.Nav_LawVersion.length; i++) {
|
||
this.model.Nav_LawVersion[i].VERSION_STATUSName = this.model.Nav_LawVersion[i].VERSION_STATUS!==undefined ? this.enumsData['BSLawStatusEnum'].find(item => item.code === this.model.Nav_LawVersion[i].VERSION_STATUS).name : '';
|
||
this.model.Nav_LawVersion[i].Files = [];
|
||
if(res.Nav_LawVersion[i].Nav_Files.length>0){
|
||
for (let j = 0; j < res.Nav_LawVersion[i].Nav_Files.length; j++) {
|
||
this.model.Nav_LawVersion[i].Files.push({
|
||
url: config.uni_app_web_source_url + res.Nav_LawVersion[i].Nav_Files[j]
|
||
.Nav_ImgFile.FILE_PATH,
|
||
name: res.Nav_LawVersion[i].Nav_Files[j].Nav_ImgFile.FILE_NAME
|
||
})
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
this.model.Nav_LawVersion.Nav_Files = strUserFiles;
|
||
this.isLoadOK = true;
|
||
})
|
||
},
|
||
returnModel(level) {
|
||
let str = '';
|
||
if (level == undefined) {
|
||
return str;
|
||
}
|
||
if (level.indexOf('1') >= 0) {
|
||
str += '讲授法 ';
|
||
}
|
||
if (level.indexOf('2') >= 0) {
|
||
str += '视听法 ';
|
||
}
|
||
if (level.indexOf('3') >= 0) {
|
||
str += '研讨法 ';
|
||
}
|
||
if (level.indexOf('4') >= 0) {
|
||
str += '演示法 ';
|
||
}
|
||
return str;
|
||
},
|
||
transLevel(level) {
|
||
if (level == 0) {
|
||
return '部门 ';
|
||
}
|
||
if (level == 1) {
|
||
return '车间 ';
|
||
}
|
||
if (level == 2) {
|
||
return '班组 ';
|
||
}
|
||
if (level == 3) {
|
||
return '公司 ';
|
||
}
|
||
},
|
||
onTableBtnAgree() {
|
||
const json = initFilter(this.orgId)
|
||
json.Parameter1 = this.ID;
|
||
json.Parameter2 = this.TaskID;
|
||
getRequest(json, "/SE/SEThreeLevelSafeTrainRecord/PersonalAgree").then(res => {
|
||
if (res) {
|
||
uni.$showMsgFunc('操作成功!', () => {
|
||
uni.navigateBack()
|
||
}, 'success', 1000)
|
||
}
|
||
})
|
||
},
|
||
onTableBtnApprove() {
|
||
const json = initFilter(this.orgId)
|
||
json.Parameter1 = this.ID;
|
||
json.Parameter2 = this.TaskID;
|
||
getRequest(json, "/SE/SEThreeLevelSafeEduCard/Approve").then(res => {
|
||
if (res) {
|
||
uni.$showMsgFunc('操作成功!', () => {
|
||
uni.navigateBack()
|
||
}, 'success', 1000)
|
||
}
|
||
})
|
||
}
|
||
},
|
||
computed: {
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
@import url("@/style/css/editTemplate.css");
|
||
|
||
.btn-wrap {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 16px;
|
||
z-index: 1000;
|
||
background: #fff;
|
||
box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05);
|
||
}
|
||
|
||
.buttons {
|
||
margin-top: 10px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.buttons .first-btn {
|
||
margin-right: 20px;
|
||
}
|
||
</style> |