p-honggang.li
5 天以前 751dfe21d19a22bb130a6a14857470868d7be53a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<template>
  <div class="bodyBox">
    <!--    产品审批-->
    <div class="searchBox">
      <div class="formDiv">
        <el-form
          :inline="true"
          :model="searchData"
          ref="searchFormRef"
          label-width="100px"
        >
          <el-form-item label="产品名称" class="form-item">
            <el-input
              v-model="searchData.name"
              placeholder="请输入名称"
              clearable
              style="width: 160px"
            />
          </el-form-item>
          <el-form-item label="行业领域" class="form-item">
            <indusreialArea ref="indusreialAreaRef" @returnData="getImportantDistrictIdList"></indusreialArea>
          </el-form-item>
            <el-form-item label="产品技术类型" class="form-item">
              <el-select
                        style="width:160px"
                        clearable
                        v-model="searchData.technologyTypeId"
                        placeholder="请选择产品技术类型"
                        >
                        <el-option
                            v-for="item in state.productTechnologyCategory"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id"
                        />
                    </el-select>
          </el-form-item>
          <el-form-item label="产品业务类型" class="form-item">
            <businessTypeTreeSelect  ref="businessTypeIdRef" @treeChange="getBusinessTypeIdChange"></businessTypeTreeSelect>
          </el-form-item>
          <el-form-item label="提报年度" class="form-item">
            <el-date-picker
              style="width: 160px"
              v-model="searchData.dateValue"
              placeholder="请选择提报年度"
              type="year"
              range-separator="-"
              format="YYYY"
              value-format="YYYY"
              @change="dateChange"
              clearable
              @blur="clearDate"
            />
          </el-form-item>
          <el-form-item class="form-item">
            <el-button
              class="btnDiv"
              icon="Search"
              type="primary"
              @click="queryInformation"
              >查询
            </el-button>
            <el-button class="btnDiv" icon="Refresh" @click="restClick()"
              >重置
            </el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
 
    <div class="buttonDiv">
      <el-row>
        <el-col :span="6" style="margin-top: 10px"> </el-col>
        <el-col :span="18" align="right" style="margin-top: 10px">
          <div class="btnBox">
            <div
              class="btnDiv"
              :class="{ btnDivClass: state.btnClassShow == 'dealwith' }"
              @click="btnClick('dealwith')"
            >
              <span class="numjx">我的待办</span>
              <span>{{ state.dealwithData }}</span>
            </div>
            <div
              class="btnDiv"
              :class="{ btnDivClass: state.btnClassShow == 'completed' }"
              @click="btnClick('completed')"
            >
              <span class="numjx">我的已办</span>
              <span>{{ state.completedData }}</span>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
 
    <div class="tableBox">
      <div class="tableDiv">
        <el-table
          :data="state.tableListData"
            v-loading="loading"
          v-tableHeight
          border
          stripe
          style="width: 100%"
          size="large"
          :header-cell-style="{
            textAlign: 'center',
            backgroundColor: '#fff',
            color: '#333',
          }"
        >
          <!--          <el-table-column align="center" type="selection" width="55"/>-->
          <el-table-column
            align="center"
            prop="name"
            label="产品名称"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            prop="industrialChainName"
            label="行业领域"
            width="120"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            prop="importantAreaName"
            label="单位工程"
            show-overflow-tooltip
            width="120"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="typeName"
            label="产品类型"
            show-overflow-tooltip
            width="120"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="submissionUnit"
            label="提报单位"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            prop="applyDate"
            label="申请时间"
            show-overflow-tooltip
            width="170"
          ></el-table-column>
          <el-table-column
            align="center"
            prop="approStatusName"
            show-overflow-tooltip
            label="状态"
            width="100"
          ></el-table-column>
          <el-table-column align="center" label="操作" width="160">
            <template #default="scope">
              <div class="rowBtnDiv">
                <!-- v-auth="['subscription:approval:approval', 'auth-btn']" -->
                <el-button
                  v-if="searchData.approvalStatus == 'dealwith'"
                  class="normal-btn"
                  type="success"
                  size="small"
                  plain
                  text
                  @click="handleApproval(scope.row)"
                  >审批
                </el-button>
                <!-- v-auth="['subscription:approval:trace', 'auth-btn']" -->
                <el-button
                  class="normal-btn"
                  type="primary"
                  size="small"
                  plain
                  text
                  @click="traceRow(scope.row)"
                  >追踪
                </el-button>
                <!-- v-auth="['subscription:approval:detail', 'auth-btn']" -->
                <el-button
                  class="normal-btn"
                  type="primary"
                  size="small"
                  plain
                  text
                  @click="viewRow(scope.row)"
                  >查看
                </el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="paginationDiv">
        <el-pagination
          v-model:currentPage="state.pageConfig.current"
          v-model:page-size="state.pageConfig.size"
          layout="total, sizes, prev, pager, next, jumper"
          :page-sizes="[10, 20, 30, 50, 100]"
          :total="state.pageConfig.total"
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          size="small"
        />
      </div>
    </div>
    <informationAddEdit
      v-if="showInformationDialog"
      ref="informationDialogRef"
      @updataFun="updataFun"
      @closeDialog="handleCloseAddEdit"
    />
  </div>
</template>
<script lang="ts">
export default {
  name: 'subscriptionApprovalView',
}
</script>
 
<script setup lang="ts">
import type Node from 'element-plus/es/components/tree/src/model/node'
import { Search } from '@element-plus/icons-vue'
import router from '@/router'
import Table from '@/components/table/index.vue'
import { ElMessageBox, ElNotification } from 'element-plus'
import productService from '@/api/zhongjian/productApi' // 接口文件
// import approvalService from '@/api/zhongjian/approvalApi' // 接口文件
import subscriptionApi from '@/api/subscription'
import informationAddEdit from './components/informationAddEdit.vue' // 添加编辑弹框
 
import type { FormInstance } from 'element-plus'
import moment from 'moment'
import { useRoute } from 'vue-router'
import Base64 from '@/utils/base64'
import bus from '@/utils/mitt'
import { useUserInfo } from '@/stores/modules/userInfo'
 
const userStore = useUserInfo() // 用户相关的状态管理器
const route = useRoute()
 
const loading = ref<boolean>(false)
 
const state = reactive<any>({
  tableListData: [],
  pageConfig: {
    current: 1,
    size: 10,
    total: 0,
  },
  //--------
  btnClassShow: 'dealwith', // class动态显示
  directionData: [], // 行业领域下拉
  regionData: [], // 单位工程下拉
  productTypeData: [], // 产品类型下拉
  productTypeChildData: [], // 产品类型子级下拉
  pageTypeData: 'option', // 上传组件类型
  dealwithData: 0, // 我的待办
  completedData: 0, // 我的已办
})
const informationDialogRef = ref()
const showInformationDialog = ref<any>()
const searchFormRef = ref<any>()
const indusreialAreaRef=ref()
const searchData = reactive<any>({
  approvalStatus: 'dealwith', //  审核状态
  name: '', // 方案名称
  industrialChainId: '', // 行业领域
  importantAreaId: '', // 单位工程
  importantAreaIdList: [], // 单位工程
  importantDistrictIdList:[],
  typeId: '', // 产品类型
  typeChildIdList: [], // 知识类型子级
  businessTypeFirstId:'',
  businessTypeId:'',
  businessTypeThirdId:'',
  technologyTypeId:'',
  startDate: '', // 年度开始时间
  endDate: '', // 年度结束时间
  page: {
    current: 1,
    size: 10,
    total: 0,
  },
})
const businessTypeIdRef=ref()
const getBusinessTypeIdChange=(data:any)=>{
  searchData.businessTypeFirstId=data.businessTypeFirstId
  searchData.businessTypeId=data.businessTypeId
  searchData.businessTypeThirdId=data.businessTypeThirdId
}
const restClick = () => {
  searchData.name = '' // 方案名称
  searchData.industrialChainId = '' // 行业领域
  searchData.importantAreaId = '' // 单位工程
  searchData.importantAreaIdList = [] // 单位工程
  searchData.typeId = '' // 产品类型
  searchData.typeChildIdList = [] // 产品类型子级
  searchData.importantDistrictIdList=[] // 单位工程二级   
  searchData.dateValue = ''
  searchData.startDate = ''
  state.regionData=[]
  state.productTypeChildData=[]
  searchData.technologyTypeId=''
  searchData.businessTypeFirstId=''
  searchData.businessTypeId=''
  searchData.businessTypeThirdId=''
  searchData.businessTypeIdCopy=''
  searchData.endDate = ''
  searchData.page = {
    current: 1,
    size: 10,
    total: 0,
  }
  businessTypeIdRef.value.clearData()
  indusreialAreaRef.value.clearData()
  state.btnClassShow = 'dealwith'
  searchData.approvalStatus = 'dealwith'
 
  // 获取数据
  getListDataFun()
}
const informationDialogData = reactive<any>({
  title: '产品使用审批',
  informationEditType: 'approval',
  userUseId: '',
  data: '',
})
 
// 审批
const handleApproval = (row?: any) => {
  showInformationDialog.value = true
  informationDialogData.userUseId = row.useId
  informationDialogData.data = row
  nextTick(() => {
    informationDialogRef.value.visibleShow(informationDialogData)
  })
}
// 更新数据
const updataFun = () => {
  // 获取数据
  getListDataFun()
}
// 取消按钮回调
const handleCloseAddEdit = (type?: string) => {
  // 获取list数据
  if (type == 'refresh') {
    getListDataFun()
  }
  showInformationDialog.value = false
}
// 跟踪
const traceRow = (row?: any) => {
  const token = userStore.getAdminToken
  router.push({
    path: '/approve/tracePage',
    query: {
      info: Base64.encode(
        JSON.stringify({
          name: '订阅',
          id: row.id,
          flowId: row.flowId,
          token: token,
        })
      ),
    },
  })
}
// 查看列表信息
const viewRow = (row: any) => {
  const token = userStore.getAdminToken
  let informationDialogData:any={}
  informationDialogData.id = row.id
  informationDialogData.flowId = row.flowId
  informationDialogData.token = token
  informationDialogData.userUseId=row.useId
  informationDialogData.taskId=row.taskId
  informationDialogData.informationEditType='view'
  informationDialogData.backPath='/approve/subscriptionManage/subscriptionApproval'
  router.push({
    path: '/approve/subscriptionManage/subscriptionApprovalView',
    query: {
      info: Base64.encode(JSON.stringify(informationDialogData)),
    },
  })
}
// 查询
const queryInformation = () => {
  // 获取list数据
  getListDataFun()
}
 
// table数据
const getListDataFun = () => {
  searchData.page = { ...state.pageConfig }
  loading.value=true
  subscriptionApi.getProductUseList({ ...searchData }).then((res: any) => {
    if (res.code == 200) {
      state.tableListData = [...res.data.records]
      state.pageConfig.current = res.data.current
      state.pageConfig.size = res.data.size
      state.pageConfig.total = res.data.total
      // 获取审核数量
      productListCountUrlFun()
    }
    loading.value=false
  }).catch(()=>{
    loading.value=false
  })
}
 // 产品技术类型
 const getProductTechnologyType=()=>{
    productService
    .getProductDict({
        parentCode: 'ProductTechnologyType',
    })
    .then((res: any) => {
      state.productTechnologyCategory = res.data
    })
}
 
const getImportantDistrictIdList=(obj:any)=>{
  searchData.industrialChainId=obj.industrialChainId
  searchData.importantDistrictIdList=obj.importantDistrictIdList
  searchData.importantAreaIdList=obj.importantAreaIdList
}
// 获取审核数量
const productListCountUrlFun = () => {
  const search = {
    name: searchData.name,
    industrialChainId: searchData.industrialChainId,
    importantAreaId: searchData.importantAreaId,
    importantAreaIdList: searchData.importantAreaIdList,
    importantDistrictIdList: searchData.importantDistrictIdList,
    typeId: searchData.typeId,
    typeChildIdList: searchData.typeChildIdList,
    startDate: searchData.startDate,
    endDate: searchData.endDate,
    businessTypeFirstId: searchData.businessTypeFirstId,
    businessTypeId: searchData.businessTypeId,
    businessTypeThirdId: searchData.businessTypeThirdId,
    technologyTypeId: searchData.technologyTypeId,
  }
  subscriptionApi.getProductUseListCount({ ...search }).then((res: any) => {
    if (res.code == 200) {
      res.data.forEach((item) => {
        if (item.approvalStatus == 'dealwith') {
          state.dealwithData = item.numCount
        }
        if (item.approvalStatus == 'completed') {
          state.completedData = item.numCount
        }
      })
    }
  })
}
 
// 修改页码
const handleSizeChange = (val: number) => {
  state.pageConfig.size = val
  getListDataFun()
}
const handleCurrentChange = (val: number) => {
  state.pageConfig.current = val
  getListDataFun()
}
 
// ----------------------------------------------
 
const btnClick = (type?: any) => {
  state.btnClassShow = type
 
  searchData.approvalStatus = type
 
  // 获取list数据
  getListDataFun()
}
 
// 选择日期change
const dateChange = (val?: any) => {
  const currentYear = moment().format('YYYY')
  const currentDate = moment().format('YYYY-MM-DD')
 
  if (val == currentYear) {
    searchData.startDate = `${val}-01-01`
    searchData.endDate = currentDate
    return
  }
 
  if (val != currentYear) {
    searchData.startDate = `${val}-01-01`
    searchData.endDate = `${val}-12-31`
    return
  }
}
// 清除时间
const clearDate = () => {
  if (!searchData.dateValue) {
    searchData.startDate = ''
    searchData.endDate = ''
  }
}
 
// 用监听的写法-解决页面滚动问题-未触底
bus.on('routerBack3', (e) => {
  // 获取list数据
  getListDataFun()
})
 
// 用监听的写法-home跳转传参
bus.on('routerHomecp', (e) => {
  // dealwith 待办
  // completed 已办
 
  if (e == 1) {
    setTimeout(() => {
      state.btnClassShow = 'dealwith'
 
      searchData.approvalStatus = 'dealwith'
      // 获取list数据
      getListDataFun()
    })
  }
  if (e == 2) {
    setTimeout(() => {
      state.btnClassShow = 'completed'
 
      searchData.approvalStatus = 'completed'
      // 获取list数据
      getListDataFun()
    })
  }
})
 
onMounted(() => {
  // 获取list数据
  getListDataFun()
  // 下拉数据-行业领域
  indusreialAreaRef.value.getData('product')
  // 下拉数据-产品技术类型
  getProductTechnologyType()
})
onActivated(() => {
  // 获取list数据
  getListDataFun()
})
</script>
 
<style scoped lang="scss">
.bodyBox {
  width: 100%;
  //height: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
 
  .searchBox {
    width: 100%;
    // border-radius: 5px;
    border: 1px solid #dbe5ea;
    // box-shadow: 0 5px 5px rgba(223, 223, 223, 0.5); // 下
    display: flex;
    flex-direction: row;
    padding-bottom: 10px;
    padding-left: 10px;
 
    .formDiv {
      width: 100%;
      height: 100%;
      position: relative;
    }
 
    .searchBtn {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      margin-right: 10px;
      margin-top: 10px;
    }
  }
 
  .btnBox {
    width: 210px;
    height: 33px;
    //background-color: pink;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
 
    .btnDivClass {
      background-color: #2f4589;
      color: #fff;
    }
 
    .btnDiv {
      width: 100px;
      height: 33px;
      border-radius: 5px;
      border: 1px solid #ebeef5;
      display: flex;
      margin-right: 5px;
 
      flex-direction: row;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      cursor: pointer;
      span :nth-child(2) {
        color: #f04844;
      }
    }
 
    .elFormDiv {
      width: 100%;
      height: 100px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
 
      .searchFormDiv {
        display: flex;
        flex-direction: row;
        align-items: center;
      }
 
      .searchBtnDiv {
        //width: 20%;
        height: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
      }
    }
  }
 
  .tableBox {
    width: 100%;
    // height: 61vh;
    margin-top: 20px;
    // border: 1px solid #f2f2f2;
 
    display: flex;
    flex-direction: column;
    // align-items: center;
    justify-content: space-between;
    //margin: -1px;
 
    .tableDiv {
      width: 100%;
      height: 100%;
      margin: auto 0 auto auto;
      // box-shadow: 0 5px 5px rgba(223, 223, 223, 0.3); // 下
      .rowBtnDiv {
        width: 100%;
        //height: 50px;
        //background-color: pink;
        display: flex;
        justify-content: center;
        .normal-btn {
          //width: 30px;
          font-size: 14px;
          padding: 5px 2px !important;
        }
      }
    }
 
    .paginationDiv {
      margin-top: 10px;
    }
  }
 
  .buttonDiv {
    width: 100%;
    height: 33px;
  }
}
.form-item {
  margin-top: 9px;
  margin-bottom: 0px;
  margin-right: 10px;
}
.numjx {
  padding-right: 5px;
}
</style>
<style>
.info-popover {
  width: 240px;
}
</style>