contacts.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="新 建"
  5. :visible.sync="dialogProjectVisible"
  6. append-to-body
  7. width="900px">
  8. <div slot="title" style="font-size: 15px">
  9. 选择联系人
  10. </div>
  11. <layout_table
  12. ref="projectTable"
  13. :layout="tablecols"
  14. :data="list"
  15. :opwidth="200"
  16. :custom="false"
  17. :height="320"
  18. :checkbox="true"
  19. :onRow="row"
  20. @rowClick="rowClick"
  21. @onRow="onRow"
  22. >
  23. </layout_table>
  24. <div style="margin-top:16px;text-align:right">
  25. <el-pagination
  26. background
  27. small
  28. @size-change="handleSizeChange"
  29. @current-change="handleCurrentChange"
  30. :current-page="currentPage"
  31. :page-size="params.content.pageSize"
  32. layout="total, prev, pager, next, jumper"
  33. :total="total">
  34. </el-pagination>
  35. </div>
  36. <div class="dialog-footer">
  37. <el-button size="small" @click="onColes" class="normal-btn-width">取 消</el-button>
  38. <el-button size="small" type="warning" class="normal-btn-width btn-warning" @click="onSubmit">确 定</el-button>
  39. </div>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script>
  44. import layout_table from '../components/table'
  45. export default {
  46. name: "contacts",
  47. props:["visible","index","sys_enterpriseid"],
  48. data(){
  49. return {
  50. dialogProjectVisible:false,
  51. bill_id:"",
  52. tablecols:[],
  53. list:[],
  54. total:0,
  55. currentPage:0,
  56. row:"",
  57. params:{
  58. "id": "20221022165503",
  59. "version": 1,
  60. "content": {
  61. "sys_enterpriseid": '',
  62. "where": {
  63. "condition": "",
  64. "workaddress": 0//0表示人,1表示地址
  65. }
  66. }
  67. }
  68. }
  69. },
  70. components:{layout_table},
  71. mounted() {
  72. console.log(this.visible)
  73. this.dialogProjectVisible = true
  74. console.log(this.index)
  75. console.log("企业id"+this.sys_enterpriseid)
  76. this.listData()
  77. },
  78. methods:{
  79. async listData(){
  80. this.params.content.sys_enterpriseid = this.sys_enterpriseid
  81. const res = await this.$api.requested(this.params)
  82. this.list = res.data
  83. this.total = res.total
  84. console.log(this.list[0])
  85. if (this.index !== ''){
  86. this.toggleSelection([this.list[this.index]])
  87. }
  88. },
  89. handleSizeChange(val) {
  90. // console.log(`每页 ${val} 条`);
  91. this.params.content.pageSize = val
  92. this.listData()
  93. },
  94. handleCurrentChange(val) {
  95. // console.log(`当前页: ${val}`);
  96. this.params.content.pageNumber = val
  97. this.listData()
  98. },
  99. onColes(){
  100. this.dialogProjectVisible = false
  101. this.$emit("onContacts")
  102. },
  103. onRow(row){
  104. console.log("**********************---------------------")
  105. console.log("勾选")
  106. console.log(row)
  107. this.row = row
  108. },
  109. onSubmit(){
  110. console.log("**********************---------------------")
  111. this.dialogProjectVisible = false
  112. this.$emit("onContacts",this.row)
  113. console.log(this.row)
  114. },
  115. toggleSelection(rows) {
  116. console.log("保存")
  117. console.log(rows)
  118. if (rows) {
  119. rows.forEach(row => {
  120. console.log("保存输出")
  121. console.log(row)
  122. console.log(this.$refs.projectTable.$refs.tables)
  123. this.$refs.projectTable.$refs.tables.setCurrentRow(row);
  124. });
  125. } else {
  126. this.$refs.projectTable.$refs.tables.clearSelection();
  127. }
  128. },
  129. rowClick(row){
  130. console.log("选中")
  131. console.log(row)
  132. }
  133. },
  134. created() {
  135. this.tablecols = this.tool.tabelCol(this.$route.name).contactsTable.tablecols
  136. }
  137. }
  138. </script>
  139. <style scoped>
  140. </style>