Browse Source

全选bug处理

祁鹏飞 3 tháng trước cách đây
mục cha
commit
f448e7cf2a

+ 8 - 4
.env.development

@@ -3,11 +3,15 @@ VITE_APP_SETTING = true
 # 页面标题
 VITE_APP_TITLE = 租户平台
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
-VITE_APP_API_BASEURL = https://tennat.baoxianzhanggui.com/api #默认地址
+# VITE_APP_API_BASEURL = https://platform.baoxianzhanggui.com/api  #线上
+# VITE_APP_API_BASEURL = https://test.baoxianzhanggui.com/web-api #默认地址
 # VITE_APP_API_BASEURL = http://192.168.5.249:8001  #田智
-# VITE_APP_API_BASEURL = http://192.168.0.19:8001  #董鑫
-# VITE_APP_API_BASEURL = http://192.168.5.17:8001  #李鹏飞
-# VITE_APP_API_BASEURL = http://192.168.5.28:8001  #贾凯
+# VITE_APP_API_BASEURL = http://192.168.5.150:8001  #董鑫
+# VITE_APP_API_BASEURL = http://192.168.5.47:8001  #屈晨
+# VITE_APP_API_BASEURL = http://192.168.5.150:8001  #徐强
+# VITE_APP_API_BASEURL = http://192.168.5.168:8001  #王浩
+ VITE_APP_API_BASEURL = http://192.168.5.163:8001  #刘斌
+#  VITE_APP_API_BASEURL = http://192.168.5.18:8001  #李鹏飞
 
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =

+ 24 - 0
.env.development1

@@ -0,0 +1,24 @@
+# 应用配置面板
+VITE_APP_SETTING = true
+# 页面标题
+VITE_APP_TITLE = 租户平台
+# 接口请求地址,会设置到 axios 的 baseURL 参数上
+# VITE_APP_API_BASEURL = https://platform.baoxianzhanggui.com/api  #线上
+# VITE_APP_API_BASEURL = https://test.baoxianzhanggui.com/web-api #默认地址
+# VITE_APP_API_BASEURL = http://192.168.5.249:8001  #田智
+# VITE_APP_API_BASEURL = http://192.168.5.150:8001  #董鑫
+# VITE_APP_API_BASEURL = http://192.168.5.47:8001  #屈晨
+# VITE_APP_API_BASEURL = http://192.168.5.150:8001  #徐强
+# VITE_APP_API_BASEURL = http://192.168.5.168:8001  #王浩
+#  VITE_APP_API_BASEURL = http://192.168.5.163:8001  #刘斌
+ VITE_APP_API_BASEURL = http://192.168.5.17:8001  #李鹏飞
+
+# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
+VITE_APP_DEBUG_TOOL =
+# 是否禁用开发者工具,可防止被调试
+VITE_APP_DISABLE_DEVTOOL = false
+
+# 是否开启代理
+VITE_OPEN_PROXY = false
+# 是否开启开发者工具
+VITE_OPEN_DEVTOOLS = false

+ 1 - 1
.env.production

@@ -5,7 +5,7 @@ VITE_APP_TITLE = 生产环境
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
 # VITE_APP_API_BASEURL = https://sxzgkj.baoxianzhanggui.com/web-api
 # VITE_APP_API_BASEURL = http://192.168.0.250:8001
-VITE_APP_API_BASEURL = http://test-tennat.baoxianzhanggui.com/api/
+VITE_APP_API_BASEURL = https://tennat.baoxianzhanggui.com/api/
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =
 # 是否禁用开发者工具,可防止被调试

+ 10 - 3
package.json

@@ -5,7 +5,8 @@
     "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
   },
   "scripts": {
-    "dev": "vite",
+    "dev": "vite --mode development ",
+    "dev1": "vite --mode development1",
     "build": "vue-tsc --noEmit && vite build",
     "build:test": "vue-tsc --noEmit && vite build --mode test",
     "serve": "http-server ./dist -o",
@@ -19,7 +20,10 @@
     "lint:stylelint": "stylelint \"src/**/*.{css,scss,vue}\" --cache --fix",
     "preinstall": "npx only-allow pnpm",
     "commit": "git cz",
-    "release": "bumpp"
+    "release": "bumpp",
+    "test": "vitest",
+    "test:run": "vitest run",
+    "test:coverage": "vitest run --coverage"
   },
   "dependencies": {
     "@headlessui/vue": "^1.7.23",
@@ -115,7 +119,10 @@
     "vite-plugin-svg-icons": "^2.0.1",
     "vite-plugin-vue-devtools": "^7.6.7",
     "vite-plugin-vue-meta-layouts": "^0.5.1",
-    "vue-tsc": "^2.1.10"
+    "vue-tsc": "^2.1.10",
+    "vitest": "^2.1.8",
+    "@vitest/coverage-v8": "^2.1.8",
+    "jsdom": "^25.0.1"
   },
   "simple-git-hooks": {
     "pre-commit": "pnpm lint-staged",

+ 1 - 15
src/components/ruleConditionContainer/index.vue

@@ -182,22 +182,8 @@ const licenseNoSelect = (e, item) => {
   }
 }
 
-const checkAll = ref(false)
-const indeterminate = ref(false)
-watch(() => props.rulesAttrList, (val) => {
-  if (val.length === 0) {
-    checkAll.value = false
-    indeterminate.value = false
-  } else if (val.length === cities.value.length) {
-    checkAll.value = true
-    indeterminate.value = false
-  } else {
-    indeterminate.value = true
-  }
-})
-
+/** 处理全选/取消全选操作,根据选中状态设置当前项的所有子选项。选中时将字典标签映射为值数组(车辆类型取 code,其余取 name),取消选中时清空数组,同时重置半选状态 */
 const handleCheckAll = (item, index: number, val: boolean) => {
-
   item.indeterminate = false
   if (val) {
     item.minArray = item.dictLabal.map((_) => _.attrName == '车辆类型' ? _.code : _.name)

+ 0 - 1
src/types/components.d.ts

@@ -11,7 +11,6 @@ declare module 'vue' {
     ComplexTable: typeof import('./../components/complexTable/index.vue')['default']
     DialogSetDeptLeader: typeof import('./../components/DialogSetDeptLeader/index.vue')['default']
     Empty: typeof import('./../components/empty/index.vue')['default']
-    Equities: typeof import('./../components/Equities/index.vue')['default']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     FixedActionBar: typeof import('./../components/FixedActionBar/index.vue')['default']
     HButton: typeof import('./../layouts/ui-kit/HButton.vue')['default']

+ 43 - 0
src/views/insurancePolicy/components/inputDatePicker.vue

@@ -0,0 +1,43 @@
+<template>
+  <div class="" style="width: 100%">
+    <el-input
+      v-model="inputData"
+      :placeholder="$attrs.placeholder"
+      prefix-icon="Calendar"
+      @click="datePicker.handleOpen()"
+      @blur="inputDate"
+    ></el-input>
+    <el-date-picker
+      ref="datePicker"
+      v-model="datePickerData"
+      v-bind="$attrs"
+      style="height: 100px; overflow: hidden"
+      @change="changeDate"
+    />
+  </div>
+</template>
+<script setup lang="ts">
+import dayjs from "dayjs";
+
+const emit = defineEmits(["update:modelValue"]);
+const props= defineProps({
+modelValue: {
+type: String
+}
+})
+
+const datePicker = ref(null);
+const datePickerData = ref(props.modelValue);
+const inputData = ref("");
+
+const inputDate = (e: any) => {
+  const date = dayjs(e.target.value).format("YYYY-MM-DD");
+  inputData.value = date;
+  emit("update:modelValue", date);
+};
+
+const changeDate = (date: any) => {
+  inputData.value = date;
+  emit("update:modelValue", date);
+};
+</script>

+ 30 - 0
vitest.config.ts

@@ -0,0 +1,30 @@
+import { defineConfig } from 'vitest/config'
+import vue from '@vitejs/plugin-vue'
+import path from 'path'
+
+export default defineConfig({
+  plugins: [vue()],
+  test: {
+    globals: true,
+    environment: 'jsdom',
+    setupFiles: ['./tests/setup.ts'],
+    include: ['tests/**/*.{test,spec}.{js,ts}'],
+    coverage: {
+      provider: 'v8',
+      reporter: ['text', 'json', 'html'],
+      exclude: [
+        'node_modules/**',
+        'tests/**',
+        'dist/**',
+        '**/*.d.ts',
+        'vite.config.*'
+      ]
+    }
+  },
+  resolve: {
+    alias: {
+      '@': path.resolve(__dirname, 'src'),
+      '#': path.resolve(__dirname, 'src/types')
+    }
+  }
+})