You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.4 KiB
84 lines
2.4 KiB
<template>
|
|
<el-dialog class="addEdit-category-form" :close-on-click-modal="false" :visible.sync="cuDialogVisible" :title="title">
|
|
<div class="setting-dialog">
|
|
<el-form ref="formData" :model="formData" size="small" label-width="90px">
|
|
<el-row v-for="(item) in formData.fields" :key="item.id">
|
|
<el-col :span="12">
|
|
<el-form-item label="组成字段">
|
|
<el-input v-model="item.fieldCnName" :disabled="true" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="组成符号">
|
|
<el-input v-model="item.connector" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="cuDialogVisible=false">取消</el-button>
|
|
<el-button type="primary" :loading="loading" @click="save">确定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { add, edit } from '@/api/category/fileNoFormat'
|
|
export default {
|
|
data() {
|
|
return {
|
|
cuDialogVisible: false,
|
|
formData: {},
|
|
title: '新增档号规则',
|
|
loading: false
|
|
}
|
|
},
|
|
methods: {
|
|
save() {
|
|
this.loading = true
|
|
if (this.title === '新增档号规则') {
|
|
const addData = this.formData.fields.map((item) => {
|
|
return {
|
|
dictionaryId: item.id,
|
|
fieldName: item.fieldName,
|
|
fieldCnName: item.fieldCnName,
|
|
connector: item.connector,
|
|
categoryId: item.categoryId
|
|
}
|
|
})
|
|
add(addData).then((res) => {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success',
|
|
duration: 2500
|
|
})
|
|
this.cuDialogVisible = false
|
|
this.loading = false
|
|
this.$emit('refresh')
|
|
})
|
|
} else {
|
|
edit(this.formData.fields).then((res) => {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success',
|
|
duration: 2500
|
|
})
|
|
this.cuDialogVisible = false
|
|
this.loading = false
|
|
this.$emit('refresh')
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
.fields-list {
|
|
max-height: calc(100vh - 312px);
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
position: relative;
|
|
}
|
|
</style>
|