| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <search ref="search" @search="search"></search>
- <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit('add')"
- >
- 添加
- </el-button>
- </template>
- <template v-slot:files="scope">
- <el-link
- v-for="link in scope.row.files"
- :key="link.id"
- type="primary"
- :underline="false"
- @click="downloadFile(link)"
- >
- {{ link.name }}
- </el-link>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit('edit', row)"
- >
- 修改
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <newEdit
- v-if="showEdit"
- :type="editType"
- :editObj="editObj"
- @close="close"
- ></newEdit>
- </div>
- </template>
- <script>
- import search from './components/search.vue';
- import newEdit from './components/newEdit.vue';
- import { getList, removeItem } from '@/api/inspectionPoint';
- import dictMixins from '@/mixins/dictMixins';
- import { getFile } from '@/api/system/file';
- export default {
- mixins: [dictMixins],
- components: {
- search,
- newEdit
- },
- data() {
- return {
- columns: [
- {
- width: 45,
- type: 'index',
- columnKey: 'index',
- align: 'center'
- },
- {
- prop: 'pointCode',
- label: '编码'
- },
- {
- label: '名称',
- prop: 'pointName'
- },
- {
- label: '区域',
- prop: 'areaName'
- },
- {
- label: '附件',
- slot: 'files'
- },
- {
- prop: 'createUserName',
- label: '创建人',
- align: 'center'
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 220,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- editType: null,
- editObj: {},
- showEdit: false
- };
- },
- created() {
-
- },
- methods: {
- datasource({ page, where, limit }) {
- return getList({
- ...where,
- pageNum: page,
- size: limit
- });
- },
- search(where) {
- this.$refs.table.reload({
- where: where,
- page: 1
- });
- },
- openEdit(type, row) {
- this.editType = type;
- this.editObj = row || {};
- this.showEdit = true;
- },
- close() {
- this.showEdit = false;
- },
- downloadFile(file) {
- getFile({ objectName: file.storePath }, file.name);
- },
- remove(row) {
- removeItem([row.id])
- .then((message) => {
- this.$message.success(message);
- this.done();
- })
- .catch((e) => {});
- }
- }
- };
- </script>
|