模型等修复

dev_2022-03-03
yujialong 3 years ago
parent afd772052d
commit 50e789bfd2
  1. 7
      src/components/Sidebar.vue
  2. 5
      src/components/codemirror.vue
  3. 1
      src/utils/api.js
  4. 17
      src/views/Login.vue
  5. 92
      src/views/serve/addModel.vue
  6. 32
      src/views/serve/backstage/model.vue
  7. 4
      src/views/serve/backstage/modelType.vue
  8. 2
      src/views/serve/backstage/sourceModel.vue
  9. 4
      src/views/serve/backstage/sourceType.vue
  10. 68
      src/views/serve/projectAdd.vue
  11. 14
      src/views/serve/projectList.vue

@ -136,8 +136,11 @@ export default {
addRoutes(routes) addRoutes(routes)
this.initMenu() this.initMenu()
}).catch(err => { }).catch(err => {
// if (err.status === 500) {
this.menus = this.menuList localStorage.removeItem('ms_username');
sessionStorage.clear()
location.reload()
}
}) })
}, },
} }

@ -193,8 +193,11 @@ export default {
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
} }
}).catch(res => { }).catch(res => {
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') this.isError = false
this.runResult = ''
this.picSrcList = []
this.loadIns.close() this.loadIns.close()
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
}) })
} }
}, },

@ -95,6 +95,7 @@ export default {
saveProjectDraft: `occupationlab/projectManage/saveProjectDraft`, // 新增项目管理 saveProjectDraft: `occupationlab/projectManage/saveProjectDraft`, // 新增项目管理
addProjectManage: `occupationlab/projectManage/addProjectManage`, // 新增项目管理 addProjectManage: `occupationlab/projectManage/addProjectManage`, // 新增项目管理
updateProjectManage: `occupationlab/projectManage/updateProjectManage`, // 修改项目管理 updateProjectManage: `occupationlab/projectManage/updateProjectManage`, // 修改项目管理
editProjectDraft: `occupationlab/projectManage/editProjectDraft`, // 修改项目管理
copyProjectManage: `occupationlab/projectManage/copyProjectManage`, // 复制项目管理 copyProjectManage: `occupationlab/projectManage/copyProjectManage`, // 复制项目管理
// 判分点 // 判分点
getBcJudgmentPoint: `judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页) getBcJudgmentPoint: `judgment/bcJudgmentPoint/getBcJudgmentPoint`, // 获取编程类判分点列表(分页)

@ -98,6 +98,7 @@
<script> <script>
import vFooter from '../components/Footer' import vFooter from '../components/Footer'
import Setting from '@/setting'
export default { export default {
data: function() { data: function() {
var regPhoneOrEmail = (rule, value, callback) => {// var regPhoneOrEmail = (rule, value, callback) => {//
@ -193,14 +194,20 @@ export default {
this.$refs[ref].validate(valid => { this.$refs[ref].validate(valid => {
if (valid) { if (valid) {
this.$post(this.api.logins,param).then(res => { this.$post(this.api.logins,param).then(res => {
this.$message.success(res.message); const { message } = res
sessionStorage.setItem('token',res.data.token) sessionStorage.setItem('token',res.data.token)
this.$router.push({ this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => {
this.$message.success(message);
this.$router.push({
path:'/customer' path:'/customer'
}); });
localStorage.setItem('ms_username', this.param.username); localStorage.setItem('ms_username', this.param.username);
}).catch(err => {
if (err.status === 500) {
sessionStorage.clear()
}
})
}).catch(err => { }).catch(err => {
console.log(err,'res-err');
if(err.status===30001){ if(err.status===30001){
this.phoneVisible = true this.phoneVisible = true
}else if(err.status == 10004){ }else if(err.status == 10004){

@ -20,6 +20,16 @@
<label>模型名称</label> <label>模型名称</label>
<el-input placeholder="请输入模型名称" v-model="form.modelName" maxlength="25" style="width: 400px"></el-input> <el-input placeholder="请输入模型名称" v-model="form.modelName" maxlength="25" style="width: 400px"></el-input>
</div> </div>
<div class="item name">
<label>模型分类</label>
<el-cascader
:options="categoryList"
v-model="categoryIdCus"
:props="categoryProps"
clearable
>
</el-cascader>
</div>
<div class="item code"> <div class="item code">
<label>模型代码</label> <label>模型代码</label>
<codemirror <codemirror
@ -44,48 +54,86 @@ export default {
postStatus : Number(this.$route.query.postStatus), postStatus : Number(this.$route.query.postStatus),
isDetail : Boolean(this.$route.query.show), // isDetail : Boolean(this.$route.query.show), //
isModel : Boolean(this.$route.query.model), // isModel : Boolean(this.$route.query.model), //
categoryIdCus: [],
form: { form: {
modelName: '', modelName: '',
modelDemo: '' modelDemo: ''
},
categoryList: [],
categoryProps: {
checkStrictly: true,
label: 'categoryName',
value: 'id'
}, },
codeKey: 1, codeKey: 1,
submiting: false submiting: false
}; };
}, },
mounted() { mounted() {
this.id && this.getData() this.getType()
}, },
methods: { methods: {
// //
getData() { async getData() {
// // /
if (this.isModel) { const res = await this.$post(`${this.api[this.isModel ? 'referenceFindById' : 'modelFindById']}?id=${this.id}`)
this.$post(`${this.api.referenceFindById}?id=${this.id}`).then(res => { const { data } = res
const { data } = res const { modelName, categoryId, modelDemo } = data
this.form.modelName = data.modelName this.form = {
this.form.modelDemo = data.modelDemo modelName,
this.codeKey++ modelDemo
}).catch(res => {}) }
this.handleId(this.categoryList, categoryId)
this.codeKey++
},
// id
handleId(list, id, parentId = []) {
list.map(e => {
// idid
if (id === e.id) {
this.categoryIdCus = [...parentId, e.id]
} else { } else {
// e.children && this.handleId(e.children, id, [...parentId, e.id])
this.$post(`${this.api.modelFindById}?id=${this.id}`).then(res => {
const { data } = res
this.form.modelName = data.modelName
this.form.modelDemo = data.modelDemo
this.codeKey++
}).catch(res => {})
} }
})
},
//
getType() {
this.$post(this.api.sourceModelClassification).then(res => {
const { data } = res
// children
const handleLeaf = list => {
list.map(e => {
if (e.children.length) {
handleLeaf(e.children)
} else {
delete e.children
}
})
}
handleLeaf(data)
this.categoryList = data
if (this.id) {
this.getData()
} else {
this.handleId(data, this.categoryId)
}
}).catch(res => {})
}, },
// //
submit(postStatus){ submit(postStatus){
if (this.submiting) return false if (this.submiting) return false
const { modelName, modelDemo } = this.form const { modelName, categoryId, modelDemo } = this.form
const categoryIdCus = this.categoryIdCus
const id = this.id const id = this.id
if (!modelName) return this.$message.error('请输入模型名称') if (!modelName) return this.$message.error('请输入模型名称')
if (!modelDemo) return this.$message.error('请输入模型代码') if (!categoryIdCus.length) return this.$message.error('请选择模型分类')
if (postStatus) {
if (!modelDemo) return this.$message.error('请输入模型代码')
}
this.submiting = true this.submiting = true
const data = { const data = {
categoryId: this.categoryId, categoryId: categoryIdCus[categoryIdCus.length - 1],
modelName, modelName,
modelDemo, modelDemo,
postStatus postStatus

@ -42,18 +42,20 @@
</div> </div>
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> <el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false">
<div class="model-wrap">
<el-tree <el-tree
:data="modelData" v-loading="modelLoading" :data="modelData" v-loading="modelLoading"
ref="model" ref="model"
default-expand-all default-expand-all
show-checkbox show-checkbox
node-key="id" node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree> </el-tree>
<span slot="footer" class="dialog-footer"> </div>
<el-button @click="modelVisible = false"> </el-button> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button> <el-button @click="modelVisible = false"> </el-button>
</span> <el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -91,9 +93,9 @@ export default {
methods: { methods: {
getData() { getData() {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // const curNode = this.$refs.tree.$refs.tree.getCurrentNode() //
this.isTopLevel = !curNode.level this.isTopLevel = !curNode.level && curNode.categoryName === '全部'
// //
if (!curNode.level) { if (this.isTopLevel) {
this.$post(this.api.getAllModelList, { this.$post(this.api.getAllModelList, {
modelName: this.keyword, modelName: this.keyword,
pageNum: this.page, pageNum: this.page,
@ -122,6 +124,7 @@ export default {
}, },
// //
add() { add() {
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类')
this.modelVisible = true this.modelVisible = true
this.modelLoading = true this.modelLoading = true
// //
@ -244,6 +247,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.wrap { .wrap {
display: flex; display: flex;
min-height: calc(100vh - 310px);
padding: 0 24px; padding: 0 24px;
.side { .side {
width: 300px; width: 300px;
@ -259,4 +263,8 @@ export default {
.el-input__inner{ .el-input__inner{
height: 32px; height: 32px;
} }
.model-wrap {
max-height: 400px;
overflow: auto;
}
</style> </style>

@ -91,8 +91,8 @@ export default {
const { data } = res const { data } = res
this.orgList = data this.orgList = data
data.length && this.$nextTick(() => { data.length && this.$nextTick(() => {
this.$refs.tree.setCurrentKey(data[0].id) this.$refs.tree.setCurrentKey(data[0].id)
this.getSingle() this.getSingle()
}) })
}).catch(res => {}) }).catch(res => {})
}, },

@ -13,7 +13,7 @@
</li> </li>
</ul> </ul>
<div> <div>
<el-button v-if="!isTopLevel" type="primary" round @click="add">新增</el-button> <el-button type="primary" round @click="add">新增模型</el-button>
<el-button type="primary" round @click="batchDel">批量删除</el-button> <el-button type="primary" round @click="batchDel">批量删除</el-button>
<el-button type="primary" round @click="batchOff(1)">批量禁用</el-button> <el-button type="primary" round @click="batchOff(1)">批量禁用</el-button>
<el-button type="primary" round @click="batchOff(0)">批量开启</el-button> <el-button type="primary" round @click="batchOff(0)">批量开启</el-button>

@ -83,8 +83,8 @@ export default {
const { data } = res const { data } = res
this.orgList = data this.orgList = data
data.length && this.$nextTick(() => { data.length && this.$nextTick(() => {
this.$refs.tree.setCurrentKey(data[0].id) this.$refs.tree.setCurrentKey(data[0].id)
this.getSingle() this.getSingle()
}) })
}).catch(res => {}) }).catch(res => {})
}, },

@ -4,9 +4,9 @@
<el-col :span="24"> <el-col :span="24">
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover" class="mgb20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="goBack" content="项目配置"></el-page-header> <el-page-header @back="back" content="项目配置"></el-page-header>
<div v-if="!isDetail"> <div v-if="!isDetail">
<el-button v-if="!projectId" type="success" @click="handleSubmit(0,projectManage.isOpen=1,projectManage.ztOpen = 1)">保存为草稿 <el-button type="success" @click="handleSubmit(0,projectManage.isOpen=1,projectManage.ztOpen = 1)">保存为草稿
</el-button> </el-button>
<el-button type="primary" @click="handleSubmit(1)">确定并发布</el-button> <el-button type="primary" @click="handleSubmit(1)">确定并发布</el-button>
</div> </div>
@ -266,7 +266,8 @@ export default {
isToPoint: false, // isToPoint: false, //
visibleLoading: false, // visibleLoading: false, //
listLoading:false,// listLoading:false,//
submiting: false // submiting: false, //
updateTime: 0
}; };
}, },
computed: { computed: {
@ -292,21 +293,19 @@ export default {
} }
}, },
watch: { watch: {
// projectJudgmentData: { // ,
// handler(newValue) { projectManage: {
// console.log("newValue", newValue); handler(){
// }, this.updateTime++
// deep: true },
// }, deep:true
judgementpointsquery(n) { },
clearTimeout(this.searchTimer); judgementpointsquery(n) {
this.searchTimer = setTimeout(() => { clearTimeout(this.searchTimer);
this.handleQueryJudgment(); this.searchTimer = setTimeout(() => {
}, 500); this.handleQueryJudgment();
} }, 500);
}, }
created() {
// console.log(this.projectManage.systemId, "this.projectManage.systemId", this.lastSystemId);
}, },
mounted() { mounted() {
if (this.$route.query.projectId) { if (this.$route.query.projectId) {
@ -328,18 +327,6 @@ export default {
} }
}, },
methods: { methods: {
goBack() { //
if (this.isDetail) {
this.$router.back();
} else {
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", {
type: "warning"
}).then(() => {
this.$router.push(`/projectList?systemId=${this.$route.query.systemId}&show=${this.isDetails}&founder=${this.founder}&name=${this.$route.query.name}`);
}).catch(() => {
});
}
},
permissionChange(){ permissionChange(){
if (this.projectManage.permissions == 1){ if (this.projectManage.permissions == 1){
this.projectManage.hintOpen = 1 this.projectManage.hintOpen = 1
@ -480,7 +467,7 @@ export default {
} }
}, },
updateProject(params) { // updateProject(params) { //
this.$post(`${this.api.updateProjectManage}`, params).then(res => { this.$post(this.api[params.projectManage.state ? 'updateProjectManage' : 'editProjectDraft'], params).then(res => {
if (res.status === 200) { if (res.status === 200) {
// //
if (!params.projectManage.founder && this.oriPer !== params.projectManage.permissions) { if (!params.projectManage.founder && this.oriPer !== params.projectManage.permissions) {
@ -757,6 +744,25 @@ export default {
} }
} }
location.href = href; location.href = href;
},
//
toList() {
this.$router.push(`/projectList?systemId=${this.$route.query.systemId}&show=${this.isDetails}&founder=${this.founder}&name=${this.$route.query.name}`);
},
//
back() {
//
if(this.updateTime > 1){
this.$confirm('编辑的内容未保存,是否保存?', "提示", {
type: "warning"
}).then(() => {
this.handleSubmit(this.projectManage.state)
}).catch(() => {
this.toList()
})
} else {
this.toList()
}
} }
} }
}; };

@ -69,25 +69,25 @@
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope">{{ scope.$index + (page - 1) * pageSize + 1 }}</template> <template slot-scope="scope">{{ scope.$index + (page - 1) * pageSize + 1 }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="projectName" label="实验项目名称" align="center"></el-table-column> <el-table-column prop="projectName" label="实验项目名称" min-width="400" align="center"></el-table-column>
<el-table-column v-if='queryData.founder == 1' prop="schoolName" label="学校名字" align="center"></el-table-column> <el-table-column v-if='queryData.founder == 1' prop="schoolName" label="学校名字" min-width="100" align="center"></el-table-column>
<el-table-column prop="founder" label="创建人" align="center"> <el-table-column prop="founder" label="创建人" min-width="150" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ founderKeys[scope.row.founder] }} {{ founderKeys[scope.row.founder] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="权限" align="center"> <el-table-column label="权限" min-width="120" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }} {{ permissionsKeys[scope.row.permissions] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> <el-table-column prop="createTime" label="创建时间" min-width="150" align="center"></el-table-column>
<el-table-column prop="status" label="状态" align="center"> <el-table-column prop="status" label="状态" min-width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ stateKeys[scope.row.state] }} {{ stateKeys[scope.row.state] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" width="300" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)"> <el-button type="text" @click="edit(scope.row)">
编辑 编辑

Loading…
Cancel
Save