list.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div>
  3. <addContact @onAddSuccess="listData" :mainData="mainData"></addContact>
  4. <tableLayout :layout="tablecols" :data="list" :custom="true" height="calc(100vh - 455px)" fixedName="operation">
  5. <template v-slot:customcol="scope">
  6. <p v-if="scope.column.columnname === 'province'">
  7. {{scope.column.data['province']}}-{{scope.column.data['city']}}-{{scope.column.data['county']}}
  8. </p>
  9. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  10. </template>
  11. <template v-slot:opreation="scope">
  12. <edit-contact class="inline-16" :mainData="mainData" :row="scope.data" @onAddSuccess="listData"></edit-contact>
  13. <el-popconfirm
  14. title="确定删除吗?"
  15. @confirm="deleteContacts(scope.data)">
  16. <el-button size="small" type="text" slot="reference">删 除</el-button>
  17. </el-popconfirm>
  18. </template>
  19. </tableLayout>
  20. </div>
  21. </template>
  22. <script>
  23. import editContact from './edit.vue'
  24. import addContact from './add.vue'
  25. export default {
  26. props:['mainData'],
  27. data () {
  28. return {
  29. list:[],
  30. param:{}
  31. }
  32. },
  33. components:{
  34. addContact,
  35. editContact
  36. },
  37. methods:{
  38. async listData () {
  39. const res = await this.$api.requested({
  40. "id": "20221009155803",
  41. "content": {
  42. "sys_enterpriseid":this.mainData.sys_enterpriseid,
  43. "where":{
  44. "condition":"",
  45. "workaddress":0
  46. }
  47. }
  48. })
  49. this.list = res.data
  50. },
  51. async deleteContacts (row) {
  52. const res = await this.$api.requested({
  53. "id": "20221009155903",
  54. "version":1,
  55. "content": {
  56. "contactsid":row.contactsid
  57. }
  58. })
  59. this.tool.showMessage(res,()=>{
  60. this.listData()
  61. })
  62. }
  63. },
  64. mounted () {
  65. this.listData()
  66. },
  67. watch:{
  68. mainData (val) {
  69. this.param = val
  70. }
  71. },
  72. created () {
  73. // 获取角色表结构
  74. this.tablecols = this.tool.tabelCol(this.$route.name)['addressAndContact'].tablecols
  75. }
  76. }
  77. </script>
  78. <style>
  79. </style>