Browse Source

客户管理页面增加高级检索

lxf 1 year ago
parent
commit
6cd856565e

+ 182 - 4
src/views/customer/file/index.vue

@@ -101,6 +101,7 @@
       :loading="loading"
       :selectConfig="selectConfig"
       highlight-current-row
+      @moreSearch="moreSearch"
       @get-list="getList">
       <template #isTop="{ item }">
         <div>
@@ -114,7 +115,7 @@
         <span v-if="item.cityName"> ,{{ item.cityName }}</span>
       </template>
       <template #name="{ item }">
-        <div style="cursor: pointer; color: #409eff" @click="handleClickName(item)">
+        <div style="cursor: pointer; color: #409eff; word-break: break-all" @click="handleClickName(item)">
           {{ item.name }}
         </div>
       </template>
@@ -373,6 +374,66 @@
         <el-button @click="openRecordMore = false" size="large">关 闭</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="700">
+      <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
+        <template #address>
+          <el-row style="width: 100%">
+            <el-col :span="8">
+              <el-form-item prop="countryId">
+                <el-select
+                  v-model="sourceList.pagination.countryId"
+                  placeholder="国家"
+                  clearable
+                  filterable
+                  @change="(val) => getCitySearchData(val, '20', true)">
+                  <el-option v-for="item in countrySearchData" :label="item.chineseName" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="provinceName">
+                <selectCity
+                  placeholder="省/洲"
+                  @change="(val) => getCitySearchData(val, '30', true)"
+                  addressId="provinceId"
+                  addressName="provinceName"
+                  v-model="sourceList.pagination"
+                  :data="provinceSearchData">
+                </selectCity>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="cityName">
+                <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="sourceList.pagination" :data="citySearchData"></selectCity>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
+        <template #tags>
+          <div style="width: 100%">
+            <el-tag style="margin-right: 8px" type="info" v-for="(tag, index) in sourceList.pagination.tags" closable :key="index" @close="tagSearchClose(tag)">
+              {{ dictValueLabel(tag, customerTag) }}
+            </el-tag>
+            <template v-if="sourceList.pagination.tags.length !== customerTag.length">
+              <el-select v-if="addTagSearchShow" v-model="addSearchTag" style="margin-top: 8px" @change="changeSearchTag">
+                <el-option
+                  v-for="tag in customerTag"
+                  :key="tag.value"
+                  :label="tag.label"
+                  :value="tag.value"
+                  :disabled="judgeTagSelect(sourceList.pagination.tags, tag.value)" />
+              </el-select>
+              <el-tag style="cursor: pointer" type="info" @click="addTagSearchShow = true" v-else> + </el-tag>
+            </template>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="cancelSearch()" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -418,9 +479,17 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
-    status: "",
-    source: "",
     type: "",
+    source: "",
+    status: "",
+    name: "",
+    countryId: "",
+    provinceId: "",
+    cityId: "",
+    customerCode: "",
+    userId: "",
+    tag: "",
+    tags: [],
   },
   paginationTwo: {
     statisticsType: 1,
@@ -469,7 +538,6 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户名称",
-        prop: "name",
         slot: "name",
         fixed: "left",
         width: 160,
@@ -1193,6 +1261,116 @@ const update = (row) => {
     dialogVisible.value = true;
   });
 };
+const countrySearchData = ref([]);
+const provinceSearchData = ref([]);
+const citySearchData = ref([]);
+const getCitySearchData = (id, type, isChange) => {
+  proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      provinceSearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.provinceId = "";
+        sourceList.value.pagination.provinceName = "";
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else if (type === "30") {
+      citySearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else {
+      countrySearchData.value = res;
+    }
+  });
+};
+getCitySearchData("0");
+const openSearch = ref(false);
+const formSearchConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "客户名称",
+      itemType: "text",
+    },
+    {
+      type: "slot",
+      slotName: "address",
+      label: "所在城市",
+    },
+    {
+      type: "input",
+      prop: "customerCode",
+      label: "客户代码",
+      itemType: "text",
+    },
+    {
+      type: "select",
+      label: "客户来源",
+      prop: "source",
+      itemWidth: 50,
+      data: customerSource.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "客户类型",
+      prop: "status",
+      itemWidth: 50,
+      data: customerStatus.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "业务员",
+      prop: "userId",
+      data: userList.value,
+      clearable: true,
+    },
+    {
+      type: "slot",
+      slotName: "tags",
+      label: "客户标签",
+    },
+  ];
+});
+const addSearchTag = ref("");
+const addTagSearchShow = ref(false);
+let copySearch = ref({});
+const moreSearch = () => {
+  if (sourceList.value.pagination.tag) {
+    sourceList.value.pagination.tags = sourceList.value.pagination.tag.split(",");
+  } else {
+    sourceList.value.pagination.tags = [];
+  }
+  addTagSearchShow.value = false;
+  copySearch.value = proxy.deepClone(sourceList.value.pagination);
+  openSearch.value = true;
+};
+const cancelSearch = () => {
+  sourceList.value.pagination = copySearch.value;
+  openSearch.value = false;
+};
+const submitSearch = () => {
+  if (sourceList.value.pagination.tags && sourceList.value.pagination.tags.length > 0) {
+    sourceList.value.pagination.tag = sourceList.value.pagination.tags.join(",");
+  } else {
+    sourceList.value.pagination.tag = "";
+  }
+  openSearch.value = false;
+  sourceList.value.pagination.pageNum = 1;
+  getList();
+};
+const tagSearchClose = (val) => {
+  sourceList.value.pagination.tags = sourceList.value.pagination.tags.filter((item) => item !== val);
+};
+const changeSearchTag = (val) => {
+  sourceList.value.pagination.tags.push(val);
+  addTagSearchShow.value = false;
+  addSearchTag.value = "";
+};
 </script>
 
 <style lang="scss" scoped>

+ 183 - 5
src/views/customer/highseas/index.vue

@@ -101,6 +101,7 @@
       :loading="loading"
       :selectConfig="selectConfig"
       highlight-current-row
+      @moreSearch="moreSearch"
       @get-list="getList">
       <template #isTop="{ item }">
         <div>
@@ -114,7 +115,7 @@
         <span v-if="item.cityName"> ,{{ item.cityName }}</span>
       </template>
       <template #name="{ item }">
-        <div style="cursor: pointer; color: #409eff" @click="handleClickName(item)">
+        <div style="cursor: pointer; color: #409eff; word-break: break-all" @click="handleClickName(item)">
           {{ item.name }}
         </div>
       </template>
@@ -365,6 +366,66 @@
         <el-button @click="openRecordMore = false" size="large">关 闭</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="700">
+      <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
+        <template #address>
+          <el-row style="width: 100%">
+            <el-col :span="8">
+              <el-form-item prop="countryId">
+                <el-select
+                  v-model="sourceList.pagination.countryId"
+                  placeholder="国家"
+                  clearable
+                  filterable
+                  @change="(val) => getCitySearchData(val, '20', true)">
+                  <el-option v-for="item in countrySearchData" :label="item.chineseName" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="provinceName">
+                <selectCity
+                  placeholder="省/洲"
+                  @change="(val) => getCitySearchData(val, '30', true)"
+                  addressId="provinceId"
+                  addressName="provinceName"
+                  v-model="sourceList.pagination"
+                  :data="provinceSearchData">
+                </selectCity>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="cityName">
+                <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="sourceList.pagination" :data="citySearchData"></selectCity>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
+        <template #tags>
+          <div style="width: 100%">
+            <el-tag style="margin-right: 8px" type="info" v-for="(tag, index) in sourceList.pagination.tags" closable :key="index" @close="tagSearchClose(tag)">
+              {{ dictValueLabel(tag, customerTag) }}
+            </el-tag>
+            <template v-if="sourceList.pagination.tags.length !== customerTag.length">
+              <el-select v-if="addTagSearchShow" v-model="addSearchTag" style="margin-top: 8px" @change="changeSearchTag">
+                <el-option
+                  v-for="tag in customerTag"
+                  :key="tag.value"
+                  :label="tag.label"
+                  :value="tag.value"
+                  :disabled="judgeTagSelect(sourceList.pagination.tags, tag.value)" />
+              </el-select>
+              <el-tag style="cursor: pointer" type="info" @click="addTagSearchShow = true" v-else> + </el-tag>
+            </template>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="cancelSearch()" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -409,9 +470,17 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
-    status: "",
+    type: "",
     source: "",
-    type: "0",
+    status: "",
+    name: "",
+    countryId: "",
+    provinceId: "",
+    cityId: "",
+    customerCode: "",
+    userId: "",
+    tag: "",
+    tags: [],
   },
   paginationTwo: {
     statisticsType: 1,
@@ -460,7 +529,6 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户名称",
-        prop: "name",
         slot: "name",
         fixed: "left",
         width: 160,
@@ -876,7 +944,7 @@ getDict();
 getList();
 const handleClickName = (row) => {
   proxy.$router.push({
-    path: "/customer/customer/portrait",
+    path: "/ERP/customer/portrait",
     query: {
       id: row.id,
     },
@@ -1113,6 +1181,116 @@ const getNum = (val) => {
   }
   return num;
 };
+const countrySearchData = ref([]);
+const provinceSearchData = ref([]);
+const citySearchData = ref([]);
+const getCitySearchData = (id, type, isChange) => {
+  proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      provinceSearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.provinceId = "";
+        sourceList.value.pagination.provinceName = "";
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else if (type === "30") {
+      citySearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else {
+      countrySearchData.value = res;
+    }
+  });
+};
+getCitySearchData("0");
+const openSearch = ref(false);
+const formSearchConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "客户名称",
+      itemType: "text",
+    },
+    {
+      type: "slot",
+      slotName: "address",
+      label: "所在城市",
+    },
+    {
+      type: "input",
+      prop: "customerCode",
+      label: "客户代码",
+      itemType: "text",
+    },
+    {
+      type: "select",
+      label: "客户来源",
+      prop: "source",
+      itemWidth: 50,
+      data: customerSource.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "客户类型",
+      prop: "status",
+      itemWidth: 50,
+      data: customerStatus.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "业务员",
+      prop: "userId",
+      data: userList.value,
+      clearable: true,
+    },
+    {
+      type: "slot",
+      slotName: "tags",
+      label: "客户标签",
+    },
+  ];
+});
+const addSearchTag = ref("");
+const addTagSearchShow = ref(false);
+let copySearch = ref({});
+const moreSearch = () => {
+  if (sourceList.value.pagination.tag) {
+    sourceList.value.pagination.tags = sourceList.value.pagination.tag.split(",");
+  } else {
+    sourceList.value.pagination.tags = [];
+  }
+  addTagSearchShow.value = false;
+  copySearch.value = proxy.deepClone(sourceList.value.pagination);
+  openSearch.value = true;
+};
+const cancelSearch = () => {
+  sourceList.value.pagination = copySearch.value;
+  openSearch.value = false;
+};
+const submitSearch = () => {
+  if (sourceList.value.pagination.tags && sourceList.value.pagination.tags.length > 0) {
+    sourceList.value.pagination.tag = sourceList.value.pagination.tags.join(",");
+  } else {
+    sourceList.value.pagination.tag = "";
+  }
+  openSearch.value = false;
+  sourceList.value.pagination.pageNum = 1;
+  getList();
+};
+const tagSearchClose = (val) => {
+  sourceList.value.pagination.tags = sourceList.value.pagination.tags.filter((item) => item !== val);
+};
+const changeSearchTag = (val) => {
+  sourceList.value.pagination.tags.push(val);
+  addTagSearchShow.value = false;
+  addSearchTag.value = "";
+};
 </script>
 
 <style lang="scss" scoped>

+ 183 - 5
src/views/customer/privatesea/index.vue

@@ -101,6 +101,7 @@
       :loading="loading"
       :selectConfig="selectConfig"
       highlight-current-row
+      @moreSearch="moreSearch"
       @get-list="getList">
       <template #isTop="{ item }">
         <div>
@@ -114,7 +115,7 @@
         <span v-if="item.cityName"> ,{{ item.cityName }}</span>
       </template>
       <template #name="{ item }">
-        <div style="cursor: pointer; color: #409eff" @click="handleClickName(item)">
+        <div style="cursor: pointer; color: #409eff; word-break: break-all" @click="handleClickName(item)">
           {{ item.name }}
         </div>
       </template>
@@ -365,6 +366,66 @@
         <el-button @click="openRecordMore = false" size="large">关 闭</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="700">
+      <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
+        <template #address>
+          <el-row style="width: 100%">
+            <el-col :span="8">
+              <el-form-item prop="countryId">
+                <el-select
+                  v-model="sourceList.pagination.countryId"
+                  placeholder="国家"
+                  clearable
+                  filterable
+                  @change="(val) => getCitySearchData(val, '20', true)">
+                  <el-option v-for="item in countrySearchData" :label="item.chineseName" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="provinceName">
+                <selectCity
+                  placeholder="省/洲"
+                  @change="(val) => getCitySearchData(val, '30', true)"
+                  addressId="provinceId"
+                  addressName="provinceName"
+                  v-model="sourceList.pagination"
+                  :data="provinceSearchData">
+                </selectCity>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item prop="cityName">
+                <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="sourceList.pagination" :data="citySearchData"></selectCity>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
+        <template #tags>
+          <div style="width: 100%">
+            <el-tag style="margin-right: 8px" type="info" v-for="(tag, index) in sourceList.pagination.tags" closable :key="index" @close="tagSearchClose(tag)">
+              {{ dictValueLabel(tag, customerTag) }}
+            </el-tag>
+            <template v-if="sourceList.pagination.tags.length !== customerTag.length">
+              <el-select v-if="addTagSearchShow" v-model="addSearchTag" style="margin-top: 8px" @change="changeSearchTag">
+                <el-option
+                  v-for="tag in customerTag"
+                  :key="tag.value"
+                  :label="tag.label"
+                  :value="tag.value"
+                  :disabled="judgeTagSelect(sourceList.pagination.tags, tag.value)" />
+              </el-select>
+              <el-tag style="cursor: pointer" type="info" @click="addTagSearchShow = true" v-else> + </el-tag>
+            </template>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="cancelSearch()" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -410,9 +471,17 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: route.query.name || "",
-    status: "",
-    source: "",
     type: "",
+    source: "",
+    status: "",
+    name: "",
+    countryId: "",
+    provinceId: "",
+    cityId: "",
+    customerCode: "",
+    userId: "",
+    tag: "",
+    tags: [],
   },
   paginationTwo: {
     statisticsType: 1,
@@ -461,7 +530,6 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户名称",
-        prop: "name",
         slot: "name",
         fixed: "left",
         width: 160,
@@ -877,7 +945,7 @@ getDict();
 getList();
 const handleClickName = (row) => {
   proxy.$router.push({
-    path: "/customer/customer/portrait",
+    path: "/ERP/customer/portrait",
     query: {
       id: row.id,
     },
@@ -1114,6 +1182,116 @@ const getNum = (val) => {
   }
   return num;
 };
+const countrySearchData = ref([]);
+const provinceSearchData = ref([]);
+const citySearchData = ref([]);
+const getCitySearchData = (id, type, isChange) => {
+  proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      provinceSearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.provinceId = "";
+        sourceList.value.pagination.provinceName = "";
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else if (type === "30") {
+      citySearchData.value = res;
+      if (isChange) {
+        sourceList.value.pagination.cityId = "";
+        sourceList.value.pagination.cityName = "";
+      }
+    } else {
+      countrySearchData.value = res;
+    }
+  });
+};
+getCitySearchData("0");
+const openSearch = ref(false);
+const formSearchConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "客户名称",
+      itemType: "text",
+    },
+    {
+      type: "slot",
+      slotName: "address",
+      label: "所在城市",
+    },
+    {
+      type: "input",
+      prop: "customerCode",
+      label: "客户代码",
+      itemType: "text",
+    },
+    {
+      type: "select",
+      label: "客户来源",
+      prop: "source",
+      itemWidth: 50,
+      data: customerSource.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "客户类型",
+      prop: "status",
+      itemWidth: 50,
+      data: customerStatus.value,
+      clearable: true,
+    },
+    {
+      type: "select",
+      label: "业务员",
+      prop: "userId",
+      data: userList.value,
+      clearable: true,
+    },
+    {
+      type: "slot",
+      slotName: "tags",
+      label: "客户标签",
+    },
+  ];
+});
+const addSearchTag = ref("");
+const addTagSearchShow = ref(false);
+let copySearch = ref({});
+const moreSearch = () => {
+  if (sourceList.value.pagination.tag) {
+    sourceList.value.pagination.tags = sourceList.value.pagination.tag.split(",");
+  } else {
+    sourceList.value.pagination.tags = [];
+  }
+  addTagSearchShow.value = false;
+  copySearch.value = proxy.deepClone(sourceList.value.pagination);
+  openSearch.value = true;
+};
+const cancelSearch = () => {
+  sourceList.value.pagination = copySearch.value;
+  openSearch.value = false;
+};
+const submitSearch = () => {
+  if (sourceList.value.pagination.tags && sourceList.value.pagination.tags.length > 0) {
+    sourceList.value.pagination.tag = sourceList.value.pagination.tags.join(",");
+  } else {
+    sourceList.value.pagination.tag = "";
+  }
+  openSearch.value = false;
+  sourceList.value.pagination.pageNum = 1;
+  getList();
+};
+const tagSearchClose = (val) => {
+  sourceList.value.pagination.tags = sourceList.value.pagination.tags.filter((item) => item !== val);
+};
+const changeSearchTag = (val) => {
+  sourceList.value.pagination.tags.push(val);
+  addTagSearchShow.value = false;
+  addSearchTag.value = "";
+};
 </script>
 
 <style lang="scss" scoped>