organization.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="hui-flex hui-content">
  3. <div class="hui-content-title">
  4. <div class="hui-title-item active">企业列表</div>
  5. </div>
  6. <div class="hui-flex-box hui-flex hui-table">
  7. <div class="hui-content-insert">
  8. <el-button type="primary" size="medium" @click="insertProject">新增企业</el-button>
  9. </div>
  10. <div class="hui-flex-box">
  11. <el-table :data="tableData" row-key="id" border height="100%">
  12. <el-table-column label="序号" width="50">
  13. <template slot-scope="scope">
  14. <div style="text-align: center;">{{scope.$index + 1}}</div>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="企业名称" prop="name"></el-table-column>
  18. <el-table-column label="企业类型">
  19. <template slot-scope="scope">
  20. <span>{{$field.findTypeName('industryType',scope.row.industryType)}}</span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="企业法人" prop="legalPerson"></el-table-column>
  24. <el-table-column label="成立时间" prop="establishDate"></el-table-column>
  25. <el-table-column label="营业期限" prop="businessTerm"></el-table-column>
  26. <el-table-column label="操作" width="150">
  27. <template slot-scope="scope">
  28. <div class="hui-table-operation">
  29. <span class="table-operation" @click="lookProject(scope.row)">详情</span>
  30. <span class="table-operation" @click="updateProject(scope.row)">编辑</span>
  31. <span class="table-operation" @click="deleteProject(scope.row)">删除</span>
  32. </div>
  33. </template>
  34. </el-table-column>
  35. <template slot="empty">
  36. <empty description="暂无数据"></empty>
  37. </template>
  38. </el-table>
  39. </div>
  40. <div class="hui-content-pagination">
  41. <el-pagination :page-size="pageSize" :pager-count="9" layout="prev, pager, next" :total="totalCount"
  42. @current-change="currentChange">
  43. </el-pagination>
  44. </div>
  45. </div>
  46. <el-dialog :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px" :append-to-body="true">
  47. <edit v-if="visible" @callback="callback" :isUpdate="isUpdate" :detailId="detailId"></edit>
  48. </el-dialog>
  49. <el-drawer title="项目详情" :visible.sync="drawer" :size="400" :append-to-body="true">
  50. <detail v-if="drawer" :detailId="detailId"></detail>
  51. </el-drawer>
  52. </div>
  53. </template>
  54. <script>
  55. import {
  56. getOrganizationListByPage,
  57. deleteOrganizationById
  58. } from '@/httpApi/business'
  59. import edit from '@/components/work/business/organization/edit'
  60. import detail from '@/components/work/business/organization/detail'
  61. export default {
  62. data() {
  63. return {
  64. tableData: [],
  65. currPage: 1,
  66. pageSize: 10,
  67. totalCount: 0,
  68. visible: false,
  69. detailId: '',
  70. isUpdate: false,
  71. drawer: false
  72. }
  73. },
  74. created() {
  75. this.init();
  76. },
  77. methods: {
  78. init() {
  79. getOrganizationListByPage({
  80. currPage: this.currPage,
  81. pageSize: this.pageSize,
  82. organizationId: this.$store.getters.organization.id
  83. }).then(res => {
  84. if (res.state) {
  85. this.tableData = res.data.dataList;
  86. this.totalCount = res.data.totalCount;
  87. }
  88. })
  89. },
  90. currentChange(currPage) {
  91. this.currPage = currPage;
  92. this.init();
  93. },
  94. insertProject() {
  95. this.isUpdate = false;
  96. this.visible = true;
  97. },
  98. updateProject(val) {
  99. this.detailId = val.id;
  100. this.isUpdate = true;
  101. this.visible = true;
  102. },
  103. lookProject(val) {
  104. this.detailId = val.id;
  105. this.drawer = true;
  106. },
  107. deleteProject(val) {
  108. this.$confirm('确定要删除该企业?', () => {
  109. deleteOrganizationById(val.id).then(res => {
  110. if (res.state) {
  111. this.init();
  112. this.$message.success('操作成功');
  113. }
  114. })
  115. });
  116. },
  117. callback(type) {
  118. if (type === 'init') this.init();
  119. this.visible = false;
  120. }
  121. },
  122. components: {
  123. edit,
  124. detail
  125. },
  126. }
  127. </script>
  128. <style lang="scss"></style>