123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023 |
- #parse("PublicMacro/AppFormMarco.vm")
- <template>
- <view class="dynamicModel-list-v" #if($isFlow) v-if="isAuthority" #end>
- <view class="u-flex top-btn" :class="slide2" v-show="showTop">
- <view class="button-left" @click.stop="cancel">
- <p class="u-m-t-10 u-font-28">{{$t('common.cancelText')}}</p>
- </view>
- <view class="button-center">
- <p class="u-m-t-10 u-font-28">已选中{{ids.length}}条</p>
- </view>
- <view class="button-right u-m-t-12" @click.stop="checkAll">
- <p class="icon-ym icon-ym-app-checkAll " :style="{'color':this.checkedAll ? '#0293fc' : '#303133'}">
- </p>
- </view>
- </view>
- <view class="head-warp com-dropdown">
- <u-dropdown class="u-dropdown" ref="uDropdown" @open="openData" type="page">
- <u-dropdown-item :title="$t('app.apply.sort','排序')" :options="sortOptions">
- <view class="screen-box">
- <view class="screen-list" v-if="sortOptions.length">
- <view class="u-p-l-20 u-p-r-20 list">
- <scroll-view scroll-y="true" style="height: 100%;">
- <u-cell-group :border="false">
- <u-cell-item @click="cellClick(item)" :arrow="false" :title="item.labelI18nCode ? $t(item.labelI18nCode) + ' ' + $t(item.sortType) : item.label"
- v-for="(item, index) in sortOptions" :key="index" :title-style="{
- color: sortValue.includes(item.value) ? '#2979ff' : '#606266' }">
- <u-icon v-if="sortValue.includes(item.value)" name="checkbox-mark"
- color="#2979ff" size="32" />
- </u-cell-item>
- </u-cell-group>
- </scroll-view>
- </view>
- </view>
- <view v-else class="notData-box u-flex-col">
- <view class="u-flex-col notData-inner">
- <image :src="icon" class="iconImg"></image>
- <text class="notData-inner-text">{{$t('common.noData','暂无数据')}}</text>
- </view>
- </view>
- <view class="buttom-actions" v-if="sortOptions.length" style="z-index: 1;">
- <u-button class="buttom-btn" @click="handleSortReset">{{$t('common.cleanText','清空')}}</u-button>
- <u-button class="buttom-btn" type="primary" @click="handleSortSearch">{{$t('common.okText','确定')}}</u-button>
- </view>
- </view>
- </u-dropdown-item>
- <u-dropdown-item :title="$t('app.apply.screen','筛选')">
- <view class="screen-box u-flex-col">
- <view class="screen-list">
- #if(${context.searchAll})
- <view class="u-p-l-20 u-p-r-20 list">
- <scroll-view scroll-y="true" style="height: 100%;">
- <u-form :label-width="150">
- #if(${context.isKeyword})
- <u-form-item :label="$t('common.keyword','关键词')">
- <JnpfInput v-model="searchForm.jnpfKeyword" :placeholder="$t('common.enterKeyword','请输入关键词')" input-align='right' />
- </u-form-item>
- #end
- #AppSearchRendering()
- </u-form>
- </scroll-view>
- </view>
- <view class="u-flex screen-btn">
- <text class="btn btn1" @click="reset">{{$t('common.resetText','重置')}}</text>
- <text class="btn btn2" type="primary" @click="closeDropdown">{{$t('common.searchText','检索')}}</text>
- </view>
- #else
- <view class="notData-box u-flex-col">
- <view class="u-flex-col notData-inner">
- <image :src="icon" class="iconImg"></image>
- <text class="notData-inner-text">{{$t('common.noData','暂无数据')}}</text>
- </view>
- </view>
- #end
- <view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
- </view>
- </view>
- </u-dropdown-item>
- </u-dropdown>
- </view>
- #if($isTab)
- <u-tabs :list="tabList" :current="tabKey" font-size="28" @change="onTabChange" height="80" name="fullName"/>
- #end
- <view class="list-warp">
- <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" :fixed="false">
- <view class="list u-p-b-20 u-p-l-20 u-p-r-20">
- <view class="list-box">
- <u-swipe-action v-for="(item, index) in list" :key="index" :options="options" :show="item.show" :index="index" @click="actionClick" @open="open" :btnWidth="160" class="u-m-t-20">
- <view class="item" @click="goDetail(item)">
- <u-checkbox v-if="showTop" @change="checkboxChange($event,item)"
- v-model="item.checked" class="checkbox" @tap.stop shape="circle"/>
- <view class="u-line-1 item-cell" v-for="(column,i) in columnList" :key="i">
- <template v-if="column.jnpfKey != 'table'">
- <text class="item-cell-label">{{column.label}}:</text>
- <text class="item-cell-content" v-if="['calculate','inputNumber'].includes(column.jnpfKey) && column.thousands">{{toThousands(item[column.prop],column)}}</text>
- <text class="item-cell-content text-primary" v-else-if="column.jnpfKey == 'relationForm'" @click.stop="relationFormClick(item,column)" >{{item[column.prop]}}</text>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'sign'">
- <JnpfSign v-model="item[column.prop]" align="left" detailed />
- </view>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'signature'">
- <JnpfSignature v-model="item[column.prop]" align="left" detailed />
- </view>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'uploadImg'" @click.stop>
- <JnpfUploadImg v-model="item[column.prop]" detailed simple v-if="item[column.prop]&&item[column.prop].length" />
- </view>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'uploadFile'" @click.stop>
- <JnpfUploadFile v-model="item[column.prop]" detailed v-if="item[column.prop]&&item[column.prop].length" align="left" />
- </view>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'rate'">
- <JnpfRate v-model="item[column.prop]" :max="column.count" :allowHalf="column.allowHalf" disabled />
- </view>
- <view class="item-cell-content item-cell-slider" v-else-if="column.jnpfKey == 'slider'">
- <JnpfSlider v-model="item[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
- </view>
- <view class="item-cell-content" v-else-if="column.jnpfKey == 'input'">
- <JnpfInput v-model="item[column.prop]" detailed showOverflow :useMask="column.useMask" :maskConfig="column.maskConfig" align='left' />
- </view>
- <text class="item-cell-content" v-else>{{item[column.prop]}}</text>
- </template>
- <tableCell v-else @click.stop :label="column.label" :childList="item[column.prop]" @cRelationForm="relationFormClick" :children="column.children"
- ref="tableCell" :pageLen="3"/>
- </view>
- #if($isFlow)
- <view class="item-cell">
- <text class="item-cell-label">审批状态:</text>
- <text :style="{color:useDefine.getFlowStatusColor(item.flowState)}">
- {{useDefine.getFlowStatusContent(item.flowState)}}
- </text>
- </view>
- #end
- </view>
- </u-swipe-action>
- </view>
- </view>
- </mescroll-uni>
- </view>
- #if(${context.webType}=='2')
- <view class="" v-if="!showTop">
- #foreach($btns in ${context.columnBtnsList})
- #if(${btns.value}=='add')
- <view class="com-addBtn" @click="addPage()" #if(${useBtnPermission}==true) v-if="${setPermission}.hasBtnP('btn_add',${menuId})" #end>
- <u-icon name="plus" size="60" color="#fff" />
- </view>
- #end
- #if(${btns.value}=='batchRemove')
- <view class="com-batch" @click="openBatchOperate()" #if(${useBtnPermission}==true) v-if="${setPermission}.hasBtnP('btn_batchRemove',${menuId}) && list && list.length > 0"
- #else v-if="list && list.length > 0" #end>
- <u-icon name="grid" size="48" color="#848484" />
- </view>
- #end
- #end
- </view>
- #end
- <view class="u-flex bottom-btn" :class="slide" v-show="ids.length">
- <view class="button-preIcon" @click.stop="batchDelete">
- <p class="icon-ym icon-ym-app-delete u-m-b-8"></p>
- <p class="u-m-t-10 u-font-24">{{$t('common.delText','删除')}}</p>
- </view>
- </view>
- </view>
- </template>
- <script>
- import resources from '@/libs/resources.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import tableCell from '../dynamicModel/components/tableCell.vue'
- import {
- getDictionaryDataSelector,
- getDataInterfaceRes
- } from '@/api/common'
- import {
- useBaseStore
- } from '@/store/modules/base'
- const baseStore = useBaseStore()
- import request from '@/utils/request'
- import appColumnList from './columnList'
- #if($isFlow)
- import {
- useDefineSetting
- } from '@/utils/useDefineSetting'
- import {
- getFlowStartFormId
- } from "@/api/workFlow/flowEngine";
- #end
- export default {
- mixins: [MescrollMixin],
- components: {
- tableCell,
- },
- data() {
- return {
- slide: '',
- slide2: '',
- checkedAll: false,
- ids: [],
- showTop: false,
- isAuthority:true,
- #if($isFlow)
- flowId : '',//请在此处填写流程id
- useDefine: useDefineSetting(),
- #end
- icon: resources.message.nodata,
- sortValue: [],
- searchForm: {
- #if(${context.isKeyword})
- jnpfKeyword:'',
- #end
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #set($model = "${html.vModel}")
- #set($config = $html.config)
- #set($value = $html.value)
- #set($defaultValue="undefined")
- #if(${value})
- #if($!config.valueType=='String')
- #set($defaultValue="'"+"${value}"+"'")
- #else
- #set($defaultValue=${value})
- #end
- #end
- ${model}:$defaultValue,
- #end
- },
- downOption: {
- use: true,
- auto: false
- },
- dataOptions:{
- },
- upOption: {
- page: {
- num: 0,
- size: ${context.pageSize},
- time: null,
- },
- empty: {
- use: true,
- icon: resources.message.nodata,
- tip: "暂无数据",
- fixed: true,
- zIndex: 5,
- },
- textNoMore: '没有更多数据',
- toTop: {
- bottom: 250
- }
- },
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #list($html,'')
- #end
- list: [],
- appColumnList:appColumnList,
- listQuery: {
- moduleId:'${context.moduleId}',
- sidx: '',
- keyword: '',
- json: ''
- },
- options: [
- #if(${context.webType}=='2')
- #foreach($btns in ${context.columnBtnsList})
- #set($remove = "删除")
- #if(${btns.value}=='remove')
- #set($remove = "${btns.label}")
- {
- value: 'remove',
- text: '${remove}',
- text2: #if(${btns.labelI18nCode})'${btns.labelI18nCode}' #else '' #end,
- style: {
- backgroundColor: '#dd524d'
- }
- }
- #end
- #end
- #end
- ],
- sortOptions:[
- #foreach($html in ${context.sortList})
- {
- label: '${html.label}降序',
- labelI18nCode: '${html.labelI18nCode}',
- sortType: 'app.apply.descendingOrder',
- sidx: '${html.prop}',
- value: '-${html.prop}',
- sort: 'desc'
- },
- {
- label: '${html.label}升序',
- labelI18nCode: '${html.labelI18nCode}',
- sortType: 'app.apply.ascendingOrder',
- sidx: '${html.prop}',
- value: '${html.prop}',
- sort: 'asc'
- },
- #end
- ],
- ableAll:{
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #set($childList = '')
- #appableAll($html $childList)
- #end
- },
- interfaceRes:{
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #faceRes($html,'')
- #end
- },
- menuId:'',
- columnList:[],
- key:new Date(),
- dataValue:{},
- userInfo:{},
- firstInitSearchData:false,
- tabList: [],
- tabKey:0,
- }
- },
- onLoad(e){
- this.userInfo = uni.getStorageSync('userInfo') || {}
- this.menuId = e.menuId
- this.setDefaultQuery()
- this.dataAll()
- #if($isTab)
- this.getTabList()
- #end
- this.getColumnList()
- #if($isFlow)
- this.getFlowId()
- #end
- },
- onShow() {
- this.$nextTick(()=>{
- this.mescroll.resetUpScroll()
- })
- },
- onUnload() {
- uni.$off('refresh')
- },
- methods:{
- #if($isTab)
- async getTabList() {
- this.tabList = []
- #if(${context.hasAllTab})
- this.tabList.push({ fullName: '全部', id: '' });
- #end
- #foreach($searchAll in ${context.tabSearch})
- #set($html = ${searchAll.html})
- #set($config =$html.config)
- #set($model = "${html.vModel}")
- #if(${config.dataType} == 'dictionary')
- const data = await baseStore.getDicDataSelector('${config.dictionaryType}')
- const options = #if($html.props.value == 'enCode') data.map(o => ({ ...o, id: o.enCode }))#else data #end;
- this.tabList = [...this.tabList,...options]
- #else
- this.tabList = this.tabList.concat( #if(${html.options}) ${html.options} #else [] #end)
- #end
- this.tabKey = 0;
- this.listQuery = {...this.listQuery, ${model} : this.tabList.length? this.tabList[0].id:'' };
- #end
- },
- onTabChange(index){
- this.tabKey = index;
- let val = this.tabList[index].id
- #foreach($searchAll in ${context.tabSearch})
- #set($html = ${searchAll.html})
- #set($model = "${html.vModel}")
- this.listQuery.${model}=val
- #end
- this.mescroll.resetUpScroll();
- },
- #end
- toThousands(val, column) {
- if (val) {
- let valList = val.toString().split('.')
- let num = Number(valList[0])
- let newVal = column.thousands ? num.toLocaleString() : num
- return valList[1] ? newVal + '.' + valList[1] : newVal
- } else {
- return val
- }
- },
- dataAll(){
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #options($html '')
- #end
- },
- #foreach($searchAll in ${context.searchAll})
- #set($html = ${searchAll.html})
- #codeOptionsList($html,'')
- #end
- openData(e){
- },
- setDefaultQuery() {
- const defaultSortConfig=#if(${context.defaultSortConfig}) ${context.defaultSortConfig} #else []#end
- const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field)
- this.listQuery.sidx = sortField.join(',')
- },
- //初始化查询的默认数据
- async initSearchData() {
- #set($formModel='this.searchForm')
- #foreach($html in ${context.mastsearchList})
- #set($fieLdsModel=$html)
- #indexDefaultData('mast',$fieLdsModel,${formModel})
- #end
- #foreach($html in ${context.searchList})
- #set($fieLdsModel=$html)
- #indexDefaultData('mastTable',$fieLdsModel,${formModel})
- #end
- #foreach($html in ${context.childSearch})
- #set($fieLdsModel=$html)
- #indexDefaultData('table',$fieLdsModel,${formModel})
- #end
- this.dataValue = JSON.parse(JSON.stringify(this.searchForm))
- },
- relationFormClick(item,column) {
- let vModel = column.__vModel__ +"_id"
- let id = item[vModel]
- let modelId = column.modelId
- if (!id || !modelId) return
- let config = {
- modelId: modelId,
- id: id,
- formTitle: '详情',
- noShowBtn: 1,
- noDataLog: 1,
- }
- this.$nextTick(() => {
- const url ='/pages/apply/dynamicModel/detail?config=' + this.jnpf.base64.encode(JSON.stringify(config),"UTF-8")
- uni.navigateTo({
- url: url
- })
- })
- },
- async upCallback(page) {
- if(!this.firstInitSearchData) {
- await this.initSearchData()
- this.firstInitSearchData = true
- }
- const query = {
- currentPage: page.num,
- pageSize: page.size,
- menuId : this.menuId,
- ...this.listQuery,
- ...this.searchForm,
- #if($isFlow)
- flowId:this.flowId,
- #end
- #set($queryDataType="0")
- #if(${context.page}=='1')
- #set($queryDataType="1")
- #end
- dataType:${queryDataType},
- }
- request({
- url: '/api/${context.module}/${context.className}/getList',
- method: 'post',
- data: query,
- }).then(res => {
- let _list = res.data.list;
- #set($list = "this.mescroll.endSuccess(_list.length);")
- #if(${context.page}=='1')
- #set($list = "this.mescroll.endSuccess(_list.length, false);")
- #end
- ${list}
- if (page.num == 1) this.list = [];
- const list = _list.map(o => ({
- show: false,
- ...o
- }));
- this.list = this.list.concat(_list);
- }).catch(() => {
- this.mescroll.endSuccess(this.list.length);
- })
- },
- open(index) {
- this.list[index].show = true;
- this.list.map((val, idx) => {
- if (index != idx) this.list[idx].show = false;
- })
- },
- actionClick(itemIndex, btnIndex) {
- if (this.options[btnIndex].value === 'remove') return this.handleClick(itemIndex)
- },
- handleClick(index, index1) {
- #if(${context.webType}=='2')
- #if(${useBtnPermission}==true)
- if (!this.${setPermission}.hasBtnP("btn_remove",this.${menuId})) return this.$u.toast("未开启删除权限")
- #end
- const item = this.list[index]
- #if($isFlow)
- if(![0, 9].includes(item.flowState)){
- this.$u.toast("流程正在审核,请勿删除")
- this.list[index].show = false
- return
- }
- #end
- const _data={ids:[item.id] }
- request({
- url: '/api/${context.module}/${context.className}/batchRemove',
- data: _data,
- method: 'delete'
- }).then(res => {
- uni.showToast({
- title: res.msg,
- complete: () => {
- ${toast}
- this.mescroll.resetUpScroll()
- }
- })
- })
- #end
- },
- open(index) {
- this.list[index].show = true;
- this.list.map((val, idx) => {
- if (index != idx) this.list[idx].show = false;
- })
- },
- search() {
- if (this.isPreview == '1') return
- this.searchTimer && clearTimeout(this.searchTimer)
- this.searchTimer = setTimeout(() => {
- this.list = [];
- this.mescroll.resetUpScroll();
- }, 300)
- },
- #if($isFlow)
- getFlowId(){
- if (!this.flowId){
- this.isAuthority = false
- return this.$u.toast("流程模板的flowId未填写")
- }
- getFlowStartFormId(this.flowId).then(res=>{
- this.isAuthority = true
- }).catch(()=>{
- this.isAuthority = false
- })
- },
- goDetail(item) {
- let flowState =item.flowState
- let id = item.id
- let btnType = ''
- let btnList = []
- #foreach($btns in ${context.columnBtnsList})
- #if(${btns.value}=='edit')
- btnList.push('btn_edit')
- #end
- #if(${btns.value}=='detail')
- btnList.push('btn_detail')
- #end
- #end
- if(btnList.includes('btn_detail')){
- btnType = "btn_detail"
- }
- if(btnList.includes('btn_edit')){
- btnType = "btn_edit"
- }
- if(!btnType) return
- #set($edit="")
- #set($detail="")
- #if(${useBtnPermission}==true)
- #foreach($btns in ${context.columnBtnsList})
- #if(${btns.value}=='edit')
- #set($edit="btn_edit")
- #end
- #if(${btns.value}=='detail')
- #set($detail="btn_detail")
- #end
- #end
- if(!this.${setPermission}.hasBtnP('${edit}',this.${menuId}) && !this.${setPermission}.hasBtnP('${detail}',this.${menuId})) return
- if(this.${setPermission}.hasBtnP('${detail}',this.${menuId})) btnType = 'btn_detail'
- if(this.${setPermission}.hasBtnP('${edit}',this.${menuId})) btnType = 'btn_edit'
- #end
- this.jumPage(id, flowState,btnType)
- },
- addPage() {
- this.jumPage()
- },
- jumPage(id, status,btnType){
- if (!id && !status) btnType = 'btn_add'
- let opType = '-1'
- if (![0, 8, 9].includes(status) && btnType != 'btn_add') opType = 0
- const config = {
- id: id || '',
- flowId: this.flowId,
- opType,
- status: status || '',
- jurisdictionType: btnType || ''
- }
- uni.navigateTo({
- url: '/pages/workFlow/flowBefore/index?config=' + this.jnpf.base64.encode(JSON.stringify(config), "UTF-8")
- })
- },
- #else
- goDetail(item) {
- #if(${context.webType}=='2')
- let id = item.id
- let btnType = ''
- let btnList = []
- #foreach($btns in ${context.columnBtnsList})
- #if(${btns.value}=='edit')
- btnList.push('btn_edit')
- #end
- #if(${btns.value}=='detail')
- btnList.push('btn_detail')
- #end
- #end
- #set($edit="")
- #set($detail="")
- #if(${useBtnPermission}==true)
- #foreach($btns in ${context.columnBtnsList})
- #if(${btns.value}=='edit')
- #set($edit="btn_edit")
- #end
- #if(${btns.value}=='detail')
- #set($detail="btn_detail")
- #end
- #end
- if(!this.${setPermission}.hasBtnP('${detail}',this.${menuId})){
- btnList = btnList.filter(o=>{return o !== '${detail}'})
- }
- if(!this.${setPermission}.hasBtnP('${edit}',this.${menuId})){
- btnList = btnList.filter(o=>{return o !== '${edit}'})
- }
- #end
- if(btnList.length==0) return
- this.jumPage(id,btnList)
- #end
- },
- addPage() {
- this.jumPage()
- },
- jumPage(id, btnList) {
- #if(${context.webType}=='2')
- let idVal = id ? "&id=" + id : ''
- let idList = []
- for(let i=0;i<this.list.length;i++){
- idList.push(this.list[i].id)
- }
- let idListVal = "&idList="+idList
- if (!id){
- uni.navigateTo({
- url: "./form?menuId=" + this.menuId + "&jurisdictionType=btn_add"
- })
- } else if(btnList.includes('btn_detail')){
- uni.navigateTo({
- url: "./detail?menuId=" + this.menuId + "&btnList=" + btnList + idVal+idListVal
- })
- } else if(btnList.includes('btn_edit')){
- uni.navigateTo({
- url: "./form?menuId=" + this.menuId + "&jurisdictionType=btn_edit&btnList=" + btnList + idVal+idListVal
- })
- }
- #end
- },
- #end
- checkboxChange(e, item) {
- if (e.value) {
- this.ids.push(item.id)
- } else {
- this.ids = this.ids.filter(o => o !== item.id)
- }
- if (this.ids.length){
- this.showTop = true
- }
- },
- batchDelete() {
- const item = this.ids
- if (!item.length) {
- return this.$u.toast("请选择一条数据")
- }
- const _data={ ids:item }
- uni.showModal({
- title: '提示',
- content: '删除后数据无法恢复',
- success: (res) => {
- if (res.confirm) {
- request({
- url: '/api/${context.module}/${context.className}/batchRemove',
- data: _data,
- method: 'delete'
- }).then(res => {
- uni.showToast({
- title: res.msg,
- complete: () => {
- this.cancel()
- ${toast}
- this.mescroll.resetUpScroll()
- }
- })
- })
- }
- }
- })
- },
- openBatchOperate() {
- this.showTop = !this.showTop
- if (this.showTop) {
- this.slide = 'slide-up'
- this.slide2 = 'slide-up2'
- }
- },
- checkAll() {
- this.checkedAll = !this.checkedAll
- this.showTop = true
- this.ids = []
- this.list = this.list.map(o => ({
- ...o,
- checked: this.checkedAll,
- }))
- this.list.forEach(o=>{
- if(this.checkedAll) this.ids.push(o.id)
- })
- },
- cancel() {
- this.list = this.list.map(o => ({
- ...o,
- checked: false
- }))
- this.showTop = false
- this.checkedAll = false
- this.ids = []
- },
- getColumnList() {
- let columnPermissionList = []
- let _appColumnList =this.appColumnList
- #if(${context.useColumnPermission}==true)
- let permissionList = uni.getStorageSync('permissionList')
- let list = permissionList.filter(o => o.modelId === this.menuId)
- let _columnList = list[0] && list[0].column ? list[0].column : []
- for (let i = 0; i < _appColumnList.length; i++) {
- let _app = _appColumnList[i].prop
- inner: for (let j = 0; j < _columnList.length; j++) {
- let _encode = _columnList[j].enCode
- if(_app == _encode){
- columnPermissionList.push(this.appColumnList[i])
- break inner
- }
- }
- }
- #else
- for (let i = 0; i < _appColumnList.length; i++) {
- columnPermissionList.push(_appColumnList[i])
- }
- #end
- this.columnList = this.transformColumnList(columnPermissionList, this.dataOptions)
- },
- transformColumnList(columnList, dataOptions) {
- let list = []
- for (let i = 0; i < columnList.length; i++) {
- let e = columnList[i]
- if(e.jnpfKey != 'calculate'){
- let columProp = e.prop
- let label = e.label
- let option = null
- let options = columProp + "Options"
- if (!columProp.includes('-')) {
- columProp = columProp
- e.label = e.labelI18nCode ? this.$t(e.labelI18nCode):label
- e.prop = columProp
- e.option = option
- list.push(e)
- } else {
- e.vModel = columProp.split('-')[1]
- e.childLabel = e.fullNameI18nCode && e.fullNameI18nCode[1] ? this.$t(e.fullNameI18nCode[1]): e.label.split('-')[1]
- options = e.vModel + "Options"
- let prop = columProp.split('-')[0]
- let label = e.fullNameI18nCode && e.fullNameI18nCode[0] ? this.$t(e.fullNameI18nCode[0]): e.label.split('-')[0]
- let newItem = {
- align: "center",
- jnpfKey: "table",
- prop,
- label,
- children: []
- }
- if (!list.some(o => o.prop === prop)) list.push(newItem)
- for (let i = 0; i < list.length; i++) {
- if (list[i].prop === prop) {
- e.prop = e.prop
- e.vModel = e.vModel
- e.option = option
- list[i].children.push(e)
- break
- }
- }
- }
- }
- }
- return list
- },
- cellClick(item) {
- const findIndex = this.sortValue.findIndex(o => o === item.value);
- if (findIndex < 0) {
- const findLikeIndex = this.sortValue.findIndex(o => o.indexOf(item.sidx) > -1);
- if (findLikeIndex > -1) this.sortValue.splice(findLikeIndex, 1)
- this.sortValue.push(item.value)
- } else {
- this.sortValue.splice(findIndex, 1)
- }
- },
- handleSortReset() {
- this.sortValue = []
- },
- handleSortSearch() {
- if (this.sortValue.length) {
- this.listQuery.sidx = this.sortValue.join(',')
- } else {
- this.setDefaultQuery()
- }
- this.$refs.uDropdown.close();
- this.$nextTick(() => {
- this.list = [];
- this.mescroll.resetUpScroll();
- })
- },
- reset() {
- this.searchForm = JSON.parse(JSON.stringify(this.dataValue))
- this.key = new Date()
- },
- closeDropdown() {
- this.$refs.uDropdown.close();
- this.$nextTick(() => {
- this.list = [];
- this.mescroll.resetUpScroll();
- })
- },
- dataList(data){
- let _list =data.list
- return _list;
- },
- },
- }
- </script>
- <style lang="scss">
- page {
- background-color: #f0f2f6;
- height: 100%;
- /* #ifdef MP-ALIPAY */
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- /* #endif */
- }
- .top-btn {
- height: 80rpx;
- position: fixed;
- width: 100%;
- top: 0;
- left: 0;
- background-color: #fff;
- /* #ifdef MP-WEIXIN */
- z-index: 99;
- /* #endif */
- /* #ifndef MP-WEIXIN */
- z-index: 999;
- /* #endif */
- justify-content: space-between;
- padding: 0 20rpx;
- .button-left {
- color: #0293fc;
- }
- .button-right {
- width: 30rpx;
- height: 30rpx;
- }
- }
- .slide-down2 {
- animation: slide-down2 0.5s forwards;
- opacity: 1;
- transform: translateY(0);
- }
- .slide-up2 {
- animation: slide-up2 0.5s forwards;
- opacity: 0;
- transform: translateY(-100%);
- }
- .slide-down {
- animation: slide-down 0.5s forwards;
- opacity: 1;
- transform: translateY(0);
- }
- .slide-up {
- animation: slide-up 0.5s forwards;
- opacity: 0;
- transform: translateY(100%);
- }
- .bottom-btn {
- height: 100rpx;
- position: fixed;
- width: 100%;
- bottom: 0;
- left: 0;
- background-color: #0293fc;
- z-index: 9;
- justify-content: space-around;
- .button-preIcon {
- color: #fff;
- text-align: center;
- width: 20%;
- .btn-icon {
- height: 32rpx;
- }
- }
- }
- @keyframes slide-up {
- to {
- transform: translateY(0);
- opacity: 1;
- }
- }
- @keyframes slide-down {
- to {
- transform: translateY(100%);
- opacity: 0;
- }
- }
- @keyframes slide-up2 {
- to {
- transform: translateY(0);
- opacity: 1;
- }
- }
- @keyframes slide-down2 {
- to {
- transform: translateY(-100%);
- opacity: 0;
- }
- }
- :deep(.u-cell) {
- padding: 0rpx;
- height: 112rpx;
- }
- .buttom-actions {
- z-index: 1;
- }
- .screen-box {
- background-color: #fff;
- height: 100%;
- .screen-btn {
- width: 100%;
- height: 2.75rem;
- .btn {
- width: 50%;
- height: 2.75rem;
- text-align: center;
- line-height: 2.75rem;
- box-shadow: 0px -4rpx 20rpx #F8F8F8
- }
- .btn1 {
- color: #606266;
- }
- .btn2 {
- background-color: #2979ff;
- color: #fff;
- }
- }
- .screen-list {
- width: 100%;
- /* #ifdef APP-HARMONY */
- height: calc(100vh - 82rpx);
- /* #endif */
- /* #ifndef APP-HARMONY */
- height: 100%;
- /* #endif */
- .list {
- height: calc(100% - 88rpx);
- overflow-y: scroll;
- }
- }
- }
- .notData-box {
- width: 100%;
- height: 100%;
- justify-content: center;
- align-items: center;
- padding-bottom: 200rpx;
- .notData-inner {
- width: 280rpx;
- height: 308rpx;
- align-items: center;
- .iconImg {
- width: 100%;
- height: 100%;
- }
- .notData-inner-text {
- padding: 30rpx 0;
- color: #909399;
- }
- }
- }
- </style>
|