瀏覽代碼

客户查重、项目查重

qymljy 2 年之前
父節點
當前提交
8d92cd3ab5

+ 10 - 4
src/Form/projectChange/add.vue

@@ -154,7 +154,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button  size="small" @click="onClose" class="normal-btn-width inline-16">取 消</el-button>
-        <duplicateCheck :data="form" @checkSuccess="checkSuccess"></duplicateCheck>
+        <duplicateCheck ref="check" :data="form"  @onSuccess="onClose"></duplicateCheck>
         <el-button size="small" type="primary" @click="onSave" class="normal-btn-width">确 定</el-button>
       </div>
     </el-drawer>
@@ -162,7 +162,7 @@
 </template>
 
 <script>
-import duplicateCheck from "@/HDrpManagement/projectChange/components/duplicateCheck";
+import duplicateCheck from "@/components/duplicatesCheck/projectCheck";
 export default {
   name: "add",
   inject:['enterpriseList','projectType','projectLead','projectPanl'],
@@ -295,7 +295,7 @@ export default {
       })
     },
     onSave(){
-      if (this.checkResults === ''){
+      /*if (this.checkResults === ''){
         this.duplicateCheck()
       }else {
         if (this.checkResults !== 0){
@@ -314,7 +314,12 @@ export default {
         }else {
           this.onSubmit()
         }
-      }
+      }*/
+      this.$refs.form.validate((valid) => {
+        if (!valid) return false
+        this.$refs.check.creatShow = true
+        this.$refs.check.listData()
+      })
     },
     onSubmit(){
       console.log(this.form)
@@ -447,6 +452,7 @@ export default {
     onClose(){
       this.$refs['form'].resetFields()
       this.dialogFormVisible = false
+      this.$emit('onSuccess')
     },
     /*获取品牌*/
     async queryBrand(){

+ 12 - 25
src/Form/projectChange/edit.vue

@@ -50,7 +50,7 @@
                 <el-cascader
                     :disabled="flagTag != 0"
                     style="width:100%"
-                    v-model="form.province"
+                    v-model="form.value"
                     :options="basicData.data().areaData"
                     @change="cascaderChange" clearable>
                 </el-cascader>
@@ -153,7 +153,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width inline-16">取 消</el-button>
-        <duplicateCheck :data="form"></duplicateCheck>
+        <duplicateCheck ref="check" :data="form"  @onSuccess="onClose"></duplicateCheck>
         <el-button size="small" type="warning" @click="onSave" class="normal-btn-width">保 存</el-button>
       </div>
     </el-drawer>
@@ -161,7 +161,7 @@
 </template>
 
 <script>
-import duplicateCheck from "@/HDrpManagement/projectChange/components/duplicateCheck";
+import duplicateCheck from "@/components/duplicatesCheck/projectCheck";
 export default {
   name: "add",
   inject:['enterpriseList','projectType','projectLead','projectPanl'],
@@ -279,12 +279,12 @@ export default {
   methods:{
     /*省市县*/
     cascaderChange (val) {
-      this.form = Object.assign({},this.form,{city:val[1],county:val[2]})
+      this.form = Object.assign({},this.form,{province:val[0],city:val[1],county:val[2]})
     },
     editBtn () {
       this.dialogFormVisible = true
       this.form = Object.assign({},this.form,this.data)
-      this.form.province = [this.form.province,this.form.city,this.form.county]
+      this.form.value = [this.form.province,this.form.city,this.form.county]
       /*this.form.grade = parseInt(this.form.grade)*/
       if (this.form.brandname === ''){
         this.form.sa_brandid = ''
@@ -319,26 +319,12 @@ export default {
       })
     },
     onSave(){
-      if (this.checkResults === ''){
-        this.duplicateCheck()
-      }else {
-        if (this.checkResults !== 0){
-          this.$confirm('该项目疑似重复,是否确认保存项目?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.onSubmit()
-          }).catch(() => {
-            this.$message({
-              type: 'info',
-              message: '已取消保存'
-            });
-          });
-        }else {
-          this.onSubmit()
-        }
-      }
+      this.$refs.form.validate((valid) => {
+        if (!valid) return false
+        this.$refs.check.creatShow = true
+        this.$refs.check.buttonTitle = '确定保存'
+        this.$refs.check.listData()
+      })
     },
     onSubmit(){
       if (this.form.signdate_due !== ''){
@@ -428,6 +414,7 @@ export default {
     },
     onClose(){
       this.dialogFormVisible = false
+      this.$emit('onSuccess')
     },
     /*获取品牌*/
     async queryBrand(){

+ 1 - 0
src/HDrpManagement/publicCustomer/modules/detail.vue

@@ -356,6 +356,7 @@ export default {
       this.$refs.detailed.basicData(this.$route.query.id)
       this.$refs.detailed.systemData(this.$route.query.id)
       this.queryMainData(this.$route.query.id)
+      this.$refs.details.refreshTag()
     },
     sysTag(val){
       this.tagFlag = false

+ 10 - 22
src/SManagement/orderclue_detail/components/changeCustomer.vue

@@ -188,7 +188,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="onClose" class="normal-btn-width inline-16">取 消</el-button>
-        <duplicateCheck :data="form" @checkSuccess="checkSuccess"></duplicateCheck>
+        <duplicateCheck :data="form" ref="check" @checkSuccess="checkSuccess" @onSuccess="onClose"></duplicateCheck>
         <el-button size="small" type="primary" @click="onSave" class="normal-btn-width">确 定</el-button>
       </div>
     </el-drawer>
@@ -197,7 +197,7 @@
 
 <script>
 import businessMessage from '@/components/businessMessage/index'
-import duplicateCheck from "@/SDrpManagement/salerPrivatecustomer/components/duplicateCheck";
+import duplicateCheck from "@/components/duplicatesCheck/customerChangeCheck";
 export default {
   props:["disabled","data"],
   name: "changeCustomer",
@@ -316,26 +316,12 @@ export default {
       })
     },
     onSave(){
-      if (this.checkResults === '' || this.checkResults === undefined){
-        this.duplicateCheck()
-      }else {
-        if (this.checkResults !== 0){
-          this.$confirm('该客户疑似重复,是否确认创建客户?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.onSubmit()
-          }).catch(() => {
-            this.$message({
-              type: 'info',
-              message: '已取消创建'
-            });
-          });
-        }else {
-          this.onSubmit()
-        }
-      }
+     this.form.enterprisename = this.form.enterprisename_customer
+      this.$refs.form.validate((valid) => {
+        if (!valid) return false
+        this.$refs.check.creatShow = true
+        this.$refs.check.listData()
+      })
     },
     async setTag(id){
       const res = await this.$api.requested({
@@ -426,6 +412,8 @@ export default {
       this.drawer = false
       this.checkResults = ''
       this.value = ''
+      this.$emit('onChangeCustomer')
+
     },
     /*获取工商信息*/
     onBusinessData(val){

+ 31 - 25
src/SManagement/orderclue_detail/components/changeProject.vue

@@ -126,7 +126,7 @@
 
             <el-col :span="24">
               <el-form-item label="领域:" prop="tradefields">
-                <el-select v-model="form.tradefields[0]" placeholder="请选择领域" style="width: 100%">
+                <el-select v-model="form.tradefields" placeholder="请选择领域" style="width: 100%">
                   <el-option
                       v-for="item in tradefieldSelect"
                       :key="item.value"
@@ -153,7 +153,7 @@
       </div>
       <div class="fixed__btn__panel">
         <el-button  size="small" @click="onClose" class="normal-btn-width inline-16">取 消</el-button>
-        <duplicateCheck :data="form" @checkSuccess="checkSuccess"></duplicateCheck>
+        <duplicateCheck :data="form" @checkSuccess="checkSuccess" ref="check" @onSuccess="onClose"></duplicateCheck>
         <el-button size="small" type="primary" @click="onSave" class="normal-btn-width">确 定</el-button>
       </div>
     </el-drawer>
@@ -161,7 +161,7 @@
 </template>
 
 <script>
-import duplicateCheck from "@/HDrpManagement/projectChange/components/duplicateCheck";
+import duplicateCheck from "@/components/duplicatesCheck/projectChangeCheck";
 export default {
   props:["disabled","data"],
   name: "changeProject",
@@ -218,7 +218,7 @@ export default {
         begdate_due:'', //预计开工时间
         enddate_due:'',  //预计完工时间
         sa_brandid:"",
-        tradefields:[],
+        tradefields:'',
         value:[],
       },
       value:'',
@@ -320,27 +320,32 @@ export default {
       this.checkResults = val
     },
     onSave(){
-      console.log(this.checkResults)
-      if (this.checkResults === '' || this.checkResults === undefined){
-        this.duplicateCheck()
-      }else {
-        if (this.checkResults !== 0){
-          this.$confirm('该项目疑似重复,是否确认创建项目?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.onSubmit()
-          }).catch(() => {
-            this.$message({
-              type: 'info',
-              message: '已取消创建'
-            });
-          });
-        }else {
-          this.onSubmit()
-        }
-      }
+      // console.log(this.checkResults)
+      // if (this.checkResults === '' || this.checkResults === undefined){
+      //   this.duplicateCheck()
+      // }else {
+      //   if (this.checkResults !== 0){
+      //     this.$confirm('该项目疑似重复,是否确认创建项目?', '提示', {
+      //       confirmButtonText: '确定',
+      //       cancelButtonText: '取消',
+      //       type: 'warning'
+      //     }).then(() => {
+      //       this.onSubmit()
+      //     }).catch(() => {
+      //       this.$message({
+      //         type: 'info',
+      //         message: '已取消创建'
+      //       });
+      //     });
+      //   }else {
+      //     this.onSubmit()
+      //   }
+      // }
+      this.$refs.form.validate((valid) => {
+        if (!valid) return false
+        this.$refs.check.creatShow = true
+        this.$refs.check.listData()
+      })
     },
     onSubmit(){
       console.log(this.form)
@@ -495,6 +500,7 @@ export default {
         tradefields:[],
         value:[],
       }
+      this.$emit('onChangeProject')
 
     },
     /*获取品牌*/

+ 164 - 0
src/components/duplicatesCheck/customerChangeCheck.vue

@@ -0,0 +1,164 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" @click="listData" class="inline-16 normal-btn-width">查 重</el-button>
+    <el-dialog title="重复客户" :visible.sync="dialogTableVisible" append-to-body width="1000px">
+      <tableLayout :layout="tablecols"   :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname === 'tag'">
+            <div v-for="item in scope.column.data.tag_sys" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag  color="#3874F6" size="mini" type="primary" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+            <div v-for="item in scope.column.data.tag" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag color="#FA8C16" size="mini" type="warning" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+          </div>
+          <div v-else-if="scope.column.columnname === 'leader'">
+            <span>{{scope.column.data.leader?scope.column.data.leader.length !== 0 ? scope.column.data.leader[0].name:'--':'--'}}</span>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
+        </template>
+      </tableLayout>
+      <div  class="container normal-panel" style="text-align:right">
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-sizes="[20, 50, 100, 200]"
+            :page-size="20"
+            :total="total">
+        </el-pagination>
+      </div>
+      <span slot="footer" class="dialog-footer" v-if="creatShow">
+        <el-button @click="dialogTableVisible = false" size="small" class="normal-btn-width">取 消</el-button>
+        <el-button :type="buttonTitle === '确定保存'?'warning':'primary'" @click="onCheck" size="small" class="normal-btn-width">{{buttonTitle}}</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "customerCheck",
+  props:["data"],
+  data(){
+    return {
+      dialogTableVisible:false,
+      list:[],
+      tablecols:[],
+      total:0,
+      currentPage:0,
+      duplicates:false,
+      creatShow:false,
+      message:'该客户疑似重复,是否确认创建客户?',
+      buttonTitle:'确定创建',
+      param:{
+        "id": 20221208172002,
+        "content": {
+          "sa_customersid":'',
+          "enterprisename":'',
+          "taxno":'',
+          "address":''
+        },
+      }
+    }
+  },
+  methods:{
+    async listData(){
+      console.log(this.data,'data')
+      this.param.content.sa_customersid = this.data.sa_customersid || 0
+      this.param.content.enterprisename = this.data.enterprisename_customer
+      this.param.content.taxno = this.data.taxno
+      this.param.content.address = this.data.address
+      const res = await this.$api.requested(this.param)
+      if (res.total > 0){
+        this.list = res.data
+        this.total = res.total
+        this.currentPage = res.pageNumber
+        this.dialogTableVisible = true
+      }else {
+        if (this.creatShow){
+          this.onSubmit()
+        }else {
+          this.$message({
+            message: '无重复数据',
+            type: 'success'
+          });
+        }
+      }
+    },
+    onCheck(){
+      if (this.buttonTitle === '确定保存'){
+        this.message = '该客户疑似重复,是否确认更新客户?'
+      }else {
+        this.message = '该客户疑似重复,是否确认创建客户?'
+      }
+      this.$confirm(this.message, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.duplicates = true
+        this.onSubmit()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      });
+    },
+    async onSubmit(){
+      console.log(this.data,'data')
+      const res = await this.$api.requested({
+        "id": 20221216184302,
+        "content": this.data
+      })
+      this.tool.showMessage(res,()=>{
+        console.log(res,'res')
+        console.log(this.duplicates,'duplicates')
+        if (this.duplicates){
+          this.setTag(res.data.sa_customersid,'疑似重复')
+        }else {
+          this.$emit('onSuccess')
+         /* this.setTag(res.data.sa_customersid,'')*/
+        }
+      })
+    },
+    async setTag(id,data){
+      console.log(id,data,'设置标签')
+      const res = await this.$api.requested({
+        "id": 20220929090901,
+        "content": {
+          "ownertable":"sa_customers",
+          "ownerid":id,
+          "datatag":[data]
+        }
+      })
+      this.dialogTableVisible = false
+      this.duplicates = false
+      this.$emit('onSuccess')
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).duplicatesCustomerTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 53 - 6
src/components/duplicatesCheck/customerCheck.vue

@@ -44,7 +44,7 @@
 <script>
 export default {
   name: "customerCheck",
-  props:["data",'creatShow'],
+  props:["data"],
   data(){
     return {
       dialogTableVisible:false,
@@ -53,6 +53,7 @@ export default {
       total:0,
       currentPage:0,
       duplicates:false,
+      creatShow:false,
       message:'该客户疑似重复,是否确认创建客户?',
       buttonTitle:'确定创建',
       param:{
@@ -115,27 +116,73 @@ export default {
         "content": this.data
       })
       this.tool.showMessage(res,()=>{
+        console.log(this.duplicates,'duplicates')
         if (this.duplicates){
-          this.setTag(res.data.sa_customersid)
+          if (this.buttonTitle === '确定保存'){
+            this.tagData(res.data.sa_customersid)
+          }else {
+            let data = ['疑似重复']
+            this.setTag(res.data.sa_customersid,data)
+          }
+
+
         }else {
           this.$emit('onSuccess')
+          /* this.setTag(res.data.sa_customersid,'')*/
         }
       })
     },
-    async setTag(id){
+    async setTag(id,data){
+      console.log(id,data,'设置标签')
       const res = await this.$api.requested({
         "id": 20220929090901,
         "content": {
           "ownertable":"sa_customers",
           "ownerid":id,
-          "datatag":[
-            "疑似重复",
-          ]
+          "datatag":data
         }
       })
       this.dialogTableVisible = false
+      this.duplicates = false
       this.$emit('onSuccess')
     },
+    // 获取标签数据
+    async tagData(id){
+      const res = await this.$api.requested({
+        content: {
+          ownertable: "sa_customers",
+          ownerid: this.$route.query.id
+        },
+        id: 20220929085401
+      })
+      console.log(res,'获取标签')
+      console.log(this.duplicates)
+      var resTagData = []
+      resTagData = res.data.datatag
+      if (this.duplicates){
+        let flag = 0
+        for (var i=0;i<res.data.datatag.length;i++){
+          if (res.data.datatag[i] === '疑似重复'){
+            flag = 1
+            break
+          }
+        }
+        if (flag === 1){
+          this.setTag(id,resTagData)
+        }else {
+          resTagData.push('疑似重复')
+          this.setTag(id,resTagData)
+        }
+      }else {
+        for (var k=0;k<res.data.datatag.length;k++){
+          if (res.data.datatag[k] === '疑似重复'){
+            resTagData.splice(k)
+            break
+          }
+        }
+        this.setTag(id,resTagData)
+      }
+    },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
       this.param.content.pageSize = val

+ 162 - 0
src/components/duplicatesCheck/projectChangeCheck.vue

@@ -0,0 +1,162 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" @click="listData" class="inline-16 normal-btn-width">查 重</el-button>
+    <el-dialog title="重复客户" :visible.sync="dialogTableVisible" append-to-body width="1000px">
+      <tableLayout :layout="tablecols"   :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname === 'tag'">
+            <div v-for="item in scope.column.data.tag_sys" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag  color="#3874F6" size="mini" type="primary" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+            <div v-for="item in scope.column.data.tag" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag color="#FA8C16" size="mini" type="warning" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+          </div>
+          <div v-else-if="scope.column.columnname === 'leader'">
+            <span>{{scope.column.data.leader?scope.column.data.leader.length !== 0 ? scope.column.data.leader[0].name:'--':'--'}}</span>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
+        </template>
+      </tableLayout>
+      <div  class="container normal-panel" style="text-align:right">
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-sizes="[20, 50, 100, 200]"
+            :page-size="20"
+            :total="total">
+        </el-pagination>
+      </div>
+      <span slot="footer" class="dialog-footer" v-if="creatShow">
+        <el-button @click="dialogTableVisible = false" size="small" class="normal-btn-width">取 消</el-button>
+        <el-button :type="buttonTitle === '确定保存'?'warning':'primary'" @click="onCheck" size="small" class="normal-btn-width">{{buttonTitle}}</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "customerCheck",
+  props:["data"],
+  data(){
+    return {
+      dialogTableVisible:false,
+      list:[],
+      tablecols:[],
+      total:0,
+      currentPage:0,
+      duplicates:false,
+      creatShow:false,
+      message:'该项目疑似重复,是否确认创建项目?',
+      buttonTitle:'确定创建',
+      param:{
+        "id": 20221208184202,
+        "content": {
+          "sa_projectid":"",
+          "projectname":"",
+          "address":""
+        },
+      }
+    }
+  },
+  methods:{
+    async listData(){
+      console.log(this.data,'data')
+      this.param.content.sa_projectid = this.data.sa_projectid || 0
+      this.param.content.projectname = this.data.projectname
+      this.param.content.address = this.data.address
+      const res = await this.$api.requested(this.param)
+      if (res.total > 0){
+        this.list = res.data
+        this.total = res.total
+        this.currentPage = res.pageNumber
+        this.dialogTableVisible = true
+      }else {
+        if (this.creatShow){
+          this.onSubmit()
+        }else {
+          this.$message({
+            message: '无重复数据',
+            type: 'success'
+          });
+        }
+      }
+    },
+    onCheck(){
+      if (this.buttonTitle === '确定保存'){
+        this.message = '该项目疑似重复,是否确认更新项目?'
+      }else {
+        this.message = '该项目疑似重复,是否确认创建项目?'
+      }
+      this.$confirm(this.message, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.duplicates = true
+        this.onSubmit()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      });
+    },
+    async onSubmit(){
+      console.log(this.data,'data')
+      const res = await this.$api.requested({
+        "id": 20221124154902,
+        "content": this.data
+      })
+      this.tool.showMessage(res,()=>{
+        console.log(res,'res')
+        console.log(this.duplicates,'duplicates')
+        if (this.duplicates){
+          this.setTag(res.data.sa_projectid,'疑似重复')
+        }else {
+          this.$emit('onSuccess')
+         /* this.setTag(res.data.sa_customersid,'')*/
+        }
+      })
+    },
+    async setTag(id,data){
+      console.log(id,data,'设置标签')
+      const res = await this.$api.requested({
+        "id": 20220929090901,
+        "content": {
+          "ownertable":"sa_project",
+          "ownerid":id,
+          "datatag":[data]
+        }
+      })
+      this.dialogTableVisible = false
+      this.duplicates = false
+      this.$emit('onSuccess')
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).duplicatesProjectTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 203 - 0
src/components/duplicatesCheck/projectCheck.vue

@@ -0,0 +1,203 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" @click="listData" class="inline-16 normal-btn-width">查 重</el-button>
+    <el-dialog title="重复项目" :visible.sync="dialogTableVisible" append-to-body width="1000px">
+      <tableLayout :layout="tablecols"   :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname === 'tag'">
+            <div v-for="item in scope.column.data.tag_sys" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag  color="#3874F6" size="mini" type="primary" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+            <div v-for="item in scope.column.data.tag" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag color="#FA8C16" size="mini" type="warning" effect="dark">
+                <span>{{item}}</span>
+              </el-tag>
+            </div>
+          </div>
+          <div v-else-if="scope.column.columnname === 'leader'">
+            <span>{{scope.column.data.leader?scope.column.data.leader.length !== 0 ? scope.column.data.leader[0].name:'--':'--'}}</span>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'--'}}</p>
+        </template>
+      </tableLayout>
+      <div  class="container normal-panel" style="text-align:right">
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-sizes="[20, 50, 100, 200]"
+            :page-size="20"
+            :total="total">
+        </el-pagination>
+      </div>
+      <span slot="footer" class="dialog-footer" v-if="creatShow">
+        <el-button @click="dialogTableVisible = false" size="small" class="normal-btn-width">取 消</el-button>
+        <el-button :type="buttonTitle === '确定保存'?'warning':'primary'" @click="onCheck" size="small" class="normal-btn-width">{{buttonTitle}}</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "customerCheck",
+  props:["data"],
+  data(){
+    return {
+      dialogTableVisible:false,
+      list:[],
+      tablecols:[],
+      total:0,
+      currentPage:0,
+      duplicates:false,
+      creatShow:false,
+      message:'该项目疑似重复,是否确认创建项目?',
+      buttonTitle:'确定创建',
+      param:{
+        "id": 20221208184202,
+        "content": {
+          "sa_projectid":"",
+          "projectname":"",
+          "address":""
+        },
+      }
+    }
+  },
+  methods:{
+    async listData(){
+      this.param.content.sa_projectid = this.data.sa_projectid || 0
+      this.param.content.projectname = this.data.projectname
+      this.param.content.address = this.data.address
+      const res = await this.$api.requested(this.param)
+      if (res.total > 0){
+        this.list = res.data
+        this.total = res.total
+        this.currentPage = res.pageNumber
+        this.dialogTableVisible = true
+      }else {
+        if (this.creatShow){
+          this.onSubmit()
+        }else {
+          this.$message({
+            message: '无重复数据',
+            type: 'success'
+          });
+        }
+      }
+    },
+    onCheck(){
+      if (this.buttonTitle === '确定保存'){
+        this.message = '该项目疑似重复,是否确认更新项目?'
+      }else {
+        this.message = '该项目疑似重复,是否确认创建项目?'
+      }
+      this.$confirm(this.message, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.duplicates = true
+        this.onSubmit()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      });
+    },
+    async onSubmit(){
+      const res = await this.$api.requested({
+        "id": 20221020144202,
+        "content": this.data
+      })
+      this.tool.showMessage(res,()=>{
+        console.log(this.duplicates,'duplicates')
+        if (this.duplicates){
+          if (this.buttonTitle === '确定保存'){
+            this.tagData(res.data.sa_projectid)
+          }else {
+            let data = ['疑似重复']
+            this.setTag(res.data.sa_projectid,data)
+          }
+
+
+        }else {
+          this.$emit('onSuccess')
+         /* this.setTag(res.data.sa_customersid,'')*/
+        }
+      })
+    },
+    async setTag(id,data){
+      console.log(id,data,'设置标签')
+      const res = await this.$api.requested({
+        "id": 20220929090901,
+        "content": {
+          "ownertable":"sa_project",
+          "ownerid":id,
+          "datatag":data
+        }
+      })
+      this.dialogTableVisible = false
+      this.duplicates = false
+      this.$emit('onSuccess')
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+    // 获取标签数据
+    async tagData(id){
+      const res = await this.$api.requested({
+        content: {
+          ownertable: "sa_project",
+          ownerid: this.$route.query.id
+        },
+        id: 20220929085401
+      })
+      console.log(res,'获取标签')
+      console.log(this.duplicates)
+      var resTagData = []
+      resTagData = res.data.datatag
+     if (this.duplicates){
+       let flag = 0
+       for (var i=0;i<res.data.datatag.length;i++){
+         if (res.data.datatag[i] === '疑似重复'){
+           flag = 1
+           break
+         }
+       }
+       if (flag === 1){
+         this.setTag(id,resTagData)
+       }else {
+         resTagData.push('疑似重复')
+         this.setTag(id,resTagData)
+       }
+     }else {
+       for (var k=0;k<res.data.datatag.length;k++){
+         if (res.data.datatag[k] === '疑似重复'){
+           resTagData.splice(k)
+           break
+         }
+       }
+       this.setTag(id,resTagData)
+     }
+    },
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).duplicatesProjectTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 49 - 5
src/components/duplicatesCheck/publicCustomerCheck.vue

@@ -116,24 +116,31 @@ export default {
       })
       this.tool.showMessage(res,()=>{
         if (this.duplicates){
-          this.setTag(res.data.sa_customersid)
+          if (this.buttonTitle === '确定保存'){
+            this.tagData(res.data.sa_customersid)
+          }else {
+            let data = ['疑似重复']
+            this.setTag(res.data.sa_customersid,data)
+          }
+
+
         }else {
           this.$emit('onSuccess')
+          /* this.setTag(res.data.sa_customersid,'')*/
         }
       })
     },
-    async setTag(id){
+    async setTag(id,data){
       const res = await this.$api.requested({
         "id": 20220929090901,
         "content": {
           "ownertable":"sa_customers",
           "ownerid":id,
-          "datatag":[
-            "疑似重复",
-          ]
+          "datatag":data
         }
       })
       this.dialogTableVisible = false
+      this.duplicates = false
       this.$emit('onSuccess')
     },
     handleSizeChange(val) {
@@ -146,6 +153,43 @@ export default {
       this.param.content.pageNumber = val
       this.listData()
     },
+    // 获取标签数据
+    async tagData(id){
+      const res = await this.$api.requested({
+        content: {
+          ownertable: "sa_customers",
+          ownerid: this.$route.query.id
+        },
+        id: 20220929085401
+      })
+      console.log(res,'获取标签')
+      console.log(this.duplicates)
+      var resTagData = []
+      resTagData = res.data.datatag
+      if (this.duplicates){
+        let flag = 0
+        for (var i=0;i<res.data.datatag.length;i++){
+          if (res.data.datatag[i] === '疑似重复'){
+            flag = 1
+            break
+          }
+        }
+        if (flag === 1){
+          this.setTag(id,resTagData)
+        }else {
+          resTagData.push('疑似重复')
+          this.setTag(id,resTagData)
+        }
+      }else {
+        for (var k=0;k<res.data.datatag.length;k++){
+          if (res.data.datatag[k] === '疑似重复'){
+            resTagData.splice(k)
+            break
+          }
+        }
+        this.setTag(id,resTagData)
+      }
+    },
   },
   created() {
     this.tablecols = this.tool.tabelCol(this.$route.name).duplicatesCustomerTable.tablecols