259 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			259 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						|
  <box-content>
 | 
						|
    <!-- 搜索框 -->
 | 
						|
    <div class="search">
 | 
						|
      <el-form :inline="true" size="mini" class="base-search-form">
 | 
						|
        <el-form-item label="文件类型:">
 | 
						|
          <el-select
 | 
						|
            v-model="searchData.FileTypeId"
 | 
						|
            style="width:150px;"
 | 
						|
          >
 | 
						|
            <el-option
 | 
						|
              v-for="item of dict.type.Common_File_Type"
 | 
						|
              :key="item.value"
 | 
						|
              :label="item.label"
 | 
						|
              :value="item.value"
 | 
						|
            />
 | 
						|
 | 
						|
          </el-select>
 | 
						|
        </el-form-item>
 | 
						|
        <el-form-item label="业务模块:">
 | 
						|
          <el-select
 | 
						|
            v-model="searchData.ModuleTypeId"
 | 
						|
            style="width:150px;"
 | 
						|
          >
 | 
						|
            <el-option
 | 
						|
              v-for="item of dict.type.Common_File_ModuleType"
 | 
						|
              :key="item.value"
 | 
						|
              :label="item.label"
 | 
						|
              :value="item.value"
 | 
						|
            />
 | 
						|
 | 
						|
          </el-select>
 | 
						|
        </el-form-item>
 | 
						|
        <el-form-item label="文件名称:">
 | 
						|
          <el-input v-model="searchData.Name" style="width:100px;" />
 | 
						|
        </el-form-item>
 | 
						|
 | 
						|
        <el-form-item>
 | 
						|
          <el-button type="primary" @click="handleReset">Reset</el-button>
 | 
						|
          <el-button type="primary" @click="handleSearch">Search</el-button>
 | 
						|
        </el-form-item>
 | 
						|
      </el-form>
 | 
						|
      <span style="margin-left:auto;">
 | 
						|
        <el-button
 | 
						|
          type="primary"
 | 
						|
          size="mini"
 | 
						|
          @click="handleAdd"
 | 
						|
        >
 | 
						|
          New
 | 
						|
        </el-button>
 | 
						|
      </span>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <!-- 系统文件列表 -->
 | 
						|
    <el-table
 | 
						|
      ref="AttachmentTemplateList"
 | 
						|
      v-loading="loading"
 | 
						|
      v-adaptive="{bottomOffset:50}"
 | 
						|
      :data="list"
 | 
						|
      stripe
 | 
						|
      height="100"
 | 
						|
      @sort-change="handleSortByColumn"
 | 
						|
    >
 | 
						|
      <el-table-column type="index" width="40" />
 | 
						|
      <el-table-column
 | 
						|
        prop="Code"
 | 
						|
        label="Code"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      />
 | 
						|
      <el-table-column
 | 
						|
        prop="FileType"
 | 
						|
        label="文件类型"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      />
 | 
						|
      <el-table-column
 | 
						|
        prop="ModuleType"
 | 
						|
        label="业务模块"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      />
 | 
						|
 | 
						|
      <el-table-column
 | 
						|
        prop="Name"
 | 
						|
        label="文件名"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      />
 | 
						|
      <el-table-column
 | 
						|
        prop="Description"
 | 
						|
        label="描述"
 | 
						|
        show-overflow-tooltip
 | 
						|
      />
 | 
						|
      <el-table-column
 | 
						|
        prop="IsDeleted"
 | 
						|
        label="是否废除"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      >
 | 
						|
        <template slot-scope="scope">
 | 
						|
          {{ scope.row.IsDeleted?'Yes':'No' }}
 | 
						|
        </template>
 | 
						|
      </el-table-column>
 | 
						|
      <el-table-column
 | 
						|
        prop="UpdateTime"
 | 
						|
        label="更新时间"
 | 
						|
        show-overflow-tooltip
 | 
						|
        sortable="custom"
 | 
						|
      />
 | 
						|
 | 
						|
      <el-table-column label="Action">
 | 
						|
        <template slot-scope="scope">
 | 
						|
          <el-button
 | 
						|
            type="text"
 | 
						|
            @click="handleDownload(scope.row)"
 | 
						|
          >
 | 
						|
            下载
 | 
						|
          </el-button>
 | 
						|
          <el-button
 | 
						|
            type="text"
 | 
						|
            @click="handleEdit(scope.row)"
 | 
						|
          >
 | 
						|
            编辑
 | 
						|
          </el-button>
 | 
						|
        </template>
 | 
						|
      </el-table-column>
 | 
						|
    </el-table>
 | 
						|
    <!-- 分页组件 -->
 | 
						|
    <pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
 | 
						|
    <!-- 新增/编辑 -->
 | 
						|
    <el-dialog
 | 
						|
      v-if="editVisible"
 | 
						|
      :visible.sync="editVisible"
 | 
						|
      :close-on-click-modal="false"
 | 
						|
      :title="title"
 | 
						|
      width="600px"
 | 
						|
      custom-class="base-dialog-wrapper"
 | 
						|
    >
 | 
						|
      <TemplateForm :data="currentRow" @closeDialog="closeDialog" @getList="getList" />
 | 
						|
    </el-dialog>
 | 
						|
  </box-content>
 | 
						|
</template>
 | 
						|
<script>
 | 
						|
import { getCommonDocumentList, DownloadCommonDoc } from '@/api/dictionary'
 | 
						|
import { userAbandonDoc } from '@/api/trials'
 | 
						|
import BoxContent from '@/components/BoxContent'
 | 
						|
import Pagination from '@/components/Pagination'
 | 
						|
import TemplateForm from './components/TemplateForm'
 | 
						|
const searchDataDefault = () => {
 | 
						|
  return {
 | 
						|
    FileTypeId: '',
 | 
						|
    ModuleTypeId: '',
 | 
						|
    Name: '',
 | 
						|
    PageIndex: 1,
 | 
						|
    PageSize: 20
 | 
						|
  }
 | 
						|
}
 | 
						|
export default {
 | 
						|
  name: 'AttachmentTemplateList',
 | 
						|
  components: { BoxContent, Pagination, TemplateForm },
 | 
						|
  dicts: ['Common_File_ModuleType', 'Common_File_Type'],
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      searchData: searchDataDefault(),
 | 
						|
      loading: false,
 | 
						|
      list: [],
 | 
						|
      editVisible: false,
 | 
						|
      previewVisible: false,
 | 
						|
      title: '',
 | 
						|
      currentRow: {},
 | 
						|
      currentPath: '',
 | 
						|
      currentType: '',
 | 
						|
      total: 0
 | 
						|
    }
 | 
						|
  },
 | 
						|
  mounted() {
 | 
						|
    this.getList()
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    // 获取系统文件数据
 | 
						|
    getList() {
 | 
						|
      this.loading = true
 | 
						|
      getCommonDocumentList(this.searchData).then(res => {
 | 
						|
        this.loading = false
 | 
						|
        this.list = res.Result.CurrentPageData
 | 
						|
        this.total = res.Result.TotalCount
 | 
						|
      }).catch(() => {
 | 
						|
        this.loading = false
 | 
						|
      })
 | 
						|
    },
 | 
						|
    // 新增
 | 
						|
    handleAdd() {
 | 
						|
      this.title = 'Add'
 | 
						|
      this.currentRow = {}
 | 
						|
      this.editVisible = true
 | 
						|
    },
 | 
						|
    // 下载
 | 
						|
    handleDownload(row) {
 | 
						|
      this.loading = true
 | 
						|
      DownloadCommonDoc(row.Code).then(data => {
 | 
						|
        this.loading = false
 | 
						|
      }).catch(() => { this.loading = false })
 | 
						|
    },
 | 
						|
    // 编辑
 | 
						|
    handleEdit(row) {
 | 
						|
      this.title = 'Edit'
 | 
						|
      this.currentRow = { ...row }
 | 
						|
      this.editVisible = true
 | 
						|
    },
 | 
						|
    // 废除
 | 
						|
    handleRepeal(row) {
 | 
						|
      this.$confirm('是否确认废除此文件?', {
 | 
						|
        type: 'warning',
 | 
						|
        distinguishCancelAndClose: true,
 | 
						|
        confirmButtonText: 'Ok',
 | 
						|
        cancelButtonText: 'Cancel'
 | 
						|
      })
 | 
						|
        .then(() => {
 | 
						|
          this.loading = true
 | 
						|
          userAbandonDoc(row.Id, true)
 | 
						|
            .then(res => {
 | 
						|
              this.loading = false
 | 
						|
              if (res.IsSuccess) {
 | 
						|
                this.getList()
 | 
						|
                this.$message.success('Saved successfully!')
 | 
						|
              }
 | 
						|
            }).catch(() => { this.loading = false })
 | 
						|
        }).catch(() => {})
 | 
						|
    },
 | 
						|
    // 关闭弹窗
 | 
						|
    closeDialog() {
 | 
						|
      this.editVisible = false
 | 
						|
    },
 | 
						|
    // 重置
 | 
						|
    handleReset() {
 | 
						|
      this.searchData = searchDataDefault()
 | 
						|
      this.getList()
 | 
						|
    },
 | 
						|
    // 查询
 | 
						|
    handleSearch() {
 | 
						|
      this.searchData.PageIndex = 1
 | 
						|
      this.getList()
 | 
						|
    },
 | 
						|
    // 排序
 | 
						|
    handleSortByColumn(column) {
 | 
						|
      if (column.order === 'ascending') {
 | 
						|
        this.searchData.Asc = true
 | 
						|
      } else {
 | 
						|
        this.searchData.Asc = false
 | 
						|
      }
 | 
						|
      this.searchData.SortField = column.prop
 | 
						|
      this.searchData.PageIndex = 1
 | 
						|
      this.getList()
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
</script>
 |