index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryForm" inline size="small">
  4. <el-form-item label="公司名称">
  5. <el-input v-model="queryForm.name" placeholder="公司名称" />
  6. </el-form-item>
  7. <el-form-item label="统一社会信用编码">
  8. <el-input v-model="queryForm.socialCode" placeholder="统一社会信用编码" />
  9. </el-form-item>
  10. <el-form-item label="法人姓名">
  11. <el-input v-model="queryForm.legalPersonName" placeholder="法人姓名" />
  12. </el-form-item>
  13. <el-form-item label="联系人">
  14. <el-input v-model="queryForm.contacts" placeholder="联系人" />
  15. </el-form-item>
  16. <el-form-item label="联系电话">
  17. <el-input v-model="queryForm.contactNumber" placeholder="联系电话" />
  18. </el-form-item>
  19. </el-form>
  20. <el-row class="action-bar-container" type="flex" justify="end">
  21. <el-button type="primary" size="small" @click.native="fetchData">查询</el-button>
  22. <el-button-group>
  23. <el-button v-permission="['category.organization.add']" size="small" @click.native="$refs.dialogForm.open({})">
  24. 添加
  25. </el-button>
  26. <el-button v-permission="['category.organization.delete']" size="small" @click.native="deleteByIds(multipleSelection)">
  27. 删除
  28. </el-button>
  29. </el-button-group>
  30. </el-row>
  31. <el-table
  32. v-loading="isLoading"
  33. :data="pageData.records"
  34. border
  35. fit
  36. highlight-current-row
  37. @selection-change="selectionChange"
  38. >
  39. <el-table-column type="selection" width="55" />
  40. <el-table-column label="ID" prop="id" width="150" />
  41. <el-table-column label="公司名称" prop="name" width="200">
  42. <template slot-scope="scope">
  43. {{ scope.row.name }}
  44. <el-tooltip v-if="scope.row.remark && scope.row.remark!==''" placement="top">
  45. <div slot="content">{{ scope.row.remark }}</div>
  46. <i class="el-icon-info" />
  47. </el-tooltip>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="统一社会信用编码" prop="socialCode" width="200" />
  51. <el-table-column label="法人姓名" prop="legalPersonName" width="150" />
  52. <el-table-column label="联系人" prop="contacts" width="200" />
  53. <el-table-column label="联系电话" prop="contactNumber" width="200" />
  54. <el-table-column label="联系地址" prop="contactAddress" width="300" />
  55. <!-- <el-table-column label="备注说明" prop="remark" min-width="300"/>-->
  56. <el-table-column label="创建时间" prop="createdTime" :formatter="dateTimeFormatter" width="180" />
  57. <el-table-column label="操作" width="70" fixed="right">
  58. <template slot-scope="scope">
  59. <el-button v-permission="['category.organization.edit']" type="text" @click.native="$refs.dialogForm.open(scope.row)">编辑</el-button>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <el-pagination
  64. class="pagination-container"
  65. background
  66. layout="prev, pager, next"
  67. :total="pageData.total"
  68. :page-size="pageData.pageSize"
  69. @current-change="paginationChange"
  70. />
  71. <dialog-form ref="dialogForm" @ok="fetchData" />
  72. </div>
  73. </template>
  74. <script>
  75. import { findPage, deleteByIds } from '@/api/category/organization'
  76. import { dateTimeFormatter } from '@/utils/formater'
  77. import DialogForm from './DialogForm'
  78. export default {
  79. components: { DialogForm },
  80. data() {
  81. return {
  82. queryForm: {},
  83. isLoading: true,
  84. pageData: {},
  85. currentPage: 1,
  86. multipleSelection: []
  87. }
  88. },
  89. computed: {},
  90. created() {
  91. },
  92. mounted() {
  93. this.fetchData()
  94. },
  95. methods: {
  96. dateTimeFormatter,
  97. selectionChange(val) {
  98. const temp = []
  99. val.forEach(o => {
  100. temp.push(o.id)
  101. })
  102. this.multipleSelection = temp
  103. },
  104. paginationChange(val) {
  105. this.currentPage = val
  106. this.fetchData()
  107. },
  108. deleteByIds(ids) {
  109. this.$confirm('确认要删除吗?', '提示', {
  110. confirmButtonText: '确定',
  111. cancelButtonText: '取消',
  112. type: 'warning'
  113. }).then(() => {
  114. deleteByIds(ids).then(() => {
  115. this.fetchData()
  116. })
  117. })
  118. },
  119. fetchData() {
  120. this.isLoading = true
  121. findPage({ ...this.queryForm, current: this.currentPage })
  122. .then((response) => {
  123. this.pageData = response
  124. })
  125. .finally(() => (this.isLoading = false))
  126. }
  127. }
  128. }
  129. </script>