web/src/components/manger/Auth.vue

83 lines
2.1 KiB
Vue

<template>
<div class="auth">
<el-form ref="ruleFormRef" model="ciphertext" label-width="auto"
class="demo-ruleForm" status-icon>
<el-input
v-model="ciphertext"
maxlength="400"
placeholder="Please input"
show-word-limit
:autosize="{ minRows: 8, maxRows: 20 }"
type="textarea"
/>
<div class="btn">
<el-button type="primary" @click="save">保存</el-button>
</div>
</el-form>
<el-descriptions title="解析后的数据" size="small" :column="2" border>
<el-descriptions-item
align="center"
label="证书创建时间"
>
{{ formatDate(decryptedText.createDate) }}
</el-descriptions-item>
<el-descriptions-item
align="center"
label="证书过期时间"
>
{{ formatDate(decryptedText.expiryDate) }}
</el-descriptions-item>
<el-descriptions-item
align="center"
label="权限"
>
{{ decryptedText.rule == 1 ? "禁用医保" : decryptedText.rule == 2 ? "全部开放" : "暂无" }}
</el-descriptions-item>
<el-descriptions-item
align="center"
label="定点机构编码"
>
{{ decryptedText.fixmedinsCode||'无'}}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script setup lang="ts">
import {post} from "@/utils/request.ts";
import {onMounted, ref} from "vue";
import {ElMessage} from "element-plus";
import {formatDate} from "@/utils/dateUtils.ts";
const decryptedText = ref<any>({})
const ciphertext = ref<any>('')
const save = () => {
if (ciphertext.value) {
post("common/auth/set", {ciphertext: ciphertext.value}).then(() => {
ElMessage.success("保存成功")
init()
})
}
}
const init = async () => {
ciphertext.value=await post("common/auth/get");
decryptedText.value=await post("common/auth/check");
}
onMounted(async () => {
await init()
})
</script>
<style scoped lang="scss">
.auth {
margin: 24px auto;
padding: 0 24px;
.btn {
margin: 24px 0;
display: flex;
justify-content: center;
}
}
</style>