|
|
@@ -38,8 +38,31 @@
|
|
|
placeholder="请输入内容"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="链接" required>
|
|
|
- <el-input v-model="form.linkUrl" placeholder="请输入内容"></el-input>
|
|
|
+ <el-form-item label="舍入类型" required>
|
|
|
+ <template>
|
|
|
+ <el-select v-model="form.type" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :key="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数据状态" required>
|
|
|
+ <template>
|
|
|
+ <el-select v-model="form.dataType" placeholder="请选择" disabled>
|
|
|
+ <el-option
|
|
|
+ v-for="item in dataTypeOptions"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :key="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注描述">
|
|
|
<el-input v-model="form.remark" placeholder="请输入内容"></el-input>
|
|
|
@@ -63,27 +86,36 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: '四舍五入',
|
|
|
+ value: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '舍位',
|
|
|
+ value: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '进位',
|
|
|
+ value: 3
|
|
|
+ }
|
|
|
+ ],
|
|
|
typeOptions: [
|
|
|
{
|
|
|
label: '固定',
|
|
|
value: 1
|
|
|
}
|
|
|
],
|
|
|
+ dataTypeOptions: [
|
|
|
+ {
|
|
|
+ label: '暂存',
|
|
|
+ value: 1
|
|
|
+ }
|
|
|
+ ],
|
|
|
dialogVisible: false,
|
|
|
file: null,
|
|
|
type: '新增',
|
|
|
- form: {},
|
|
|
- imageUrl: '',
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '程序应用',
|
|
|
- value: '1'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '网页应用',
|
|
|
- value: '2'
|
|
|
- }
|
|
|
- ]
|
|
|
+ form: {}
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -103,24 +135,6 @@
|
|
|
}
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
- handleAvatarChangeIcon(file, fileList) {
|
|
|
- //选中文件触发的change事件
|
|
|
- console.log(file);
|
|
|
- const isJPG = file.raw.type === 'image/jpeg';
|
|
|
- const isPNG = file.raw.type === 'image/png';
|
|
|
- const isLt10M = file.raw.size / 1024 / 1024 < 10; //限制上传文件的大小
|
|
|
- if (!isLt10M) {
|
|
|
- this.$message.error('上传文件大小不能超过 10MB!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!isPNG && !isJPG && !isLt2M) {
|
|
|
- this.$message.error('上传图片只能是 JPG/PNG 格式!');
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- this.imageUrl = URL.createObjectURL(file.raw); //赋值图片的url,用于图片回显功能
|
|
|
- this.file = file.raw; //赋值文件对象,用于上传操作
|
|
|
- }
|
|
|
- },
|
|
|
async config() {
|
|
|
if (!this.form.name) {
|
|
|
return this.$message.error('请输入名称');
|
|
|
@@ -137,24 +151,6 @@
|
|
|
if (this.form.architType < 0) {
|
|
|
return this.$message.error('请选择架构类型');
|
|
|
}
|
|
|
- // 文件上传操作
|
|
|
- if (this.file) {
|
|
|
- try {
|
|
|
- let res = await uploadFile({
|
|
|
- multiPartFile: this.file,
|
|
|
- module: 'gateway'
|
|
|
- });
|
|
|
- this.form.icon = res.data.id;
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- return this.$message.error('上传文件失败');
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (this.type == '新增') {
|
|
|
- return this.$message.error('请上传图片');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (this.type == '新增') {
|
|
|
// 保存数据
|
|
|
try {
|