“ystl_myq” 2 weeks ago
parent
commit
af942b7bbc

+ 4 - 4
src/api/indexDefine.ts

@@ -15,10 +15,10 @@ type recordsList = {
   records: Array<any>;
 };
 
-// 分页查询
-export const postAddDisposableQuota = () => {
+// 一次性
+export const postAddDisposableQuota = data => {
   return http.request<QuotaPageList>("post", "/quota/addDisposableQuota", {
-    name: ""
+    data
   });
 };
 // 分页查询
@@ -40,7 +40,7 @@ export const postUpdateDept = data => {
   return http.request<QuotaPage>("post", "/quota/updateQuota", { data });
 };
 // 来源
-export const getQuotaSourceList = data => {
+export const getQuotaSourceList = (data?: any) => {
   return http.request<QuotaPage>("get", "/quota/getQuotaSourceList", { data });
 };
 

+ 1 - 0
src/api/select.ts

@@ -52,3 +52,4 @@ export const getFromSelectDictRankApi = async () => {
     return data;
   }
 };
+// 指标来源

+ 6 - 0
src/api/templateInfo.ts

@@ -58,6 +58,12 @@ export const getIndexInfo = id => {
     `/templateIndicatorRelation/getInfo/${id}`
   );
 };
+//  根据主键更新考核模板表
+export const postUpdateTemplateIn = data => {
+  return http.request<templateInfoList>("post", `/templateInfo/update`, {
+    data
+  });
+};
 //  根据主键更新模板指标关联表
 export const postUpdate = data => {
   return http.request<templateInfoList>(

+ 19 - 5
src/views/evaluate/children/change/components/newAdd.vue

@@ -13,6 +13,7 @@ import { ElMessageBox, ElMessage } from "element-plus";
 import { postAddRelationList, postUpdateDept } from "@/api/dimension";
 import { useAppStoreHook } from "@/store/modules/app";
 import { addQuota } from "@/api/indexDefine";
+import { postUpdateTemplateIn } from "@/api/templateInfo";
 import {
   postAddDimension,
   getDimensionRemove,
@@ -112,7 +113,6 @@ const getAddListByApi = async id => {
   };
   const { code, data, msg } = await getListBy(obj);
   if (code === 200) {
-    titleShow.value = true;
     eaxmCard.value = data;
     eaxmCard.value.forEach(item => {
       initializeTableData(item);
@@ -179,10 +179,21 @@ const backChange = () => {
   useAppStoreHook().toggleSideBar(true, "打开");
   router.back();
 };
+// 更新模板
+const postUpdateTemplateInApi = async () => {
+  const { code, msg } = await postUpdateTemplateIn({
+    tpName: tepNameForm.tpName,
+    id: tepNameForm.id
+  });
+  if (code == 200) {
+    titleShow.value = true;
+  } else {
+    ElMessage.error(msg);
+  }
+};
+// 保存
 const save = () => {
   if (titleShow.value) {
-    console.log("触发");
-
     router.back();
     useAppStoreHook().toggleSideBar(true, "打开");
   } else {
@@ -190,6 +201,9 @@ const save = () => {
       if (valid) {
         if (tepNameForm.id) {
           getAddListByApi(tepNameForm.id);
+          postUpdateTemplateInApi();
+          if (router.query) {
+          }
         } else {
           postAddTemplateApi();
         }
@@ -273,8 +287,8 @@ const importIndexOne = async row => {
   let formula = JSON.stringify({
     noConditionFormula: ""
   });
-  const { code, data, msg } = await postAddDisposableQuota();
-  if ((code = 200)) {
+  const { code, data, msg } = await postAddDisposableQuota({ name: "" });
+  if (code == 200) {
     const res = await postAddRelationList([
       {
         dimId: row.id,

+ 13 - 5
src/views/indexDefine/children/components/dialog.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import { reactive, computed, ref, onMounted } from "vue";
 import { ElMessage } from "element-plus";
-import { addQuota } from "@/api/indexDefine";
+import { addQuota, getQuotaSourceList } from "@/api/indexDefine";
 import {
   getSelectDictListtApi,
   select,
@@ -20,6 +20,13 @@ const form = reactive({
   source: "",
   statue: null
 });
+const sourceList = ref([]);
+const getQuotaSourceListApi = async () => {
+  const { data, code } = await getQuotaSourceList();
+  if (code == 200) {
+    sourceList.value = data;
+  }
+};
 onMounted(() => {
   getSelectDictListtApi();
   getFromSelectDictListtApi();
@@ -62,6 +69,7 @@ const save = () => {
   addQuotaApi();
 };
 const open = () => {
+  getQuotaSourceListApi();
   // 打开弹框
   Object.assign(form, {
     name: "",
@@ -133,10 +141,10 @@ defineExpose({
         <el-form-item label="来源">
           <el-select v-model="form.source" placeholder="请选择">
             <el-option
-              v-for="(item, index) in selectFrom"
-              :key="index"
-              :label="item.dictValue"
-              :value="item.dictValue"
+              v-for="item in sourceList"
+              :key="item.id"
+              :label="item.sourceValue"
+              :value="item.sourceValue"
             />
           </el-select>
         </el-form-item>