Compare commits

..

No commits in common. "cbee69b4c0e9ed0ed365c86d57da81037fc2687c" and "7fed65dbe3274a28b0c31e97452ad763a6add051" have entirely different histories.

2 changed files with 97 additions and 174 deletions

View File

@ -3,7 +3,7 @@
ref="sysTemplateFrom" ref="sysTemplateFrom"
v-loading="loading" v-loading="loading"
:model="form" :model="form"
label-width="140px" label-width="90px"
size="small" size="small"
:rules="rules" :rules="rules"
class="upload-temporary-file" class="upload-temporary-file"
@ -15,7 +15,7 @@
<el-form-item label="业务场景: " prop="BusinessScenarioEnum"> <el-form-item label="业务场景: " prop="BusinessScenarioEnum">
<el-select <el-select
v-model="form.BusinessScenarioEnum" v-model="form.BusinessScenarioEnum"
style="width: 100%" style="width:100%;"
size="small" size="small"
filterable filterable
> >
@ -44,14 +44,12 @@
:on-exceed="handleExceed" :on-exceed="handleExceed"
:disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum" :disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum"
> >
<el-button <el-button size="small" type="primary" :disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum" :loading="btnLoading">Select</el-button>
size="small" <span
type="primary" slot="tip"
:disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum" style="margin-left:10px;"
:loading="btnLoading" class="el-upload__tip"
>Select</el-button
> >
<span slot="tip" style="margin-left: 10px" class="el-upload__tip">
(must be in xlsx/xls/doc/docx format) (must be in xlsx/xls/doc/docx format)
</span> </span>
</el-upload> </el-upload>
@ -60,61 +58,37 @@
<el-form-item label="文件名" prop="Name"> <el-form-item label="文件名" prop="Name">
<el-input v-model="form.Name" /> <el-input v-model="form.Name" />
</el-form-item> </el-form-item>
<el-form-item
:label="$t('dictionary:attachment:export:form:nameCN')"
prop="NameCN"
>
<el-input v-model="form.NameCN" />
</el-form-item>
<el-form-item v-if="form.Id !== ''" label="是否废除: "> <el-form-item v-if="form.Id !== ''" label="是否废除: ">
<el-radio-group v-model="form.IsDeleted"> <el-radio-group v-model="form.IsDeleted">
<el-radio <el-radio v-for="item of $d.YesOrNo" :label="item.value">{{item.label}}</el-radio>
v-for="item of $d.YesOrNo"
:label="item.value"
:key="item.id"
>{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="描述"> <el-form-item label="描述">
<el-input <el-input
v-model="form.Description" v-model="form.Description"
type="textarea" type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4}"
placeholder="请输入内容" placeholder="请输入内容"
/> />
</el-form-item> </el-form-item>
</div> </div>
<div class="base-dialog-footer" style="text-align: right; margin-top: 10px"> <div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<el-form-item style="text-align: right"> <el-form-item style="text-align:right;">
<el-button <el-button size="small" type="primary" :disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum" :loading="saveBtnLoading" @click="handleSave">Save</el-button>
size="small"
type="primary"
:disabled="!form.FileTypeEnum || !form.BusinessScenarioEnum"
:loading="saveBtnLoading"
@click="handleSave"
>Save</el-button
>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
</template> </template>
<script> <script>
import { import { addOrUpdateCommonDocument, uploadCommonDoc, Upload } from '@/api/dictionary'
addOrUpdateCommonDocument,
uploadCommonDoc,
Upload,
} from '@/api/dictionary'
import { getBasicDataSelects } from '@/api/dictionary/dictionary' import { getBasicDataSelects } from '@/api/dictionary/dictionary'
export default { export default {
name: 'TemplateForm', name: 'TemplateForm',
props: { props: {
data: { data: {
type: Object, type: Object,
default() { default() { return {} }
return {} }
},
},
}, },
data() { data() {
@ -125,30 +99,20 @@ export default {
FileTypeEnum: null, FileTypeEnum: null,
BusinessScenarioEnum: null, BusinessScenarioEnum: null,
Name: '', Name: '',
NameCN: '',
Path: '', Path: '',
Description: '', Description: '',
IsDeleted: false, IsDeleted: false
}, },
rules: { rules: {
Code: [ Code: [{ required: true, message: 'Please specify', trigger: ['blur'] }],
{ required: true, message: 'Please specify', trigger: ['blur'] }, Name: [{ required: true, message: 'Please specify', trigger: ['blur'] }],
], BusinessScenarioEnum: [{ required: true, message: 'Please select', trigger: ['blur'] }]
Name: [
{ required: true, message: 'Please specify', trigger: ['blur'] },
],
NameCN: [
{ required: true, message: 'Please specify', trigger: ['blur'] },
],
BusinessScenarioEnum: [
{ required: true, message: 'Please select', trigger: ['blur'] },
],
}, },
fileList: [], fileList: [],
btnLoading: false, btnLoading: false,
saveBtnLoading: false, saveBtnLoading: false,
loading: false, loading: false,
dictionaryList: {}, dictionaryList: {}
} }
}, },
mounted() { mounted() {
@ -164,8 +128,8 @@ export default {
name: this.data.Name, name: this.data.Name,
path: this.data.Path, path: this.data.Path,
url: this.data.Path, url: this.data.Path,
type: this.data.Type, type: this.data.Type
}, }
] ]
} }
for (const k in this.form) { for (const k in this.form) {
@ -178,14 +142,12 @@ export default {
// //
getDicData() { getDicData() {
this.loading = true this.loading = true
getBasicDataSelects(['Common_File_ModuleType', 'Common_File_Type']) getBasicDataSelects(['Common_File_ModuleType', 'Common_File_Type']).then(res => {
.then((res) => { this.dictionaryList = { ...res.Result }
this.dictionaryList = { ...res.Result } this.loading = false
this.loading = false }).catch(() => {
}) this.loading = false
.catch(() => { })
this.loading = false
})
}, },
beforeUpload(file) { beforeUpload(file) {
// //
@ -203,43 +165,35 @@ export default {
const formData = new FormData() const formData = new FormData()
formData.append('file', param.file) formData.append('file', param.file)
this.form.FileName = param.file.name this.form.FileName = param.file.name
Upload(formData, 1).then((res) => { Upload(formData, 1).then(res => {
this.fileList.push({ this.fileList.push({ name: param.file.name, path: res.Result.FilePath, fullPath: res.Result.FullFilePath, url: res.Result.FilePath })
name: param.file.name,
path: res.Result.FilePath,
fullPath: res.Result.FullFilePath,
url: res.Result.FilePath,
})
this.form.Path = res.Result.FilePath this.form.Path = res.Result.FilePath
this.form.NameCN = param.file.name this.form.Name = param.file.name
this.loading = false this.loading = false
this.btnLoading = false this.btnLoading = false
}) })
}, },
handleSave() { handleSave() {
this.$refs.sysTemplateFrom.validate((valid) => { this.$refs.sysTemplateFrom.validate(valid => {
if (!valid) return if (!valid) return
if (!this.form.Name) { if (!this.form.Name) {
this.$alert('Please select file.') this.$alert('Please select file.')
return return
} }
this.saveBtnLoading = true this.saveBtnLoading = true
addOrUpdateCommonDocument(this.form) addOrUpdateCommonDocument(this.form).then(res => {
.then((res) => { this.saveBtnLoading = false
this.saveBtnLoading = false this.$emit('closeDialog')
this.$emit('closeDialog') this.$emit('getList')
this.$emit('getList') this.$message.success('Uploaded successfully')
this.$message.success('Uploaded successfully') }).catch(() => {
}) this.saveBtnLoading = false
.catch(() => { })
this.saveBtnLoading = false
})
}) })
}, },
handleRemoveFile() { handleRemoveFile() {
this.fileList = [] this.fileList = []
this.form.Path = '' this.form.Path = ''
this.form.NameCN = ''
this.form.Name = '' this.form.Name = ''
}, },
handlePreview(file) { handlePreview(file) {
@ -252,21 +206,19 @@ export default {
}, },
checkFileSuffix(fileName) { checkFileSuffix(fileName) {
var typeArr = ['xls', 'xlsx', 'doc', 'docx'] var typeArr = ['xls', 'xlsx', 'doc', 'docx']
var extendName = fileName var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase()
.substring(fileName.lastIndexOf('.') + 1)
.toLocaleLowerCase()
if (typeArr.indexOf(extendName) !== -1) { if (typeArr.indexOf(extendName) !== -1) {
return true return true
} else { } else {
return false return false
} }
}, }
}, }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.upload-temporary-file { .upload-temporary-file{
.upload-container .el-upload--text { .upload-container .el-upload--text {
border: none; border: none;
width: 80px; width: 80px;
@ -279,8 +231,8 @@ export default {
color: #428bca; color: #428bca;
font-size: 13px; font-size: 13px;
} }
.account_item_clear { .account_item_clear{
.el-tag__close { .el-tag__close{
display: none !important; display: none !important;
} }
} }

View File

@ -5,7 +5,7 @@
<el-form-item label="业务场景"> <el-form-item label="业务场景">
<el-select <el-select
v-model="searchData.BusinessScenarioEnum" v-model="searchData.BusinessScenarioEnum"
style="width: 150px" style="width:150px;"
> >
<el-option <el-option
v-for="item of $d.Common_File_BusinessScenario" v-for="item of $d.Common_File_BusinessScenario"
@ -13,10 +13,15 @@
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文件名称"> <el-form-item label="文件名称">
<el-input v-model="searchData.Name" style="width: 130px" clearable /> <el-input
v-model="searchData.Name"
style="width:130px;"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -25,28 +30,24 @@
{{ $t('common:button:search') }} {{ $t('common:button:search') }}
</el-button> </el-button>
<!-- 重置 --> <!-- 重置 -->
<el-button <el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t('common:button:reset') }} {{ $t('common:button:reset') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button
type="primary"
icon="el-icon-plus"
style="float: right"
size="small"
@click="handleAdd"
>
{{ $t('common:button:new') }}
</el-button>
</el-form> </el-form>
<el-button
type="primary"
icon="el-icon-plus"
style="margin-left:auto;"
size="small"
@click="handleAdd"
>
{{ $t('common:button:new') }}
</el-button>
</template> </template>
<template slot="main-container"> <template slot="main-container">
<el-table <el-table
v-adaptive="{ bottomOffset: 60 }" v-adaptive="{bottomOffset:60}"
v-loading="loading" v-loading="loading"
:data="list" :data="list"
stripe stripe
@ -68,13 +69,9 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{ $fd('Common_File_BusinessScenario',scope.row.BusinessScenarioEnum) }}
$fd(
'Common_File_BusinessScenario',
scope.row.BusinessScenarioEnum
)
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -83,12 +80,6 @@
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> />
<el-table-column
prop="NameCN"
:label="$t('dictionary:attachment:upload:table:nameCN')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column <el-table-column
prop="Description" prop="Description"
label="描述" label="描述"
@ -101,12 +92,8 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.IsDeleted" type="danger">{{ <el-tag v-if="scope.row.IsDeleted" type="danger">{{ $fd('YesOrNo', scope.row.IsDeleted) }}</el-tag>
$fd('YesOrNo', scope.row.IsDeleted) <el-tag v-else type="primary">{{ $fd('YesOrNo', scope.row.IsDeleted) }}</el-tag>
}}</el-tag>
<el-tag v-else type="primary">{{
$fd('YesOrNo', scope.row.IsDeleted)
}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -118,26 +105,29 @@
<el-table-column label="Action"> <el-table-column label="Action">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleDownload(scope.row)"> <el-button
type="text"
@click="handleDownload(scope.row)"
>
下载 下载
</el-button> </el-button>
<el-button type="text" @click="handleEdit(scope.row)"> <el-button
type="text"
@click="handleEdit(scope.row)"
>
编辑 编辑
</el-button> </el-button>
<el-button type="text" @click="handleDelete(scope.row)"> <el-button
type="text"
@click="handleDelete(scope.row)"
>
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="getList" />
class="page"
:total="total"
:page.sync="searchData.PageIndex"
:limit.sync="searchData.PageSize"
@pagination="getList"
/>
<!-- 新增/编辑 --> <!-- 新增/编辑 -->
<el-dialog <el-dialog
@ -148,21 +138,13 @@
width="600px" width="600px"
custom-class="base-dialog-wrapper" custom-class="base-dialog-wrapper"
> >
<TemplateForm <TemplateForm :data="currentRow" @closeDialog="closeDialog" @getList="getList" />
:data="currentRow"
@closeDialog="closeDialog"
@getList="getList"
/>
</el-dialog> </el-dialog>
</template> </template>
</BaseContainer> </BaseContainer>
</template> </template>
<script> <script>
import { import { getCommonDocumentList, DownloadCommonDoc, deleteCommonDocument } from '@/api/dictionary'
getCommonDocumentList,
DownloadCommonDoc,
deleteCommonDocument,
} from '@/api/dictionary'
import BaseContainer from '@/components/BaseContainer' import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import TemplateForm from './TemplateForm' import TemplateForm from './TemplateForm'
@ -173,7 +155,7 @@ const searchDataDefault = () => {
BusinessScenarioEnum: null, BusinessScenarioEnum: null,
Name: '', Name: '',
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20
} }
} }
export default { export default {
@ -186,7 +168,7 @@ export default {
total: 0, total: 0,
currentRow: {}, currentRow: {},
editDialog: { title: '', visible: false }, editDialog: { title: '', visible: false },
loading: false, loading: false
} }
}, },
mounted() { mounted() {
@ -203,15 +185,13 @@ export default {
}, },
getList() { getList() {
this.loading = true this.loading = true
getCommonDocumentList(this.searchData) getCommonDocumentList(this.searchData).then(res => {
.then((res) => { this.loading = false
this.loading = false this.list = res.Result.CurrentPageData
this.list = res.Result.CurrentPageData this.total = res.Result.TotalCount
this.total = res.Result.TotalCount }).catch(() => {
}) this.loading = false
.catch(() => { })
this.loading = false
})
}, },
// //
handleAdd() { handleAdd() {
@ -222,13 +202,9 @@ export default {
// //
handleDownload(row) { handleDownload(row) {
this.loading = true this.loading = true
DownloadCommonDoc(row.Code) DownloadCommonDoc(row.Code).then(data => {
.then((data) => { this.loading = false
this.loading = false }).catch(() => { this.loading = false })
})
.catch(() => {
this.loading = false
})
}, },
// //
handleEdit(row) { handleEdit(row) {
@ -257,12 +233,7 @@ export default {
this.searchData.SortField = column.prop this.searchData.SortField = column.prop
this.searchData.PageIndex = 1 this.searchData.PageIndex = 1
this.getList() this.getList()
}, }
}, }
} }
</script> </script>
<style lang="scss" scoped>
::v-deep .search {
display: block;
}
</style>