Commit fa5bd8c9 by 谢林威

修改模板参数页面

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