Commit 2ba2c875 by 谢林威

fix:修复描述字段不能换行的问题

1 parent a9cc0aa4
Pipeline #5992 passed
in 2 minutes 16 seconds
......@@ -210,7 +210,7 @@ export default class seetaTableIndex extends Vue {
@Prop({ type: Boolean, default: true }) stripe
// 数据加载函数
@Prop({ type: Function, default: () => { return {} } }) loadFunction
@Prop({ type: Number, default: 30 }) pageSize
@Prop({ type: Number, default: 10 }) pageSize
@Prop({ type: Number, default: 1 }) pageIndex
// 手动传入数据
@Prop({ type: Object, default: () => {} }) data
......
......@@ -36,6 +36,15 @@ export const stringToBase64 = str => {
export const base64ToString = base64 => {
// 对base64转编码
const decode = atob(base64)
// const temp = decode.replace(/%/g, '%25')
// 编码转字符串
const str = decodeURI(decode)
return str
}
export const dataBase64ToString = base64 => {
// 对base64转编码
const decode = atob(base64)
const temp = decode.replace(/%/g, '%25')
// 编码转字符串
const str = decodeURI(temp)
......
......@@ -88,10 +88,10 @@
<st-input v-model="form.confirmPwd" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'" :label="'原密码:'" prop="passwordd">
<st-input v-model="form.passwordd" type="password"></st-input>
<st-input v-model="form.password" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'" :label="'新密码:'" prop="new_passwordd">
<st-input v-model="form.new_passwordd" type="password"></st-input>
<st-input v-model="form.new_password" type="password"></st-input>
</st-form-item>
<st-form-item
:label="'备注:'">
......@@ -116,6 +116,7 @@
<script>
import { getUsers, createUser, deleteUser, editUser } from '@/axios'
import { base64ToString, stringToBase64 } from '@/utils/typeConversion'
import browserStorage from '@/services/local-storage'
import { rTimeMin } from '@/utils/system.js'
import Dialog from '@/helpers/dialog'
......@@ -191,6 +192,7 @@ export default {
username: [{ required: true, message: '请输入账号', trigger: 'blur' }],
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
role: [{ required: true, message: '请选择角色', trigger: 'change' }],
email: [{ required: true, message: '请选择邮箱', trigger: 'change' }],
passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
confirmPwd: [
{ required: true, message: '请确认密码', trigger: 'blur' },
......@@ -222,6 +224,7 @@ export default {
let submitForm = ''
switch (this.submitType) {
case 'create':
if (this.form.description) this.form.description = stringToBase64(this.form.description)
submitForm = JSON.parse(JSON.stringify(this.form))
delete submitForm.confirmPwd
submitForm.creater = browserStorage.getItem('username')
......@@ -232,9 +235,8 @@ export default {
this.showDialog = false
break
case 'edit':
this.form.description = stringToBase64(this.form.description)
submitForm = JSON.parse(JSON.stringify(this.form))
delete submitForm.confirmPwd
submitForm.creater = browserStorage.getItem('username')
res = await editUser(submitForm)
if (res && res.data && res.data.code === 0) {
this.getData()
......@@ -276,6 +278,10 @@ export default {
const res = await getUsers({ pages: this.currentPage - 1, pagesize: this.currentSize, nickname: this.nickname, role: this.role, begin_date: this.created_at ? this.created_at[0] : '', end_date: this.created_at ? this.created_at[1] : '' })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.users
this.tokenList.map(item => {
item.description = base64ToString(item.description)
return item
})
this.total = res.data.data.total
}
this.loadingStatus = false
......
......@@ -68,6 +68,7 @@
<script>
import { getApp, deleteApp, setApp, addApp } from '@/axios'
import { base64ToString, stringToBase64 } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog'
import browserStorage from '@/services/local-storage'
export default {
......@@ -133,6 +134,10 @@ export default {
const res = await getApp({ pages: this.currentPage - 1, pagesize: this.currentSize })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.apps
this.tokenList.map(item => {
item.description = base64ToString(item.description)
return item
})
this.total = res.data.data.total
}
this.loadingStatus = false
......@@ -143,6 +148,7 @@ export default {
},
async submit() {
const userInfo = JSON.parse(browserStorage.getItem('user'))
if (this.form.description) this.form.description = stringToBase64(this.form.description)
const res = await addApp({ ...this.form, creater: userInfo.creater })
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
......
......@@ -91,7 +91,7 @@
<script>
import { addData, getData, deleteData } from '@/axios'
import Dialog from '@/helpers/dialog'
import { base64ToString, stringToBase64, isASCII } from '@/utils/typeConversion'
import { dataBase64ToString, stringToBase64, isASCII } from '@/utils/typeConversion'
export default {
data() {
return {
......@@ -138,7 +138,7 @@ export default {
if (res && res.data && res.data.code === 0) {
this.tableData = res.data.table.data.map(item => {
item.binary = item.binary.map(base64 => {
const decode = base64ToString(base64)
const decode = dataBase64ToString(base64)
const str = decode.length > 64 ? 'blob' : isASCII(decode) ? decode : 'blob'
return str
})
......
......@@ -30,7 +30,7 @@
clearable
>
</st-select> -->
<el-select v-model="form.base" placeholder="请选择" style="width: 400px;height: 32px;line-height: 32px" @change="handleSelectBase">
<el-select v-model="form.base" placeholder="请选择" style="width: 400px;height: 32px;line-height: 32px" @change="handleSelectBase" :disabled="$route.query.level === '1'">
<el-option
v-for="item in baseOptions"
:key="item.name"
......@@ -87,10 +87,10 @@
<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="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>
<span style="cursor:pointer;float: left;overflow: visible;z-index:0" @click="openFlie">{{calculateByte(scope.row.value)}}字节</span>
<input style="width: 80px;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:100px;" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<div slot="error" style="width: 80px; height: 24px;overflow: visible">(不可预览)</div>
</el-image>
</span>
</div>
......@@ -130,7 +130,7 @@
<script>
import { createParameter, getTable, getParameter, detailParameter } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import { fileToBase64, stringToBase64 } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
import Dialog from '@/helpers/dialog'
export default {
......@@ -225,11 +225,15 @@ export default {
const binaryObj = {}
const tableObj = {}
for (let i = 0; i < scalarsArr.length; i++) {
scalarsObj[scalarsArr[i].field] = scalarsArr[i].value
}
for (let j = 0; j < binaryArr.length; j++) {
binaryObj[binaryArr[j].field] = binaryArr[j].value
}
for (let k = 0; k < tableArr.length; k++) {
tableObj[tableArr[k].field] = tableArr[k].value
}
if (this.form.description) this.form.description = stringToBase64(this.form.description)
const res = await createParameter({
...this.form,
parameters: {
......@@ -240,7 +244,10 @@ export default {
})
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
// this.$router.push({ path: '/params' })
this.$router.push({ path: '/params' })
} else {
this.form = {}
this.tableData = []
}
},
cancel() {
......
......@@ -52,6 +52,7 @@
<script>
import { detailParameter, getTable, getData } from '@/axios'
import { base64ToString } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
export default {
data() {
......@@ -107,6 +108,7 @@ export default {
}
}
this.form = res.data
this.form.description = base64ToString(this.form.description)
binaryObj = Object.assign(JSON.parse(JSON.stringify(binaryObj1)), res.data.parameters.binary)
scalarsObj = Object.assign(JSON.parse(JSON.stringify(scalarsObj1)), res.data.parameters.scalars)
tableObj = Object.assign(JSON.parse(JSON.stringify(tableObj1)), res.data.parameters.table)
......
......@@ -53,7 +53,7 @@
</st-form-item>
<st-form-item class="flex-item"
:label="'参数'+':'"
prop="description">
prop="param">
<div>
<el-table :max-height="flexHeight"
ref="singleTable"
......@@ -90,10 +90,10 @@
<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">
<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>
<span style="cursor:pointer;float: left;overflow: visible;z-index:0" @click="openFile">{{parseInt(calculateByte(scope.row.value))}}&nbsp;字节</span>
<input style="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;margin-left: 10px;overflow: visible;position: absolute;left:100px;" :src="scope.row.value" fit="fit" :preview-src-list="[scope.row.value]">
<div slot="error" style="width: 80px; height: 24px;overflow: visible;">(不可预览)</div>
</el-image>
</span>
</div>
......@@ -138,7 +138,7 @@
<script>
import { editParameter, getParameter, detailParameter, getTable, getData } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import { fileToBase64, base64ToString, stringToBase64 } from '@/utils/typeConversion'
import { calculateByte } from '@/utils/system'
import Dialog from '@/helpers/dialog'
export default {
......@@ -239,6 +239,7 @@ export default {
}
}
this.form = res.data
this.form.description = base64ToString(this.form.description)
binaryObj = Object.assign(JSON.parse(JSON.stringify(binaryObj1)), res.data.parameters.binary)
scalarsObj = Object.assign(JSON.parse(JSON.stringify(scalarsObj1)), res.data.parameters.scalars)
tableObj = Object.assign(JSON.parse(JSON.stringify(tableObj1)), res.data.parameters.table)
......@@ -312,6 +313,7 @@ export default {
for (let k = 0; k < tableArr.length; k++) {
tableObj[tableArr[k].field] = tableArr[k].value
}
this.form.description = stringToBase64(this.form.description)
const res = await editParameter({
...this.form,
parameters: {
......
......@@ -82,6 +82,7 @@
<script>
import { getParameter, deleteParameter } from '@/axios'
import { base64ToString } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -134,6 +135,7 @@ export default {
if (oneLevel && oneLevel.data && oneLevel.data.code === 0) {
this.oneList = oneLevel.data.parameters.datas.map((item, index) => {
item.order = index + 1 + (this.oneCurrentPage - 1) * 10
item.description = base64ToString(item.description)
return item
})
this.oneTotal = oneLevel.data.parameters.total
......@@ -146,6 +148,7 @@ export default {
if (twoLevel && twoLevel.data && twoLevel.data.code === 0) {
this.twoList = twoLevel.data.parameters.datas.map((item, index) => {
item.order = index + 1 + (this.twoCurrentPage - 1) * 10
item.description = base64ToString(item.description)
return item
})
this.twoTotal = twoLevel.data.parameters.total
......
......@@ -331,7 +331,7 @@ export default {
.layout
background: #539DFF
min-height: 100%
// min-width: 1300px
min-width: 1300px
.notification
width: 100%
height: 40px
......
......@@ -12,6 +12,7 @@
</template>
<script>
import { base64ToString } from '@/utils/typeConversion'
import { getApp, getAccount } from '@/axios'
import * as echarts from 'echarts'
export default {
......@@ -35,6 +36,7 @@ export default {
const res = await getApp({ pages: 0, pagesize: 100000000 })
if (res && res.data && res.data.code === 0) {
this.applyInfo = res.data.data.apps.filter(item => item.ismainapp === 1)[0]
this.applyInfo.description = base64ToString(this.applyInfo.description)
}
},
repint() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!