|
@@ -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>
|