common-setting.tsx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import {NAlert, NButton, NForm, NFormItemGi, NGrid, NInput, NInputGroup, useMessage} from 'naive-ui'
  2. import {defineComponent, onMounted, reactive, ref} from 'vue'
  3. import {sysParamConfigQueryByParamNameList, sysParamConfigUpdate} from '@views/system-manage/param-settings/api'
  4. export default defineComponent({
  5. name: 'project-param-setting',
  6. setup() {
  7. const forms = reactive({}) as any
  8. const formsRef = ref()
  9. const btnLoading = ref(false)
  10. const message = useMessage()
  11. onMounted(async () => {
  12. const {data} = await sysParamConfigQueryByParamNameList("" +
  13. "not_played_note_percent" +
  14. ",played_note_high_low_percent" +
  15. ",played_note_fast_slow_percent" +
  16. ",played_note_duration_less_percent" +
  17. ",evaluation_level_score_less" +
  18. ",evaluation_level_score_less_beginner" +
  19. ",not_proficient_section_score" as any)
  20. if (data) {
  21. data.forEach((row: any) => {
  22. forms[row.paramName] = row.paramValue
  23. })
  24. } else {
  25. message.error('加载配置参数失败')
  26. }
  27. })
  28. const onSubmit = async () => {
  29. const configs = [] as any
  30. Object.keys(forms).forEach((item) => {
  31. configs.push({
  32. "paramName": item,
  33. "paramValue": forms[item],
  34. })
  35. })
  36. const param = {
  37. group: 'OTHER',
  38. configs: configs
  39. }
  40. btnLoading.value = true
  41. try {
  42. const res = (await sysParamConfigUpdate(param)) as any
  43. if (res && res.code == '200') {
  44. message.success('保存成功')
  45. }
  46. } catch (err) {
  47. }
  48. btnLoading.value = false
  49. }
  50. return () => (
  51. <>
  52. <NForm labelPlacement="left" model={forms} requireMarkPlacement="left" ref={formsRef}>
  53. <NAlert
  54. title="云教练配置"
  55. showIcon={false}
  56. bordered={false}
  57. style="margin-bottom: 12px;"
  58. />
  59. <h3>1、异常情况提示配置</h3>
  60. <NGrid cols={1} style={"padding-left: 13px"}>
  61. <NFormItemGi
  62. style={"margin-top:10px"}
  63. label="设备问题:未演奏音符达到"
  64. path="not_played_note_percent"
  65. rule={[
  66. {
  67. required: true,
  68. pattern: /^\d+$/,
  69. message: '请输入',
  70. trigger: ['blur', 'input']
  71. }
  72. ]}
  73. >
  74. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  75. <NInput v-model:value={forms['not_played_note_percent']}>
  76. {{suffix: () => '%'}}
  77. </NInput>
  78. </NInputGroup>
  79. </NFormItemGi>
  80. <NFormItemGi
  81. label="音准问题:满足音符偏高/偏低达到"
  82. path="played_note_high_low_percent"
  83. rule={[
  84. {
  85. required: true,
  86. pattern: /^\d+$/,
  87. message: '请输入',
  88. trigger: ['blur', 'input']
  89. }
  90. ]}
  91. >
  92. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  93. <NInput v-model:value={forms['played_note_high_low_percent']}>
  94. {{suffix: () => '%'}}
  95. </NInput>
  96. </NInputGroup>
  97. 时提示
  98. </NFormItemGi>
  99. <NFormItemGi
  100. label="节奏问题:演奏音符偏快/偏慢达到"
  101. path="played_note_fast_slow_percent"
  102. rule={[
  103. {
  104. required: true,
  105. pattern: /^\d+$/,
  106. message: '请输入',
  107. trigger: ['blur', 'input']
  108. }
  109. ]}
  110. >
  111. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  112. <NInput v-model:value={forms['played_note_fast_slow_percent']}>
  113. {{suffix: () => '%'}}
  114. </NInput>
  115. </NInputGroup>
  116. 时提示
  117. </NFormItemGi>
  118. <NFormItemGi
  119. label="完整性问题:演奏音符时值不足达到"
  120. path="played_note_duration_less_percent"
  121. rule={[
  122. {
  123. required: true,
  124. pattern: /^\d+$/,
  125. message: '请输入',
  126. trigger: ['blur', 'input']
  127. }
  128. ]}
  129. >
  130. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  131. <NInput v-model:value={forms['played_note_duration_less_percent']}>
  132. {{suffix: () => '%'}}
  133. </NInput>
  134. </NInputGroup>
  135. 时提示
  136. </NFormItemGi>
  137. <NFormItemGi
  138. label="评测难度:评测级别为进阶、大师时,评测维度分数都低于"
  139. path="evaluation_level_score_less"
  140. rule={[
  141. {
  142. required: true,
  143. pattern: /^\d+$/,
  144. message: '请输入',
  145. trigger: ['blur', 'input']
  146. }
  147. ]}
  148. >
  149. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  150. <NInput v-model:value={forms['evaluation_level_score_less']}>
  151. {{suffix: () => '分'}}
  152. </NInput>
  153. </NInputGroup>
  154. 时提示
  155. </NFormItemGi>
  156. <NFormItemGi
  157. label="评测难度:评测级别为入门时,评测维度分数都低于"
  158. path="evaluation_level_score_less_beginner"
  159. rule={[
  160. {
  161. required: true,
  162. pattern: /^\d+$/,
  163. message: '请输入',
  164. trigger: ['blur', 'input']
  165. }
  166. ]}
  167. >
  168. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  169. <NInput v-model:value={forms['evaluation_level_score_less_beginner']}>
  170. {{suffix: () => '分'}}
  171. </NInput>
  172. </NInputGroup>
  173. 时提示
  174. </NFormItemGi>
  175. <NFormItemGi
  176. label="不熟练小节:评测分值不低于"
  177. path="not_proficient_section_score"
  178. rule={[
  179. {
  180. required: true,
  181. pattern: /^\d+$/,
  182. message: '请输入',
  183. trigger: ['blur', 'input']
  184. }
  185. ]}
  186. >
  187. <NInputGroup style={"width: 140px !important;margin-right: 14px"}>
  188. <NInput v-model:value={forms['not_proficient_section_score']}>
  189. {{suffix: () => '分'}}
  190. </NInput>
  191. </NInputGroup>
  192. </NFormItemGi>
  193. </NGrid>
  194. </NForm>
  195. <NButton
  196. type="primary"
  197. onClick={onSubmit}
  198. loading={btnLoading.value}
  199. // v-auth="sysParamConfig/update1750838255892299777"
  200. >
  201. 保存设置
  202. </NButton>
  203. </>
  204. )
  205. }
  206. })