seal.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="hui-flex hui-content border-box">
  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 v-permission="'/work/organization/seal/add'" type="primary" size="small" @click="insertSeal">
  9. 新增印章
  10. </el-button>
  11. </div>
  12. <div class="hui-flex-box">
  13. <el-table :data="tableData" row-key="id" height="100%">
  14. <el-table-column label="序号" width="50">
  15. <template slot-scope="scope">
  16. <div style="text-align: center;">{{scope.$index + 1}}</div>
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="印章名称" prop="name"></el-table-column>
  20. <el-table-column label="印章类型">
  21. <template slot-scope="scope">
  22. <span>{{$field.findTypeName('sealType',scope.row.type)}}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="印章描述" prop="comment"></el-table-column>
  26. <el-table-column label="操作" width="150" align="center">
  27. <template slot-scope="scope">
  28. <div class="hui-table-operation">
  29. <span class="table-operation" v-permission="'/work/organization/seal/detail'"
  30. @click="lookSeal(scope.row)">
  31. 详情
  32. </span>
  33. <span class="table-operation" v-permission="'/work/organization/seal/update'"
  34. @click="updateSeal(scope.row)">
  35. 编辑
  36. </span>
  37. <span class="table-operation" v-permission="'/work/organization/seal/delete'"
  38. @click="deleteSeal(scope.row)">
  39. 删除
  40. </span>
  41. </div>
  42. </template>
  43. </el-table-column>
  44. <template slot="empty">
  45. <el-empty description="暂无数据"></el-empty>
  46. </template>
  47. </el-table>
  48. </div>
  49. </div>
  50. <el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px"
  51. :append-to-body="true">
  52. <edit v-if="visible" @callback="callback" :isUpdate="isUpdate" :detailId="detailId"></edit>
  53. </el-dialog>
  54. <el-drawer title="项目详情" :visible.sync="drawer" :size="400" :append-to-body="true">
  55. <detail v-if="drawer" :detailId="detailId"></detail>
  56. </el-drawer>
  57. </div>
  58. </template>
  59. <script>
  60. import {
  61. getSealList,
  62. deleteSeal
  63. } from '@/api/organization'
  64. const edit = () => import('@/components/work/organization/seal/edit');
  65. const detail = () => import('@/components/work/organization/seal/detail');
  66. export default {
  67. data() {
  68. return {
  69. tableData: [],
  70. visible: false,
  71. detailId: '',
  72. isUpdate: false,
  73. drawer: false
  74. }
  75. },
  76. mounted() {
  77. this.init();
  78. },
  79. methods: {
  80. init() {
  81. if (!this.auth('/work/organization/seal/list')) return;
  82. getSealList(this.$store.getters.organization.id).then(res => {
  83. if (res.state) {
  84. this.tableData = res.data;
  85. }
  86. })
  87. },
  88. insertSeal() {
  89. this.isUpdate = false;
  90. this.visible = true;
  91. },
  92. updateSeal(item) {
  93. this.detailId = item.id;
  94. this.isUpdate = true;
  95. this.visible = true;
  96. },
  97. lookSeal(item) {
  98. this.detailId = item.id;
  99. this.drawer = true;
  100. },
  101. deleteSeal(item) {
  102. this.$confirm('确定要删除该印章?', () => {
  103. deleteSeal(item.id).then(res => {
  104. if (res.state) {
  105. this.init();
  106. this.$message.success('操作成功');
  107. }
  108. })
  109. });
  110. },
  111. callback(type) {
  112. if (type === 'init') this.init();
  113. this.visible = false;
  114. }
  115. },
  116. components: {
  117. edit,
  118. detail
  119. },
  120. }
  121. </script>
  122. <style lang="scss"></style>