|
@@ -0,0 +1,108 @@
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
|
+import { computed, onMounted, ref } from 'vue';
|
|
|
|
|
+
|
|
|
|
|
+import { Page } from '@vben/common-ui';
|
|
|
|
|
+
|
|
|
|
|
+import { Button, Input, message } from 'ant-design-vue';
|
|
|
|
|
+
|
|
|
|
|
+import {
|
|
|
|
|
+ getReviewCostLimitMethod,
|
|
|
|
|
+ updateReviewCostLimitMethod,
|
|
|
|
|
+} from '#/api';
|
|
|
|
|
+
|
|
|
|
|
+const dictValue = ref('');
|
|
|
|
|
+const originalValue = ref('');
|
|
|
|
|
+const loading = ref(false);
|
|
|
|
|
+const saving = ref(false);
|
|
|
|
|
+
|
|
|
|
|
+const hasChanged = computed(
|
|
|
|
|
+ () => dictValue.value.trim() !== originalValue.value,
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+async function loadConfig() {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await getReviewCostLimitMethod();
|
|
|
|
|
+ dictValue.value = data.dictValue ?? '';
|
|
|
|
|
+ originalValue.value = dictValue.value;
|
|
|
|
|
+ } catch (error: any) {
|
|
|
|
|
+ message.error(error.message || '获取配置失败');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function handleSave() {
|
|
|
|
|
+ const value = dictValue.value.trim();
|
|
|
|
|
+ if (!value) {
|
|
|
|
|
+ message.warning('请输入均贴费用上限价');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ saving.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ await updateReviewCostLimitMethod(value);
|
|
|
|
|
+ originalValue.value = value;
|
|
|
|
|
+ dictValue.value = value;
|
|
|
|
|
+ message.success('保存成功');
|
|
|
|
|
+ } catch (error: any) {
|
|
|
|
|
+ dictValue.value = originalValue.value;
|
|
|
|
|
+ message.error(error.message || '保存失败');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ saving.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ loadConfig();
|
|
|
|
|
+});
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<template>
|
|
|
|
|
+ <Page auto-content-height class="cost-limit-page">
|
|
|
|
|
+ <div class="cost-limit-form">
|
|
|
|
|
+ <span class="cost-limit-form__label">中药处方均贴费用上限价:</span>
|
|
|
|
|
+ <Input
|
|
|
|
|
+ v-model:value="dictValue"
|
|
|
|
|
+ :disabled="loading || saving"
|
|
|
|
|
+ class="cost-limit-form__input"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ />
|
|
|
|
|
+ <span class="cost-limit-form__unit">元</span>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ :disabled="loading || !hasChanged"
|
|
|
|
|
+ :loading="saving"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="handleSave"
|
|
|
|
|
+ >
|
|
|
|
|
+ 保存
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Page>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.cost-limit-page {
|
|
|
|
|
+ padding: 24px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.cost-limit-form {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.cost-limit-form__label {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: rgb(0 0 0 / 88%);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.cost-limit-form__input {
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.cost-limit-form__unit {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: rgb(0 0 0 / 88%);
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|