Pārlūkot izejas kodu

重置题名修改

duy 1 nedēļu atpakaļ
vecāks
revīzija
32194954d4
1 mainītis faili ar 17 papildinājumiem un 6 dzēšanām
  1. 17 6
      src/views/data-fill/query.vue

+ 17 - 6
src/views/data-fill/query.vue

@@ -345,7 +345,8 @@
                         <div class="flex items-center">
                             <span class="text-red">*</span>
                             <el-select 
-                                v-model="row.rule" 
+                                v-model="row.rule"
+                                :class="{ 'error-border': !row.rule || row.rule.length === 0 }" 
                                 placeholder="请选择" 
                                 multiple
                                 clearable
@@ -369,19 +370,19 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from 'vue'
+import { nextTick, onMounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { arrToId, arrToKey, downloadBlob, getArrValue, getObjValue, isString } from 'js-fast-way'
 import queryApi from '~api/data-fill/query'
-import divisionApi from '~api/data-fill/division'
+
 import { eVisaTaskCheckApi } from '~api/other'
 import { toPdfPage } from '~uti/btn-auth'
 import wbsApi from '~api/data-fill/wbs'
 import website from '~src/config'
 import { getDictionaryData } from '~uti/tools'
 import { getDictionary } from '~api/other'
-import { reRendering } from 'element-plus/es/components/watermark/src/utils.mjs'
+
 //变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
@@ -1182,6 +1183,7 @@ const ruleModalSave = async ()=>{
         window.$message.warning('请选择题名规规则')
         return
      }
+
     let arr = []
     ruleTableData.value.forEach(item=>{
         arr.push({
@@ -1233,7 +1235,7 @@ const batchSetRule = async ()=>{
         })
    })
    let afterArr = await getRuleValue(arr)
-console.log(afterArr, 'afterArr')
+
 
       for (let i = 0; i < ruleTableData.value.length; i++) {
             const currentItem = ruleTableData.value[i]
@@ -1274,7 +1276,12 @@ const getRuleListData = async (arr) => {
 
 }
 const getRuleValue = async (arr) => { 
-
+  // 检查 arr 中每一项的 nameRule 是否有值
+  const hasInvalidItem = arr.some(item => !item.nameRule || item.nameRule.length === 0)
+  if (hasInvalidItem) {
+   window.$message.warning('请选择题名规则')
+    return
+  }
     getRuleLoad.value = true
     const { error, code, msg, data } = await queryApi.previewNodeName(arr)
     //处理数据
@@ -1311,6 +1318,10 @@ const getWbsNodeTypeApi = async () => {
 
 <style lang="scss" scoped>
 @import "../../styles/data-fill/query.scss";
+
+.error-border {
+    border: 1px solid red;
+}
 .iscusor {
     cursor: pointer;
 }