华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

392 lines
15 KiB

<template>
<div class="app-container study-page">
<div class="content-list" v-show="showType==='list'">
<el-form :model="searchForm" ref="searchForm" :inline="true" class="search-box">
<el-form-item :label="$t('page.business.study.study.name')" prop="name">
<el-input v-model="searchForm.name" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
</el-form-item>
<el-form-item :label="$t('page.business.study.study.sn')" prop="sn">
<el-input v-model="searchForm.sn" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
</el-form-item>
<el-form-item :label="$t('page.business.study.study.dateRange')">
<el-date-picker v-model="daterange" clearable type="daterange" range-separator="-" :start-placeholder="$t('page.business.study.study.startDate')"
:end-placeholder="$t('page.business.study.study.endDate')" value-format="yyyy-MM-dd" @change="search" style="width: 220px" />
</el-form-item>
<el-form-item prop="status" :label="$t('page.business.study.study.status')">
<el-select
v-model="searchForm.status"
:placeholder="$t('form.placeholderSelect')"
clearable
style="width: 100px"
@change="search"
>
<el-option :label="$t('page.business.study.study.statusCg')" :value="1" />
<el-option :label="$t('page.business.study.study.statusSyz')" :value="3" />
<el-option :label="$t('page.business.study.study.statusYsd')" :value="5" />
<el-option :label="$t('page.business.study.study.statusDgd')" :value="7" />
<el-option :label="$t('page.business.study.study.statusGd')" :value="9" />
<el-option :label="$t('page.business.study.study.statusDjd')" :value="10" />
</el-select>
</el-form-item>
<el-form-item prop="leaderName" :label="$t('page.business.study.study.leader')">
<el-input v-model="searchForm.leaderName" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
</el-form-item>
<div class="right-btn">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search">{{ $t('page.business.study.study.search') }}</el-button>
<el-button icon="el-icon-refresh" @click="reset">{{ $t('form.reset') }}</el-button>
</el-form-item>
</div>
</el-form>
<div class="content-box">
<el-row class="add-box">
<el-col>
<el-button type="primary" icon="el-icon-plus" @click="edit(null)" v-hasPermi="['business:study:add']">{{ $t('page.business.study.study.add') }}</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="list">
<el-table-column :label="$t('page.business.study.study.sort')" type="index" width="50" />
<el-table-column :label="$t('page.business.study.study.name')" prop="name" />
<el-table-column :label="$t('page.business.study.study.sn')" prop="sn" />
<el-table-column :label="$t('page.business.study.study.status')" prop="status" width="100">
<template slot-scope="scope">
<span v-if="scope.row.status===1"><span class="status-circle cg"></span>{{$t('page.business.study.study.statusCg')}}</span>
<span v-if="scope.row.status===3"><span class="status-circle syz"></span>{{$t('page.business.study.study.statusSyz')}}</span>
<span v-if="scope.row.status===5"><span class="status-circle ysd"></span>{{$t('page.business.study.study.statusYsd')}}</span>
<span v-if="scope.row.status===7"><span class="status-circle"></span>{{$t('page.business.study.study.statusDgd')}}</span>
<span v-if="scope.row.status===9"><span class="status-circle"></span>{{$t('page.business.study.study.statusGd')}}</span>
<span v-if="scope.row.status===10"><span class="status-circle"></span>{{$t('page.business.study.study.statusDjd')}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('page.business.study.study.borrowStatus')" prop="borrowStatus" width="100">
<template slot-scope="scope">
<span v-if="scope.row.borrowStatus===1">{{$t('page.business.study.study.borrowStatusWjy')}}</span>
<span v-if="scope.row.borrowStatus===5">{{$t('page.business.study.study.borrowStatusJyz')}}</span>
<span v-if="scope.row.borrowStatus===10">{{$t('page.business.study.study.borrowStatusDjy')}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('page.business.study.study.formCount')" align="center" prop="formCount" width="100" />
<el-table-column :label="$t('page.business.study.study.formFinishCount')" align="center" prop="formFinishCount" width="120" />
<el-table-column :label="$t('page.business.study.study.leader')" align="center" prop="leaderName" width="100" />
<el-table-column :label="$t('page.business.study.study.createDate')" align="center" prop="createTime" width="140" />
<el-table-column :label="$t('form.operate')" fixed="right" align="center" width="200">
<template slot-scope="scope">
<!-- 编辑 -->
<el-button type="text" @click="edit(scope.row)" v-hasPermi="['business:study:edit']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && (scope.row.status===1 || scope.row.status===3)">{{$t('page.business.study.study.edit')}}</el-button>
<!-- 删除 -->
<el-button type="text" style="color:#E22626" @click="del(scope.row)" v-hasPermi="['business:study:remove']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && scope.row.status===1">{{$t('page.business.study.study.delete')}}</el-button>
<!-- 详情 -->
<el-button type="text" @click="detail(scope.row)" v-hasPermi="['business:study:detail']" v-if="scope.row.status===1 || scope.row.status===3 || scope.row.status===5 || (scope.row.status===9 && scope.row.borrowStatus===10)">{{$t('page.business.study.study.detail')}}</el-button>
<!-- 进入试验 -->
<el-button type="text" @click="enter(scope.row)" v-hasPermi="['business:study:enter']" v-if="scope.row.status===3 || scope.row.status===5 || (scope.row.status===9 && scope.row.borrowStatus===10)">{{$t('page.business.study.study.enter')}}</el-button>
<!-- 归档 -->
<el-button type="text" @click="gd(scope.row)" v-hasPermi="['business:study:gd']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && scope.row.status===5">{{$t('page.business.study.study.gd')}}</el-button>
<!-- 解锁 -->
<el-button type="text" @click="js(scope.row)" v-hasPermi="['business:study:js']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && scope.row.status===5">{{$t('page.business.study.study.js')}}</el-button>
<!-- 解档 -->
<el-button type="text" @click="jd(scope.row)" v-hasPermi="['business:study:jd']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && scope.row.status===9 && scope.row.borrowStatus===1">{{$t('page.business.study.study.jd')}}</el-button>
<!-- 借阅 -->
<el-button type="text" @click="jy(scope.row)" v-hasPermi="['business:study:jy']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && scope.row.status===9 && scope.row.borrowStatus===1">{{$t('page.business.study.study.jy')}}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="searchForm.pageNum"
:limit.sync="searchForm.pageSize"
@pagination="getList"
/>
</div>
<!-- <el-dialog :close-on-click-modal="false" :title="infoDialog.title" :visible.sync="infoDialog.visible" width="600px" append-to-body>
<el-form ref="infoDialogForm" :model="infoDialog.formData" :rules="infoDialog.rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item :label="$t('page.business.study.study.name')+':'" prop="name">
<el-input v-model="infoDialog.formData.name" :placeholder="$t('form.placeholderInput')" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t('page.business.study.study.sn')+':'" prop="sn">
<el-input v-model="infoDialog.formData.sn" :placeholder="$t('form.placeholderInput')" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t('page.business.study.study.leader')+':'" prop="leader">
<el-input v-model="infoDialog.formData.leader" :placeholder="$t('form.placeholderInput')" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t('page.business.study.study.remark')+':'" prop="remark">
<el-input type="textarea" :rows="5" :placeholder="$t('form.placeholderInput')" v-model="infoDialog.formData.remark"> </el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="save"> </el-button>
<el-button @click="infoDialog.visible = false"> </el-button>
</div>
</el-dialog> -->
</div>
<Edit ref="edit" v-show="showType==='edit'" @cancel="showType='list'" @save="save" />
<!-- <Enter ref="enter" v-show="showType==='enter'" @cancel="showType='list'" /> -->
<Detail ref="detail" v-show="showType==='detail'" @cancel="showType='list'" />
<Sign ref="signRef" @callback="doSign" />
</div>
</template>
<script>
import { checkPermi, checkRole } from "@/utils/permission";
import { study_list,study_delete,study_gd,study_js,study_jd,study_jy} from "@/api/business/study/study";
import Edit from './comp/edit.vue'
import Enter from './comp/enter.vue'
import Detail from './comp/detail.vue'
import Sign from './comp/sign.vue'
export default {
name: "Study",
props:{
},
components:{
Edit,
Enter,
Detail,
Sign
},
computed: {
},
filters:{
},
data() {
return {
userId:this.$store.getters.id,
daterange:[],
searchForm: {
pageNum: 1,
pageSize: 10,
sn:'',
name:'',
leaderName:'',
status:'',
startDate:'',
endDate:'',
},
loading: true,
total: 0,
list: [],
//线上类型list,edit。。。。
showType:'list',
operate:'',
operateRow:{},
};
},
created() {
this.getList();
},
methods: {
checkPermi,
checkRole,
getList() {
this.loading = true;
this.searchForm.startDate = this.daterange && this.daterange.length > 0 ? this.daterange[0] : ''
this.searchForm.endDate = this.daterange && this.daterange.length > 1 ? this.daterange[1] : ''
study_list(this.searchForm).then(response => {
this.list = response.rows;
this.total = response.total;
}).finally(()=>{
this.loading = false;
})
},
search() {
this.searchForm.pageNum = 1;
this.getList();
},
reset(){
this.searchForm = {
pageNum: 1,
pageSize: 10,
sn:'',
name:'',
leaderName:'',
status:'',
startDate:'',
endDate:'',
}
this.daterange = []
this.search()
},
edit(row) {
this.showType = 'edit'
this.$refs.edit.edit(row)
},
save() {
this.showType = 'list'
this.getList()
},
enter(row){
this.$tab.openPage("进入试验", '/study/enter/' + row.id)
// this.showType = 'enter'
// this.$refs.enter.show(row)
},
detail(row){
this.showType = 'detail'
this.$refs.detail.show(row)
},
del(row) {
this.operate = 'del'
this.operateRow = row
this.$refs.signRef.show(this.$t('page.business.study.study.scsy'),'删除试验')
},
doDel(signInfo) {
this.$modal.loading()
let postData = {
study:this.operateRow,
sign:signInfo
}
study_delete(postData).then(() => {
this.$refs.signRef.cancel()
this.getList()
})
.finally(() => {
this.$modal.closeLoading()
})
},
gd(row) {
this.operate = 'gd'
this.operateRow = row
this.$refs.signRef.show(this.$t('page.business.study.study.sqgd'),'申请归档')
},
doGd(signInfo) {
this.$modal.loading()
let postData = {
study:this.operateRow,
sign:signInfo
}
study_gd(postData).then(() => {
this.$refs.signRef.cancel()
this.getList()
})
.finally(() => {
this.$modal.closeLoading()
})
},
js(row) {
this.operate = 'js'
this.operateRow = row
this.$refs.signRef.show(this.$t('page.business.study.study.jssy'),'解锁试验')
},
doJs(signInfo) {
this.$modal.loading()
let postData = {
study:this.operateRow,
sign:signInfo
}
study_js(postData).then(() => {
this.$refs.signRef.cancel()
this.getList()
})
.finally(() => {
this.$modal.closeLoading()
})
},
jd(row) {
this.operate = 'jd'
this.operateRow = row
this.$refs.signRef.show(this.$t('page.business.study.study.sqjd'),'申请解档')
},
doJd(signInfo) {
this.$modal.loading()
let postData = {
study:this.operateRow,
sign:signInfo
}
study_jd(postData).then(() => {
this.$refs.signRef.cancel()
this.getList()
})
.finally(() => {
this.$modal.closeLoading()
})
},
jy(row) {
this.operate = 'jy'
this.operateRow = row
this.$refs.signRef.show(this.$t('page.business.study.study.sqjy'),'申请借阅',true)
},
doJy(signInfo) {
this.$modal.loading()
let postData = {
study:this.operateRow,
sign:signInfo
}
study_jy(postData).then(() => {
this.$refs.signRef.cancel()
this.getList()
})
.finally(() => {
this.$modal.closeLoading()
})
},
doSign(val){
if(this.operate==='del'){
this.doDel(val)
}
if(this.operate==='gd'){
this.doGd(val)
}
if(this.operate==='js'){
this.doJs(val)
}
if(this.operate==='jd'){
this.doJd(val)
}
if(this.operate==='jy'){
this.doJy(val)
}
},
}
};
</script>
<style lang="scss" scoped>
.study-page{
background: #f5f5f5;
padding: 0;
.content-list{
.search-box{
background: #fff;
padding: 20px 20px 2px 20px;
margin-bottom: 10px;
.right-btn{
text-align:right
}
}
.content-box{
background: #fff;
padding: 20px;
.add-box{
margin-bottom: 10px;
}
}
}
}
</style>