index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div>
  3. <el-popover
  4. :placement="placement || 'bottom-start'"
  5. width="900"
  6. v-model="show"
  7. trigger="click">
  8. <el-input style="width:200px;margin-bottom: 10px" :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="clearSearchValue" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
  9. </el-input>
  10. <el-table
  11. border
  12. height="500px"
  13. :data="list"
  14. @row-click="contactSelect"
  15. :header-cell-style="{background:'#EEEEEE',color:'#333'}"
  16. size="mini">
  17. <el-table-column width="80" :label="$t(`姓名`)">
  18. <template slot-scope="scope">
  19. <span >{{ scope.row.name?scope.row.name:'--' }}</span>
  20. </template>
  21. </el-table-column>
  22. <el-table-column width="120" :label="$t(`联系方式`)">
  23. <template slot-scope="scope">
  24. <span >{{ scope.row.phonenumber?scope.row.phonenumber:'--' }}</span>
  25. </template>
  26. </el-table-column>
  27. <el-table-column width="200" :label="$t(`邮箱`)">
  28. <template slot-scope="scope">
  29. <span >{{ scope.row.email?scope.row.email:'--' }}</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column width="200" :label="$t(`单位`)">
  33. <template slot-scope="scope">
  34. <span >{{ scope.row.enterprisename?scope.row.enterprisename:'--' }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column width="120" :label="$t(`部门`)">
  38. <template slot-scope="scope">
  39. <span >{{ scope.row.position?scope.row.position:'--' }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column width="120" :label="$t(`职位`)">
  43. <template slot-scope="scope">
  44. <span >{{ scope.row.depname?scope.row.depname:'--' }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column width="80" :label="$t(`性别`)">
  48. <template slot-scope="scope">
  49. <span >{{ scope.row.sex?scope.row.sex:'--' }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column width="120" :label="$t(`生日`)">
  53. <template slot-scope="scope">
  54. <span >{{ scope.row.birthday?scope.row.birthday:'--' }}</span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column width="300" :label="$t(`家庭住址`)">
  58. <template slot-scope="scope">
  59. <span >{{ scope.row.address?scope.row.address:'--' }}</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column width="200" :label="$t(`备注`)">
  63. <template slot-scope="scope">
  64. <span >{{ scope.row.remarks?scope.row.remarks:'--' }}</span>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div class="container normal-panel" style="text-align:right">
  69. <el-pagination
  70. background
  71. @size-change="handleSizeChange"
  72. @current-change="handleCurrentChange"
  73. :current-page="currentPage"
  74. :page-sizes="[20, 50, 100, 200]"
  75. :page-size="20"
  76. layout="total,sizes, prev, pager, next, jumper"
  77. :total="total">
  78. </el-pagination>
  79. </div>
  80. <el-input slot="reference" :readonly="isReadonly" autosize v-model="name?name:nameValue" :placeholder="$t('请填写联系人')" @focus="listData" :disabled="disabled" @change="inputChange"></el-input>
  81. </el-popover>
  82. </div>
  83. </template>
  84. <script>
  85. export default {
  86. name: "index",
  87. props:['disabled','ownertable','ownerid','name','placement','isParam','newParam','isReadonly','phonenumber'],
  88. data(){
  89. return {
  90. list:[],
  91. show:false,
  92. currentPage:0,
  93. total:0,
  94. param:{
  95. "id": 20240531152004,
  96. "content": {
  97. "phonenumber":'',
  98. "ownertable":"sa_project",// 客户 sys_enterprise 项目 sa_project
  99. "ownerid":"7074",// 客户 sys_enterpriseid 项目 sa_projectid
  100. "pageNumber": 1,
  101. "pageSize": 20,
  102. "where":{
  103. "condition":""
  104. }
  105. }
  106. },
  107. nameValue:''
  108. }
  109. },
  110. methods:{
  111. async listData(){
  112. console.log('激活')
  113. console.log(this.phonenumber,'手机号')
  114. if (this.isParam){
  115. this.param = this.newParam
  116. }else {
  117. this.param.content.ownertable = this.ownertable
  118. this.param.content.ownerid = this.ownerid
  119. }
  120. if (this.phonenumber) {
  121. this.param.content.phonenumber = this.phonenumber
  122. }
  123. const res = await this.$api.requested(this.param)
  124. this.list = res.data
  125. this.total = res.total
  126. this.currentPage = res.pageNumber
  127. },
  128. contactSelect(val){
  129. this.nameValue = val.name
  130. this.show = false
  131. this.param.content.where.condition = ''
  132. this.$emit('contactData',val)
  133. },
  134. handleSizeChange(val) {
  135. // console.log(`每页 ${val} 条`);
  136. this.param.content.pageSize = val
  137. this.listData()
  138. },
  139. handleCurrentChange(val) {
  140. // console.log(`当前页: ${val}`);
  141. this.param.content.pageNumber = val
  142. this.listData()
  143. },
  144. inputChange(){
  145. this.$emit('inputChange',this.nameValue)
  146. },
  147. clearSearchValue () {
  148. this.$store.dispatch('clearSearchValue')
  149. this.listData(this.param.content.pageNumber = 1)
  150. }
  151. },
  152. mounted() {
  153. },
  154. watch:{
  155. 'show':function (val){
  156. if (!val){
  157. this.param.content.where.condition = ''
  158. }
  159. },
  160. 'name':function (val){
  161. val?this.nameValue = val:this.nameValue = ''
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped>
  167. /deep/ .el-input__validateIcon {
  168. display: none;
  169. }
  170. </style>