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{
diff --git a/src/views/serve/backstage/model.vue b/src/views/serve/backstage/model.vue
index b748a93..4277035 100644
--- a/src/views/serve/backstage/model.vue
+++ b/src/views/serve/backstage/model.vue
@@ -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 = []
+ // 判重,重复的模型不再显示,通过模型的copyId和源模型的id作比对
+ 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) {
diff --git a/src/views/serve/backstage/modelType.vue b/src/views/serve/backstage/modelType.vue
index b4e6706..95b6b31 100644
--- a/src/views/serve/backstage/modelType.vue
+++ b/src/views/serve/backstage/modelType.vue
@@ -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
diff --git a/src/views/serve/backstage/sourceType.vue b/src/views/serve/backstage/sourceType.vue
index dc5353d..44a17d7 100644
--- a/src/views/serve/backstage/sourceType.vue
+++ b/src/views/serve/backstage/sourceType.vue
@@ -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
diff --git a/src/views/system/addLog.vue b/src/views/system/addLog.vue
index 97bec87..d271813 100644
--- a/src/views/system/addLog.vue
+++ b/src/views/system/addLog.vue
@@ -7,15 +7,15 @@
返回
-
-
+
@@ -42,26 +42,26 @@
- -
+
-
-
+
+ v-for="item in funcList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
-
-
+
+
+ v-model="item.content">
@@ -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 => {
diff --git a/src/views/system/log.vue b/src/views/system/log.vue
index 08e265c..0a09c93 100644
--- a/src/views/system/log.vue
+++ b/src/views/system/log.vue
@@ -13,7 +13,7 @@
- {{ 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 }}
@@ -49,9 +49,7 @@ export default {
roleName: "",
remark: ""
},
- listData: [
- {}
- ],
+ listData: [],
page: 1,
pageSize: 10,
total: 0
diff --git a/src/views/system/manageLog.vue b/src/views/system/manageLog.vue
index 7b6717d..00d0fb7 100644
--- a/src/views/system/manageLog.vue
+++ b/src/views/system/manageLog.vue
@@ -5,12 +5,12 @@
日志更新
-
+
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
@@ -21,16 +21,16 @@
- {{ item.updateTime }}
+ {{ item.updateTime }}
- {{ platformList.find(e => e.id === item.platformId).name + item.versionName }}
+ {{ platformName + item.versionName }}
-
+
-
@@ -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()
}
}
};