| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <template>
- <view class="mainBox">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="文档列表" @clickLeft="back">
- </uni-nav-bar>
- <view class="topBtn">
- <u-button v-if="type!=='view'" type="primary" @click="add" text="本地上传"></u-button>
- <u-button v-if="type!=='view'" @click="selectDoc" text="关联文档库"></u-button>
- </view>
- <u-cell-group>
- <u-cell v-for="(item, index) in tableList" :key="index">
- <view class="listTitle" slot="title">
- {{item.name}}
- </view>
- <view slot="value" class="listBtn">
- <u-button text="浏览" size='mini'></u-button>
- <u-button v-if="type!=='view'" text="删除" size='mini' @click="del(index)"></u-button>
- </view>
- </u-cell>
- </u-cell-group>
- <view style="height: 84rpx;"></view>
- <view class="footerButton">
- <u-button type="primary" @click="back" text="返回"></u-button>
- <u-button v-if="type!=='view'" @click="save" text="保存"></u-button>
- </view>
- <fileEdit ref="fileEditRef" @success="done"></fileEdit>
- </view>
- </template>
- <script>
- import {
- queryIds
- } from './api';
- import fileEdit from './file-edit';
- export default {
- components: {
- fileEdit
- },
- computed: {
- },
- data() {
- return {
- tableList: [],
- fileId: [],
- type: ''
- }
- },
- onLoad({
- fileId,
- type
- }) {
- this.type = type
- console.log(type);
- if (fileId) {
- this.fileId = JSON.parse(fileId)
- }
- this.init()
- uni.$off('setDocList')
- uni.$on('setDocList', (id) => {
- this.fileId.push(...id);
- this.init()
- })
- },
- methods: {
- async init() {
- if (this.fileId.length > 0) {
- this.tableList = await queryIds({
- ids: "'" + this.fileId + "'"
- });
- } else {
- this.tableList = [];
- }
- },
- del(index) {
- this.tableList.splice(index, 1);
- this.fileId = this.tableList.map((item) => item.id);
- },
- selectDoc() {
- uni.navigateTo({
- url: '/pages/doc/selectDoc?isAll=' + 1 + '&fileId=' + JSON.stringify(this.fileId)
- })
- },
- save() {
- uni.$emit('getFiles', this.fileId)
- this.back()
- },
- onunload() {
- uni.$off('setDocList')
- },
- add() {
- this.$refs.fileEditRef.open()
- },
- done(id) {
- this.fileId.push(...id);
- this.init()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .listTitle {
- width: 420rpx;
- white-space: nowrap;
- /* 防止文本换行 */
- overflow: hidden;
- /* 隐藏溢出的内容 */
- text-overflow: ellipsis;
- /* 显示省略符号来代表被修剪的文本 */
- }
- .topBtn {
- display: flex;
- margin-bottom: 20rpx;
- margin-top: 10rpx;
- uni-button {
- width: 180rpx;
- margin-left: 5px;
- margin-right: 5px;
- }
- }
- .listBtn {
- display: flex;
- uni-button {
- width: 100rpx;
- // height: 50rpx;
- margin-left: 10rpx;
- margin-right: 0;
- color: #fff !important;
- border: none;
- background: #157a2c !important;
- }
- }
- .footerButton {
- width: 100%;
- height: 84rpx;
- display: flex;
- position: fixed;
- bottom: 0;
- z-index: 10;
- /deep/.u-button {
- height: 100%;
- }
- >view {
- flex: 1;
- }
- }
- .item {
- display: flex;
- flex-direction: column;
- padding: 16rpx;
- >view {
- padding-top: 14rpx;
- }
- .item_title {
- font-size: 32rpx;
- font-weight: 800;
- }
- .item_list {
- display: flex;
- align-items: center;
- text {
- font-size: 28rpx;
- }
- .lable {
- color: #626060;
- }
- .value {
- color: #333;
- margin-left: 12rpx;
- flex: 1
- }
- }
- }
- /deep/.u-swipe-action-item__right__button__wrapper {
- background-color: #f56c6c !important;
- }
- /deep/.u-input {
- padding: 0 !important;
- }
- /deep/uni-textarea {
- padding: 0 !important;
- }
- </style>
|