Commit e69959c4 by 温丽香

接口联调

1 parent 8ca80d42
Pipeline #3601 passed
in 2 minutes 24 seconds
......@@ -7859,6 +7859,11 @@
"sshpk": "^1.7.0"
}
},
"https": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz",
"integrity": "sha1-PDfHrhqO65ZpBKKtHpdaGUt+06Q="
},
"https-browserify": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/https-browserify/download/https-browserify-1.0.0.tgz",
......
......@@ -18,6 +18,7 @@
"dompurify": "^2.0.7",
"element-ui": "^2.15.3",
"exif-js": "^2.3.0",
"https": "^1.0.0",
"jquery": "^3.3.1",
"lodash": "^4.17.20",
"moment": "^2.24.0",
......
......@@ -11,6 +11,7 @@ export const getParameter = data => axios(GET, FRONT + PARAMETER + '/query_list'
export const createParameter = data => axios(POST, FRONT + PARAMETER + '/create', data)
export const deleteParameter = data => axios(GET, FRONT + PARAMETER + '/delete', data)
export const editParameter = data => axios(POST, FRONT + PARAMETER + '/change', data)
export const detailParameter = data => axios(GET, FRONT + PARAMETER + '/query', data)
const TABLE = '/table'
export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data)
......
......@@ -15,7 +15,7 @@ function notificationError(title: any, msg: any, duration: number = 1500) {
})
}
Axios.defaults.baseURL = baseUrl
// Axios.defaults.baseURL = '/front'
export default (method, url, data, config) => {
method = method.toLowerCase()
......
export default [
{
path: '/',
redirect: '/device'
redirect: '/login'
},
{
path: '/login',
......
export const fileToBase64 = file => {
return new Promise((resolve, reject) => {
try {
const read = new FileReader()
read.onload = function(e) {
resolve(e.target.result)
}
read.readAsDataURL(file)
} catch (err) {
reject(err)
}
})
}
export const base64ToFile = (base64, fileName) => {
const arr = base64.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
const blob = new Blob([u8arr], { type: mime })
return new File([blob], fileName, { type: mime })
}
......@@ -202,7 +202,7 @@ export default {
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此账号?' })
if (!confirmDelete) return
const res = await this.getData()
......
......@@ -31,6 +31,7 @@
</template>
<script>
import { getApp } from '@/axios'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -65,36 +66,24 @@ export default {
slotName: 'operate'
},
],
tokenList: [
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 2, name: 'aa', type: 'aa', desc: 'aaaa' },
],
tokenList: [],
total: 34
}
},
mounted() {
// this.getData()
this.getData()
},
methods: {
async getData() {
const res = await getApp({ pages: 0, pagesize: 5 })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.apps
this.total = res.data.data.total
}
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此应用?' })
if (!confirmDelete) return
const res = await this.getData()
......
......@@ -94,6 +94,7 @@
</template>
<script>
import { insertTable } from '@/axios'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -196,9 +197,20 @@ export default {
this.clearCell(this.agoCell)
this.setCurrent()
},
save() {
async save() {
this.clearCell(this.agoCell)
this.setCurrent()
const res = await insertTable({
name: 'demo',
binary: [
['dGhpcyBpcyBhIHRlc3Qy', 'emhhbmc='],
['dGhpcyBpcyBhIHRlc3Qz', 'c2FuY2h1'],
['dGhpcyBpcyBhIHRlc3Qx', 'c2FuY2g1'],
]
})
if (res && res.data) {
}
},
setFlexHeight() {
const ele = document.getElementsByClassName('list-content') && document.getElementsByClassName('list-content')[0]
......@@ -220,7 +232,7 @@ export default {
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此数据?' })
if (!confirmDelete) return
const res = await this.getData()
......
......@@ -59,6 +59,7 @@
</template>
<script>
import { createTable, getTable, deleteTable } from '@/axios'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -77,23 +78,23 @@ export default {
},
{
label: '列数',
render: 'type'
render: 'columns'
},
{
label: '行数',
render: 'desc'
render: 'rows'
},
{
label: '容量',
render: 'desc'
render: 'storage'
},
{
label: '创建时间',
render: 'desc'
render: 'create_date'
},
{
label: '修改时间',
render: 'desc'
render: 'update_date'
},
{
label: '操作',
......@@ -102,46 +103,38 @@ export default {
slotName: 'operate'
},
],
tokenList: [
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
],
total: 34
tokenList: [],
total: 0
}
},
mounted() {
// this.getData()
this.getData()
},
methods: {
async getData() {
const res = await getTable({ pages: 0, pagesize: 5 })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.tables
this.total = res.data.data.total
}
},
cancelSubmit() {
this.form = {}
this.showDialog = false
},
submit() {
async submit() {
const res = await createTable(this.form)
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.getData()
}
this.showDialog = false
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此数据表?' })
if (!confirmDelete) return
const res = await this.getData()
const res = await deleteTable({ name: row.name })
if (res) {
Toast.success('操作成功')
this.getData()
......
......@@ -16,20 +16,28 @@
</st-form-item>
<st-form-item
:label="'模板类型'+':'"
prop="name">
<st-input v-model="form.name"></st-input>
prop="type">
<st-input v-model="form.type"></st-input>
</st-form-item>
<st-form-item
:label="'基础模板'+':'"
prop="name">
<st-select
v-model="form.name"
:options="modelOptions"
prop="base">
<!-- <st-select
v-model="form.base"
:options="baseOptions"
size="small"
class="contents"
clearable
>
</st-select>
</st-select> -->
<el-select v-model="form.base" placeholder="请选择" style="width: 400px;height: 32px;line-height: 32px">
<el-option
v-for="item in baseOptions"
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</st-form-item>
<st-form-item class="textarea"
:label="'描述'+':'"
......@@ -78,15 +86,18 @@
<div class="btn-box" v-if="scope.row.type === 'blob'">
<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 class="file-btn" v-if="scope.row.value">{{scope.row.value}}<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i></span>
<span class="file-btn" v-if="scope.row.value">
<el-image v-if="scope.row.value" style="width: 24px; height: 24px" :src="scope.row.value" fit="fit"></el-image>
<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i>
</span>
</div>
<div v-if="scope.row.type === 'table'">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<el-option
v-for="item in tableOptions"
:key="item.value"
:label="item.label"
:value="item.value">
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</pack-select>
</div>
......@@ -94,11 +105,11 @@
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<span @click="handleDelete(scope.row)" class="delete-btn">删除</span>
<span @click="handleDelete(scope.$index)" class="delete-btn">删除</span>
</template>
</el-table-column>
</el-table>
<div class="add-btn" @click="addTableData">
<div class="add-btn" @click="insertTableData">
<span class="add-btn-text"><i class="iconfont icon-tianjia"></i> 添加</span>
</div>
</div>
......@@ -113,13 +124,14 @@
</template>
<script>
import { createParameter, getTable, getParameter } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog'
export default {
data() {
return {
form: {},
rules: [],
file: '',
typeOptions: [{
value: 'number',
label: 'number'
......@@ -133,35 +145,9 @@ export default {
value: 'blob',
label: 'blob'
}],
tableOptions: [{
value: 'table1',
label: 'table1'
}, {
value: 'table2',
label: 'table2'
}],
modelOptions: [],
tableData: [{
field: 'name',
type: 'number',
value: '122'
}, {
field: 'database',
type: 'table',
value: 'fein_fe'
}, {
field: 'image',
type: 'blob',
value: ''
}, {
field: 'file',
type: 'blob',
value: ''
}, {
field: 'teat',
type: 'string',
value: '上海市普陀区金沙江路'
}],
tableOptions: [],
baseOptions: [],
tableData: [],
flexHeight: 0,
currentRow: ''
}
......@@ -176,36 +162,72 @@ export default {
this.setFlexHeight()
}, 10)
}
this.getTableOptions()
this.getBaseOptions()
},
methods: {
cancel() {},
save() {},
handleUpload(event, row) {
async getTableOptions() {
const res = await getTable({ pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
this.tableOptions = res.data.data.tables
}
},
async getBaseOptions() {
if (this.$route.query.level === '1') return
const res = await getParameter({ base: 1, pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
this.baseOptions = res.data.parameters.datas
}
},
async save() {
const tableData = this.tableData.filter(item => item.field && item.value)
const scalarsArr = tableData.filter(item => item.type === 'string' || item.type === 'number')
const binaryArr = tableData.filter(item => item.type === 'blob')
const tableArr = tableData.filter(item => item.type === 'table')
const scalarsObj = {}
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
}
const res = await createParameter({
...this.form,
parameters: {
scalars: scalarsObj,
binary: binaryObj,
table: tableObj
}
})
Toast.success('操作成功')
this.$router.push({ path: '/params' })
},
cancel() {
this.$router.push({ path: '/params' })
},
async handleUpload(event, row) {
row.file = event.target.files[0]
row.value = event.target.files[0].name
row.value = await fileToBase64(event.target.files[0])
},
deleteFile(row) {
row.file = ''
row.value = ''
},
insertTableData() {
this.tableData.push({ field: '', type: '', value: '' })
},
handleDelete(index) {
this.tableData.splice(index, 1)
},
setFlexHeight() {
const ele = document.getElementsByClassName('flex-item') && document.getElementsByClassName('flex-item')[0]
this.flexHeight = ele && ele.clientHeight
},
addTableData() {
this.tableData.push({ field: '', type: 'string', value: '' })
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
if (!confirmDelete) return
const res = await this.getData()
if (res) {
Toast.success('操作成功')
this.getData()
}
},
handleChange(row) {
row.file = ''
row.value = ''
......@@ -243,11 +265,16 @@ export default {
text-align: left
position: relative
::v-deep input
height: 32px
line-height: 32px
&::placeholder
font-size: 14px
font-family: PingFangSC-Regular, PingFang SC
font-weight: 400
color:#999999
::v-deep.el-input__icon
height: 32px
line-height: 32px
::v-deep.el-form-item, ::v-deep.el-form-item__label, ::v-deep.el-form-item__content
height: 32px
line-height: 32px
......
......@@ -12,13 +12,13 @@
<span>{{form.name}}</span>
</st-form-item>
<st-form-item :label="'模板类型'+':'">
<span>{{form.name}}</span>
<span>{{form.type}}</span>
</st-form-item>
<st-form-item :label="'基础模板'+':'">
<span>{{form.name}}</span>
<span>{{form.base}}</span>
</st-form-item>
<st-form-item :label="'描述'+':'">
<span>{{form.name}}</span>
<span>{{form.description}}</span>
</st-form-item>
<st-form-item :label="'参数'+':'" class="flex1">
<st-table
......@@ -29,6 +29,17 @@
list: tokenList,
total: total,
}">
<div slot="value" slot-scope="row">
<span v-if="row.type === 'number' || row.type === 'string'">{{row.value}}</span>
<span v-if="row.type === 'blob'" style="line-height: 28px">
<!-- TODO -->
<span style="float: left;margin-right: 10px">{{row.value.length * 0.75}}字节</span>
<el-image style="width: 42px; height: 28px;overflow: visible" :src="row.value" fit="fit">
<div slot="error">(不可预览)</div>
</el-image>
</span>
<span v-if="row.type === 'table'" style="color: #409EFF; cursor: pointer" @click="$router.push({ path: '/data' })">{{row.value}}</span>
</div>
</st-table>
</st-form-item>
</st-form>
......@@ -37,6 +48,7 @@
</template>
<script>
import { detailParameter } from '@/axios'
export default {
data() {
return {
......@@ -52,62 +64,31 @@ export default {
},
{
label: '值',
render: 'value'
type: 'slot',
slotName: 'value'
}
],
tokenList: [{
field: 'name',
type: 'number',
value: '122'
}, {
field: 'database',
type: 'table',
value: 'fein_fe'
}, {
field: 'image',
type: 'blob',
value: '24字节'
}, {
field: 'teat',
type: 'string',
value: '上海市普陀区金沙江路'
}, {
field: 'name',
type: 'number',
value: '122'
}, {
field: 'database',
type: 'table',
value: 'fein_fe'
}, {
field: 'image',
type: 'blob',
value: '24字节'
}, {
field: 'teat',
type: 'string',
value: '上海市普陀区金沙江路'
}, {
field: 'name',
type: 'number',
value: '122'
}, {
field: 'database',
type: 'table',
value: 'fein_fe'
}, {
field: 'image',
type: 'blob',
value: '24字节'
}, {
field: 'teat',
type: 'string',
value: '上海市普陀区金沙江路'
}],
tokenList: [],
total: 0
}
},
mounted() {
async mounted() {
const res = await detailParameter({ name: this.$route.query.name })
if (res && res.data && res.data.code === 0) {
this.form = res.data
const binaryObj = res.data.parameters.binary
const scalarsObj = res.data.parameters.scalars
const tableObj = res.data.parameters.table
for (const key in binaryObj) {
this.tokenList.push({ field: key, type: 'blob', value: binaryObj[key] })
}
for (const key in scalarsObj) {
this.tokenList.push({ field: key, type: typeof scalarsObj[key], value: scalarsObj[key] })
}
for (const key in tableObj) {
this.tokenList.push({ field: key, type: 'table', value: tableObj[key] })
}
}
},
methods: {
}
......@@ -122,8 +103,16 @@ export default {
display: flex
flex-direction: column
height: 100%
text-align: left
.flex1
flex: 1
::v-deep.el-form-item__content
height: 100%!important
::v-deep .el-table__row
height: 48px
::v-deep td
padding: 10px 0
::v-deep .cell
height: 28px
line-height: 28px!important
</style>
......@@ -16,20 +16,28 @@
</st-form-item>
<st-form-item
:label="'模板类型'+':'"
prop="name">
<st-input v-model="form.name"></st-input>
prop="type">
<st-input v-model="form.type"></st-input>
</st-form-item>
<st-form-item
:label="'基础模板'+':'"
prop="name">
<st-select
prop="base">
<!-- <st-select
v-model="form.name"
:options="modelOptions"
size="small"
class="contents"
clearable
>
</st-select>
</st-select> -->
<el-select v-model="form.base" placeholder="请选择" style="width: 400px;height: 32px;line-height: 32px">
<el-option
v-for="item in baseOptions"
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</st-form-item>
<st-form-item class="textarea"
:label="'描述'+':'"
......@@ -78,15 +86,23 @@
<div class="btn-box" v-if="scope.row.type === 'blob'">
<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 class="file-btn" v-if="scope.row.value">{{scope.row.value}}<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i></span>
<span v-if="scope.row.value" style="float: left;margin-right: 10px">{{scope.row.value.length * 0.75}}字节</span>
<span class="file-btn" v-if="scope.row.value">
<el-image v-if="scope.row.value" style="width: 24px; height: 24px" :src="scope.row.value" fit="fit"></el-image>
<i class="iconfont icon-guanbi" @click="deleteFile(scope.row)"></i>
</span>
<!-- <span v-if="scope.row.value" style="float: left;margin-right: 10px">{{scope.row.value.length * 0.75}}字节</span>
<el-image v-if="scope.row.value" style="width: 42px; height: 28px;overflow: visible" :src="scope.row.value" fit="fit">
<div slot="error">(不可预览)</div>
</el-image> -->
</div>
<div v-if="scope.row.type === 'table'">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<el-option
v-for="item in tableOptions"
:key="item.value"
:label="item.label"
:value="item.value">
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</pack-select>
</div>
......@@ -94,7 +110,7 @@
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<span @click="handleDelete(scope.row)" class="delete-btn">删除</span>
<span @click="handleDelete(scope.$index)" class="delete-btn">删除</span>
</template>
</el-table-column>
</el-table>
......@@ -113,6 +129,8 @@
</template>
<script>
import { editParameter, getParameter, detailParameter, getTable } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -133,35 +151,9 @@ export default {
value: 'blob',
label: 'blob'
}],
tableOptions: [{
value: 'table1',
label: 'table1'
}, {
value: 'table2',
label: 'table2'
}],
modelOptions: [],
tableData: [{
field: 'name',
type: 'number',
value: '122'
}, {
field: 'database',
type: 'table',
value: 'fein_fe'
}, {
field: 'image',
type: 'blob',
value: ''
}, {
field: 'file',
type: 'blob',
value: ''
}, {
field: 'teat',
type: 'string',
value: '上海市普陀区金沙江路'
}],
tableOptions: [],
baseOptions: [],
tableData: [],
flexHeight: 0,
currentRow: ''
}
......@@ -176,13 +168,74 @@ export default {
this.setFlexHeight()
}, 10)
}
this.getData()
this.getTableOptions()
this.getBaseOptions()
},
methods: {
async getTableOptions() {
const res = await getTable({ pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
this.tableOptions = res.data.data.tables
}
},
async getBaseOptions() {
if (this.$route.query.level === '1') return
const res = await getParameter({ base: 1, pages: 0, pagesize: 10000000000 })
if (res && res.data && res.data.code === 0) {
this.baseOptions = res.data.parameters.datas
}
},
async getData() {
const res = await detailParameter({ name: this.$route.query.name })
if (res && res.data && res.data.code === 0) {
this.form = res.data
const binaryObj = res.data.parameters.binary
const scalarsObj = res.data.parameters.scalars
const tableObj = res.data.parameters.table
for (const key in binaryObj) {
this.tableData.push({ field: key, type: 'blob', value: binaryObj[key] })
}
for (const key in scalarsObj) {
this.tableData.push({ field: key, type: typeof scalarsObj[key], value: scalarsObj[key] })
}
for (const key in tableObj) {
this.tableData.push({ field: key, type: 'table', value: tableObj[key] })
}
}
},
cancel() {},
save() {},
handleUpload(event, row) {
async save() {
const tableData = this.tableData.filter(item => item.field && item.value)
const scalarsArr = tableData.filter(item => item.type === 'string' || item.type === 'number')
const binaryArr = tableData.filter(item => item.type === 'blob')
const tableArr = tableData.filter(item => item.type === 'table')
const scalarsObj = {}
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
}
const res = await editParameter({
...this.form,
parameters: {
scalars: scalarsObj,
binary: binaryObj,
table: tableObj
}
})
Toast.success('操作成功')
this.$router.push({ path: '/params' })
},
async handleUpload(event, row) {
row.file = event.target.files[0]
row.value = event.target.files[0].name
row.value = await fileToBase64(event.target.files[0])
},
deleteFile(row) {
row.file = ''
......@@ -195,16 +248,8 @@ export default {
addTableData() {
this.tableData.push({ field: '', type: 'string', value: '' })
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
if (!confirmDelete) return
const res = await this.getData()
if (res) {
Toast.success('操作成功')
this.getData()
}
handleDelete(index) {
this.tableData.splice(index, 1)
},
handleChange(row) {
row.file = ''
......@@ -243,11 +288,16 @@ export default {
text-align: left
position: relative
::v-deep input
height: 32px
line-height: 32px
&::placeholder
font-size: 14px
font-family: PingFangSC-Regular, PingFang SC
font-weight: 400
color:#999999
::v-deep.el-input__icon
height: 32px
line-height: 32px
::v-deep.el-form-item, ::v-deep.el-form-item__label, ::v-deep.el-form-item__content
height: 32px
line-height: 32px
......
......@@ -6,7 +6,7 @@
<div class="page-content">
<div class="level level-one">
<div class="content-header">
<st-button type="primary" @click="$router.push({ path: '/params/add' })">
<st-button type="primary" @click="$router.push({ path: '/params/add', query: { level: 1 } })">
<i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
......@@ -20,13 +20,13 @@
:options="definitions"
:data="{
list: oneList,
total: total,
total: oneTotal,
}"
highlight-current-row
@row-click="handleClickRow">
<div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail' })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit' })">编辑</span>
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name }})">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div>
</st-table>
......@@ -36,7 +36,7 @@
<div class="blanking"></div>
<div class="level level-two">
<div class="content-header">
<st-button type="primary" @click="$router.push({ path: '/params/add' })">
<st-button type="primary" @click="$router.push({ path: '/params/add', query: { level: 2 } })">
<i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
......@@ -50,11 +50,11 @@
:options="definitions"
:data="{
list: twoList,
total: total,
total: twoTotal,
}">
<div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail' })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit' })">编辑</span>
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name } })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div>
</st-table>
......@@ -66,6 +66,7 @@
</template>
<script>
import { getParameter, deleteParameter } from '@/axios'
import Dialog from '@/helpers/dialog'
export default {
data() {
......@@ -86,7 +87,7 @@ export default {
},
{
label: '描述',
render: 'desc'
render: 'description'
},
{
label: '操作',
......@@ -95,45 +96,34 @@ export default {
slotName: 'operate'
},
],
oneList: [
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' },
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' },
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' },
],
twoList: [
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' },
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' },
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' },
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' },
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' }
],
total: 34
oneList: [],
twoList: [],
oneTotal: 0,
twoTotal: 0
}
},
mounted() {
// this.getData()
this.getData()
},
methods: {
async getData() {
const oneLevel = await getParameter({ base: 1, pages: 0, pagesize: 5 })
if (oneLevel && oneLevel.data && oneLevel.data.code === 0) {
this.oneList = oneLevel.data.parameters.datas
this.oneTotal = oneLevel.data.parameters.total
}
const twoLevel = await getParameter({ base: 0, pages: 0, pagesize: 5 })
if (twoLevel && twoLevel.data && twoLevel.data.code === 0) {
this.twoList = twoLevel.data.parameters.datas
this.twoTotal = twoLevel.data.parameters.total
}
},
async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此模板?' })
if (!confirmDelete) return
const res = await this.getData()
const res = await deleteParameter({ name: row.name })
if (res) {
Toast.success('操作成功')
this.getData()
......
......@@ -124,7 +124,8 @@ import seetaPopover from '@/components/seeta-ui/seeta-popover'
import { saveUser } from '@/utils/user'
import { loginApi } from '@/axios'
import { langList } from '@/i18n/utils'
import axios from 'axios'
import https from 'https'
export default {
name: 'login',
components: {
......@@ -275,36 +276,25 @@ export default {
username: this.userName,
password: this.userPassWord
})
if (res) {
// const res = await axios({
// httpsAgent: new https.Agent({
// rejectUnauthorized: false
// }),
// data: {
// username: this.userName,
// password: this.userPassWord
// },
// method: 'post',
// url: '/front/user/login',
// })
// .then(response => console.log(response.data))
// .catch(e => console.log(e))
if (res && res.data.code === 0) {
// TokenId
browserStorage.setItem('id', res.data.id)
const resInfo = await usersApi.getUser(res.data.subject_id)
if (resInfo) {
// 如果subjectID和个人信息ID重复则只存一个
if (res.data.subject_id === resInfo.data.id) {
// 用户ID
browserStorage.setItem('userId', res.data.subject_id)
} else {
// 个人信息的ID
browserStorage.setItem('reqId', resInfo.data.id)
// 用户ID
browserStorage.setItem('userId', res.data.subject_id)
}
browserStorage.setItem('username', resInfo.data.username)
// UUID
browserStorage.setItem('uuid', resInfo.data.uuid)
// 页面右上角用户名显示
browserStorage.setItem('user', JSON.stringify({ username: this.userName }))
// 进入欢迎页
this.$router.push({ name: 'apply' })
} else {
vm.$notify.error({
title: '请求错误',
message: '获取用户信息失败,请重新登录',
})
}
browserStorage.setItem('token', res.data.token)
this.$router.push({ path: '/params' })
} else {
this.errmsg = this.$store.getters.errorInfo.msg
Toast.danger(res.data.msg)
}
},
// 管理员登录
......
......@@ -52,21 +52,22 @@ module.exports = {
.loader('babel-loader')
.end()
},
// devServer: {
// // development server port 8000
// port: 9000,
// // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
// // 配置代理,解决跨域
// proxy: {
// // 匹配到/api才使用代理,避免路由冲突
// '/api': {
// target: 'http://218.94.122.141:8089',
// changeOrigin: true,
// pathRewrite: {
// // 路径重写
// '^/api': '/' // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上
// }
// }
// }
// },
devServer: {
// development server port 8000
// port: 8080,
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
// 配置代理,解决跨域
proxy: {
// 匹配到/api才使用代理,避免路由冲突
'/front': {
target: 'https://218.94.122.141:9997',
// secure: false,
changeOrigin: true,
pathRewrite: {
// 路径重写
'^/front': '/front' // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上
}
}
}
},
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!