Commit fa5bd8c9 by 谢林威

修改模板参数页面

1 parent 0eab7795
......@@ -87,8 +87,9 @@
<span class="upload-btn" v-if="!scope.row.value">Select File</span>
<input type="file" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)" class="input-btn" v-if="!scope.row.value">
<span v-if="scope.row.value">
<span style="float: left;margin-right: 10px" @click="scope.row.value = ''">{{calculateByte(scope.row.value)}}字节</span>
<el-image style="width: 42px; height: 28px;overflow: visible" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<span style="cursor:pointer;width: 80px;float: left;margin-right: 10px;position: absolute;z-index:0" @click="openFlie">{{calculateByte(scope.row.value)}}字节</span>
<input style="width: 80px;height: 24px;opacity: 0;position: absolute;left:0;z-index:-1" type="file" title="" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)">
<el-image style="width: 42px; height: 28px;overflow: visible;position: absolute;left:80px;" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<div slot="error" style="width: 80px; height: 28px;overflow: visible">(不可预览)</div>
</el-image>
</span>
......@@ -275,6 +276,11 @@ export default {
handleChange(row) {
row.value = ''
},
openFlie(e) {
const event = document.createEvent('MouseEvent')
event.initEvent('click', false, false)
e.target.nextElementSibling.dispatchEvent(event)
},
handleVisibleChange(val) {
if (!val) {
this.setCurrent()
......
......@@ -51,7 +51,7 @@
</template>
<script>
import { detailParameter, getTable } from '@/axios'
import { detailParameter, getTable, getData } from '@/axios'
import { calculateByte } from '@/utils/system'
export default {
data() {
......@@ -141,8 +141,10 @@ export default {
calculateByte: base64 => calculateByte(base64),
async handleToTableDetail(name) {
const res = await getTable({ pages: 0, pagesize: 1, name: name })
if (res && res.data && res.data.code === 0) {
if (res && res.data && res.data.code === 0 && res.data.data.total !== 0) {
this.$router.push({ path: '/data/edit', query: { name: name, columns: res.data.data && res.data.data.tables.length && res.data.data.tables[0].columns } })
} else {
const res = await getData({ pages: 0, pagesize: 1, name: name })
}
}
}
......
......@@ -84,21 +84,26 @@
<el-table-column label="值">
<template slot-scope="scope">
<!-- string number -->
<input v-if="scope.row.type === 'string' || scope.row.type === 'number'" type="text" v-model="scope.row.value" @blur="handleBlur" placeholder="请输入" :style="{color: scope.row.value != freezeData[scope.$index].value ? '#F56C6C' : ''}">
<input v-if="scope.row.type === 'string' || scope.row.type === 'number'" type="text" v-model="scope.row.value" @blur="handleBlur" placeholder="请输入" >
<!-- blob -->
<div class="btn-box" v-if="scope.row.type === 'blob'">
<span class="upload-btn" v-if="!scope.row.value">Select File</span>
<span ref="span_style" class="upload-btn" v-if="!scope.row.value">Select File</span>
<input type="file" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)" class="input-btn" v-if="!scope.row.value">
<span v-if="scope.row.value" :style="{color: scope.row.value != freezeData[scope.$index].value ? '#F56C6C' : ''}">
<span style="float: left;margin-right: 10px" @click="scope.row.value = ''">{{parseInt(calculateByte(scope.row.value))}}&nbsp;字节</span>
<el-image style="width: 42px; height: 28px;overflow: visible" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<div slot="error" style="width: 80px; height: 28px;overflow: visible">(不可预览)</div>
<span v-if="scope.row.value">
<span style="cursor:pointer;width: 80px;float: left;margin-right: 10px;position: absolute;z-index:0" @click="openFile">{{parseInt(calculateByte(scope.row.value))}}&nbsp;字节</span>
<input style="width: 80px;height: 24px;opacity: 0;position: absolute;left:0;z-index:-1" type="file" title="" @blur="handleBlur" @change="(event) => handleUpload(event, scope.row)">
<el-image style="width: 42px; height: 28px;overflow: visible;position: absolute;left:80px;" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<div slot="error" style="width: 80px; height: 28px;overflow: visible;">(不可预览)</div>
</el-image>
</span>
</div>
<!-- table -->
<div v-if="scope.row.type === 'table'" :class="{updated: scope.row.value != freezeData[scope.$index].value ? true : false}">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<div v-if="scope.row.type === 'table'">
<div style="height: 24px;margin-left: 14px;position: relative" v-show="!select_table[scope.$index]">
<span style="color: #409EFF; cursor: pointer" @click="handleToTableDetail(scope.row.value)">{{scope.row.value}}</span>
<i class="el-icon-edit" style="margin-left: 7px;color: #409EFF" @click="selectTable(scope.$index)"></i>
</div>
<pack-select v-show="select_table[scope.$index]" v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="val => handleTable(val,scope.$index)" >
<el-option
v-for="item in tableOptions"
:key="item.name"
......@@ -132,7 +137,7 @@
</template>
<script>
import { editParameter, getParameter, detailParameter, getTable } from '@/axios'
import { editParameter, getParameter, detailParameter, getTable, getData } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
import Dialog from '@/helpers/dialog'
......@@ -164,7 +169,8 @@ export default {
tableObj: {},
baseObj: {},
flexHeight: 0,
currentRow: ''
currentRow: '',
select_table: []
}
},
created() {
......@@ -183,6 +189,14 @@ export default {
},
methods: {
calculateByte: base64 => calculateByte(base64),
async handleToTableDetail(name) {
const res = await getTable({ pages: 0, pagesize: 1, name: name })
if (res && res.data && res.data.code === 0 && res.data.data.total !== 0) {
this.$router.push({ path: '/data/edit', query: { name: name, columns: res.data.data && res.data.data.tables.length && res.data.data.tables[0].columns } })
} else {
const res = await getData({ pages: 0, pagesize: 1, name: name })
}
},
async getTableOptions() {
const res = await getTable({ pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
......@@ -326,6 +340,11 @@ export default {
this.setCurrent()
}
},
openFile(e) {
const event = document.createEvent('MouseEvent')
event.initEvent('click', false, false)
e.target.nextElementSibling.dispatchEvent(event)
},
setFlexHeight() {
const ele = document.getElementsByClassName('flex-item') && document.getElementsByClassName('flex-item')[0]
this.flexHeight = ele && ele.clientHeight
......@@ -334,6 +353,17 @@ export default {
this.setCurrent()
event.target && event.target.classList && event.target.classList.remove('write')
},
// 改变Table可选状态
selectTable(index) {
this.$set(this.select_table, index, true)
this.setCurrent()
},
handleTable(val, index) {
if (!val) {
this.$set(this.select_table, index, false)
this.setCurrent()
}
},
cellClick(row, column, cell, event) {
if (row.level && (column.label === '字段' || column.label === '类型')) return
if (cell.getElementsByTagName('input')[0]) {
......
......@@ -126,22 +126,22 @@ export default {
nickname: [
{ required: true, message: '请输入姓名' }
],
email: [
{ required: true, message: '请输入邮箱' },
{ type: 'email', message: '邮箱格式不正确' },
],
password: [
{ required: true, message: '请输入密码' },
{ validator: validatePassword, message: '密码必须包含大小写字母和数字,大于8位且小于64位' },
],
newPwd: [
{ required: true, message: '请输入密码' },
{ validator: validatePassword, message: '密码必须包含大小写字母和数字,大于8位且小于64位' },
],
confirmPwd: [
{ required: true, message: '请确认密码' },
{ validator: validatePasswordConfirmation, trigger: 'blur', message: '密码与确认密码不一致' },
],
// email: [
// { required: true, message: '请输入邮箱' },
// { type: 'email', message: '邮箱格式不正确' },
// ],
// password: [
// { required: true, message: '请输入密码' },
// { validator: validatePassword, message: '密码必须包含大小写字母和数字,大于8位且小于64位' },
// ],
// newPwd: [
// { required: true, message: '请输入密码' },
// { validator: validatePassword, message: '密码必须包含大小写字母和数字,大于8位且小于64位' },
// ],
// confirmPwd: [
// { required: true, message: '请确认密码' },
// { validator: validatePasswordConfirmation, trigger: 'blur', message: '密码与确认密码不一致' },
// ],
}
}
},
......
......@@ -4,28 +4,30 @@
.navigation
.flex.left
img.logo-img(src="@assets/logo/logoa.png")
.right.lang
span.login-btn(@click="$router.push({ name: 'register' })") {{'注册'}}
seeta-popover(
trigger="hover"
placement="bottom"
width="100"
v-model="showLangePopover"
popper-class="login-popover"
)
ul.lang-list
li(
v-for="item in langList"
@click="changeLang(item)"
:class="{'is-active': item === currentLang}"
) {{item === 'zh-CN' ? '简体中文' : '日本語'}}
template(v-slot:reference)
span.reference {{currentLang === 'zh-CN' ? '简体中文' : '日本語'}}
.fly-mid
span.title {{'设备管理后台'}}
//- .right.lang
//- span.login-btn(@click="$router.push({ name: 'register' })") {{'注册'}}
//- seeta-popover(
//- trigger="hover"
//- placement="bottom"
//- width="100"
//- v-model="showLangePopover"
//- popper-class="login-popover"
//- )
//- ul.lang-list
//- li(
//- v-for="item in langList"
//- @click="changeLang(item)"
//- :class="{'is-active': item === currentLang}"
//- ) {{item === 'zh-CN' ? '简体中文' : '日本語'}}
//- template(v-slot:reference)
//- span.reference {{currentLang === 'zh-CN' ? '简体中文' : '日本語'}}
.wrap.flex-1
.content
.introduce
.title {{'自主 · 可控 · 边缘智算'}}
.desc {{'人工智能物联网平台'}}
.title {{'自主 · 可控 · 全栈'}}
.desc {{'设备管理后台'}}
.login-area
.pic-code-continue(v-show="yzmDialogVisible")
puzzle-validator(
......@@ -100,16 +102,16 @@
:src="getOidcIcon(item)",
)
.text {{ item.service_name }}
.admin-tips(v-if="!isAdminLogin")
span {{$t('login.adminPlease')}}
span.pointer(
@click="linkToAdmin",
) {{$t('login.backLogin')}}
.admin-tips(v-else)
span {{$t('public.return')}}
span.pointer(
@click="linkToFront",
) {{$t('public.fontUserLogin')}}
//- .admin-tips(v-if="!isAdminLogin")
//- span {{$t('login.adminPlease')}}
//- span.pointer(
//- @click="linkToAdmin",
//- ) {{$t('login.backLogin')}}
//- .admin-tips(v-else)
//- span {{$t('public.return')}}
//- span.pointer(
//- @click="linkToFront",
//- ) {{$t('public.fontUserLogin')}}
.first-content(v-else)
first-login(
:username="userName",
......@@ -365,6 +367,17 @@ export default {
float: left
.logo-img
height: 24px
.fly-mid
display: inline-block;
height: 14px
width: 1px
margin: 0 10px
vertical-align: middle
background-color: #FFF
.title
color: #FFF
font-size: 18px
line-height: 25px
.right
float: right
height: 50px
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!