Browse Source

添加参数配置

yuanliang 1 year ago
parent
commit
4c4ead1b3d

+ 212 - 0
src/views/system-manage/param-settings/component/common-setting.tsx

@@ -0,0 +1,212 @@
+import {NAlert, NButton, NForm, NFormItemGi, NGrid, NInput, NInputGroup, useMessage} from 'naive-ui'
+import {defineComponent, onMounted, reactive, ref} from 'vue'
+import {sysParamConfigQueryByParamNameList, sysParamConfigUpdate} from '@views/system-manage/param-settings/api'
+
+export default defineComponent({
+  name: 'project-param-setting',
+  setup() {
+    const forms = reactive({}) as any
+    const formsRef = ref()
+    const btnLoading = ref(false)
+    const message = useMessage()
+
+
+    onMounted(async () => {
+      const {data} = await sysParamConfigQueryByParamNameList("" +
+      "not_played_note_percent" +
+      ",played_note_high_low_percent" +
+      ",played_note_fast_slow_percent" +
+      ",played_note_duration_less_percent" +
+      ",evaluation_level_score_less" +
+      ",evaluation_level_score_less_beginner" +
+      ",not_proficient_section_score" as any)
+      if (data) {
+        data.forEach((row: any) => {
+          forms[row.paramName] = row.paramValue
+        })
+      } else {
+        message.error('加载配置参数失败')
+      }
+    })
+
+    const onSubmit = async () => {
+      const configs = [] as any
+      Object.keys(forms).forEach((item) => {
+        configs.push({
+          "paramName": item,
+          "paramValue": forms[item],
+        })
+      })
+      const param = {
+        group: 'OTHER',
+        configs: configs
+      }
+      btnLoading.value = true
+      try {
+        const res = (await sysParamConfigUpdate(param)) as any
+        if (res && res.code == '200') {
+          message.success('保存成功')
+        }
+      } catch (err) {
+      }
+      btnLoading.value = false
+    }
+
+    return () => (
+        <>
+          <NForm labelPlacement="left" model={forms} requireMarkPlacement="left" ref={formsRef}>
+            <NAlert
+                title="云教练配置"
+                showIcon={false}
+                bordered={false}
+                style="margin-bottom: 12px;"
+            />
+            <h3>1、异常情况提示配置</h3>
+            <NGrid cols={1} style={"padding-left: 13px"}>
+              <NFormItemGi
+                  style={"margin-top:10px"}
+                  label="设备问题:未演奏音符达到"
+                  path="not_played_note_percent"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['not_played_note_percent']}>
+                    {{suffix: () => '%'}}
+                  </NInput>
+                </NInputGroup>
+              </NFormItemGi>
+              <NFormItemGi
+                  label="音准问题:满足音符偏高/偏低达到"
+                  path="played_note_high_low_percent"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['played_note_high_low_percent']}>
+                    {{suffix: () => '%'}}
+                  </NInput>
+                </NInputGroup>
+                时提示
+              </NFormItemGi>
+              <NFormItemGi
+                  label="节奏问题:演奏音符偏快/偏慢达到"
+                  path="played_note_fast_slow_percent"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['played_note_fast_slow_percent']}>
+                    {{suffix: () => '%'}}
+                  </NInput>
+                </NInputGroup>
+                时提示
+              </NFormItemGi>
+              <NFormItemGi
+                  label="完整性问题:演奏音符时值不足达到"
+                  path="played_note_duration_less_percent"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['played_note_duration_less_percent']}>
+                    {{suffix: () => '%'}}
+                  </NInput>
+                </NInputGroup>
+                时提示
+              </NFormItemGi>
+              <NFormItemGi
+                  label="评测难度:评测级别为进阶、大师时,评测维度分数都低于"
+                  path="evaluation_level_score_less"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['evaluation_level_score_less']}>
+                    {{suffix: () => '分'}}
+                  </NInput>
+                </NInputGroup>
+                时提示
+              </NFormItemGi>
+              <NFormItemGi
+                  label="评测难度:评测级别为入门时,评测维度分数都低于"
+                  path="evaluation_level_score_less_beginner"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['evaluation_level_score_less_beginner']}>
+                    {{suffix: () => '分'}}
+                  </NInput>
+                </NInputGroup>
+                时提示
+              </NFormItemGi>
+              <NFormItemGi
+                  label="不熟练小节:评测分值不低于"
+                  path="not_proficient_section_score"
+                  rule={[
+                    {
+                      required: true,
+                      pattern: /^\d+$/,
+                      message: '请输入',
+                      trigger: ['blur', 'input']
+                    }
+                  ]}
+              >
+                <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
+                  <NInput v-model:value={forms['not_proficient_section_score']}>
+                    {{suffix: () => '分'}}
+                  </NInput>
+                </NInputGroup>
+              </NFormItemGi>
+            </NGrid>
+          </NForm>
+
+          <NButton
+              type="primary"
+              onClick={onSubmit}
+              loading={btnLoading.value}
+              // v-auth="sysParamConfig/update1750838255892299777"
+          >
+            保存设置
+          </NButton>
+        </>
+    )
+  }
+})

+ 38 - 32
src/views/system-manage/param-settings/index.tsx

@@ -1,16 +1,17 @@
-import { NTabPane, NTabs } from 'naive-ui'
-import { defineComponent, h, onMounted, reactive } from 'vue'
-import { useRoute } from 'vue-router'
-import { getTabsCache, setTabsCaches } from '@/hooks/use-async'
-import { appKey } from '@/utils/constant'
-import { sysApplicationPage } from '@views/menu-manage/api'
+import {NTabPane, NTabs} from 'naive-ui'
+import {defineComponent, h, onMounted, reactive} from 'vue'
+import {useRoute} from 'vue-router'
+import {getTabsCache, setTabsCaches} from '@/hooks/use-async'
+import {appKey} from '@/utils/constant'
+import {sysApplicationPage} from '@views/menu-manage/api'
 import ProjectSetting from '@views/system-manage/param-settings/component/project-setting'
+import CommonSetting from "@views/system-manage/param-settings/component/common-setting";
 
 export default defineComponent({
   name: 'param-settings',
   setup() {
     const state = reactive({
-      tabName: 'KT' as 'KT' | 'GYT' | 'KLX' | 'GYM',
+      tabName: 'COMMON' as 'COMMON' | 'KT' | 'GYT' | 'KLX' | 'GYM',
       appKeyList: [] as any,
       appNameList: [] as any
     })
@@ -28,7 +29,7 @@ export default defineComponent({
       // 获取应用APP信息
       {
         const appKeys = Object.keys(appKey)
-        const { data } = await sysApplicationPage({ page: 1, rows: 99, parentId: 0 })
+        const {data} = await sysApplicationPage({page: 1, rows: 99, parentId: 0})
         const tempList = data.rows || []
         tempList.forEach((next: any) => {
           if (appKeys.includes(next.appKey)) {
@@ -41,31 +42,36 @@ export default defineComponent({
 
     return () => {
       return (
-        <div class="system-menu-container">
-          <div class={['section-container']} style="padding-top: 0">
-            <NTabs
-              type="line"
-              size="large"
-              v-model:value={state.tabName}
-              onUpdate:value={(val: any) => setTabs(val)}
-            >
-              {state.appKeyList.map((app: any, index: number) => {
-                return h(
-                  NTabPane,
-                  {
-                    name: app,
-                    tab: state.appNameList[index]
-                  },
-                  {
-                    default: () => {
-                      return h(ProjectSetting, { appKey: app })
-                    }
-                  }
-                )
-              })}
-            </NTabs>
+          <div class="system-menu-container">
+            <div class={['section-container']} style="padding-top: 0">
+              <NTabs
+                  type="line"
+                  size="large"
+                  v-model:value={state.tabName}
+                  onUpdate:value={(val: any) => setTabs(val)}
+              >
+                <NTabPane name="COMMON" tab="通用参数配置"
+                    //v-auth="sysMenuButton/page1600386298522472450"
+                >
+                  <CommonSetting/>
+                </NTabPane>
+                {state.appKeyList.map((app: any, index: number) => {
+                  return h(
+                      NTabPane,
+                      {
+                        name: app,
+                        tab: state.appNameList[index]
+                      },
+                      {
+                        default: () => {
+                          return h(ProjectSetting, {appKey: app})
+                        }
+                      }
+                  )
+                })}
+              </NTabs>
+            </div>
           </div>
-        </div>
       )
     }
   }