Lijy 6 ヶ月 前
コミット
21f11410a1

+ 52 - 12
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/personnelSearch/personnelSearch.vue

@@ -35,9 +35,9 @@ const getSelectedLabel = computed(() => {
     return item ? item.label : props.placeholder
   }
 
-  if(props.multiple) {
-    if(Array.isArray(selectedValue.value)) {
-      if(selectedValue.value.length <= 0) {
+  if (props.multiple) {
+    if (Array.isArray(selectedValue.value)) {
+      if (selectedValue.value.length <= 0) {
         return props.placeholder
       }
       const item = getPersonnelListItems(selectedValue.value);
@@ -51,7 +51,7 @@ const getSelectedLabel = computed(() => {
 })
 
 function tagClose(_evt: MouseEvent) {
-  if(Array.isArray(selectedValue.value)) {
+  if (Array.isArray(selectedValue.value)) {
     selectedValue.value.shift()
     updateValue(selectedValue.value)
   }
@@ -84,7 +84,7 @@ function filterMethods(val: string) {
   if (val == '') {
     personnelArray.value = personnelList.value
     selectLoading.value = false
-    return
+    return personnelArray.value
   }
   getUserList(val)
 }
@@ -101,17 +101,51 @@ onMounted(() => {
     personnelArray.value = personnelList.value
   }
 })
-
-console.log(props, userInfo.value, '<==== 看看数据')
 </script>
 
 <template>
-  <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
+  <!-- <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
     :loading="selectLoading" :placeholder="placeholder" :disabled="disabled" clearable filterable collapse-tags
     :style="`width: ${width}`"
     :class="`custom-select ${userInfo.userNameNeedTranslate != 1 && !controlTranslation.visibleFlag ? 'setUpInput' : ''}`"
     @change="updateValue" @visible-change="visibleChange"
     :filter-method="(val: string) => { selectLoading = true, filterMethod(val) }">
+    搜索内容显示
+    <template #prefix v-if="!multiple">
+      <div style="height: 100%;display: flex;align-items: center;">
+        单选
+        <div v-if="!controlTranslation.visibleFlag" class="selectSingleChoice">
+          <template v-if="getSelectedLabel == placeholder">
+            {{ placeholder }}
+          </template>
+<template v-else>
+            <span style="color: #303133;">
+              <TextTranslation translationTypes="userName" :translationValue="getSelectedLabel"></TextTranslation>
+            </span>
+          </template>
+</div>
+</div>
+</template>
+<template #tag v-if="multiple">
+      多选
+      <template v-if="Array.isArray(selectedValue) && selectedValue.length > 0">
+        <el-tag type="info" :size="size" closable @close="tagClose">
+          <TextTranslation translationTypes="userName" :translationValue="getSelectedLabel"></TextTranslation>
+        </el-tag>
+        <el-tag type="info" :size="size" v-if="selectedValue.length > 1">+{{ selectedValue.length }}</el-tag>
+      </template>
+<template v-else>
+        <span style="color: #A8ABB2">{{ placeholder }}</span> 
+      </template>
+</template>
+主题内容显示
+<el-option v-for="item in personnelArray" :key="item.value" :label="item.label" :value="item.value"></el-option>
+</el-select> -->
+  <el-select-v2 v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
+    :loading="selectLoading" :placeholder="placeholder" :disabled="disabled" clearable filterable collapse-tags
+    :style="`width: ${width}`" :options="personnelArray"
+    :class="`custom-select ${!controlTranslation.visibleFlag ? 'setUpInput' : ''}`" @change="updateValue"
+    @visible-change="visibleChange" :filter-method="filterMethod">
     <!-- 搜索内容显示 -->
     <template #prefix v-if="!multiple">
       <div style="height: 100%;display: flex;align-items: center;">
@@ -137,12 +171,16 @@ console.log(props, userInfo.value, '<==== 看看数据')
         <el-tag type="info" :size="size" v-if="selectedValue.length > 1">+{{ selectedValue.length }}</el-tag>
       </template>
       <template v-else>
-        <span style="color: #A8ABB2">{{ placeholder }}</span> 
+        <span style="color: #A8ABB2">{{ placeholder }}</span>
       </template>
     </template>
-    <!-- 主题内容显示 -->
-    <el-option v-for="item in personnelArray" :key="item.value" :label="item.label" :value="item.value"></el-option>
-  </el-select>
+    <!-- 基础 -->
+    <template #default="{ item }">
+      <div class="flex items-center">
+        <TextTranslation translationTypes="userName" :translationValue="item.label"></TextTranslation>
+      </div>
+    </template>
+  </el-select-v2>
   <span class="aabbcc">aabbcc</span>
 </template>
 
@@ -151,6 +189,7 @@ console.log(props, userInfo.value, '<==== 看看数据')
   :deep(.el-select__placeholder.is-transparent) {
     color: transparent !important;
   }
+
   :deep(.el-select__placeholder) {
     span {
       display: none;
@@ -161,6 +200,7 @@ console.log(props, userInfo.value, '<==== 看看数据')
 .setUpInput :deep(.el-input__inner) {
   color: #fff !important;
 }
+
 .aabbcc {
   color: $modena;
 }

+ 8 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/textTranslation/textTranslation.vue

@@ -1,9 +1,9 @@
 <template>
-  <template v-if="userInfo.userNameNeedTranslate == 1">
-    <ww-open-data :type='translationTypes' :openid='translationValue'></ww-open-data>
+  <template v-if="!translationVal">
+    {{ translationValue }}
   </template>
   <template v-else>
-    {{ translationValue }}
+    <ww-open-data :type="translationTypes" :openid="translationValue"></ww-open-data>
   </template>
 </template>
 <script lang="ts" setup>
@@ -19,5 +19,9 @@ interface Props {
 const props = defineProps<Props>();
 const { userInfo } = storeToRefs(useStore());
 
-console.log(props, '<==== 看看数据')
+const translationVal = ref(false);
+
+onMounted(() => {
+  translationVal.value = userInfo.value.userNameNeedTranslate == 0 ? false : true;
+})
 </script>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/home.vue

@@ -60,7 +60,7 @@ const agentConfig = () => {
             console.log(window, 'window')
             //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
             if (window.WWOpenData) {
-              window.WWOpenData.bind(document.querySelector('TranslationOpenDataText'))
+              window.WWOpenData.bind(document.querySelector('ww-open-data'))
               if (WWOpenData.initCanvas) {
                 WWOpenData.initCanvas()
                 console.log('我企业微信 canvas 应该执行了吧')

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/vite.config.ts

@@ -10,7 +10,13 @@ const target = "http://127.0.0.1:10010";
 // const target = 'http://47.101.180.183:10010';
 
 export default defineConfig({
-  plugins: [vue()],
+  plugins: [vue({
+    template: {
+      compilerOptions: {
+        isCustomElement: (tag) => tag === 'ww-open-data'
+      }
+    }
+  })],
   server: {
     host: '0.0.0.0',
     port: 19123,