Blame view

src/components/oa/notepadDetail.vue 2.41 KB
0bf7e6a5   wuxw   加入问卷功能代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  <template>
    <el-dialog
      :title="$t('notepadManage.detail.title')"
      :visible.sync="visible"
      width="70%"
    >
      <el-table
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column
          type="index"
          :label="$t('notepadManage.detail.index')"
          width="80"
          align="center"
        />
        <el-table-column
          prop="createUserName"
          :label="$t('notepadManage.detail.createUser')"
          align="center"
        />
        <el-table-column
          prop="createTime"
          :label="$t('notepadManage.detail.createTime')"
          align="center"
        />
        <el-table-column
          prop="content"
          :label="$t('notepadManage.detail.content')"
          align="center"
        />
        <el-table-column
          :label="$t('common.operation')"
          align="center"
          width="120"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.row)"
            >
              {{ $t('common.delete') }}
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </template>
  
  <script>
  import { listNotepadDetail, deleteNotepadDetail } from '@/api/oa/notepadManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'NotepadDetail',
    data() {
      return {
        visible: false,
        tableData: [],
        formData: {
          noteId: '',
          communityId: ''
        }
      }
    },
    methods: {
      open(data) {
        this.visible = true
        this.formData.noteId = data.noteId
        this.formData.communityId = getCommunityId()
        this.loadDetails()
      },
      async loadDetails() {
        try {
          const params = {
            noteId: this.formData.noteId,
            communityId: this.formData.communityId,
            page: 1,
            row: 50
          }
          const { data } = await listNotepadDetail(params)
          this.tableData = data
        } catch (error) {
          console.error('获取记事本详情失败:', error)
        }
      },
      async handleDelete(row) {
        try {
          await deleteNotepadDetail({
            detailId: row.detailId,
            communityId: this.formData.communityId
          })
          this.$message.success(this.$t('common.deleteSuccess'))
          this.loadDetails()
        } catch (error) {
          console.error('删除记事本详情失败:', error)
        }
      }
    }
  }
  </script>