Commit e69959c4 by 温丽香

接口联调

1 parent 8ca80d42
Pipeline #3601 passed
in 2 minutes 24 seconds
...@@ -7859,6 +7859,11 @@ ...@@ -7859,6 +7859,11 @@
"sshpk": "^1.7.0" "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": { "https-browserify": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/https-browserify/download/https-browserify-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/https-browserify/download/https-browserify-1.0.0.tgz",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"dompurify": "^2.0.7", "dompurify": "^2.0.7",
"element-ui": "^2.15.3", "element-ui": "^2.15.3",
"exif-js": "^2.3.0", "exif-js": "^2.3.0",
"https": "^1.0.0",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"moment": "^2.24.0", "moment": "^2.24.0",
......
...@@ -11,6 +11,7 @@ export const getParameter = data => axios(GET, FRONT + PARAMETER + '/query_list' ...@@ -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 createParameter = data => axios(POST, FRONT + PARAMETER + '/create', data)
export const deleteParameter = data => axios(GET, FRONT + PARAMETER + '/delete', data) export const deleteParameter = data => axios(GET, FRONT + PARAMETER + '/delete', data)
export const editParameter = data => axios(POST, FRONT + PARAMETER + '/change', data) export const editParameter = data => axios(POST, FRONT + PARAMETER + '/change', data)
export const detailParameter = data => axios(GET, FRONT + PARAMETER + '/query', data)
const TABLE = '/table' const TABLE = '/table'
export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data) export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data)
......
...@@ -15,7 +15,7 @@ function notificationError(title: any, msg: any, duration: number = 1500) { ...@@ -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) => { export default (method, url, data, config) => {
method = method.toLowerCase() method = method.toLowerCase()
......
export default [ export default [
{ {
path: '/', path: '/',
redirect: '/device' redirect: '/login'
}, },
{ {
path: '/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 { ...@@ -202,7 +202,7 @@ export default {
}, },
async handleDelete(row) { async handleDelete(row) {
console.log(row) console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此账号?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await this.getData()
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
</template> </template>
<script> <script>
import { getApp } from '@/axios'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
...@@ -65,36 +66,24 @@ export default { ...@@ -65,36 +66,24 @@ export default {
slotName: 'operate' slotName: 'operate'
}, },
], ],
tokenList: [ 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' },
],
total: 34 total: 34
} }
}, },
mounted() { mounted() {
// this.getData() this.getData()
}, },
methods: { 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) { async handleDelete(row) {
console.log(row) console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此应用?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await this.getData()
......
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
</template> </template>
<script> <script>
import { insertTable } from '@/axios'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
...@@ -196,9 +197,20 @@ export default { ...@@ -196,9 +197,20 @@ export default {
this.clearCell(this.agoCell) this.clearCell(this.agoCell)
this.setCurrent() this.setCurrent()
}, },
save() { async save() {
this.clearCell(this.agoCell) this.clearCell(this.agoCell)
this.setCurrent() this.setCurrent()
const res = await insertTable({
name: 'demo',
binary: [
['dGhpcyBpcyBhIHRlc3Qy', 'emhhbmc='],
['dGhpcyBpcyBhIHRlc3Qz', 'c2FuY2h1'],
['dGhpcyBpcyBhIHRlc3Qx', 'c2FuY2g1'],
]
})
if (res && res.data) {
}
}, },
setFlexHeight() { setFlexHeight() {
const ele = document.getElementsByClassName('list-content') && document.getElementsByClassName('list-content')[0] const ele = document.getElementsByClassName('list-content') && document.getElementsByClassName('list-content')[0]
...@@ -220,7 +232,7 @@ export default { ...@@ -220,7 +232,7 @@ export default {
}, },
async handleDelete(row) { async handleDelete(row) {
console.log(row) console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此数据?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await this.getData()
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
</template> </template>
<script> <script>
import { createTable, getTable, deleteTable } from '@/axios'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
...@@ -77,23 +78,23 @@ export default { ...@@ -77,23 +78,23 @@ export default {
}, },
{ {
label: '列数', label: '列数',
render: 'type' render: 'columns'
}, },
{ {
label: '行数', label: '行数',
render: 'desc' render: 'rows'
}, },
{ {
label: '容量', label: '容量',
render: 'desc' render: 'storage'
}, },
{ {
label: '创建时间', label: '创建时间',
render: 'desc' render: 'create_date'
}, },
{ {
label: '修改时间', label: '修改时间',
render: 'desc' render: 'update_date'
}, },
{ {
label: '操作', label: '操作',
...@@ -102,46 +103,38 @@ export default { ...@@ -102,46 +103,38 @@ export default {
slotName: 'operate' slotName: 'operate'
}, },
], ],
tokenList: [ tokenList: [],
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' }, total: 0
{ 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
} }
}, },
mounted() { mounted() {
// this.getData() this.getData()
}, },
methods: { 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() { cancelSubmit() {
this.form = {} this.form = {}
this.showDialog = false 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 this.showDialog = false
}, },
async handleDelete(row) { async handleDelete(row) {
console.log(row) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此数据表?' })
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await deleteTable({ name: row.name })
if (res) { if (res) {
Toast.success('操作成功') Toast.success('操作成功')
this.getData() this.getData()
......
...@@ -16,20 +16,28 @@ ...@@ -16,20 +16,28 @@
</st-form-item> </st-form-item>
<st-form-item <st-form-item
:label="'模板类型'+':'" :label="'模板类型'+':'"
prop="name"> prop="type">
<st-input v-model="form.name"></st-input> <st-input v-model="form.type"></st-input>
</st-form-item> </st-form-item>
<st-form-item <st-form-item
:label="'基础模板'+':'" :label="'基础模板'+':'"
prop="name"> prop="base">
<st-select <!-- <st-select
v-model="form.name" v-model="form.base"
:options="modelOptions" :options="baseOptions"
size="small" size="small"
class="contents" class="contents"
clearable 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>
<st-form-item class="textarea" <st-form-item class="textarea"
:label="'描述'+':'" :label="'描述'+':'"
...@@ -78,15 +86,18 @@ ...@@ -78,15 +86,18 @@
<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 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 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>
<div v-if="scope.row.type === 'table'"> <div v-if="scope.row.type === 'table'">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange"> <pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<el-option <el-option
v-for="item in tableOptions" v-for="item in tableOptions"
:key="item.value" :key="item.name"
:label="item.label" :label="item.name"
:value="item.value"> :value="item.name">
</el-option> </el-option>
</pack-select> </pack-select>
</div> </div>
...@@ -94,11 +105,11 @@ ...@@ -94,11 +105,11 @@
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="handleDelete(scope.row)" class="delete-btn">删除</span> <span @click="handleDelete(scope.$index)" class="delete-btn">删除</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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> <span class="add-btn-text"><i class="iconfont icon-tianjia"></i> 添加</span>
</div> </div>
</div> </div>
...@@ -113,13 +124,14 @@ ...@@ -113,13 +124,14 @@
</template> </template>
<script> <script>
import { createParameter, getTable, getParameter } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
return { return {
form: {}, form: {},
rules: [], rules: [],
file: '',
typeOptions: [{ typeOptions: [{
value: 'number', value: 'number',
label: 'number' label: 'number'
...@@ -133,35 +145,9 @@ export default { ...@@ -133,35 +145,9 @@ export default {
value: 'blob', value: 'blob',
label: 'blob' label: 'blob'
}], }],
tableOptions: [{ tableOptions: [],
value: 'table1', baseOptions: [],
label: 'table1' tableData: [],
}, {
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: '上海市普陀区金沙江路'
}],
flexHeight: 0, flexHeight: 0,
currentRow: '' currentRow: ''
} }
...@@ -176,36 +162,72 @@ export default { ...@@ -176,36 +162,72 @@ export default {
this.setFlexHeight() this.setFlexHeight()
}, 10) }, 10)
} }
this.getTableOptions()
this.getBaseOptions()
}, },
methods: { methods: {
cancel() {}, async getTableOptions() {
save() {}, const res = await getTable({ pages: 0, pagesize: 10000000000 })
handleUpload(event, row) { 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.file = event.target.files[0]
row.value = event.target.files[0].name row.value = await fileToBase64(event.target.files[0])
}, },
deleteFile(row) { deleteFile(row) {
row.file = '' row.file = ''
row.value = '' row.value = ''
}, },
insertTableData() {
this.tableData.push({ field: '', type: '', value: '' })
},
handleDelete(index) {
this.tableData.splice(index, 1)
},
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
}, },
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) { handleChange(row) {
row.file = '' row.file = ''
row.value = '' row.value = ''
...@@ -243,11 +265,16 @@ export default { ...@@ -243,11 +265,16 @@ export default {
text-align: left text-align: left
position: relative position: relative
::v-deep input ::v-deep input
height: 32px
line-height: 32px
&::placeholder &::placeholder
font-size: 14px font-size: 14px
font-family: PingFangSC-Regular, PingFang SC font-family: PingFangSC-Regular, PingFang SC
font-weight: 400 font-weight: 400
color:#999999 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 ::v-deep.el-form-item, ::v-deep.el-form-item__label, ::v-deep.el-form-item__content
height: 32px height: 32px
line-height: 32px line-height: 32px
......
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
<span>{{form.name}}</span> <span>{{form.name}}</span>
</st-form-item> </st-form-item>
<st-form-item :label="'模板类型'+':'"> <st-form-item :label="'模板类型'+':'">
<span>{{form.name}}</span> <span>{{form.type}}</span>
</st-form-item> </st-form-item>
<st-form-item :label="'基础模板'+':'"> <st-form-item :label="'基础模板'+':'">
<span>{{form.name}}</span> <span>{{form.base}}</span>
</st-form-item> </st-form-item>
<st-form-item :label="'描述'+':'"> <st-form-item :label="'描述'+':'">
<span>{{form.name}}</span> <span>{{form.description}}</span>
</st-form-item> </st-form-item>
<st-form-item :label="'参数'+':'" class="flex1"> <st-form-item :label="'参数'+':'" class="flex1">
<st-table <st-table
...@@ -29,6 +29,17 @@ ...@@ -29,6 +29,17 @@
list: tokenList, list: tokenList,
total: total, 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-table>
</st-form-item> </st-form-item>
</st-form> </st-form>
...@@ -37,6 +48,7 @@ ...@@ -37,6 +48,7 @@
</template> </template>
<script> <script>
import { detailParameter } from '@/axios'
export default { export default {
data() { data() {
return { return {
...@@ -52,62 +64,31 @@ export default { ...@@ -52,62 +64,31 @@ export default {
}, },
{ {
label: '值', label: '值',
render: 'value' type: 'slot',
slotName: 'value'
} }
], ],
tokenList: [{ 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: '上海市普陀区金沙江路'
}],
total: 0 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: { methods: {
} }
...@@ -122,8 +103,16 @@ export default { ...@@ -122,8 +103,16 @@ export default {
display: flex display: flex
flex-direction: column flex-direction: column
height: 100% height: 100%
text-align: left
.flex1 .flex1
flex: 1 flex: 1
::v-deep.el-form-item__content ::v-deep.el-form-item__content
height: 100%!important 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> </style>
...@@ -16,20 +16,28 @@ ...@@ -16,20 +16,28 @@
</st-form-item> </st-form-item>
<st-form-item <st-form-item
:label="'模板类型'+':'" :label="'模板类型'+':'"
prop="name"> prop="type">
<st-input v-model="form.name"></st-input> <st-input v-model="form.type"></st-input>
</st-form-item> </st-form-item>
<st-form-item <st-form-item
:label="'基础模板'+':'" :label="'基础模板'+':'"
prop="name"> prop="base">
<st-select <!-- <st-select
v-model="form.name" v-model="form.name"
:options="modelOptions" :options="modelOptions"
size="small" size="small"
class="contents" class="contents"
clearable 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>
<st-form-item class="textarea" <st-form-item class="textarea"
:label="'描述'+':'" :label="'描述'+':'"
...@@ -78,15 +86,23 @@ ...@@ -78,15 +86,23 @@
<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 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 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>
<div v-if="scope.row.type === 'table'"> <div v-if="scope.row.type === 'table'">
<pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange"> <pack-select v-model="scope.row.value" placeholder="请选择" @blur="handleBlur" @visible-change="handleVisibleChange">
<el-option <el-option
v-for="item in tableOptions" v-for="item in tableOptions"
:key="item.value" :key="item.name"
:label="item.label" :label="item.name"
:value="item.value"> :value="item.name">
</el-option> </el-option>
</pack-select> </pack-select>
</div> </div>
...@@ -94,7 +110,7 @@ ...@@ -94,7 +110,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="handleDelete(scope.row)" class="delete-btn">删除</span> <span @click="handleDelete(scope.$index)" class="delete-btn">删除</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -113,6 +129,8 @@ ...@@ -113,6 +129,8 @@
</template> </template>
<script> <script>
import { editParameter, getParameter, detailParameter, getTable } from '@/axios'
import { fileToBase64 } from '@/utils/typeConversion'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
...@@ -133,35 +151,9 @@ export default { ...@@ -133,35 +151,9 @@ export default {
value: 'blob', value: 'blob',
label: 'blob' label: 'blob'
}], }],
tableOptions: [{ tableOptions: [],
value: 'table1', baseOptions: [],
label: 'table1' tableData: [],
}, {
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: '上海市普陀区金沙江路'
}],
flexHeight: 0, flexHeight: 0,
currentRow: '' currentRow: ''
} }
...@@ -176,13 +168,74 @@ export default { ...@@ -176,13 +168,74 @@ export default {
this.setFlexHeight() this.setFlexHeight()
}, 10) }, 10)
} }
this.getData()
this.getTableOptions()
this.getBaseOptions()
}, },
methods: { 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() {}, cancel() {},
save() {}, async save() {
handleUpload(event, row) { 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.file = event.target.files[0]
row.value = event.target.files[0].name row.value = await fileToBase64(event.target.files[0])
}, },
deleteFile(row) { deleteFile(row) {
row.file = '' row.file = ''
...@@ -195,16 +248,8 @@ export default { ...@@ -195,16 +248,8 @@ export default {
addTableData() { addTableData() {
this.tableData.push({ field: '', type: 'string', value: '' }) this.tableData.push({ field: '', type: 'string', value: '' })
}, },
async handleDelete(row) { handleDelete(index) {
console.log(row) this.tableData.splice(index, 1)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' })
if (!confirmDelete) return
const res = await this.getData()
if (res) {
Toast.success('操作成功')
this.getData()
}
}, },
handleChange(row) { handleChange(row) {
row.file = '' row.file = ''
...@@ -243,11 +288,16 @@ export default { ...@@ -243,11 +288,16 @@ export default {
text-align: left text-align: left
position: relative position: relative
::v-deep input ::v-deep input
height: 32px
line-height: 32px
&::placeholder &::placeholder
font-size: 14px font-size: 14px
font-family: PingFangSC-Regular, PingFang SC font-family: PingFangSC-Regular, PingFang SC
font-weight: 400 font-weight: 400
color:#999999 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 ::v-deep.el-form-item, ::v-deep.el-form-item__label, ::v-deep.el-form-item__content
height: 32px height: 32px
line-height: 32px line-height: 32px
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="page-content"> <div class="page-content">
<div class="level level-one"> <div class="level level-one">
<div class="content-header"> <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> <i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search"> <div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal"> <input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
:options="definitions" :options="definitions"
:data="{ :data="{
list: oneList, list: oneList,
total: total, total: oneTotal,
}" }"
highlight-current-row highlight-current-row
@row-click="handleClickRow"> @row-click="handleClickRow">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail' })">详情</span> <span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name }})">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit' })">编辑</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> <span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div> </div>
</st-table> </st-table>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<div class="blanking"></div> <div class="blanking"></div>
<div class="level level-two"> <div class="level level-two">
<div class="content-header"> <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> <i class="iconfont icon-tianjia"></i><span class="text">{{'添加'}}</span></st-button>
<div class="search"> <div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal"> <input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
:options="definitions" :options="definitions"
:data="{ :data="{
list: twoList, list: twoList,
total: total, total: twoTotal,
}"> }">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail' })">详情</span> <span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name } })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit' })">编辑</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> <span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div> </div>
</st-table> </st-table>
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
</template> </template>
<script> <script>
import { getParameter, deleteParameter } from '@/axios'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
...@@ -86,7 +87,7 @@ export default { ...@@ -86,7 +87,7 @@ export default {
}, },
{ {
label: '描述', label: '描述',
render: 'desc' render: 'description'
}, },
{ {
label: '操作', label: '操作',
...@@ -95,45 +96,34 @@ export default { ...@@ -95,45 +96,34 @@ export default {
slotName: 'operate' slotName: 'operate'
}, },
], ],
oneList: [ oneList: [],
{ number: 1, name: 'aa', type: 'aa', desc: 'aaasdfasdfasdaa' }, twoList: [],
{ number: 1, name: 'aa', type: 'aa', desc: '描述描述描述描述描述描述' }, oneTotal: 0,
{ number: 1, name: 'aa', type: 'aa', desc: 'aaaa' }, twoTotal: 0
{ 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
} }
}, },
mounted() { mounted() {
// this.getData() this.getData()
}, },
methods: { 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) { async handleDelete(row) {
console.log(row) console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此日志?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此模板?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await deleteParameter({ name: row.name })
if (res) { if (res) {
Toast.success('操作成功') Toast.success('操作成功')
this.getData() this.getData()
......
...@@ -124,7 +124,8 @@ import seetaPopover from '@/components/seeta-ui/seeta-popover' ...@@ -124,7 +124,8 @@ import seetaPopover from '@/components/seeta-ui/seeta-popover'
import { saveUser } from '@/utils/user' import { saveUser } from '@/utils/user'
import { loginApi } from '@/axios' import { loginApi } from '@/axios'
import { langList } from '@/i18n/utils' import { langList } from '@/i18n/utils'
import axios from 'axios'
import https from 'https'
export default { export default {
name: 'login', name: 'login',
components: { components: {
...@@ -275,36 +276,25 @@ export default { ...@@ -275,36 +276,25 @@ export default {
username: this.userName, username: this.userName,
password: this.userPassWord 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 // TokenId
browserStorage.setItem('id', res.data.id) browserStorage.setItem('token', res.data.token)
const resInfo = await usersApi.getUser(res.data.subject_id) this.$router.push({ path: '/params' })
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: '获取用户信息失败,请重新登录',
})
}
} else { } else {
this.errmsg = this.$store.getters.errorInfo.msg Toast.danger(res.data.msg)
} }
}, },
// 管理员登录 // 管理员登录
......
...@@ -52,21 +52,22 @@ module.exports = { ...@@ -52,21 +52,22 @@ module.exports = {
.loader('babel-loader') .loader('babel-loader')
.end() .end()
}, },
// devServer: { devServer: {
// // development server port 8000 // development server port 8000
// port: 9000, // port: 8080,
// // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11 // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
// // 配置代理,解决跨域 // 配置代理,解决跨域
// proxy: { proxy: {
// // 匹配到/api才使用代理,避免路由冲突 // 匹配到/api才使用代理,避免路由冲突
// '/api': { '/front': {
// target: 'http://218.94.122.141:8089', target: 'https://218.94.122.141:9997',
// changeOrigin: true, // secure: false,
// pathRewrite: { changeOrigin: true,
// // 路径重写 pathRewrite: {
// '^/api': '/' // 这个意思就是以api开头的,定向到哪里, 如果你的后边还有路径的话, 会自动拼接上 // 路径重写
// } '^/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!