ystl_myq 1 mesiac pred
rodič
commit
0c532bb214

+ 13 - 14
src/views/evaluate/children/change/components/editMould.vue

@@ -181,9 +181,9 @@ const showStartValueValue = computed({
   }
 });
 const remarkValueValue = computed({
-  get: () => formLabelAlign.showIndicRemark === 1,
+  get: () => formLabelAlign.showRemark === 1,
   set: value => {
-    formLabelAlign.showIndicRemark = value ? 1 : 0;
+    formLabelAlign.showRemark = value ? 1 : 0;
   }
 });
 // 分割————————————————————————————————————————————
@@ -224,18 +224,17 @@ const postUpdateDeptApi = async () => {
 const handClose = (indName, ind, indId) => {
   let newIndName = indName;
   newIndName.indLimitScore = null;
-  nextTick(() => {
-    formLabelAlign.tableData.push(newIndName);
-    indexList.value[ind].splice(indId, 1);
-    if (indexList.value[ind].length == 0) {
-      // oldIndexList.indLimitScore[ind] = 1;
-      oldIndexList.indLimitScore.splice(ind, 1);
-      indexList.value.splice(ind, 1);
-    }
-    if (indexList.value[ind]?.length > 0 && !indexList.value[ind][0].id) {
-      indexList.value[ind].splice(0, 1);
-    }
-  });
+  formLabelAlign.tableData.push(newIndName);
+  indexList.value[ind].splice(indId, 1);
+  if (indexList.value[ind].length == 0) {
+    oldIndexList.indLimitScore.splice(ind, 1);
+    indexList.value.splice(ind, 1);
+  }
+  // 删除前面push的脏数据时遍历报错,在发送请求会过滤掉脏数据
+  // if (!indexList.value[ind][0].id && indexList.value[ind].length == 1) {
+  //   oldIndexList.indLimitScore.splice(ind, 1);
+  //   indexList.value[ind].splice(0, 1);
+  // }
 };
 const delteIndex = (index, item) => {
   nextTick(() => {

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

@@ -583,7 +583,7 @@ const titleShowClick = () => {
               />
               <vxe-column
                 v-if="item.showIndicRemark"
-                field="remark"
+                field="indicRemark"
                 title="指标说明"
                 :edit-render="{ name: 'input' }"
                 drag-sort
@@ -636,13 +636,12 @@ const titleShowClick = () => {
                 title="门槛值"
                 :edit-render="{ name: 'input' }"
               />
-              <!-- 后端字段搞错了,上面指标说明和备注字段估计都要换 -->
-              <!-- <vxe-column
-                v-if="item.showIndicRemark"
+              <vxe-column
+                v-if="item.showRemark"
                 field="remark"
                 title="备注"
                 :edit-render="{ name: 'input' }"
-              /> -->
+              />
               <vxe-column field="age" fixed="right" title="操作">
                 <template #default="{ row }">
                   <el-icon class="mr-3" @click="settingIndex(row)">

+ 10 - 31
src/views/evaluate/children/change/mould/editIndex.vue

@@ -13,7 +13,8 @@ import manyFormula from "@/components/formula/manyFormula.vue";
 const emit = defineEmits(["updateDialog"]);
 const formRef = ref();
 const drawer = ref(false);
-const disabledShow = ref<any>(true);
+// 延迟组件传递数据
+const showData = ref(false);
 const direction = ref<DrawerProps["direction"]>("rtl");
 // 表单
 const formulaOne = ref();
@@ -39,16 +40,11 @@ const formLabelAlign = reactive({
 });
 // 抽屉逻辑
 const open = row => {
-  console.log("编辑", row);
-  Object.assign(formLabelAlign, row);
-  // console.log(1111, JSON.parse(formLabelAlign.formula));
+  Object.assign(formLabelAlign, JSON.parse(JSON.stringify(row)));
   let dataJSon = JSON.parse(row.formula);
   formulaOne.value = dataJSon.noConditionFormula;
-  // if (formLabelAlign.formulaType == 0) {
-  // } else {
-  //   formula
-  // }
   drawer.value = true;
+  showData.value = true;
 };
 // 公式
 const countNoConditionFormulaClick = (data: any) => {
@@ -57,28 +53,9 @@ const countNoConditionFormulaClick = (data: any) => {
 defineExpose({
   open
 });
-const handleClose = (done: () => void) => {
-  if (disabledShow.value) {
-    disabledShow.value = true;
-    drawer.value = false;
-  } else {
-    ElMessageBox.confirm("配置项未保存,确认关闭", {
-      type: "warning"
-    }).then(() => {
-      formRef.value.clearValidate(); // 清除验证错误
-      formRef.value.resetFields(); // 重置表单字段
-      disabledShow.value = true;
-      drawer.value = false;
-    });
-  }
-};
-const cancelClick = () => {
-  formRef.value.validate(valid => {
-    if (valid) {
-      disabledShow.value = true;
-      drawer.value = true;
-    }
-  });
+const handleClose = () => {
+  showData.value = false;
+  drawer.value = false;
 };
 // 公式验证
 const dialogFormVisibleFormula = ref(false);
@@ -312,6 +289,7 @@ const postUpdateApi = async () => {
               <div class="w-full flex item-center">
                 <div class="mr-4"><el-text>得分 =</el-text></div>
                 <jishuanqi
+                  v-if="showData"
                   :outerConditionValue="formulaOne"
                   @handClick="countNoConditionFormulaClick"
                 />
@@ -333,6 +311,7 @@ const postUpdateApi = async () => {
             >
               <div class="w-full flex item-center">
                 <manyFormula
+                  v-if="showData"
                   :formulaJSON="formulaOne"
                   @handUpdataClick="countNoConditionFormulaClick"
                 />
@@ -343,7 +322,7 @@ const postUpdateApi = async () => {
       </template>
       <template #footer>
         <div>
-          <el-button @click="cancelClick">取消</el-button>
+          <el-button @click="handleClose">取消</el-button>
           <el-button type="primary" @click="confirmClick">确认</el-button>
         </div>
       </template>