Procházet zdrojové kódy

样品单、销售合同列表增加“客户标签”字段,且点击后跳转至“私海”页面并过滤数据

lxf před 1 rokem
rodič
revize
e4cfc7bdf3

+ 2 - 4
src/components/byTable/index.vue

@@ -67,7 +67,7 @@
           placeholder="请输入关键字"
           suffix-icon="search"
           size="mini"
-          v-model="keywrod"
+          v-model="pagination.keyword"
           @keyup.enter="searchFn"
         >
         </el-input>
@@ -298,7 +298,6 @@ export default defineComponent({
   },
   setup(props) {
     const { proxy } = getCurrentInstance();
-    const keywrod = ref("");
     const selectConfigCopy = computed(() => {
       return props.selectConfig.map((item) => {
         if (!item.labelCopy) item.labelCopy = { ...item }.label;
@@ -381,7 +380,7 @@ export default defineComponent({
       console.log(props);
       proxy.$emit(
         "getList",
-        Object.assign(props.filterParams, { [props.searchKey]: keywrod.value })
+        Object.assign(props.filterParams, { [props.searchKey]: props.pagination.keyword })
       );
     };
     const handlePageChange = (val) => {
@@ -461,7 +460,6 @@ export default defineComponent({
       getHeaderActions,
       stopBubbles,
       handleNativeClick,
-      keywrod,
       searchFn,
       searchItemSelct,
       selectConfigCopy,

+ 105 - 4
src/views/EHSD/saleContract/contractEHSD/index.vue

@@ -21,6 +21,32 @@
             <span>{{ moneyFormat(item.amount, 2) }}</span>
           </div>
         </template>
+        <template #buyCorporationName="{ item }">
+          <div style="width: 100%">
+            <a style="color: #409eff; cursor: pointer" @click="clickCorporationName(item.buyCorporationName)">{{ item.buyCorporationName }}</a>
+          </div>
+        </template>
+        <template #tags="{ item }">
+          <div style="width: 100%">
+            <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tags" closable :key="index" @close="tagClose(tag, item)">
+              {{ dictValueLabel(tag, customerTag) }}
+            </el-tag>
+            <template v-if="item.tags.length !== customerTag.length">
+              <el-select
+                v-if="item.addTagShow"
+                v-model="addTag"
+                style="width: 100%"
+                @change="
+                  (val) => {
+                    return changeTag(val, item);
+                  }
+                ">
+                <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value" :disabled="judgeTagSelect(item.tags, tag.value)" />
+              </el-select>
+              <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else> + </el-tag>
+            </template>
+          </div>
+        </template>
         <template #advanceRatio="{ item }">
           <div>
             <span>{{ item.advanceRatio }}%</span>
@@ -265,6 +291,7 @@ const corporationList = ref([]);
 const customerList = ref([]);
 const userList = ref([]);
 const shippingMethod = ref([]);
+const customerTag = ref([]);
 const status = ref([
   {
     label: "草稿",
@@ -352,11 +379,15 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户名称",
-        prop: "buyCorporationId",
+        slot: "buyCorporationName",
         "min-width": 220,
       },
-      render(type) {
-        return proxy.dictValueLabel(type, customerList.value);
+    },
+    {
+      attrs: {
+        label: "客户标签",
+        slot: "tags",
+        width: 180,
       },
     },
     {
@@ -448,7 +479,11 @@ const config = computed(() => {
   ];
 });
 const getDict = () => {
-  proxy.getDictOne(["trade_methods", "account_currency", "shipping_method"]).then((res) => {
+  proxy.getDictOne(["customer_tag,", "trade_methods", "account_currency", "shipping_method"]).then((res) => {
+    customerTag.value = res["customer_tag"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
     tradeMethods.value = res["trade_methods"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
@@ -499,6 +534,14 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
+    res.rows.forEach((x) => {
+      x.addTagShow = false;
+      if (x.tag) {
+        x.tags = x.tag.split(",");
+      } else {
+        x.tags = [];
+      }
+    });
     sourceList.value.data = res.rows;
     sourceList.value.pagination.total = res.total;
     setTimeout(() => {
@@ -685,6 +728,64 @@ const submitHandoverSlip = () => {
     getList();
   });
 };
+const addTag = ref("");
+const judgeTagSelect = (data, val) => {
+  if (data && data.length > 0) {
+    if (data.includes(val)) {
+      return true;
+    }
+  }
+  return false;
+};
+const changeTag = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag.push(val);
+  data.tag = data.tag.join(",");
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "添加成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+const tagClose = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag = data.tag.filter((row) => row !== val);
+  if (data.tag && data.tag.length > 0) {
+    data.tag = data.tag.join(",");
+  } else {
+    data.tag = "";
+  }
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "添加成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+const showSelect = (item) => {
+  item.addTagShow = true;
+};
+const clickCorporationName = (name) => {
+  proxy.$router.replace({
+    path: "/ERP/customer/privatesea",
+    query: {
+      name: name,
+    },
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 107 - 6
src/views/EHSD/saleContract/sampleEHSD/index.vue

@@ -15,13 +15,39 @@
       ]"
       @get-list="getList">
       <template #amount="{ item }">
-        <div>
+        <div style="width: 100%">
           <span style="padding-right: 4px">{{ item.currency }}</span>
           <span>{{ moneyFormat(item.amount, 2) }}</span>
         </div>
       </template>
+      <template #buyCorporationName="{ item }">
+        <div style="width: 100%">
+          <a style="color: #409eff; cursor: pointer" @click="clickCorporationName(item.buyCorporationName)">{{ item.buyCorporationName }}</a>
+        </div>
+      </template>
+      <template #tags="{ item }">
+        <div style="width: 100%">
+          <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tags" closable :key="index" @close="tagClose(tag, item)">
+            {{ dictValueLabel(tag, customerTag) }}
+          </el-tag>
+          <template v-if="item.tags.length !== customerTag.length">
+            <el-select
+              v-if="item.addTagShow"
+              v-model="addTag"
+              style="width: 100%"
+              @change="
+                (val) => {
+                  return changeTag(val, item);
+                }
+              ">
+              <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value" :disabled="judgeTagSelect(item.tags, tag.value)" />
+            </el-select>
+            <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else> + </el-tag>
+          </template>
+        </div>
+      </template>
       <template #advanceRatio="{ item }">
-        <div>
+        <div style="width: 100%">
           <span>{{ item.advanceRatio }}%</span>
         </div>
       </template>
@@ -80,6 +106,7 @@ const corporationList = ref([]);
 const customerList = ref([]);
 const userList = ref([]);
 const shippingMethod = ref([]);
+const customerTag = ref([]);
 const status = ref([
   {
     label: "草稿",
@@ -167,11 +194,15 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户名称",
-        prop: "buyCorporationId",
+        slot: "buyCorporationName",
         "min-width": 220,
       },
-      render(type) {
-        return proxy.dictValueLabel(type, customerList.value);
+    },
+    {
+      attrs: {
+        label: "客户标签",
+        slot: "tags",
+        width: 180,
       },
     },
     {
@@ -252,7 +283,11 @@ const config = computed(() => {
   ];
 });
 const getDict = () => {
-  proxy.getDictOne(["trade_methods", "account_currency", "shipping_method"]).then((res) => {
+  proxy.getDictOne(["customer_tag", "trade_methods", "account_currency", "shipping_method"]).then((res) => {
+    customerTag.value = res["customer_tag"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
     tradeMethods.value = res["trade_methods"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
@@ -303,6 +338,14 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy.post("/sample/page", sourceList.value.pagination).then((res) => {
+    res.rows.forEach((x) => {
+      x.addTagShow = false;
+      if (x.tag) {
+        x.tags = x.tag.split(",");
+      } else {
+        x.tags = [];
+      }
+    });
     sourceList.value.data = res.rows;
     sourceList.value.pagination.total = res.total;
     setTimeout(() => {
@@ -466,6 +509,64 @@ const submitHandoverSlip = () => {
     getList();
   });
 };
+const addTag = ref("");
+const judgeTagSelect = (data, val) => {
+  if (data && data.length > 0) {
+    if (data.includes(val)) {
+      return true;
+    }
+  }
+  return false;
+};
+const changeTag = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag.push(val);
+  data.tag = data.tag.join(",");
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "添加成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+const tagClose = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag = data.tag.filter((row) => row !== val);
+  if (data.tag && data.tag.length > 0) {
+    data.tag = data.tag.join(",");
+  } else {
+    data.tag = "";
+  }
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "添加成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+const showSelect = (item) => {
+  item.addTagShow = true;
+};
+const clickCorporationName = (name) => {
+  proxy.$router.replace({
+    path: "/ERP/customer/privatesea",
+    query: {
+      name: name,
+    },
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 1 - 0
src/views/customer/file/index.vue

@@ -386,6 +386,7 @@ const sourceList = ref({
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    keyword: "",
     status: "",
     source: "",
     type: "",

+ 1 - 0
src/views/customer/highseas/index.vue

@@ -377,6 +377,7 @@ const sourceList = ref({
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    keyword: "",
     status: "",
     source: "",
     type: "0",

+ 4 - 6
src/views/customer/privatesea/index.vue

@@ -173,14 +173,14 @@
             </el-col>
             <el-col :span="8">
               <el-form-item prop="provinceId">
-                <el-select v-model="formData.data.provinceId" placeholder="省/洲"  filterable allow-create @change="(val) => getCityData(val, '30', true)">
+                <el-select v-model="formData.data.provinceId" placeholder="省/洲" filterable allow-create @change="(val) => getCityData(val, '30', true)">
                   <el-option v-for="item in provinceData" :label="item.name" :value="item.id"> </el-option>
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item prop="cityId">
-                <el-select v-model="formData.data.cityId"  filterable allow-create placeholder="城市">
+                <el-select v-model="formData.data.cityId" filterable allow-create placeholder="城市">
                   <el-option v-for="item in cityData" :label="item.name" :value="item.id"> </el-option>
                 </el-select>
               </el-form-item>
@@ -346,6 +346,7 @@ import { computed, ref } from "vue";
 import useUserStore from "@/store/modules/user";
 
 const { proxy } = getCurrentInstance();
+const route = useRoute();
 const loading = ref(false);
 const loadingOperation = ref(false);
 const submitLoading = ref(false);
@@ -377,6 +378,7 @@ const sourceList = ref({
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    keyword: route.query.name || "",
     status: "",
     source: "",
     type: "",
@@ -562,9 +564,6 @@ let formData = reactive({
 let formPerson = reactive({
   data: {},
 });
-let formAllocation = reactive({
-  data: {},
-});
 let formFollow = reactive({
   data: {},
 });
@@ -684,7 +683,6 @@ let rulesFollow = ref({
 });
 const submit = ref(null);
 const person = ref(null);
-const allocation = ref(null);
 const follow = ref(null);
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };