| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <view class='purchase-list'>
- <my-tabs @change="tapChange" :modelData="modelData" :initIndex="initIndex"></my-tabs>
- <scroll-view class="purchase-body" scroll-y="true" @scrolltolower="scrolltolower" @scrolltoupper="scrolltoupper" @scroll="scroll" @touchstart="touchstart" @touchend="touchend">
- <view class="searchBox">
- <uni-search-bar placeholder="请输入搜索内容" @confirm="search" @blur="blur" @cancel="cancel" @clear="clear">
- </uni-search-bar>
- </view>
- <my-unit v-for="(item,index) in listData" :key="index" :info="item" :initIndex="initIndex" @faClick="handdle"></my-unit>
- </scroll-view>
- <!-- 底部弹窗 -->
- <uni-popup ref="popup" background-color="#fff" border-radius="10px 10px 0 0">
- <view class="popup-body">
- <view class="popup-close">
- <uni-icons type="closeempty" size="20" @click="closePopup"></uni-icons>
- </view>
- <view class="popup-content">
- <async-form-component :id="businessKey" :name="initIndex.toString()" @popupClose="popupClose"></async-form-component>
- </view>
- </view>
-
- </uni-popup>
- </view>
- </template>
- <script>
- import Vue from 'vue'
- import { getTodoTaskPage, getDoneTaskPage,getMyProcessInstancePage } from "@/api/work/index"
- import myTabs from '@/components/myTabs/myTabs.vue'
- import myUnit from '@/components/myUnits/purchaseUnit/unit.vue'
- import myPull from '@/static/js/myPull.js'
- export default {
- components:{myTabs,myUnit},
- data() {
- return {
- name:'',
- businessKey:'',
- initIndex:0,
- pageNo: 1,
- pageSize: 10
- }
- },
- onShow(){
- let option = uni.getStorageSync('option');
- this.initIndex = option.initIndex?option.initIndex:0;
- this.refresh();
- },
- methods: {
- search(res) {
- this.name = res.value;
- this.page = 1;
- this.getList(this.page,this.__pulldone)
- },
- clear(res) {
- this.name = '';
- this.page = 1;
- this.getList(this.page,this.__pulldone)
- },
- blur(res) {
- this.name = res.value;
- this.page = 1;
- this.getList(this.page,this.__pulldone)
- },
- cancel(res) {
- this.name = '';
- this.page = 1;
- this.getList(this.page,this.__pulldone)
- },
- handdle(row) {
- this.businessKey = row.businessKey;
- //将业务表单,注册为动态组件
- const path = row.path;
- console.log("path:" + path)
- Vue.component("async-form-component", function (resolve) {
- require([`@/pages${path}`], resolve);
- });
- this.$refs.popup.open('bottom');
- },
-
- closePopup(){
- this.$refs.popup.close();
- },
- popupClose(){
- this.$refs.popup.close();
- // this.page = 1;
- // this.getList(this.page,this.__pulldone)
- setTimeout(() => {
- this.$router.go(0)
- }, 500)
- },
- /**
- * @name 获取列表
- */
- getList(page,done){
- console.log(`获取第${page}页数据`);
- if(this.initIndex==0){
- getTodoTaskPage({pageNo:page,pageSize: this.pageSize,name:this.name}).then(response => {
- let dataList = response.data.list;
- let list = []
- dataList.forEach(v => {
- list.push({
- businessKey:v.processInstance.businessKey,
- path:v.taskDefinitionKey == 'modifyApply' ? v.processDefinition.formCustomCreatePath : v.processDefinition.formCustomViewPath,
- title:v.processInstance.name,
- status: v.name,
- time:v.createTime,
- nickname:v.processInstance.startUser.nickname
- })
- })
- done(list);
- });
- }
- if(this.initIndex==1){
- getDoneTaskPage({pageNo:page,pageSize: this.pageSize,name:this.name}).then(response => {
- let dataList = response.data.list;
- let list = []
- dataList.forEach(v => {
- list.push({
- businessKey:v.processInstance.businessKey,
- path:v.processDefinition.formCustomViewPath,
- title:v.processInstance.name,
- status: v.name,
- time:v.createTime,
- nickname:v.processInstance.startUser.nickname
- })
- })
- done(list);
- });
- }
- if(this.initIndex==2){
- getMyProcessInstancePage({pageNo:page,pageSize: this.pageSize,name:this.name}).then(response => {
- let dataList = response.data.list;
- let list = []
- dataList.forEach(v => {
- list.push({
- businessKey:v.businessKey,
- path:v.processDefinition.formCustomViewPath,
- title:v.name,
- status: v.statusDesc,
- time:v.startTime,
- nickname:v.currentAuditUser?v.currentAuditUser.nickname:''
- })
- })
- done(list);
- });
- }
-
-
- },
-
- /**
- * @name 触底加载
- */
- scrolltolower(event){
- this.getList(this.page,this.__pulldone)
- },
-
- scroll(e){
- // 重新设置pulldown
- this.setPullDown(e.detail.scrollTop<10)
- },
-
- scrolltoupper(){
-
- },
-
-
- /**
- * @name 改变tab
- * @param val 索引
- */
- tapChange(val){
- this.initIndex=val;
- uni.setStorageSync('option',{initIndex:val, val:'switchTab'})
- this.page = 1;
- this.getList(this.page,this.__pulldone)
- }
- },
- mixins:[myPull({})],
-
- }
- </script>
- <style lang='scss' scoped>
- .searchBox{
- background-color: #fff;
- position: -webkit-sticky; /* Safari */
- position: sticky;
- top: 0; /* 设置元素距离顶部的位置 */
- width: 100%;
- }
- .popup-body{
- z-index: 99;
- }
- .popup-close{
- cursor: pointer;
- height: 40px;
- line-height: 40px;
- padding-left: 10px;
- border-bottom: 1px solid #eaecef;
- }
- .popup-content{
- height: 550px;
- overflow-x: auto;
- padding-bottom: 50px;
- }
- .purchase-list {
- background-color: #f5f5f5;
- height: 100%;
- overflow: hidden;
-
- .purchase-body{
- height: calc(100% - 88upx);
- overflow: auto
- }
- }
- </style>
|