qymljy 1 bulan lalu
induk
melakukan
89173db9cc

+ 30 - 22
src/HManagement/addressList/mycontact/modules/addContact.vue

@@ -35,24 +35,17 @@
             </el-col>
             <el-col :span="24">
               <el-form-item :label="$t(`关联客户`)+':'" prop="sys_enterpriseids">
-<!--                <popoverTemplate ref="enterpriseRef" :params="enterpriseParam"></popoverTemplate>-->
-                <el-select
-                    clearable
-                    v-model="form.tradeCode"
-                    placeholder="请选择"
-                    ref="select"
-                >
-                  <el-option v-show="false" value="1"></el-option>
-                  <el-table
-
-                      border
-                      highlight-current-row
-
-                  >
-                    <el-table-column label="名称" prop="name" />
-                    <el-table-column label="编码" prop="code" />
-                  </el-table>
-                  </el-select>
+                <el-tag
+                    style="float: left;margin-right: 5px;margin-bottom: 5px"
+                    v-for="tag in selectTag"
+                    :key="tag.rowindex"
+                    closable
+                    @close="closeTag(tag)"
+                    :type="tag.type">
+                  {{$t(tag.name)}}
+                </el-tag>
+                <tableDataAdd :tablecols="tool.tabelCol($route.name).selectEnterpriseTable.tablecols" btnTitle="添加" :param="enterpriseParam" @onSelect="onSelect"
+                :selectData="selectTag"></tableDataAdd>
               </el-form-item>
             </el-col>
             <el-col :span="24">
@@ -156,9 +149,10 @@
 <script>
 import {mapGetters} from 'vuex'
 import popoverTemplate from '@/components/popoverTemplate/index'
+import tableDataAdd from '@/components/tableDataAdd/index'
 export default {
   props:['group','tagList'],
-  components:{popoverTemplate},
+  components:{popoverTemplate,tableDataAdd},
   data () {
     var telephone = (rule,value,callback) =>{
       if (this.form.areaCode === '' && this.form.telephone === ''){
@@ -219,13 +213,14 @@ export default {
       enterpriseParam:{
         "content": {
           "pageNumber": 1,
-          "pageSize": 9999,
+          "pageSize": 50,
           "where": {
             "condition": ""
           }
         },
         "id": 2025041710422802,
-      }
+      },
+      selectTag:[]
     }
   },
   watch: {
@@ -344,7 +339,20 @@ export default {
         }
       })
       this.groupList = res.data
-    }
+    },
+    onSelect(row){
+      this.selectTag = row
+      this.form.sys_enterpriseids = row.map(item=>item.sys_enterpriseid)
+    },
+    closeTag(row){
+      for (var i=0;i<this.selectTag.length;i++){
+        if (row.sys_enterpriseid === this.selectTag[i].sys_enterpriseid){
+          this.selectTag.splice(i,1)
+          this.form.sys_enterpriseids.splice(i,1)
+          break
+        }
+      }
+    },
   },
   mounted () {
     this.$store.dispatch('optiontypeselect','sex')

+ 3 - 4
src/components/table/index5.vue

@@ -3,7 +3,7 @@
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
     <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'':'calc(100vh - 420px)':height"  @row-click="rowClick"
               style="width:100%;min-height:260px;max-height: calc(100vh - 420px)" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
-              :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
+              :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" v-loading="loading">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
@@ -41,14 +41,13 @@ export default {
     return {
       list:[],
       allArr:[],
-      loading:false
     }
   },
-  /*computed:{
+  computed:{
     ...mapGetters({
       loading:'loading'
     })
-  },*/
+  },
   watch:{
     data(val){
       this.doLayout()

+ 129 - 0
src/components/tableDataAdd/index.vue

@@ -0,0 +1,129 @@
+<template>
+  <div>
+    <el-popover
+        placement="left"
+        width="800"
+        trigger="click"
+        v-model="popoverShow"
+    >
+      <div style="display: flex;justify-content: space-between">
+        <el-input  style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
+        </el-input>
+        <el-button type="primary" size="small" @click="onSelect">{{$t(`确定`)}}</el-button>
+      </div>
+      <tableList ref="table" height="600px"  style="margin-top: 10px" :checkbox="true"   :layout="tablecols" :data="list" :opwidth="200" :custom="true" @selectionChange="selectionChange"
+      >
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname === 'tag'">
+            <div v-if="scope.column.data.tag_sys.length > 0 || scope.column.data.tag.length > 0">
+              <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>{{$t(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>{{$t(item)}}</span>
+                </el-tag>
+              </div>
+            </div>
+            <p v-else>--</p>
+          </div>
+          <div v-else-if="scope.column.columnname === 'industry'">
+            <span
+                v-if="
+                JSON.stringify(scope.column.data.industry) !== '[]' &&
+                scope.column.data.industry
+              "
+            >
+              <div
+                  v-for="item in scope.column.data.industry"
+                  :key="item.index"
+                  style="float: left; margin-left: 5px; margin-bottom: 5px"
+              >
+                <el-tag size="mini" effect="dark">
+                  <span>{{ $t(item) }}</span>
+                </el-tag>
+              </div>
+            </span>
+            <div v-else>--</div>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]?$t(scope.column.data[scope.column.columnname]):'--'}}</p>
+        </template>
+      </tableList>
+      <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="50"
+            layout="total,sizes, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>
+      <el-button slot="reference" style="float: left" @click="onShow" size="small" type="primary" icon="el-icon-plus">{{$t(btnTitle)}}</el-button>
+    </el-popover>
+  </div>
+</template>
+
+<script>
+import tableList from '@/components/table/index5';
+export default {
+  name: "index",
+  props:["tablecols","btnTitle","param",'selectData'],
+  components:{tableList},
+  data(){
+    return {
+      popoverShow:false,
+      list:[],
+      select:[],
+      total:0,
+      currentPage:0,
+    }
+  },
+  methods:{
+    onShow(){
+      // this.popoverShow = true
+      this.listData()
+    },
+    async listData(){
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+      console.log(this.selectData,'selectData')
+      this.selectData.forEach(item=>{
+        this.list.forEach((k,index)=>{
+          if (item.sys_enterpriseid == k.sys_enterpriseid){
+            this.list.splice(index,1)
+          }
+        })
+      })
+      console.log(this.list,'列表数据')
+    },
+    selectionChange(row){
+      this.select = [...row,...this.selectData]
+    },
+    onSelect(){
+      this.popoverShow = false
+      this.$emit('onSelect',this.select)
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>