模型、日志联调

dev_2022-03-03
yujialong 3 years ago
parent 2c6fe60b1d
commit b04fa6a44b
  1. 4
      src/views/order/AddOrder.vue
  2. 79
      src/views/serve/backstage/model.vue
  3. 7
      src/views/serve/backstage/modelType.vue
  4. 3
      src/views/serve/backstage/sourceType.vue
  5. 89
      src/views/system/addLog.vue
  6. 6
      src/views/system/log.vue
  7. 49
      src/views/system/manageLog.vue

@ -300,7 +300,7 @@
<span v-if="scope.row.startTime"><span v-if='scope.row.endTime'> - </span>{{ scope.row.endTime }}</span></p>
</template>
</el-table-column>
<el-table-column label="剩余期限" align="center" min-width="65">
<el-table-column label="剩余期限" align="center" min-width="70">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.remainingPeriod" placeholder=""
@ -1361,7 +1361,7 @@ export default {
let optionsData = ''
if(e > 0){
if (options == 1){
optionsData = e*30*24*60*60*1000
optionsData = e === '12' ? 31536000000 : e*30*24*60*60*1000
}else if(options == 2){
optionsData = e*365*24*60*60*1000
}else{

@ -105,40 +105,57 @@ export default {
//
add() {
this.modelVisible = true
//
this.$post(this.api.sourceModelClassification).then(res => {
const { data } = res
const promises = []
const addType = list => {
list.map(e => {
// promise
promises.push(new Promise((resolve,reject) => {
this.$post(this.api.sysModelDemoList, {
pageNum: 1,
pageSize: 10000,
categoryId: e.id
}).then(res => {
const { records } = res.data
records.map(n => {
n.categoryName = n.modelName
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() //
//
this.$post(this.api.referenceDemoList, {
pageNum: 1,
pageSize: 10000,
categoryId
}).then(res => {
const modelList = res.data.records
//
this.$post(this.api.sourceModelClassification).then(res => {
const { data } = res
const promises = []
const addType = list => {
list.map(e => {
// promise
promises.push(new Promise((resolve,reject) => {
//
this.$post(this.api.sysModelDemoList, {
pageNum: 1,
pageSize: 10000,
categoryId: e.id
}).then(res => {
const { records } = res.data
const modelChildren = []
// copyIdid
records.map(n => {
if (!modelList.find(e => e.copyId === n.id)) {
n.categoryName = n.modelName
modelChildren.push(n)
}
})
e.children = [...e.children, ...modelChildren]
// console.log(11, e)
resolve()
}).catch(res => {
reject()
})
e.children = [...e.children, ...records]
// console.log(11, e)
resolve()
}).catch(res => {
reject()
})
}))
e.children && e.children.length && addType(e.children)
})
}
addType(data)
// debugger
console.log(data, promises)
Promise.all(promises).then(_ => {
this.modelData = data
}))
e.children && e.children.length && addType(e.children)
})
}
addType(data)
// debugger
console.log(data, promises)
Promise.all(promises).then(_ => {
this.modelData = data
}).catch(res => {})
}).catch(res => {})
}).catch(res => {})
},
//
show(row) {

@ -119,7 +119,7 @@ export default {
//
async addData(id) {
//
this.$post(this.api.sourceModelClassification).then((res) => {
this.$post(this.api.sourceModelClassification).then(res => {
const { data } = res
const systemId = this.systemId
const promises = []
@ -149,7 +149,7 @@ export default {
records = records.filter(e => e.postStatus && !e.isOpen) //
if (records.length) {
const modelData = []
//
//
records.map(e => {
modelData.push({
systemId,
@ -199,6 +199,7 @@ export default {
//
editType(data) {
this.Form.id = data.id
this.Form.parentId = data ? data.parentId : 0
this.Form.categoryName = data.categoryName
this.typeVisible = true
},
@ -209,6 +210,7 @@ export default {
const form = this.Form
const data = {
id: form.id,
parentId: form.parentId,
categoryName: form.categoryName,
systemId: this.systemId
}
@ -220,7 +222,6 @@ export default {
}).catch(res => {})
} else {
data.level = form.level
data.parentId = form.parentId
this.$post(this.api.saveReferenceCategory, data).then(res => {
this.$message.success("添加成功")
this.typeVisible = false

@ -100,6 +100,7 @@ export default {
//
editType(data) {
this.Form.id = data.id
this.Form.parentId = data ? data.parentId : 0
this.Form.categoryName = data.categoryName
this.typeVisible = true
},
@ -110,6 +111,7 @@ export default {
const form = this.Form
const data = {
id: form.id,
parentId: form.parentId,
categoryName: form.categoryName,
systemId: this.systemId
}
@ -121,7 +123,6 @@ export default {
}).catch(res => {})
} else {
data.level = form.level
data.parentId = form.parentId
this.$post(this.api.categorySave, data).then(res => {
this.$message.success("添加成功")
this.typeVisible = false

@ -7,15 +7,15 @@
<span class="per_back">返回</span>
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span>
</div>
<div v-if="!isDetail">
<div>
<el-button type="primary" round v-preventReClick @click="submit(0)">发布</el-button>
<el-button v-if="!postStatus" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button>
<el-button v-if="draft || !id" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button>
</div>
</div>
</el-card>
<el-card shadow="hover">
<el-form ref="form" label-width="120px" :disabled="isDetail">
<el-form ref="form" label-width="120px">
<el-form-item label="版本标题">
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px"></el-input>
</el-form-item>
@ -42,26 +42,26 @@
</el-form-item>
<el-form-item label="更新内容">
<ul class="contents">
<li v-for="(item, i) in form.content" :key="i">
<li v-for="(item, i) in form.logContents" :key="i">
<div class="action">
<el-select v-model="value" size="small" placeholder="请选择版本">
<el-select v-model="item.type" size="small" placeholder="请选择">
<el-option
v-for="item in vers"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in funcList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<div class="btns">
<i v-if="i === form.content.length - 1" class="el-icon-circle-plus-outline" @click="add"></i>
<i class="el-icon-delete" @click="del"></i>
<i v-if="i === form.logContents.length - 1" class="el-icon-circle-plus-outline" @click="add"></i>
<i class="el-icon-delete" @click="del(i)"></i>
</div>
</div>
<el-input
type="textarea"
:rows="5"
placeholder="请输入"
v-model="textarea">
v-model="item.content">
</el-input>
</li>
</ul>
@ -76,15 +76,38 @@ export default {
data() {
return {
id : this.$route.query.id,
platformId: this.$route.query.platformId,
draft : this.$route.query.draft === '1',
headers: {
token: sessionStorage.getItem("token")
},
funcList: [
{
id: 0,
name: '新功能'
},
{
id: 1,
name: '修复'
},
{
id: 2,
name: '优化'
}
],
form: {
versionName: '',
coverUrl: '',
content: [{}]
logContents: []
},
originContent: {
type: '',
content: ''
}
};
},
mounted() {
this.id && this.getData()
this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
},
methods: {
//
@ -93,27 +116,53 @@ export default {
const { log } = res
this.form.versionName = log.versionName
this.form.coverUrl = log.coverUrl
this.form.logContents = log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))]
}).catch(res => {})
},
//
add() {
this.form.content.push({})
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent)))
},
//
del() {
del(i) {
this.form.logContents.splice(i, 1)
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.coverUrl = ''
}).catch(res => {});
},
//
submit(draft){
const { versionName, coverUrl } = this.form
const { versionName, logContents } = this.form
const id = this.id
if (!versionName) return this.$message.error('请输入版本标题')
if (!coverUrl) return this.$message.error('请输入更新内容')
if (!logContents.length || !logContents.find(e => e.type !== '' && e.content)) return this.$message.error('请输入更新内容')
const data = {
platformId: this.platformId,
versionName,
coverUrl,
coverUrl: this.form.coverUrl,
logContents,
draft
}
debugger
if (id) {
data.logId = id
this.$post(this.api.listUpdate, data).then(res => {

@ -13,7 +13,7 @@
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="roleName" label="平台名称" align="center" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ platformList.find(e => e.id === scope.row.platformId).name }}
{{ platformList.find(e => e.id === scope.row.platformId) && platformList.find(e => e.id === scope.row.platformId).name }}
</template>
</el-table-column>
<el-table-column prop="versionName" label="最新版本名称" align="center"></el-table-column>
@ -49,9 +49,7 @@ export default {
roleName: "",
remark: ""
},
listData: [
{}
],
listData: [],
page: 1,
pageSize: 10,
total: 0

@ -5,12 +5,12 @@
<h6>日志更新</h6>
<div class="filter">
<label>版本查询</label>
<el-select v-model="versionName" size="small" placeholder="请选择版本">
<el-select v-model="versionName" size="small" placeholder="请选择版本" filterable @change="verChange">
<el-option
v-for="item in vers"
:key="item.value"
:label="item.label"
:value="item.value">
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
@ -21,16 +21,16 @@
</div>
<el-timeline class="timeline">
<el-timeline-item placement="top" v-for="(item, i) in listData" :key="i">
<p class="sign">{{ item.updateTime }}</p>
<p class="sign" :id="'ver' + i">{{ item.updateTime }}</p>
<div class="ver">
<div>
{{ platformList.find(e => e.id === item.platformId).name + item.versionName }}
{{ platformName + item.versionName }}
<span class="action">
<i class="el-icon-edit-outline" @click="edit(item)"></i>
<i class="el-icon-delete" @click="del(item)"></i>
</span>
</div>
<el-switch v-model="frontShow" :active-value="0" :inactive-value="1"></el-switch>
<el-switch v-model="item.open" :active-value="0" :inactive-value="1" @change="switchOff($event, item)"></el-switch>
</div>
<ul class="detail">
<li>
@ -49,7 +49,7 @@ export default {
data() {
return {
platformId: this.$route.query.platformId,
platformList: Setting.platformList,
platformName: '',
versionName: '',
vers: [],
listData: []
@ -59,18 +59,32 @@ export default {
this.getData()
},
methods: {
//
getData() {
this.$get(`${this.api.platformLogList}?platformId=${this.platformId}&versionName=${this.versionName}`).then(res => {
this.listData = res.logList
const { logList } = res
if (logList.length) {
const vers = []
const platformName = Setting.platformList.find(e => e.id === logList[0].platformId).name
this.platformName = platformName
this.listData = logList
logList.map((e, i) => {
vers.push({
id: i,
name: e.versionName
})
})
this.vers = vers
}
}).catch(res => {})
},
//
add() {
this.$router.push(`/addLog`)
this.$router.push(`/addLog?platformId=${this.platformId}`)
},
//
edit(item) {
this.$router.push(`/addLog?id=${item.logId}`)
this.$router.push(`/addLog?platformId=${this.platformId}&id=${item.logId}&draft=${item.draft}`)
},
//
del(item) {
@ -82,6 +96,19 @@ export default {
this.getData()
}).catch(res => {})
}).catch(() => {})
},
//
switchOff(val, row) {
this.$post(this.api.listUpdate, {
logId: row.logId,
open: val
}).then(res => {
this.$message.success(val ? '禁用成功' : '启用成功')
}).catch(res => {})
},
//
verChange(i) {
document.querySelector(`#ver${i}`).scrollIntoView()
}
}
};

Loading…
Cancel
Save