index.vue.vm 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. #parse("PublicMacro/AppFormMarco.vm")
  2. <template>
  3. <view class="dynamicModel-list-v" #if($isFlow) v-if="isAuthority" #end>
  4. <view class="u-flex top-btn" :class="slide2" v-show="showTop">
  5. <view class="button-left" @click.stop="cancel">
  6. <p class="u-m-t-10 u-font-28">{{$t('common.cancelText')}}</p>
  7. </view>
  8. <view class="button-center">
  9. <p class="u-m-t-10 u-font-28">已选中{{ids.length}}条</p>
  10. </view>
  11. <view class="button-right u-m-t-12" @click.stop="checkAll">
  12. <p class="icon-ym icon-ym-app-checkAll " :style="{'color':this.checkedAll ? '#0293fc' : '#303133'}">
  13. </p>
  14. </view>
  15. </view>
  16. <view class="head-warp com-dropdown">
  17. <u-dropdown class="u-dropdown" ref="uDropdown" @open="openData" type="page">
  18. <u-dropdown-item :title="$t('app.apply.sort','排序')" :options="sortOptions">
  19. <view class="screen-box">
  20. <view class="screen-list" v-if="sortOptions.length">
  21. <view class="u-p-l-20 u-p-r-20 list">
  22. <scroll-view scroll-y="true" style="height: 100%;">
  23. <u-cell-group :border="false">
  24. <u-cell-item @click="cellClick(item)" :arrow="false" :title="item.labelI18nCode ? $t(item.labelI18nCode) + ' ' + $t(item.sortType) : item.label"
  25. v-for="(item, index) in sortOptions" :key="index" :title-style="{
  26. color: sortValue.includes(item.value) ? '#2979ff' : '#606266' }">
  27. <u-icon v-if="sortValue.includes(item.value)" name="checkbox-mark"
  28. color="#2979ff" size="32" />
  29. </u-cell-item>
  30. </u-cell-group>
  31. </scroll-view>
  32. </view>
  33. </view>
  34. <view v-else class="notData-box u-flex-col">
  35. <view class="u-flex-col notData-inner">
  36. <image :src="icon" class="iconImg"></image>
  37. <text class="notData-inner-text">{{$t('common.noData','暂无数据')}}</text>
  38. </view>
  39. </view>
  40. <view class="buttom-actions" v-if="sortOptions.length" style="z-index: 1;">
  41. <u-button class="buttom-btn" @click="handleSortReset">{{$t('common.cleanText','清空')}}</u-button>
  42. <u-button class="buttom-btn" type="primary" @click="handleSortSearch">{{$t('common.okText','确定')}}</u-button>
  43. </view>
  44. </view>
  45. </u-dropdown-item>
  46. <u-dropdown-item :title="$t('app.apply.screen','筛选')">
  47. <view class="screen-box u-flex-col">
  48. <view class="screen-list">
  49. #if(${context.searchAll})
  50. <view class="u-p-l-20 u-p-r-20 list">
  51. <scroll-view scroll-y="true" style="height: 100%;">
  52. <u-form :label-width="150">
  53. #if(${context.isKeyword})
  54. <u-form-item :label="$t('common.keyword','关键词')">
  55. <JnpfInput v-model="searchForm.jnpfKeyword" :placeholder="$t('common.enterKeyword','请输入关键词')" input-align='right' />
  56. </u-form-item>
  57. #end
  58. #AppSearchRendering()
  59. </u-form>
  60. </scroll-view>
  61. </view>
  62. <view class="u-flex screen-btn">
  63. <text class="btn btn1" @click="reset">{{$t('common.resetText','重置')}}</text>
  64. <text class="btn btn2" type="primary" @click="closeDropdown">{{$t('common.searchText','检索')}}</text>
  65. </view>
  66. #else
  67. <view class="notData-box u-flex-col">
  68. <view class="u-flex-col notData-inner">
  69. <image :src="icon" class="iconImg"></image>
  70. <text class="notData-inner-text">{{$t('common.noData','暂无数据')}}</text>
  71. </view>
  72. </view>
  73. #end
  74. <view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
  75. </view>
  76. </view>
  77. </u-dropdown-item>
  78. </u-dropdown>
  79. </view>
  80. #if($isTab)
  81. <u-tabs :list="tabList" :current="tabKey" font-size="28" @change="onTabChange" height="80" name="fullName"/>
  82. #end
  83. <view class="list-warp">
  84. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" :fixed="false">
  85. <view class="list u-p-b-20 u-p-l-20 u-p-r-20">
  86. <view class="list-box">
  87. <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">
  88. <view class="item" @click="goDetail(item)">
  89. <u-checkbox v-if="showTop" @change="checkboxChange($event,item)"
  90. v-model="item.checked" class="checkbox" @tap.stop shape="circle"/>
  91. <view class="u-line-1 item-cell" v-for="(column,i) in columnList" :key="i">
  92. <template v-if="column.jnpfKey != 'table'">
  93. <text class="item-cell-label">{{column.label}}:</text>
  94. <text class="item-cell-content" v-if="['calculate','inputNumber'].includes(column.jnpfKey) && column.thousands">{{toThousands(item[column.prop],column)}}</text>
  95. <text class="item-cell-content text-primary" v-else-if="column.jnpfKey == 'relationForm'" @click.stop="relationFormClick(item,column)" >{{item[column.prop]}}</text>
  96. <view class="item-cell-content" v-else-if="column.jnpfKey == 'sign'">
  97. <JnpfSign v-model="item[column.prop]" align="left" detailed />
  98. </view>
  99. <view class="item-cell-content" v-else-if="column.jnpfKey == 'signature'">
  100. <JnpfSignature v-model="item[column.prop]" align="left" detailed />
  101. </view>
  102. <view class="item-cell-content" v-else-if="column.jnpfKey == 'uploadImg'" @click.stop>
  103. <JnpfUploadImg v-model="item[column.prop]" detailed simple v-if="item[column.prop]&&item[column.prop].length" />
  104. </view>
  105. <view class="item-cell-content" v-else-if="column.jnpfKey == 'uploadFile'" @click.stop>
  106. <JnpfUploadFile v-model="item[column.prop]" detailed v-if="item[column.prop]&&item[column.prop].length" align="left" />
  107. </view>
  108. <view class="item-cell-content" v-else-if="column.jnpfKey == 'rate'">
  109. <JnpfRate v-model="item[column.prop]" :max="column.count" :allowHalf="column.allowHalf" disabled />
  110. </view>
  111. <view class="item-cell-content item-cell-slider" v-else-if="column.jnpfKey == 'slider'">
  112. <JnpfSlider v-model="item[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
  113. </view>
  114. <view class="item-cell-content" v-else-if="column.jnpfKey == 'input'">
  115. <JnpfInput v-model="item[column.prop]" detailed showOverflow :useMask="column.useMask" :maskConfig="column.maskConfig" align='left' />
  116. </view>
  117. <text class="item-cell-content" v-else>{{item[column.prop]}}</text>
  118. </template>
  119. <tableCell v-else @click.stop :label="column.label" :childList="item[column.prop]" @cRelationForm="relationFormClick" :children="column.children"
  120. ref="tableCell" :pageLen="3"/>
  121. </view>
  122. #if($isFlow)
  123. <view class="item-cell">
  124. <text class="item-cell-label">审批状态:</text>
  125. <text :style="{color:useDefine.getFlowStatusColor(item.flowState)}">
  126. {{useDefine.getFlowStatusContent(item.flowState)}}
  127. </text>
  128. </view>
  129. #end
  130. </view>
  131. </u-swipe-action>
  132. </view>
  133. </view>
  134. </mescroll-uni>
  135. </view>
  136. #if(${context.webType}=='2')
  137. <view class="" v-if="!showTop">
  138. #foreach($btns in ${context.columnBtnsList})
  139. #if(${btns.value}=='add')
  140. <view class="com-addBtn" @click="addPage()" #if(${useBtnPermission}==true) v-if="${setPermission}.hasBtnP('btn_add',${menuId})" #end>
  141. <u-icon name="plus" size="60" color="#fff" />
  142. </view>
  143. #end
  144. #if(${btns.value}=='batchRemove')
  145. <view class="com-batch" @click="openBatchOperate()" #if(${useBtnPermission}==true) v-if="${setPermission}.hasBtnP('btn_batchRemove',${menuId}) && list && list.length > 0"
  146. #else v-if="list && list.length > 0" #end>
  147. <u-icon name="grid" size="48" color="#848484" />
  148. </view>
  149. #end
  150. #end
  151. </view>
  152. #end
  153. <view class="u-flex bottom-btn" :class="slide" v-show="ids.length">
  154. <view class="button-preIcon" @click.stop="batchDelete">
  155. <p class="icon-ym icon-ym-app-delete u-m-b-8"></p>
  156. <p class="u-m-t-10 u-font-24">{{$t('common.delText','删除')}}</p>
  157. </view>
  158. </view>
  159. </view>
  160. </template>
  161. <script>
  162. import resources from '@/libs/resources.js'
  163. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  164. import tableCell from '../dynamicModel/components/tableCell.vue'
  165. import {
  166. getDictionaryDataSelector,
  167. getDataInterfaceRes
  168. } from '@/api/common'
  169. import {
  170. useBaseStore
  171. } from '@/store/modules/base'
  172. const baseStore = useBaseStore()
  173. import request from '@/utils/request'
  174. import appColumnList from './columnList'
  175. #if($isFlow)
  176. import {
  177. useDefineSetting
  178. } from '@/utils/useDefineSetting'
  179. import {
  180. getFlowStartFormId
  181. } from "@/api/workFlow/flowEngine";
  182. #end
  183. export default {
  184. mixins: [MescrollMixin],
  185. components: {
  186. tableCell,
  187. },
  188. data() {
  189. return {
  190. slide: '',
  191. slide2: '',
  192. checkedAll: false,
  193. ids: [],
  194. showTop: false,
  195. isAuthority:true,
  196. #if($isFlow)
  197. flowId : '',//请在此处填写流程id
  198. useDefine: useDefineSetting(),
  199. #end
  200. icon: resources.message.nodata,
  201. sortValue: [],
  202. searchForm: {
  203. #if(${context.isKeyword})
  204. jnpfKeyword:'',
  205. #end
  206. #foreach($searchAll in ${context.searchAll})
  207. #set($html = ${searchAll.html})
  208. #set($model = "${html.vModel}")
  209. #set($config = $html.config)
  210. #set($value = $html.value)
  211. #set($defaultValue="undefined")
  212. #if(${value})
  213. #if($!config.valueType=='String')
  214. #set($defaultValue="'"+"${value}"+"'")
  215. #else
  216. #set($defaultValue=${value})
  217. #end
  218. #end
  219. ${model}:$defaultValue,
  220. #end
  221. },
  222. downOption: {
  223. use: true,
  224. auto: false
  225. },
  226. dataOptions:{
  227. },
  228. upOption: {
  229. page: {
  230. num: 0,
  231. size: ${context.pageSize},
  232. time: null,
  233. },
  234. empty: {
  235. use: true,
  236. icon: resources.message.nodata,
  237. tip: "暂无数据",
  238. fixed: true,
  239. zIndex: 5,
  240. },
  241. textNoMore: '没有更多数据',
  242. toTop: {
  243. bottom: 250
  244. }
  245. },
  246. #foreach($searchAll in ${context.searchAll})
  247. #set($html = ${searchAll.html})
  248. #list($html,'')
  249. #end
  250. list: [],
  251. appColumnList:appColumnList,
  252. listQuery: {
  253. moduleId:'${context.moduleId}',
  254. sidx: '',
  255. keyword: '',
  256. json: ''
  257. },
  258. options: [
  259. #if(${context.webType}=='2')
  260. #foreach($btns in ${context.columnBtnsList})
  261. #set($remove = "删除")
  262. #if(${btns.value}=='remove')
  263. #set($remove = "${btns.label}")
  264. {
  265. value: 'remove',
  266. text: '${remove}',
  267. text2: #if(${btns.labelI18nCode})'${btns.labelI18nCode}' #else '' #end,
  268. style: {
  269. backgroundColor: '#dd524d'
  270. }
  271. }
  272. #end
  273. #end
  274. #end
  275. ],
  276. sortOptions:[
  277. #foreach($html in ${context.sortList})
  278. {
  279. label: '${html.label}降序',
  280. labelI18nCode: '${html.labelI18nCode}',
  281. sortType: 'app.apply.descendingOrder',
  282. sidx: '${html.prop}',
  283. value: '-${html.prop}',
  284. sort: 'desc'
  285. },
  286. {
  287. label: '${html.label}升序',
  288. labelI18nCode: '${html.labelI18nCode}',
  289. sortType: 'app.apply.ascendingOrder',
  290. sidx: '${html.prop}',
  291. value: '${html.prop}',
  292. sort: 'asc'
  293. },
  294. #end
  295. ],
  296. ableAll:{
  297. #foreach($searchAll in ${context.searchAll})
  298. #set($html = ${searchAll.html})
  299. #set($childList = '')
  300. #appableAll($html $childList)
  301. #end
  302. },
  303. interfaceRes:{
  304. #foreach($searchAll in ${context.searchAll})
  305. #set($html = ${searchAll.html})
  306. #faceRes($html,'')
  307. #end
  308. },
  309. menuId:'',
  310. columnList:[],
  311. key:new Date(),
  312. dataValue:{},
  313. userInfo:{},
  314. firstInitSearchData:false,
  315. tabList: [],
  316. tabKey:0,
  317. }
  318. },
  319. onLoad(e){
  320. this.userInfo = uni.getStorageSync('userInfo') || {}
  321. this.menuId = e.menuId
  322. this.setDefaultQuery()
  323. this.dataAll()
  324. #if($isTab)
  325. this.getTabList()
  326. #end
  327. this.getColumnList()
  328. #if($isFlow)
  329. this.getFlowId()
  330. #end
  331. },
  332. onShow() {
  333. this.$nextTick(()=>{
  334. this.mescroll.resetUpScroll()
  335. })
  336. },
  337. onUnload() {
  338. uni.$off('refresh')
  339. },
  340. methods:{
  341. #if($isTab)
  342. async getTabList() {
  343. this.tabList = []
  344. #if(${context.hasAllTab})
  345. this.tabList.push({ fullName: '全部', id: '' });
  346. #end
  347. #foreach($searchAll in ${context.tabSearch})
  348. #set($html = ${searchAll.html})
  349. #set($config =$html.config)
  350. #set($model = "${html.vModel}")
  351. #if(${config.dataType} == 'dictionary')
  352. const data = await baseStore.getDicDataSelector('${config.dictionaryType}')
  353. const options = #if($html.props.value == 'enCode') data.map(o => ({ ...o, id: o.enCode }))#else data #end;
  354. this.tabList = [...this.tabList,...options]
  355. #else
  356. this.tabList = this.tabList.concat( #if(${html.options}) ${html.options} #else [] #end)
  357. #end
  358. this.tabKey = 0;
  359. this.listQuery = {...this.listQuery, ${model} : this.tabList.length? this.tabList[0].id:'' };
  360. #end
  361. },
  362. onTabChange(index){
  363. this.tabKey = index;
  364. let val = this.tabList[index].id
  365. #foreach($searchAll in ${context.tabSearch})
  366. #set($html = ${searchAll.html})
  367. #set($model = "${html.vModel}")
  368. this.listQuery.${model}=val
  369. #end
  370. this.mescroll.resetUpScroll();
  371. },
  372. #end
  373. toThousands(val, column) {
  374. if (val) {
  375. let valList = val.toString().split('.')
  376. let num = Number(valList[0])
  377. let newVal = column.thousands ? num.toLocaleString() : num
  378. return valList[1] ? newVal + '.' + valList[1] : newVal
  379. } else {
  380. return val
  381. }
  382. },
  383. dataAll(){
  384. #foreach($searchAll in ${context.searchAll})
  385. #set($html = ${searchAll.html})
  386. #options($html '')
  387. #end
  388. },
  389. #foreach($searchAll in ${context.searchAll})
  390. #set($html = ${searchAll.html})
  391. #codeOptionsList($html,'')
  392. #end
  393. openData(e){
  394. },
  395. setDefaultQuery() {
  396. const defaultSortConfig=#if(${context.defaultSortConfig}) ${context.defaultSortConfig} #else []#end
  397. const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field)
  398. this.listQuery.sidx = sortField.join(',')
  399. },
  400. //初始化查询的默认数据
  401. async initSearchData() {
  402. #set($formModel='this.searchForm')
  403. #foreach($html in ${context.mastsearchList})
  404. #set($fieLdsModel=$html)
  405. #indexDefaultData('mast',$fieLdsModel,${formModel})
  406. #end
  407. #foreach($html in ${context.searchList})
  408. #set($fieLdsModel=$html)
  409. #indexDefaultData('mastTable',$fieLdsModel,${formModel})
  410. #end
  411. #foreach($html in ${context.childSearch})
  412. #set($fieLdsModel=$html)
  413. #indexDefaultData('table',$fieLdsModel,${formModel})
  414. #end
  415. this.dataValue = JSON.parse(JSON.stringify(this.searchForm))
  416. },
  417. relationFormClick(item,column) {
  418. let vModel = column.__vModel__ +"_id"
  419. let id = item[vModel]
  420. let modelId = column.modelId
  421. if (!id || !modelId) return
  422. let config = {
  423. modelId: modelId,
  424. id: id,
  425. formTitle: '详情',
  426. noShowBtn: 1,
  427. noDataLog: 1,
  428. }
  429. this.$nextTick(() => {
  430. const url ='/pages/apply/dynamicModel/detail?config=' + this.jnpf.base64.encode(JSON.stringify(config),"UTF-8")
  431. uni.navigateTo({
  432. url: url
  433. })
  434. })
  435. },
  436. async upCallback(page) {
  437. if(!this.firstInitSearchData) {
  438. await this.initSearchData()
  439. this.firstInitSearchData = true
  440. }
  441. const query = {
  442. currentPage: page.num,
  443. pageSize: page.size,
  444. menuId : this.menuId,
  445. ...this.listQuery,
  446. ...this.searchForm,
  447. #if($isFlow)
  448. flowId:this.flowId,
  449. #end
  450. #set($queryDataType="0")
  451. #if(${context.page}=='1')
  452. #set($queryDataType="1")
  453. #end
  454. dataType:${queryDataType},
  455. }
  456. request({
  457. url: '/api/${context.module}/${context.className}/getList',
  458. method: 'post',
  459. data: query,
  460. }).then(res => {
  461. let _list = res.data.list;
  462. #set($list = "this.mescroll.endSuccess(_list.length);")
  463. #if(${context.page}=='1')
  464. #set($list = "this.mescroll.endSuccess(_list.length, false);")
  465. #end
  466. ${list}
  467. if (page.num == 1) this.list = [];
  468. const list = _list.map(o => ({
  469. show: false,
  470. ...o
  471. }));
  472. this.list = this.list.concat(_list);
  473. }).catch(() => {
  474. this.mescroll.endSuccess(this.list.length);
  475. })
  476. },
  477. open(index) {
  478. this.list[index].show = true;
  479. this.list.map((val, idx) => {
  480. if (index != idx) this.list[idx].show = false;
  481. })
  482. },
  483. actionClick(itemIndex, btnIndex) {
  484. if (this.options[btnIndex].value === 'remove') return this.handleClick(itemIndex)
  485. },
  486. handleClick(index, index1) {
  487. #if(${context.webType}=='2')
  488. #if(${useBtnPermission}==true)
  489. if (!this.${setPermission}.hasBtnP("btn_remove",this.${menuId})) return this.$u.toast("未开启删除权限")
  490. #end
  491. const item = this.list[index]
  492. #if($isFlow)
  493. if(![0, 9].includes(item.flowState)){
  494. this.$u.toast("流程正在审核,请勿删除")
  495. this.list[index].show = false
  496. return
  497. }
  498. #end
  499. const _data={ids:[item.id] }
  500. request({
  501. url: '/api/${context.module}/${context.className}/batchRemove',
  502. data: _data,
  503. method: 'delete'
  504. }).then(res => {
  505. uni.showToast({
  506. title: res.msg,
  507. complete: () => {
  508. ${toast}
  509. this.mescroll.resetUpScroll()
  510. }
  511. })
  512. })
  513. #end
  514. },
  515. open(index) {
  516. this.list[index].show = true;
  517. this.list.map((val, idx) => {
  518. if (index != idx) this.list[idx].show = false;
  519. })
  520. },
  521. search() {
  522. if (this.isPreview == '1') return
  523. this.searchTimer && clearTimeout(this.searchTimer)
  524. this.searchTimer = setTimeout(() => {
  525. this.list = [];
  526. this.mescroll.resetUpScroll();
  527. }, 300)
  528. },
  529. #if($isFlow)
  530. getFlowId(){
  531. if (!this.flowId){
  532. this.isAuthority = false
  533. return this.$u.toast("流程模板的flowId未填写")
  534. }
  535. getFlowStartFormId(this.flowId).then(res=>{
  536. this.isAuthority = true
  537. }).catch(()=>{
  538. this.isAuthority = false
  539. })
  540. },
  541. goDetail(item) {
  542. let flowState =item.flowState
  543. let id = item.id
  544. let btnType = ''
  545. let btnList = []
  546. #foreach($btns in ${context.columnBtnsList})
  547. #if(${btns.value}=='edit')
  548. btnList.push('btn_edit')
  549. #end
  550. #if(${btns.value}=='detail')
  551. btnList.push('btn_detail')
  552. #end
  553. #end
  554. if(btnList.includes('btn_detail')){
  555. btnType = "btn_detail"
  556. }
  557. if(btnList.includes('btn_edit')){
  558. btnType = "btn_edit"
  559. }
  560. if(!btnType) return
  561. #set($edit="")
  562. #set($detail="")
  563. #if(${useBtnPermission}==true)
  564. #foreach($btns in ${context.columnBtnsList})
  565. #if(${btns.value}=='edit')
  566. #set($edit="btn_edit")
  567. #end
  568. #if(${btns.value}=='detail')
  569. #set($detail="btn_detail")
  570. #end
  571. #end
  572. if(!this.${setPermission}.hasBtnP('${edit}',this.${menuId}) && !this.${setPermission}.hasBtnP('${detail}',this.${menuId})) return
  573. if(this.${setPermission}.hasBtnP('${detail}',this.${menuId})) btnType = 'btn_detail'
  574. if(this.${setPermission}.hasBtnP('${edit}',this.${menuId})) btnType = 'btn_edit'
  575. #end
  576. this.jumPage(id, flowState,btnType)
  577. },
  578. addPage() {
  579. this.jumPage()
  580. },
  581. jumPage(id, status,btnType){
  582. if (!id && !status) btnType = 'btn_add'
  583. let opType = '-1'
  584. if (![0, 8, 9].includes(status) && btnType != 'btn_add') opType = 0
  585. const config = {
  586. id: id || '',
  587. flowId: this.flowId,
  588. opType,
  589. status: status || '',
  590. jurisdictionType: btnType || ''
  591. }
  592. uni.navigateTo({
  593. url: '/pages/workFlow/flowBefore/index?config=' + this.jnpf.base64.encode(JSON.stringify(config), "UTF-8")
  594. })
  595. },
  596. #else
  597. goDetail(item) {
  598. #if(${context.webType}=='2')
  599. let id = item.id
  600. let btnType = ''
  601. let btnList = []
  602. #foreach($btns in ${context.columnBtnsList})
  603. #if(${btns.value}=='edit')
  604. btnList.push('btn_edit')
  605. #end
  606. #if(${btns.value}=='detail')
  607. btnList.push('btn_detail')
  608. #end
  609. #end
  610. #set($edit="")
  611. #set($detail="")
  612. #if(${useBtnPermission}==true)
  613. #foreach($btns in ${context.columnBtnsList})
  614. #if(${btns.value}=='edit')
  615. #set($edit="btn_edit")
  616. #end
  617. #if(${btns.value}=='detail')
  618. #set($detail="btn_detail")
  619. #end
  620. #end
  621. if(!this.${setPermission}.hasBtnP('${detail}',this.${menuId})){
  622. btnList = btnList.filter(o=>{return o !== '${detail}'})
  623. }
  624. if(!this.${setPermission}.hasBtnP('${edit}',this.${menuId})){
  625. btnList = btnList.filter(o=>{return o !== '${edit}'})
  626. }
  627. #end
  628. if(btnList.length==0) return
  629. this.jumPage(id,btnList)
  630. #end
  631. },
  632. addPage() {
  633. this.jumPage()
  634. },
  635. jumPage(id, btnList) {
  636. #if(${context.webType}=='2')
  637. let idVal = id ? "&id=" + id : ''
  638. let idList = []
  639. for(let i=0;i<this.list.length;i++){
  640. idList.push(this.list[i].id)
  641. }
  642. let idListVal = "&idList="+idList
  643. if (!id){
  644. uni.navigateTo({
  645. url: "./form?menuId=" + this.menuId + "&jurisdictionType=btn_add"
  646. })
  647. } else if(btnList.includes('btn_detail')){
  648. uni.navigateTo({
  649. url: "./detail?menuId=" + this.menuId + "&btnList=" + btnList + idVal+idListVal
  650. })
  651. } else if(btnList.includes('btn_edit')){
  652. uni.navigateTo({
  653. url: "./form?menuId=" + this.menuId + "&jurisdictionType=btn_edit&btnList=" + btnList + idVal+idListVal
  654. })
  655. }
  656. #end
  657. },
  658. #end
  659. checkboxChange(e, item) {
  660. if (e.value) {
  661. this.ids.push(item.id)
  662. } else {
  663. this.ids = this.ids.filter(o => o !== item.id)
  664. }
  665. if (this.ids.length){
  666. this.showTop = true
  667. }
  668. },
  669. batchDelete() {
  670. const item = this.ids
  671. if (!item.length) {
  672. return this.$u.toast("请选择一条数据")
  673. }
  674. const _data={ ids:item }
  675. uni.showModal({
  676. title: '提示',
  677. content: '删除后数据无法恢复',
  678. success: (res) => {
  679. if (res.confirm) {
  680. request({
  681. url: '/api/${context.module}/${context.className}/batchRemove',
  682. data: _data,
  683. method: 'delete'
  684. }).then(res => {
  685. uni.showToast({
  686. title: res.msg,
  687. complete: () => {
  688. this.cancel()
  689. ${toast}
  690. this.mescroll.resetUpScroll()
  691. }
  692. })
  693. })
  694. }
  695. }
  696. })
  697. },
  698. openBatchOperate() {
  699. this.showTop = !this.showTop
  700. if (this.showTop) {
  701. this.slide = 'slide-up'
  702. this.slide2 = 'slide-up2'
  703. }
  704. },
  705. checkAll() {
  706. this.checkedAll = !this.checkedAll
  707. this.showTop = true
  708. this.ids = []
  709. this.list = this.list.map(o => ({
  710. ...o,
  711. checked: this.checkedAll,
  712. }))
  713. this.list.forEach(o=>{
  714. if(this.checkedAll) this.ids.push(o.id)
  715. })
  716. },
  717. cancel() {
  718. this.list = this.list.map(o => ({
  719. ...o,
  720. checked: false
  721. }))
  722. this.showTop = false
  723. this.checkedAll = false
  724. this.ids = []
  725. },
  726. getColumnList() {
  727. let columnPermissionList = []
  728. let _appColumnList =this.appColumnList
  729. #if(${context.useColumnPermission}==true)
  730. let permissionList = uni.getStorageSync('permissionList')
  731. let list = permissionList.filter(o => o.modelId === this.menuId)
  732. let _columnList = list[0] && list[0].column ? list[0].column : []
  733. for (let i = 0; i < _appColumnList.length; i++) {
  734. let _app = _appColumnList[i].prop
  735. inner: for (let j = 0; j < _columnList.length; j++) {
  736. let _encode = _columnList[j].enCode
  737. if(_app == _encode){
  738. columnPermissionList.push(this.appColumnList[i])
  739. break inner
  740. }
  741. }
  742. }
  743. #else
  744. for (let i = 0; i < _appColumnList.length; i++) {
  745. columnPermissionList.push(_appColumnList[i])
  746. }
  747. #end
  748. this.columnList = this.transformColumnList(columnPermissionList, this.dataOptions)
  749. },
  750. transformColumnList(columnList, dataOptions) {
  751. let list = []
  752. for (let i = 0; i < columnList.length; i++) {
  753. let e = columnList[i]
  754. if(e.jnpfKey != 'calculate'){
  755. let columProp = e.prop
  756. let label = e.label
  757. let option = null
  758. let options = columProp + "Options"
  759. if (!columProp.includes('-')) {
  760. columProp = columProp
  761. e.label = e.labelI18nCode ? this.$t(e.labelI18nCode):label
  762. e.prop = columProp
  763. e.option = option
  764. list.push(e)
  765. } else {
  766. e.vModel = columProp.split('-')[1]
  767. e.childLabel = e.fullNameI18nCode && e.fullNameI18nCode[1] ? this.$t(e.fullNameI18nCode[1]): e.label.split('-')[1]
  768. options = e.vModel + "Options"
  769. let prop = columProp.split('-')[0]
  770. let label = e.fullNameI18nCode && e.fullNameI18nCode[0] ? this.$t(e.fullNameI18nCode[0]): e.label.split('-')[0]
  771. let newItem = {
  772. align: "center",
  773. jnpfKey: "table",
  774. prop,
  775. label,
  776. children: []
  777. }
  778. if (!list.some(o => o.prop === prop)) list.push(newItem)
  779. for (let i = 0; i < list.length; i++) {
  780. if (list[i].prop === prop) {
  781. e.prop = e.prop
  782. e.vModel = e.vModel
  783. e.option = option
  784. list[i].children.push(e)
  785. break
  786. }
  787. }
  788. }
  789. }
  790. }
  791. return list
  792. },
  793. cellClick(item) {
  794. const findIndex = this.sortValue.findIndex(o => o === item.value);
  795. if (findIndex < 0) {
  796. const findLikeIndex = this.sortValue.findIndex(o => o.indexOf(item.sidx) > -1);
  797. if (findLikeIndex > -1) this.sortValue.splice(findLikeIndex, 1)
  798. this.sortValue.push(item.value)
  799. } else {
  800. this.sortValue.splice(findIndex, 1)
  801. }
  802. },
  803. handleSortReset() {
  804. this.sortValue = []
  805. },
  806. handleSortSearch() {
  807. if (this.sortValue.length) {
  808. this.listQuery.sidx = this.sortValue.join(',')
  809. } else {
  810. this.setDefaultQuery()
  811. }
  812. this.$refs.uDropdown.close();
  813. this.$nextTick(() => {
  814. this.list = [];
  815. this.mescroll.resetUpScroll();
  816. })
  817. },
  818. reset() {
  819. this.searchForm = JSON.parse(JSON.stringify(this.dataValue))
  820. this.key = new Date()
  821. },
  822. closeDropdown() {
  823. this.$refs.uDropdown.close();
  824. this.$nextTick(() => {
  825. this.list = [];
  826. this.mescroll.resetUpScroll();
  827. })
  828. },
  829. dataList(data){
  830. let _list =data.list
  831. return _list;
  832. },
  833. },
  834. }
  835. </script>
  836. <style lang="scss">
  837. page {
  838. background-color: #f0f2f6;
  839. height: 100%;
  840. /* #ifdef MP-ALIPAY */
  841. position: absolute;
  842. top: 0;
  843. left: 0;
  844. width: 100%;
  845. /* #endif */
  846. }
  847. .top-btn {
  848. height: 80rpx;
  849. position: fixed;
  850. width: 100%;
  851. top: 0;
  852. left: 0;
  853. background-color: #fff;
  854. /* #ifdef MP-WEIXIN */
  855. z-index: 99;
  856. /* #endif */
  857. /* #ifndef MP-WEIXIN */
  858. z-index: 999;
  859. /* #endif */
  860. justify-content: space-between;
  861. padding: 0 20rpx;
  862. .button-left {
  863. color: #0293fc;
  864. }
  865. .button-right {
  866. width: 30rpx;
  867. height: 30rpx;
  868. }
  869. }
  870. .slide-down2 {
  871. animation: slide-down2 0.5s forwards;
  872. opacity: 1;
  873. transform: translateY(0);
  874. }
  875. .slide-up2 {
  876. animation: slide-up2 0.5s forwards;
  877. opacity: 0;
  878. transform: translateY(-100%);
  879. }
  880. .slide-down {
  881. animation: slide-down 0.5s forwards;
  882. opacity: 1;
  883. transform: translateY(0);
  884. }
  885. .slide-up {
  886. animation: slide-up 0.5s forwards;
  887. opacity: 0;
  888. transform: translateY(100%);
  889. }
  890. .bottom-btn {
  891. height: 100rpx;
  892. position: fixed;
  893. width: 100%;
  894. bottom: 0;
  895. left: 0;
  896. background-color: #0293fc;
  897. z-index: 9;
  898. justify-content: space-around;
  899. .button-preIcon {
  900. color: #fff;
  901. text-align: center;
  902. width: 20%;
  903. .btn-icon {
  904. height: 32rpx;
  905. }
  906. }
  907. }
  908. @keyframes slide-up {
  909. to {
  910. transform: translateY(0);
  911. opacity: 1;
  912. }
  913. }
  914. @keyframes slide-down {
  915. to {
  916. transform: translateY(100%);
  917. opacity: 0;
  918. }
  919. }
  920. @keyframes slide-up2 {
  921. to {
  922. transform: translateY(0);
  923. opacity: 1;
  924. }
  925. }
  926. @keyframes slide-down2 {
  927. to {
  928. transform: translateY(-100%);
  929. opacity: 0;
  930. }
  931. }
  932. :deep(.u-cell) {
  933. padding: 0rpx;
  934. height: 112rpx;
  935. }
  936. .buttom-actions {
  937. z-index: 1;
  938. }
  939. .screen-box {
  940. background-color: #fff;
  941. height: 100%;
  942. .screen-btn {
  943. width: 100%;
  944. height: 2.75rem;
  945. .btn {
  946. width: 50%;
  947. height: 2.75rem;
  948. text-align: center;
  949. line-height: 2.75rem;
  950. box-shadow: 0px -4rpx 20rpx #F8F8F8
  951. }
  952. .btn1 {
  953. color: #606266;
  954. }
  955. .btn2 {
  956. background-color: #2979ff;
  957. color: #fff;
  958. }
  959. }
  960. .screen-list {
  961. width: 100%;
  962. /* #ifdef APP-HARMONY */
  963. height: calc(100vh - 82rpx);
  964. /* #endif */
  965. /* #ifndef APP-HARMONY */
  966. height: 100%;
  967. /* #endif */
  968. .list {
  969. height: calc(100% - 88rpx);
  970. overflow-y: scroll;
  971. }
  972. }
  973. }
  974. .notData-box {
  975. width: 100%;
  976. height: 100%;
  977. justify-content: center;
  978. align-items: center;
  979. padding-bottom: 200rpx;
  980. .notData-inner {
  981. width: 280rpx;
  982. height: 308rpx;
  983. align-items: center;
  984. .iconImg {
  985. width: 100%;
  986. height: 100%;
  987. }
  988. .notData-inner-text {
  989. padding: 30rpx 0;
  990. color: #909399;
  991. }
  992. }
  993. }
  994. </style>