Răsfoiți Sursa

fix 机构属性保存

Michael Wang 3 ani în urmă
părinte
comite
8e771a2c2a
3 a modificat fișierele cu 58 adăugiri și 73 ștergeri
  1. 11 1
      src/api/rootOrgPage.ts
  2. 20 0
      src/constants/constants.ts
  3. 27 72
      src/features/rootOrg/RootOrgEdit.vue

+ 11 - 1
src/api/rootOrgPage.ts

@@ -22,6 +22,16 @@ export function updateRootOrg(params: {
 }
 
 /** 查询顶级机构所有属性 */
-export function getRootOrgSettings(orgId: string) {
+export function getRootOrgSettings(orgId: number) {
   return httpApp.post(`/api/ess/root/org/property/all/${orgId}`);
 }
+
+/** 查询机构单个属性 */
+export function getRootOrgSettingsOfKey(orgId: number, key: string) {
+  return httpApp.post(`/api/ess/root/org/property/${orgId}/${key}`);
+}
+
+/** 保存机构属性 */
+export function saveOrgSetting(orgId: number, properties: any) {
+  return httpApp.post(`/api/ess/root/org/property/save`, { orgId, properties });
+}

+ 20 - 0
src/constants/constants.ts

@@ -30,3 +30,23 @@ export const PROJECT_STATUS = [
     code: "STOPING",
   },
 ];
+
+export const ORG_GLOSSARY = {
+  DESCRIBE01: "整体分析——试卷特征量数",
+  DESCRIBE02: "整体分析——等距(10分)分组频数分布",
+  DESCRIBE03: "整体分析——科目分数线分组的频数分布",
+  DESCRIBE04: "整体分析——科目成绩占初试总分权重",
+  DESCRIBE05: "试卷分析——试卷题目编排",
+  DESCRIBE06: "试卷分析——试题特征量数",
+  DESCRIBE07: "试卷分析——题型题目难度等级构成分布",
+  DESCRIBE08: "试卷分析——内容题目难度等级构成分布",
+  DESCRIBE09: "试卷分析——能力题目难度等级构成分布(一)",
+  DESCRIBE10: "试卷分析——能力题目难度等级构成分布(二)",
+  DESCRIBE11: "试卷分析——题型题目区分度等级构成分布",
+  DESCRIBE12: "试卷分析——内容题目区分度等级构成分布",
+  DESCRIBE13: "试卷分析——能力题目区分度等级构成分布(一)",
+  DESCRIBE14: "试卷分析——能力题目区分度等级构成分布(二)",
+  DESCRIBE15: "试卷分析——试题难度分组分布(按本科目成绩分组)",
+  DESCRIBE16: "试卷分析——试题难度分组分布(按初试总分分组)",
+  DESCRIBE17: "试卷分析——客观题选项选择比率分布",
+};

+ 27 - 72
src/features/rootOrg/RootOrgEdit.vue

@@ -2,94 +2,49 @@
   <div>
     <div>
       <div>报表默认说明</div>
-      <a-button>确定</a-button>
-      <a-button>取消</a-button>
+      <a-button @click="handleOrgPorps">确定</a-button>
+      <a-button @click="goBack">取消</a-button>
     </div>
 
     <div>
-      <div>
-        <div>整体分析——试卷特征量数</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>整体分析——等距(10分)分组频数分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>整体分析——科目分数线分组的频数分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>整体分析——科目成绩占初试总分权重</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——试卷题目编排</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——试题特征量数</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——题型题目难度等级构成分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——内容题目难度等级构成分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——能力题目难度等级构成分布(一)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——能力题目难度等级构成分布(二)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——题型题目区分度等级构成分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——内容题目区分度等级构成分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——能力题目区分度等级构成分布(一)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——能力题目区分度等级构成分布(二)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——试题难度分组分布(按本科目成绩分组)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——试题难度分组分布(按初试总分分组)</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
-      </div>
-      <div>
-        <div>试卷分析——客观题选项选择比率分布</div>
-        <a-textarea :auto-size="{ minRows: 3, maxRows: 5 }"></a-textarea>
+      <div v-for="(item, index) in Object.keys(orgPorps).sort()" :key="index">
+        <div>{{ codeToName(item) }}</div>
+        <a-textarea
+          :auto-size="{ minRows: 3, maxRows: 5 }"
+          v-model:value="orgPorps[item]"
+        ></a-textarea>
       </div>
     </div>
   </div>
 </template>
 
 <script setup lang="ts">
-import { getRootOrgSettings } from "@/api/rootOrgPage";
+import { getRootOrgSettings, saveOrgSetting } from "@/api/rootOrgPage";
 import { onMounted, reactive } from "vue-demi";
 import { useRoute } from "vue-router";
+import { ORG_GLOSSARY } from "@/constants/constants";
+import { goBack } from "@/utils/utils";
 
 const route = useRoute();
-const orgId = route.params.orgId as string;
-const rootOrg = reactive({});
+const orgId = +route.params.orgId;
+
+let orgPorps = reactive<any>({});
+// let orgPorps = reactive<typeof ORG_GLOSSARY>({} as any);
 
 onMounted(async () => {
   const res = await getRootOrgSettings(orgId);
   console.log(res);
+  // orgPorps = res.data;
+  Object.assign(orgPorps, res.data);
 });
+
+async function handleOrgPorps() {
+  await saveOrgSetting(orgId, orgPorps);
+}
+function codeToName(item: any): any {
+  return ORG_GLOSSARY[item as keyof typeof ORG_GLOSSARY];
+}
+function codeToValue(item: any): any {
+  return orgPorps[item as keyof typeof ORG_GLOSSARY];
+}
 </script>