模型等修复

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)
this.initMenu()
}).catch(err => {
//
this.menus = this.menuList
if (err.status === 500) {
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))
}
}).catch(res => {
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
this.isError = false
this.runResult = ''
this.picSrcList = []
this.loadIns.close()
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
})
}
},

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

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

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

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

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

@ -13,7 +13,7 @@
</li>
</ul>
<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="batchOff(1)">批量禁用</el-button>
<el-button type="primary" round @click="batchOff(0)">批量开启</el-button>

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

@ -4,9 +4,9 @@
<el-col :span="24">
<el-card shadow="hover" class="mgb20">
<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">
<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 type="primary" @click="handleSubmit(1)">确定并发布</el-button>
</div>
@ -266,7 +266,8 @@ export default {
isToPoint: false, //
visibleLoading: false, //
listLoading:false,//
submiting: false //
submiting: false, //
updateTime: 0
};
},
computed: {
@ -292,21 +293,19 @@ export default {
}
},
watch: {
// projectJudgmentData: {
// handler(newValue) {
// console.log("newValue", newValue);
// },
// deep: true
// },
judgementpointsquery(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.handleQueryJudgment();
}, 500);
}
},
created() {
// console.log(this.projectManage.systemId, "this.projectManage.systemId", this.lastSystemId);
// ,
projectManage: {
handler(){
this.updateTime++
},
deep:true
},
judgementpointsquery(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.handleQueryJudgment();
}, 500);
}
},
mounted() {
if (this.$route.query.projectId) {
@ -328,18 +327,6 @@ export default {
}
},
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(){
if (this.projectManage.permissions == 1){
this.projectManage.hintOpen = 1
@ -480,7 +467,7 @@ export default {
}
},
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 (!params.projectManage.founder && this.oriPer !== params.projectManage.permissions) {
@ -757,6 +744,25 @@ export default {
}
}
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">
<template slot-scope="scope">{{ scope.$index + (page - 1) * pageSize + 1 }}</template>
</el-table-column>
<el-table-column prop="projectName" label="实验项目名称" align="center"></el-table-column>
<el-table-column v-if='queryData.founder == 1' prop="schoolName" label="学校名字" align="center"></el-table-column>
<el-table-column prop="founder" label="创建人" align="center">
<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="学校名字" min-width="100" align="center"></el-table-column>
<el-table-column prop="founder" label="创建人" min-width="150" align="center">
<template slot-scope="scope">
{{ founderKeys[scope.row.founder] }}
</template>
</el-table-column>
<el-table-column label="权限" align="center">
<el-table-column label="权限" min-width="120" align="center">
<template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<el-table-column prop="status" label="状态" align="center">
<el-table-column prop="createTime" label="创建时间" min-width="150" align="center"></el-table-column>
<el-table-column prop="status" label="状态" min-width="100" align="center">
<template slot-scope="scope">
{{ stateKeys[scope.row.state] }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<el-table-column label="操作" width="300" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">
编辑

Loading…
Cancel
Save