parent
3c362751b8
commit
fe898632d4
11 changed files with 1504 additions and 1240 deletions
File diff suppressed because it is too large
Load Diff
@ -1,392 +1,452 @@ |
||||
<template> |
||||
<div> |
||||
<el-card v-if="showBack" shadow="hover" class="mgb20"> |
||||
<el-page-header :content="'实验项目管理 / '+titleName" @back="goBack"></el-page-header> |
||||
</el-card> |
||||
<div> |
||||
<el-card v-if="showBack" |
||||
shadow="hover" |
||||
class="mgb20"> |
||||
<el-page-header :content="'实验项目管理 / '+titleName" |
||||
@back="goBack"></el-page-header> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>筛选</span> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<el-col :span="4"> |
||||
<el-form-item label="来源"> |
||||
<el-select v-model="queryData.founder" clearable placeholder="请选择创建人" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in founderList" :key="index" :label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4"> |
||||
<el-form-item label="状态"> |
||||
<el-select v-model="queryData.state" clearable placeholder="请选择状态" @change="initData"> |
||||
<el-option v-for="(item,index) in stateList" :key="index" :label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4"> |
||||
<el-form-item label="权限"> |
||||
<el-select v-model="queryData.permissions" placeholder="请选择" @change="initData"> |
||||
<el-option |
||||
v-for="item in permissionsList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item> |
||||
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" |
||||
v-model="keyword" clearable></el-input> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" |
||||
class="mgb20"> |
||||
<div> |
||||
<div class="flex-center mgb20"> |
||||
<p class="hr_tag"></p> |
||||
<span>筛选</span> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="80px"> |
||||
<el-col :span="4"> |
||||
<el-form-item label="来源"> |
||||
<el-select v-model="queryData.founder" |
||||
clearable |
||||
placeholder="请选择创建人" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in founderList" |
||||
:key="index" |
||||
:label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4"> |
||||
<el-form-item label="状态"> |
||||
<el-select v-model="queryData.state" |
||||
clearable |
||||
placeholder="请选择状态" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in stateList" |
||||
:key="index" |
||||
:label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4"> |
||||
<el-form-item label="权限"> |
||||
<el-select v-model="queryData.permissions" |
||||
placeholder="请选择" |
||||
@change="initData"> |
||||
<el-option v-for="item in permissionsList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="6"> |
||||
<el-form-item> |
||||
<el-input placeholder="请输入项目名称" |
||||
prefix-icon="el-icon-search" |
||||
v-model="keyword" |
||||
clearable></el-input> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="hr_tag"></p> |
||||
<span>项目列表</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" round @click="add" class="mag">新增项目</el-button> |
||||
<el-button type="primary" round @click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="projectId" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<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="实验项目名称" min-width="400" 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 prop="creator" label="创建人" min-width="140" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ queryData.founder == 1 ? scope.row.schoolName : scope.row.creator }} |
||||
</template> |
||||
</el-table-column> |
||||
<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="创建时间" 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="操作" width="300" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row)"> |
||||
编辑 |
||||
</el-button> |
||||
<el-button type="text" @click="handleDelete(scope.row.projectId)"> |
||||
删除 |
||||
</el-button> |
||||
<el-button type="text" @click="copyData(scope.row.projectId)">复制</el-button> |
||||
<el-switch |
||||
v-if="scope.row.state" |
||||
v-model="scope.row.ztOpen" |
||||
:active-text="scope.row.ztOpen ? '关闭' : '启用'" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
style="margin: 0 10px 0 10px" |
||||
@change="switchOff(scope.row)" |
||||
></el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" |
||||
class="mgb20"> |
||||
<div class="flex-between mgb20"> |
||||
<div class="flex-center"> |
||||
<p class="hr_tag"></p> |
||||
<span>项目列表</span> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" |
||||
round |
||||
@click="add" |
||||
class="mag">新增项目</el-button> |
||||
<el-button type="primary" |
||||
round |
||||
@click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" |
||||
class="table" |
||||
ref="table" |
||||
stripe |
||||
header-align="center" |
||||
row-key="projectId" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" |
||||
width="55" |
||||
align="center"></el-table-column> |
||||
<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="实验项目名称" |
||||
min-width="400" |
||||
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 prop="creator" |
||||
label="创建人" |
||||
min-width="140" |
||||
align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ queryData.founder == 1 ? scope.row.schoolName : scope.row.creator }} |
||||
</template> |
||||
</el-table-column> |
||||
<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="创建时间" |
||||
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="操作" |
||||
width="300" |
||||
align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" |
||||
@click="edit(scope.row)"> |
||||
编辑 |
||||
</el-button> |
||||
<el-button type="text" |
||||
@click="handleDelete(scope.row.projectId)"> |
||||
删除 |
||||
</el-button> |
||||
<el-button type="text" |
||||
@click="copyData(scope.row.projectId)">复制</el-button> |
||||
<el-switch v-if="scope.row.state" |
||||
v-model="scope.row.ztOpen" |
||||
:active-text="scope.row.ztOpen ? '关闭' : '启用'" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
style="margin: 0 10px 0 10px" |
||||
@change="switchOff(scope.row)"></el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background |
||||
@current-change="handleCurrentChange" |
||||
:current-page="page" |
||||
layout="total, prev, pager, next" |
||||
:total="total"></el-pagination> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<!--复制对话框--> |
||||
<el-dialog title="复制" :visible.sync="copyVisible" width="24%" center :close-on-click-modal="false"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<!--前端不用做名称判重了:@change='projectNameExistis'--> |
||||
<el-input placeholder="请输入项目名称" v-model="projectName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="copyVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="copySubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
<!--复制对话框--> |
||||
<el-dialog title="复制" |
||||
:visible.sync="copyVisible" |
||||
width="24%" |
||||
center |
||||
:close-on-click-modal="false"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<!--前端不用做名称判重了:@change='projectNameExistis'--> |
||||
<el-input placeholder="请输入项目名称" |
||||
v-model="projectName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" |
||||
class="dialog-footer"> |
||||
<el-button @click="copyVisible = false">取 消</el-button> |
||||
<el-button type="primary" |
||||
@click="copySubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState, mapActions } from 'vuex'; |
||||
import Setting from "@/setting"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
showBack: Boolean(this.$route.query.show), |
||||
systemId: this.$route.query.systemId, |
||||
titleName: this.$route.query.name, |
||||
queryData: { |
||||
platformId: 3, // 平台:职站:1 中台:3 |
||||
founder: 0, // 创建人角色(0:系统 1:老师) |
||||
state: "", // 状态(0:草稿箱 1:已发布) |
||||
permissions: "", // 项目权限(0:练习 1:考核 2:竞赛) |
||||
}, |
||||
keyword: '', |
||||
status: '', |
||||
listData: [], |
||||
total: 0, |
||||
permissionsList: [{ |
||||
value: '', |
||||
label: '不限' |
||||
}, { |
||||
value: 0, |
||||
label: '练习' |
||||
}, { |
||||
value: 1, |
||||
label: '考核' |
||||
}, { |
||||
value: 2, |
||||
label: '竞赛' |
||||
} |
||||
], |
||||
permissionsKeys: { |
||||
0: '练习', |
||||
1: '考核', |
||||
2: '竞赛' |
||||
}, |
||||
founderList: [{ |
||||
value: 2, |
||||
label: '全部' |
||||
}, { |
||||
value: 0, |
||||
label: '系统' |
||||
}, { |
||||
value: 1, |
||||
label: '院校' |
||||
} |
||||
], |
||||
founderKeys: { |
||||
0: '系统', |
||||
1: '院校' |
||||
}, |
||||
stateList: [{ |
||||
value: '', |
||||
label: '不限' |
||||
}, { |
||||
value: 0, |
||||
label: '草稿箱' |
||||
}, { |
||||
value: 1, |
||||
label: '已发布' |
||||
} |
||||
], |
||||
stateKeys: { |
||||
0: '草稿箱', |
||||
1: '已发布' |
||||
}, |
||||
page: +this.$route.query.page || 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
copyVisible: false, |
||||
projectName: '', |
||||
currentRow: {}, // 复制之后,提交到后台的数据 |
||||
listDataAll: [] |
||||
}; |
||||
data () { |
||||
return { |
||||
showBack: Boolean(this.$route.query.show), |
||||
systemId: this.$route.query.systemId, |
||||
titleName: this.$route.query.name, |
||||
queryData: { |
||||
platformId: 3, // 平台:职站:1 中台:3 |
||||
founder: 0, // 创建人角色(0:系统 1:老师) |
||||
state: "", // 状态(0:草稿箱 1:已发布) |
||||
permissions: "", // 项目权限(0:练习 1:考核 2:竞赛) |
||||
}, |
||||
keyword: '', |
||||
status: '', |
||||
listData: [], |
||||
total: 0, |
||||
permissionsList: [{ |
||||
value: '', |
||||
label: '不限' |
||||
}, { |
||||
value: 0, |
||||
label: '练习' |
||||
}, { |
||||
value: 1, |
||||
label: '考核' |
||||
}, { |
||||
value: 2, |
||||
label: '竞赛' |
||||
} |
||||
], |
||||
permissionsKeys: { |
||||
0: '练习', |
||||
1: '考核', |
||||
2: '竞赛' |
||||
}, |
||||
founderList: [{ |
||||
value: 2, |
||||
label: '全部' |
||||
}, { |
||||
value: 0, |
||||
label: '系统' |
||||
}, { |
||||
value: 1, |
||||
label: '院校' |
||||
} |
||||
], |
||||
founderKeys: { |
||||
0: '系统', |
||||
1: '院校' |
||||
}, |
||||
stateList: [{ |
||||
value: '', |
||||
label: '不限' |
||||
}, { |
||||
value: 0, |
||||
label: '草稿箱' |
||||
}, { |
||||
value: 1, |
||||
label: '已发布' |
||||
} |
||||
], |
||||
stateKeys: { |
||||
0: '草稿箱', |
||||
1: '已发布' |
||||
}, |
||||
page: +this.$route.query.page || 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
copyVisible: false, |
||||
projectName: '', |
||||
currentRow: {}, // 复制之后,提交到后台的数据 |
||||
listDataAll: [] |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
if (this.$route.query.founder && this.$route.query.founder != 'undefined') { |
||||
this.queryData.founder = +this.$route.query.founder |
||||
} else { |
||||
this.queryData.founder = 0 |
||||
} |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
let data = { |
||||
...this.queryData, |
||||
projectName: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
systemId: this.systemId |
||||
}; |
||||
this.$post(this.api.queryProjectManage, data).then(res => { |
||||
this.listData = res.data.records; |
||||
this.total = res.data.total; |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
initData () { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
mounted() { |
||||
if (this.$route.query.founder && this.$route.query.founder != 'undefined'){ |
||||
this.queryData.founder = +this.$route.query.founder |
||||
}else{ |
||||
this.queryData.founder = 0 |
||||
handleCurrentChange (val) { // 切换页码 |
||||
this.page = val; |
||||
this.$router.replace({ |
||||
path: 'projectList', |
||||
query: { |
||||
...this.$route.query, |
||||
page: val |
||||
} |
||||
this.getData(); |
||||
}) |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
let data = { |
||||
...this.queryData, |
||||
projectName: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
systemId: this.systemId |
||||
}; |
||||
this.$post(this.api.queryProjectManage, data).then(res => { |
||||
this.listData = res.data.records; |
||||
this.total = res.data.total; |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
initData() { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
handleCurrentChange(val) { // 切换页码 |
||||
this.page = val; |
||||
this.$router.push({ |
||||
path: 'projectList', |
||||
query: { |
||||
...this.$route.query, |
||||
page: val |
||||
} |
||||
}) |
||||
this.getData(); |
||||
}, |
||||
add() { // 新增项目 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}&founder=${this.queryData.founder}&isDetails=${this.$route.query.show}&name=${this.titleName}`); |
||||
}, |
||||
edit(row) { // 编辑 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}&projectId=${row.projectId}&founder=${this.queryData.founder}&isDetails=${this.$route.query.show}&name=${this.titleName}`); |
||||
}, |
||||
handleSelectionChange(val) { // 处理多选 |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData() { // 批量删除 |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.projectId |
||||
}); |
||||
let strIds = ids.toString(); |
||||
this.handleDelete(strIds); |
||||
add () { // 新增项目 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}&founder=${this.queryData.founder}&isDetails=${this.$route.query.show}&name=${this.titleName}`); |
||||
}, |
||||
edit (row) { // 编辑 |
||||
this.$router.push(`/projectAdd?systemId=${this.systemId}&projectId=${row.projectId}&founder=${this.queryData.founder}&isDetails=${this.$route.query.show}&name=${this.titleName}`); |
||||
}, |
||||
handleSelectionChange (val) { // 处理多选 |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData () { // 批量删除 |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.projectId |
||||
}); |
||||
let strIds = ids.toString(); |
||||
this.handleDelete(strIds); |
||||
} else { |
||||
this.$message.error("请先选择项目"); |
||||
} |
||||
}, |
||||
handleDelete (ids) { // 删除 |
||||
this.$confirm('确定要删除吗?', '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { |
||||
console.log(ids) |
||||
if (res.status == 200) { |
||||
let delList = [] |
||||
if (isNaN(ids) == 'NaN') { |
||||
delList = ids.split(',') |
||||
} else { |
||||
this.$message.error("请先选择项目"); |
||||
delList.push(ids) |
||||
} |
||||
}, |
||||
handleDelete(ids) { // 删除 |
||||
this.$confirm('确定要删除吗?', '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { |
||||
console.log(ids) |
||||
if (res.status == 200) { |
||||
let delList = [] |
||||
if (isNaN(ids) == 'NaN'){ |
||||
delList = ids.split(',') |
||||
}else{ |
||||
delList.push(ids) |
||||
} |
||||
if(delList.length == this.listData.length){ |
||||
if(this.page > 1){ |
||||
this.page = this.page-1 |
||||
} |
||||
}else{ |
||||
|
||||
} |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}).catch(() => { |
||||
this.$message.info('已取消删除'); |
||||
}); |
||||
}, |
||||
switchOff(row) { // 更新是否启用 |
||||
this.$get(`${this.api.updateIsOpen}?isOpen=${row.ztOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success('更新启用状态成功'); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
projectNameExistis() { // 项目管理名称判重 |
||||
if (this.projectName) { |
||||
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false; |
||||
} else { |
||||
this.projectNameRepeat = true; |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true; |
||||
}); |
||||
if (delList.length == this.listData.length) { |
||||
if (this.page > 1) { |
||||
this.page = this.page - 1 |
||||
} |
||||
} else { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}, |
||||
copyData(projectId) { // 复制,根据项目id查询详情 |
||||
this.copyVisible = true; |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectName = res.projectManage.projectName; |
||||
this.currentRow = { |
||||
projectManage: res.projectManage, |
||||
projectJudgmentList: res.projectJudgmentVos |
||||
} |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
copySubmit() { |
||||
if (!this.projectName) { |
||||
this.$message.warning("请输入项目名称"); |
||||
return; |
||||
} |
||||
; |
||||
if (this.projectNameRepeat) { |
||||
this.$message.warning("该项目名称已存在"); |
||||
return; |
||||
|
||||
} |
||||
this.currentRow.projectManage.projectName = this.projectName; |
||||
this.currentRow.projectManage.projectId = ""; |
||||
this.currentRow.projectManage.founder = 0 |
||||
this.currentRow.projectJudgmentList.forEach(i => { |
||||
i.projectId = ""; |
||||
}); |
||||
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { |
||||
if (res.status === 200) { |
||||
this.queryData.founder = 0 |
||||
this.initData(); |
||||
this.$message.success("复制实验项目成功"); |
||||
this.copyVisible = false; |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
goBack() { // 返回 |
||||
// this.$router.push(`/configure`) |
||||
this.$router.back() |
||||
this.$message.success("删除成功"); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}).catch(() => { |
||||
this.$message.info('已取消删除'); |
||||
}); |
||||
}, |
||||
switchOff (row) { // 更新是否启用 |
||||
this.$get(`${this.api.updateIsOpen}?isOpen=${row.ztOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.$message.success('更新启用状态成功'); |
||||
this.getData(); |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
projectNameExistis () { // 项目管理名称判重 |
||||
if (this.projectName) { |
||||
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false; |
||||
} else { |
||||
this.projectNameRepeat = true; |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true; |
||||
}); |
||||
} else { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}, |
||||
copyData (projectId) { // 复制,根据项目id查询详情 |
||||
this.copyVisible = true; |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectName = res.projectManage.projectName; |
||||
this.currentRow = { |
||||
projectManage: res.projectManage, |
||||
projectJudgmentList: res.projectJudgmentVos |
||||
} |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
copySubmit () { |
||||
if (!this.projectName) { |
||||
this.$message.warning("请输入项目名称"); |
||||
return; |
||||
} |
||||
; |
||||
if (this.projectNameRepeat) { |
||||
this.$message.warning("该项目名称已存在"); |
||||
return; |
||||
} |
||||
this.currentRow.projectManage.projectName = this.projectName; |
||||
this.currentRow.projectManage.projectId = ""; |
||||
this.currentRow.projectManage.founder = 0 |
||||
this.currentRow.projectJudgmentList.forEach(i => { |
||||
i.projectId = ""; |
||||
}); |
||||
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { |
||||
if (res.status === 200) { |
||||
this.queryData.founder = 0 |
||||
this.initData(); |
||||
this.$message.success("复制实验项目成功"); |
||||
this.copyVisible = false; |
||||
} else { |
||||
this.$message.error(res.message); |
||||
} |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
goBack () { // 返回 |
||||
this.$router.back() |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue