seal.vue 3.5 KB

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