|
@@ -14,7 +14,7 @@
|
|
|
v-for="(item, index) in fileData"
|
|
|
:key="index"
|
|
|
>
|
|
|
- <div class="content flcard" @tap="openFile(item)">
|
|
|
+ <div class="content flcard" @tab="openFile(item)">
|
|
|
<view
|
|
|
class="demo-layout bg-purple-light"
|
|
|
style="margin-bottom: 20rpx"
|
|
@@ -54,14 +54,110 @@
|
|
|
>
|
|
|
</view>
|
|
|
</div>
|
|
|
+ <div class="btnClass">
|
|
|
+ <u-button
|
|
|
+ class="btn"
|
|
|
+ type="primary"
|
|
|
+ shape="circle"
|
|
|
+ text="审批详情"
|
|
|
+ @click="detailmodal(item)"
|
|
|
+ ></u-button>
|
|
|
+ <u-button
|
|
|
+ class="btn"
|
|
|
+ type="primary"
|
|
|
+ shape="circle"
|
|
|
+ text="提交"
|
|
|
+ @click="commitmodal(item)"
|
|
|
+ ></u-button>
|
|
|
+ <u-button
|
|
|
+ class="btn"
|
|
|
+ type="primary"
|
|
|
+ shape="circle"
|
|
|
+ text="撤回"
|
|
|
+ @click="retractmodal(item)"
|
|
|
+ ></u-button>
|
|
|
+ <u-button
|
|
|
+ class="btn"
|
|
|
+ type="primary"
|
|
|
+ shape="circle"
|
|
|
+ text="下载"
|
|
|
+ @click="download(item)"
|
|
|
+ ></u-button>
|
|
|
+ <u-button
|
|
|
+ class="btn"
|
|
|
+ type="primary"
|
|
|
+ shape="circle"
|
|
|
+ text="删除"
|
|
|
+ @click="showmodal(item)"
|
|
|
+ ></u-button>
|
|
|
+ </div>
|
|
|
</u-list-item>
|
|
|
</u-list>
|
|
|
+ <!-- 审批详情 -->
|
|
|
+ <u-popup
|
|
|
+ :show="detailShow"
|
|
|
+ :closeable="true"
|
|
|
+ :round="10"
|
|
|
+ mode="bottom"
|
|
|
+ @close="detailClose"
|
|
|
+ >
|
|
|
+ <view>
|
|
|
+ <u--textarea
|
|
|
+ v-model="value1"
|
|
|
+ placeholder="请输入撤回原因"
|
|
|
+ ></u--textarea>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+ <!-- 删除 -->
|
|
|
+ <u-modal
|
|
|
+ :show="show"
|
|
|
+ :showCancelButton="true"
|
|
|
+ :showConfirmButton="true"
|
|
|
+ :content="content"
|
|
|
+ @confirm="confirm"
|
|
|
+ @cancel="cancel"
|
|
|
+ ></u-modal>
|
|
|
+ <!-- 提交 -->
|
|
|
+ <u-picker
|
|
|
+ :show="commitShow"
|
|
|
+ :columns="columns"
|
|
|
+ title="选择审批"
|
|
|
+ @confirm="confirmCommit"
|
|
|
+ @cancel="cancelCommit"
|
|
|
+ ></u-picker>
|
|
|
+ <!-- 撤回 -->
|
|
|
+ <u-popup
|
|
|
+ :show="showretract"
|
|
|
+ closeable="true"
|
|
|
+ :round="10"
|
|
|
+ mode="bottom"
|
|
|
+ @close="close"
|
|
|
+ >
|
|
|
+ <view>
|
|
|
+ <u--textarea
|
|
|
+ v-model="value1"
|
|
|
+ placeholder="请输入撤回原因"
|
|
|
+ ></u--textarea>
|
|
|
+ </view>
|
|
|
+ <view class="button-container">
|
|
|
+ <u-button @click="cancelRetract" shape="circle">取消</u-button>
|
|
|
+ <u-button @click="confirmRetract" shape="circle" type="primary"
|
|
|
+ >确认</u-button
|
|
|
+ >
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+ <u-notify
|
|
|
+ message="只有审批中的数据才能撤回!"
|
|
|
+ :show="notifyShow"
|
|
|
+ :duration="1000"
|
|
|
+ ></u-notify>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import api from "@/api/api";
|
|
|
+import configService from "../../common/service/config.service";
|
|
|
import { computed } from "uview-ui/libs/mixin/mixin";
|
|
|
export default {
|
|
|
components: {},
|
|
@@ -77,6 +173,18 @@ export default {
|
|
|
curNow: 0,
|
|
|
fileData: [],
|
|
|
bpmStatus: 1, //1处理中 2 已完成 3 已驳回
|
|
|
+ show: false, //删除modal
|
|
|
+ content: "确定要删除吗?",
|
|
|
+ selectItem: "", //选择文件
|
|
|
+ showretract: false, //撤回popup
|
|
|
+ value1: "", //撤回原因
|
|
|
+ cancelItem: "", //撤回文件
|
|
|
+ detailShow: false, //详情
|
|
|
+ notifyShow: false, //撤回文件提示消息显示
|
|
|
+ commitShow: false, //提交
|
|
|
+ columns: [],
|
|
|
+ commitItem: "", //提交文件
|
|
|
+ selectFile: [],
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -127,16 +235,214 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ //查看文件内容
|
|
|
openFile(params) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/filecenter/fileModel?id=${params.id}&type=${params.fileSuffix}`,
|
|
|
+ uni.downloadFile({
|
|
|
+ url:
|
|
|
+ configService.apiUrl +
|
|
|
+ "/ventanaly-sharefile/fileServer/onlyOffice/read?id=" +
|
|
|
+ params.id,
|
|
|
+ success: function (res) {
|
|
|
+ var filePath = res.tempFilePath;
|
|
|
+ uni.openDocument({
|
|
|
+ filePath: filePath,
|
|
|
+ showMenu: true,
|
|
|
+ success: function (res) {
|
|
|
+ console.log("打开文档成功");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // //下载文件到手机
|
|
|
+ download(params) {
|
|
|
+ var fileiId = params.id;
|
|
|
+ var params = {
|
|
|
+ id: fileiId,
|
|
|
+ responseType: "blob", // 期望的响应类型是Blob
|
|
|
+ };
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .downloadFile(params)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ const blob = response.data;
|
|
|
+ const fileName = params.fileName; // 替换为你的文件名和扩展名
|
|
|
+ // 使用uni.saveFile保存文件
|
|
|
+ uni.saveFile({
|
|
|
+ tempFilePath: response.tempFilePath,
|
|
|
+ content: blob,
|
|
|
+ success: (saveRes) => {
|
|
|
+ console.log("saved file path:", saveRes.savedFilePath);
|
|
|
+ // 可以使用 uni.openDocument 打开文件(如果支持)
|
|
|
+ // 或者引导用户去文件管理器中查找
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.error("save file fail:", err);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // console.log("请求下载文件失败:", err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // //删除文件
|
|
|
+ showmodal(data) {
|
|
|
+ this.selectItem = data;
|
|
|
+ this.show = true;
|
|
|
+ },
|
|
|
+ confirm() {
|
|
|
+ this.delatefile(this.selectItem);
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.show = false;
|
|
|
+ },
|
|
|
+ delatefile(params) {
|
|
|
+ var fileiId = params.id;
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .delateFile({ id: fileiId })
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ this.show = false;
|
|
|
+ this.getFileInfo();
|
|
|
+ } else {
|
|
|
+ // console.log("请求下载文件失败:", err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
+ //撤回文件
|
|
|
+ retractmodal(data) {
|
|
|
+ this.showretract = true;
|
|
|
+ this.cancelItem = data;
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ this.showretract = false;
|
|
|
+ },
|
|
|
+ cancelRetract() {
|
|
|
+ this.showretract = false;
|
|
|
+ },
|
|
|
+ confirmRetract(e) {
|
|
|
+ console.log(e);
|
|
|
+ var fileiId = this.cancelItem.id;
|
|
|
+ var params = {
|
|
|
+ tableId: fileiId,
|
|
|
+ reason: this.value1,
|
|
|
+ tableName: this.cancelItem.tableName,
|
|
|
+ };
|
|
|
+ if (this.cancelItem.bpmStatus == 1) {
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .cancelFile(params)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ this.showretract = false;
|
|
|
+ this.getFileInfo();
|
|
|
+ } else {
|
|
|
+ // console.log("请求下载文件失败:", err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.notifyShow = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ detailmodal() {
|
|
|
+ this.detailShow = true;
|
|
|
+ },
|
|
|
+ detailClose() {
|
|
|
+ this.detailShow = false;
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ commitmodal(data) {
|
|
|
+ this.commitShow = true;
|
|
|
+ this.commitItem = data;
|
|
|
+ this.getListFile();
|
|
|
+ },
|
|
|
+ getListFile() {
|
|
|
+ this.columns = [];
|
|
|
+ var params = {
|
|
|
+ zx: true,
|
|
|
+ column: "createTime",
|
|
|
+ order: "desc",
|
|
|
+ status: 1,
|
|
|
+ _t: Date.now(),
|
|
|
+ };
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .getListFile(params)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ this.selectFile = response.data.result;
|
|
|
+ this.selectFile.forEach((item) => {
|
|
|
+ this.columns.push(item.id);
|
|
|
+ console.log(this.columns);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // console.log("请求下载文件失败:", err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ confirmCommit() {
|
|
|
+ var fileiId = this.commitItem.id;
|
|
|
+ var params = {
|
|
|
+ tableId: fileiId,
|
|
|
+ procDefId: this.columns,
|
|
|
+ };
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ api
|
|
|
+ .commitFile(params)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code == 200) {
|
|
|
+ this.commitShow = false;
|
|
|
+ this.getFileInfo();
|
|
|
+ } else {
|
|
|
+ // console.log("请求下载文件失败:", err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cancelCommit() {
|
|
|
+ this.commitShow = false;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
+.button-container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-top: 10px; /* 根据需要调整 */
|
|
|
+}
|
|
|
+button {
|
|
|
+ /* 样式可以根据需要自定义 */
|
|
|
+ padding: 10px 20px;
|
|
|
+ background-color: #007aff;
|
|
|
+ color: white;
|
|
|
+ border: none;
|
|
|
+ border-radius: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
.main {
|
|
|
/* margin-top: 100rpx; */
|
|
|
margin-top: 80px;
|
|
@@ -149,6 +455,20 @@ export default {
|
|
|
padding: 20rpx;
|
|
|
background-color: #ffffff;
|
|
|
margin-bottom: 5rpx;
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+.btnClass {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ margin-top: 20rpx;
|
|
|
+}
|
|
|
+.btn {
|
|
|
+ border-radius: 10rpx;
|
|
|
+ margin-right: 10rpx; /* 示例:添加一些右外边距,但确保它不会导致换行 */
|
|
|
+}
|
|
|
+/* 最后一个按钮不需要右外边距 */
|
|
|
+.btn:last-child {
|
|
|
+ margin-right: 0;
|
|
|
}
|
|
|
.text-style {
|
|
|
color: #3787fe;
|