| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <template>
- <div class="check-register">
- <NavBar :go="go"/>
- <div class="statistics-container">
- <!-- 搜索 -->
- <div style="background-color: #fff;">
- <!--需求改为只查看本检查机构、登录角色的任务-->
- <div class="org-line van-hairline--bottom">
- <org-tree clearable v-model="query.beCheckedOrgId" placeholder="选择受检机构" @change="changeOrgId"></org-tree>
- </div>
- <div >
- <date-cell title="日期" is-row v-model="query.taskTime" date-type="date" @change="refreshData"/>
- <!-- <search-select-cell-->
- <!-- class="van-hairline--right"-->
- <!-- title="检查角色"-->
- <!-- :border="false"-->
- <!-- v-model="query.roleIds"-->
- <!-- :dataList="rolesList"-->
- <!-- :prop="prop"-->
- <!-- @change="refreshData"/> </div> -->
- </div>
- </div>
- <div class="card-list">
- <Scroll
- ref="Scroll"
- @refresh="refreshData"
- @loadMore="getDataList"
- :pullup="pullup">
- <empty v-if="!dataList || dataList.length === 0" />
- <card class="list-item" v-for="(v,i) in dataList" :key="v.planId+i">
- <div class="item-title">
- <van-cell :title="v.taskName" :border="false" :label="rangDate(formatDate(v.planStartTime,'DATE'),formatDate(v.planEndTime,'DATE'))" ></van-cell>
- <div class="collapse-title">
- <div :class="{'active':v.active==2}" @click.stop="changeList(v,2)">
- <p> {{v.uncompleted.length}}</p>
- <p>未完成</p>
- </div>
- <div :class="{'active':v.active==1}" @click.stop="changeList(v,1)">
- <p>{{v.completed.length}}</p>
- <p>完成</p>
- </div>
- </div>
- </div>
- <div class="check-item-list">
- <empty v-if="v.active==1? v.completed.length == 0 : v.uncompleted.length == 0" />
- <van-cell
- v-else
- v-for="(a,index) in v.active==1? v.completed:v.uncompleted" :key="a.taskId"
- :title="a.beCheckedOrgName"
- @click="clickItem(a)">
- <template #right-icon>
- <div>
- <span :style="{color:getState(getDictLabel(a.status,'safety_check_status'))}">
- {{getDictLabel(a.status,'safety_check_status')}}
- </span>
- </div>
- </template>
- </van-cell>
- </div>
- </card>
- </Scroll>
- </div>
- </div>
- </div>
- </template>
- <script>
- import NavBar from '@/components/NavBar'
- import OrgTree from '@/components/orgTree'
- import Card from '@/components/card'
- import DateCell from '@/components/dateCell'
- import SelectCell from '@/components/selectCell'
- import SearchSelectCell from '@/components/SearchSelectCell'
- import Scroll from '@/components/scroll/scroll'
- import {dataList,registerRole} from './api'
- import {mapGetters} from "vuex";
- import {formatDate} from "@/filters/filter";
- export default {
- components: {
- NavBar,
- OrgTree,
- Card,
- DateCell,
- SelectCell,
- SearchSelectCell,
- Scroll
- },
- data() {
- return {
- active:['1'],
- query:{
- taskTime: `${formatDate(new Date(),'YYYY-MM-DD')}`,
- checkOrgId:null,
- beCheckedOrgId:null,
- roleIds:[],
- // state:'1',
- pageNum:1,
- pageSize:10,
- },
- total:0,
- rolesList:[],
- prop:{
- label:'name',
- value:'id',
- },
- loading:false,
- dataList:[],
- dicts:['safety_check_status'],
- finishList:[],
- unfinishedList:[],
- //控制上拉加载
- pullup:false,
- go:{
- type:'replace',
- path:'/menu',
- }
- }
- },
- mounted() {
- this.initData();
- this.query.checkOrgId = this.orgId;
- // this.getRoleList();
- },
- computed:{
- ...mapGetters(['orgId','dictionary','roleList']),
- },
- methods: {
- formatDate,
- clickItem(item){
- if(item.status == 3){
- this.$router.push(
- {
- path:'/securityDetail',
- query:{id:item.taskId,enable:1}
- }
- )
- }else {
- this.$router.push(
- {
- path:'/securityAdd',
- query:{id:item.taskId,enable:1}
- }
- )
- }
- console.log(item,'item')
- },
- getState(state){
- switch (state){
- case '待检查':
- return '#008cd6';
- case '进行中':
- return '#bc9f71';
- case '已完成':
- return '#009240';
- case '已逾期':
- return '#D7000F';
- }
- },
- changeOrgId(){
- this.query.roleIds = [];
- this.getRoleList();
- this.refreshData();
- },
- changeList(item,type){
- this.$set(item,'active',type);
- },
- refreshData(){
- this.pullup = true;
- this.total = 0;
- this.query.pageNum = 1;
- this.dataList = [];
- this.getDataList();
- },
- initData(){
- this.query.checkOrgId = this.orgId;
- this.query.taskTime = formatDate(new Date(),'YYYY-MM-DD');
- this.getDataList();
- },
- getRoleList(){
- registerRole(this.query.checkOrgId).then(res=>{
- this.rolesList = res.data;
- })
- },
- getDataList(){
- if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
- this.pullup = false;
- this.$toast('已加载完毕');
- return;
- }
- let data = {
- ...this.query
- }
- //if(!this.query.checkOrgId) return this.$toast('请选择机构');
- data.roleIds= this.roleList.map(v=>{return v.roleId})
- dataList(data).then(res=>{
- if(res.total === '0'){
- this.pullup = false;
- this.$toast('已加载完毕');
- return
- }
- this.total = res.total;
- res.rows.forEach(v=>{
- v.active = 2
- });
- if(this.dataList.length < res.total) {
- this.dataList = [...this.dataList,...res.rows];
- this.pullup = true;
- this.query.pageNum++;
- this.$refs.Scroll.refresh(); //异步请求数据量过大,需手动刷新容器
- }
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .check-register{
- .item-title{
- >.van-cell{
- padding: 0;
- }
- }
- .van-empty{
- padding: 0;
- .van-empty__image{
- width: 160px;
- height: 160px;
- }
- }
- .check-item-list{
- >.van-cell{
- padding: 20px;
- .van-cell__title{
- flex:2;
- }
- .van-cell__value{
- flex:1;
- }
- }
- .van-cell::after{
- left: 20px;
- right: 20px;
- }
- }
- }
- </style>
- <style lang="scss" scoped>
- .check-register{
- .org-line{
- padding:0 10px;
- background-color: #fff;
- }
- .search-flex{
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #f5f5f5;
- >div{
- width: 50%;
- }
- }
- .org-label{
- height: 90px;
- width: 100%;
- display: flex;
- align-items: center;
- font-size: 28px;
- }
- .card-list{
- padding:0 20px 20px 20px;
- height: calc(100vh - 370px);
- overflow: auto;
- }
- .list-item{
- padding: 20px;
- }
- .item-title{
- width: 100%;
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #f5f5f5;
- padding-bottom: 10px;
- }
- .check-item-list{
- -max-height: 500px;
- overflow: auto;
- }
- .card-num{
- display: flex;
- align-items: center;
- font-size: 28px;
- color: #008cd6;
- }
- .collapse-title{
- width: 50%;
- margin-left: 10px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 28px;
- color: #ccc;
- >div{
- width: 100px;
- font-size: 24px;
- height: 70px;
- padding: 5px 10px;
- border: 2px solid #ccc;
- border-radius: 10px;
- box-shadow: 0 3px 6px #eaeaea;
- >p{
- height: 28px;
- line-height: 28px;
- text-align: center;
- }
- }
- >div.active{
- color: #fff;
- background-color: #008cd6;
- border: 3px solid #008cd6;
- }
- }
- .flex-box{
- display: flex;
- align-items: center;
- >div{
- margin-right: 40px;
- }
- }
- .search-box{
- display: flex;
- justify-content: space-between;
- align-items: center;
- >div{
- width: 50%;
- }
- }
- }
- </style>
|