filecenter.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. <template name="filecenter">
  2. <view >
  3. <u-navbar title="文件中心" :bgStatusImage="backPic0" :bgImage="backPic" :safeAreaInsetTop="true" leftIcon=""> </u-navbar>
  4. <view class="container">
  5. <view class="main">
  6. <view class="u-page">
  7. <u-subsection
  8. :list="sectionList"
  9. mode="subsection"
  10. :current="curNow"
  11. @change="sectionChange"
  12. ></u-subsection>
  13. <u-list>
  14. <u-list-item
  15. class="itemback"
  16. v-for="(item, index) in fileData"
  17. :key="index"
  18. >
  19. <view class="content flcard" @tap="openFile(item)">
  20. <view
  21. class="demo-layout bg-purple-light"
  22. style="margin-bottom: 20rpx"
  23. >
  24. <view style="margin-top: 10rpx">
  25. <text class="text-style1">{{ item.fileName }}</text>
  26. </view>
  27. </view>
  28. <view class="datacard laiyuan">
  29. <view style="margin: 20rpx 20rpx">
  30. <text class="text-style">{{ item.fileSource }}</text>
  31. </view>
  32. <view style="margin: 20rpx 20rpx; font-size: small"
  33. >文件来源</view
  34. >
  35. </view>
  36. <view class="datacard zhuangtai">
  37. <view style="margin: 20rpx 20rpx">
  38. <text class="text-style">{{ item.bpmStatus_dictText }}</text>
  39. </view>
  40. <view style="margin: 20rpx 20rpx; font-size: small"
  41. >审批状态</view
  42. >
  43. </view>
  44. <view class="datacard user">
  45. <view style="margin: 20rpx 20rpx">
  46. <text class="text-style">{{ item.createBy }}</text>
  47. </view>
  48. <view style="margin: 20rpx 20rpx; font-size: small">创建人</view>
  49. </view>
  50. <view class="datacard time">
  51. <view style="margin: 20rpx 20rpx">
  52. <text class="text-style">{{ item.createTime }}</text>
  53. </view>
  54. <view style="margin: 20rpx 20rpx; font-size: small"
  55. >上传时间</view
  56. >
  57. </view>
  58. </view>
  59. <view class="btnClass">
  60. <u-button
  61. class="btn"
  62. type="primary"
  63. shape="circle"
  64. text="审批详情"
  65. @click="detailmodal(item)"
  66. ></u-button>
  67. <u-button
  68. class="btn"
  69. type="primary"
  70. shape="circle"
  71. text="提交"
  72. @click="commitmodal(item)"
  73. ></u-button>
  74. <u-button
  75. class="btn"
  76. type="primary"
  77. shape="circle"
  78. text="撤回"
  79. @click="retractmodal(item)"
  80. ></u-button>
  81. <u-button
  82. class="btn"
  83. type="primary"
  84. shape="circle"
  85. text="下载"
  86. @click="download(item)"
  87. ></u-button>
  88. <u-button
  89. class="btn"
  90. type="primary"
  91. shape="circle"
  92. text="删除"
  93. @click="showmodal(item)"
  94. ></u-button>
  95. </view>
  96. </u-list-item>
  97. </u-list>
  98. <!-- 审批详情 -->
  99. <u-popup
  100. :show="detailShow"
  101. :closeable="true"
  102. :round="10"
  103. mode="bottom"
  104. @close="detailClose"
  105. >
  106. <view>
  107. <view class="title">
  108. <span class="firetext">流程审批进度历史</span>
  109. </view>
  110. <view class="table-container">
  111. <view class="table">
  112. <view class="table-header">
  113. <view class="table-cell">序号</view>
  114. <view class="table-cell">当前环节</view>
  115. <view class="table-cell">审批人</view>
  116. <view class="table-cell">审批结果</view>
  117. <view class="table-cell">审批开始时间</view>
  118. <view class="table-cell">审批结束时间</view>
  119. <view class="table-cell">处理意见</view>
  120. <view class="table-cell">状态</view>
  121. <!-- ... 根据需要添加更多表头 -->
  122. </view>
  123. <view
  124. class="table-row"
  125. v-for="(item, index) in tableData"
  126. :key="index"
  127. >
  128. <view class="table-cell"
  129. ><template>
  130. <span>{{ index + 1 }}</span>
  131. </template></view
  132. >
  133. <view class="table-cell">{{ item.name }}</view>
  134. <view class="table-cell">
  135. <template>
  136. <span v-if="item.assignees && item.assignees.length > 0">
  137. {{ item.assignees[0].username }}
  138. </span>
  139. <!-- 如果没有审批人,可以显示空或占位符 -->
  140. <span v-else> - </span>
  141. </template></view
  142. >
  143. <view class="table-cell">{{ item.deleteReason }}</view>
  144. <view class="table-cell">{{ item.createTime }}</view>
  145. <view class="table-cell">{{ item.endTime }}</view>
  146. <view class="table-cell">{{ item.comment }}</view>
  147. <view class="table-cell">
  148. <template>
  149. <span v-if="item.assignees[0].isExecutor"> 已处理 </span>
  150. <!-- 如果没有审批人,可以显示空或占位符 -->
  151. <span v-else> 待处理</span>
  152. </template></view
  153. >
  154. <!-- ... 根据需要添加更多单元格 -->
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <view>
  160. <view class="title">
  161. <span class="firetext">实时流程图</span>
  162. </view>
  163. <image style="width: 100%" :src="imageUrl" alt="" />
  164. </view>
  165. </u-popup>
  166. <!-- 删除 -->
  167. <u-modal
  168. :show="show"
  169. :showCancelButton="true"
  170. :showConfirmButton="true"
  171. :content="content"
  172. @confirm="confirm"
  173. @cancel="cancel"
  174. ></u-modal>
  175. <!-- 提交 -->
  176. <u-picker
  177. :show="commitShow"
  178. :columns="[columns]"
  179. title="选择审批"
  180. @confirm="confirmCommit"
  181. @cancel="cancelCommit"
  182. ></u-picker>
  183. <!-- 撤回 -->
  184. <u-popup
  185. :show="showretract"
  186. :closeable="true"
  187. :round="10"
  188. mode="bottom"
  189. @close="close"
  190. >
  191. <view>
  192. <u--textarea
  193. v-model="value1"
  194. placeholder="请输入撤回原因"
  195. ></u--textarea>
  196. </view>
  197. <view class="button-container">
  198. <u-button @click="cancelRetract" shape="circle">取消</u-button>
  199. <u-button @click="confirmRetract" shape="circle" type="primary"
  200. >确认</u-button
  201. >
  202. </view>
  203. </u-popup>
  204. <u-notify
  205. message="只有审批中的数据才能撤回!"
  206. :show="notifyShow"
  207. :duration="1000"
  208. ></u-notify>
  209. </view>
  210. </view>
  211. </view>
  212. </view>
  213. </template>
  214. <script>
  215. import api from "@/api/api";
  216. import configService from "../../common/service/config.service";
  217. export default {
  218. components: {},
  219. name: "filecenter",
  220. watch: {},
  221. data() {
  222. return {
  223. backPic0: "url(/static/topnavbar0.png)",
  224. backPic: "url(../../static/topnavbar.png)",
  225. sectionList: [
  226. { name: "全部", code: 0 },
  227. { name: "待审批", code: 1 },
  228. { name: "已审批", code: 2 },
  229. ],
  230. curNow: 0,
  231. fileData: [],
  232. bpmStatus: 1, //1处理中 2 已完成 3 已驳回
  233. show: false, //删除modal
  234. content: "确定要删除吗?",
  235. selectItem: "", //选择文件
  236. showretract: false, //撤回popup
  237. value1: "", //撤回原因
  238. cancelItem: "", //撤回文件
  239. detailShow: false, //详情
  240. notifyShow: false, //撤回文件提示消息显示
  241. commitShow: false, //提交
  242. columns: [],
  243. commitItem: "", //提交文件
  244. selectFile: [],
  245. tableData: [], //审批内容
  246. detailItem: "", //详情文件
  247. imageUrl: "",
  248. };
  249. },
  250. mounted() {
  251. this.getFileInfo();
  252. },
  253. computed: {},
  254. methods: {
  255. sectionChange(newVal) {
  256. this.curNow = newVal;
  257. if (this.curNow === 0) {
  258. // 如果选择了“全部”,返回所有文件
  259. this.bpmStatus = "";
  260. this.getFileInfo(this.bpmStatus);
  261. } else if (this.curNow === 1) {
  262. // 否则,根据curNow的值过滤文件
  263. this.bpmStatus = 1;
  264. this.getFileInfo(this.bpmStatus);
  265. } else if (this.curNow === 2) {
  266. this.bpmStatus = 2;
  267. this.getFileInfo(this.bpmStatus);
  268. }
  269. },
  270. getFileInfo(code) {
  271. var params = {
  272. bpmStatus: code,
  273. column: "createTime",
  274. fileSuffix: "",
  275. likeFileName: "",
  276. pageNo: 1,
  277. pageSize: 10000,
  278. parentId: "",
  279. selectFlag: true,
  280. sysOrgCode: "",
  281. };
  282. new Promise((resolve, reject) => {
  283. api
  284. .getFileInfo(params)
  285. .then((response) => {
  286. if (response.data.code == 200) {
  287. this.fileData = response.data.result.records;
  288. } else {
  289. reject(response);
  290. }
  291. })
  292. .catch((error) => {
  293. console.log("catch===>response", response);
  294. reject(error);
  295. });
  296. });
  297. },
  298. //查看文件内容
  299. openFile(params) {
  300. uni.downloadFile({
  301. url:
  302. configService.apiUrl +
  303. "/ventanaly-sharefile/fileServer/onlyOffice/read?id=" +
  304. params.id,
  305. success: function (res) {
  306. var filePath = res.tempFilePath;
  307. uni.openDocument({
  308. filePath: filePath,
  309. showMenu: true,
  310. success: function (res) {
  311. console.log("打开文档成功");
  312. },
  313. });
  314. },
  315. });
  316. },
  317. // //下载文件到手机
  318. download(params) {
  319. var fileiId = params.id;
  320. var params = {
  321. id: fileiId,
  322. };
  323. new Promise((resolve, reject) => {
  324. api
  325. .downloadFile(params)
  326. .then((response) => {
  327. if (response.statusCode == 200) {
  328. console.log(response, "111");
  329. // const blob = new Blob([response.data], {
  330. // type: "charset=UTF-8",
  331. // }); // 构造一个blob对象来处理数据
  332. // if ("download" in document.createElement("a")) {
  333. // // 支持a标签download的浏览器
  334. // const link = document.createElement("a"); // 创建a标签
  335. // link.href = URL.createObjectURL(blob);
  336. // document.body.appendChild(link);
  337. // link.click(); // 执行下载
  338. // URL.revokeObjectURL(link.href); //
  339. // document.body.removeChild(link); //
  340. // }
  341. } else {
  342. // console.log("请求下载文件失败:", err);
  343. }
  344. })
  345. .catch((error) => {
  346. reject(error);
  347. });
  348. });
  349. },
  350. // //删除文件
  351. showmodal(data) {
  352. this.selectItem = data;
  353. this.show = true;
  354. },
  355. confirm() {
  356. this.delatefile(this.selectItem);
  357. },
  358. cancel() {
  359. this.show = false;
  360. },
  361. delatefile(params) {
  362. var fileiId = params.id;
  363. new Promise((resolve, reject) => {
  364. api
  365. .delateFile({ id: fileiId })
  366. .then((response) => {
  367. if (response.data.code == 200) {
  368. this.show = false;
  369. this.getFileInfo();
  370. } else {
  371. // console.log("请求下载文件失败:", err);
  372. }
  373. })
  374. .catch((error) => {
  375. reject(error);
  376. });
  377. });
  378. },
  379. //撤回文件
  380. retractmodal(data) {
  381. this.showretract = true;
  382. this.cancelItem = data;
  383. },
  384. close() {
  385. this.showretract = false;
  386. },
  387. cancelRetract() {
  388. this.showretract = false;
  389. },
  390. confirmRetract() {
  391. this.value1 = "";
  392. var fileiId = this.cancelItem.id;
  393. var params = {
  394. tableId: fileiId,
  395. reason: this.value1,
  396. tableName: this.cancelItem.tableName,
  397. };
  398. if (this.cancelItem.bpmStatus == 1) {
  399. new Promise((resolve, reject) => {
  400. api
  401. .cancelFile(params)
  402. .then((response) => {
  403. if (response.data.code == 200) {
  404. this.showretract = false;
  405. this.getFileInfo();
  406. } else {
  407. // console.log("请求下载文件失败:", err);
  408. }
  409. })
  410. .catch((error) => {
  411. reject(error);
  412. });
  413. });
  414. } else {
  415. this.notifyShow = true;
  416. }
  417. },
  418. // 详情
  419. detailmodal(data) {
  420. this.detailShow = true;
  421. var fileiId = data.id;
  422. var tablename = data.tableName;
  423. var params = {
  424. tableId: fileiId,
  425. tableName: tablename,
  426. };
  427. new Promise((resolve, reject) => {
  428. api
  429. .gethistoricFlowNew(params)
  430. .then((response) => {
  431. if (response.data.code == 200) {
  432. var detailData = response.data;
  433. this.tableData = detailData.result;
  434. } else {
  435. // console.log("请求下载文件失败:", err);
  436. }
  437. })
  438. .catch((error) => {
  439. reject(error);
  440. });
  441. });
  442. this.getDetailImg(data);
  443. },
  444. getDetailImg(data) {
  445. var fileiId = data.id;
  446. var tablename = data.tableName;
  447. var params = {
  448. tableId: fileiId,
  449. tableName: tablename,
  450. };
  451. new Promise((resolve, reject) => {
  452. api
  453. .getHighlightImgNew(params)
  454. .then((response) => {
  455. if (response.statusCode == 200) {
  456. this.imageUrl = response.config.baseUrl + response.config.url;
  457. } else {
  458. // console.log("请求下载文件失败:", err);
  459. }
  460. })
  461. .catch((error) => {
  462. reject(error);
  463. });
  464. });
  465. },
  466. detailClose() {
  467. this.detailShow = false;
  468. },
  469. // 提交
  470. commitmodal(data) {
  471. this.commitShow = true;
  472. this.commitItem = data;
  473. this.getListFile();
  474. },
  475. getListFile() {
  476. this.columns = [];
  477. var params = {
  478. zx: true,
  479. column: "createTime",
  480. order: "desc",
  481. status: 1,
  482. _t: Date.now(),
  483. };
  484. new Promise((resolve, reject) => {
  485. api
  486. .getListFile(params)
  487. .then((response) => {
  488. if (response.data.code == 200) {
  489. this.selectFile = response.data.result;
  490. this.selectFile.forEach((item) => {
  491. this.columns.push(item.id);
  492. console.log(this.columns);
  493. });
  494. } else {
  495. // console.log("请求下载文件失败:", err);
  496. }
  497. })
  498. .catch((error) => {
  499. reject(error);
  500. });
  501. });
  502. },
  503. confirmCommit() {
  504. var fileiId = this.commitItem.id;
  505. var reqDefId = this.columns[0];
  506. var params = {
  507. tableId: fileiId,
  508. procDefId: reqDefId,
  509. firstGateway: true,
  510. };
  511. new Promise((resolve, reject) => {
  512. api
  513. .commitFile(params)
  514. .then((response) => {
  515. if (response.data.code == 200) {
  516. this.commitShow = false;
  517. this.getFileInfo();
  518. } else {
  519. // console.log("请求下载文件失败:", err);
  520. }
  521. })
  522. .catch((error) => {
  523. reject(error);
  524. });
  525. });
  526. },
  527. cancelCommit() {
  528. this.commitShow = false;
  529. },
  530. },
  531. };
  532. </script>
  533. <style scoped>
  534. .button-container {
  535. display: flex;
  536. justify-content: space-between;
  537. margin-top: 10px; /* 根据需要调整 */
  538. }
  539. button {
  540. /* 样式可以根据需要自定义 */
  541. padding: 10px 20px;
  542. background-color: #007aff;
  543. color: white;
  544. border: none;
  545. border-radius: 5px;
  546. cursor: pointer;
  547. }
  548. .main {
  549. /* margin-top: 100rpx; */
  550. /* margin-top: 80px; */
  551. display: flex;
  552. flex-direction: column;
  553. }
  554. .itemback {
  555. padding: 20rpx;
  556. background-color: #ffffff;
  557. margin-bottom: 5rpx;
  558. display: flex;
  559. }
  560. .btnClass {
  561. display: flex;
  562. justify-content: space-around;
  563. margin-top: 20rpx;
  564. }
  565. .btn {
  566. border-radius: 10rpx;
  567. margin-right: 10rpx; /* 示例:添加一些右外边距,但确保它不会导致换行 */
  568. }
  569. /* 最后一个按钮不需要右外边距 */
  570. .btn:last-child {
  571. margin-right: 0;
  572. }
  573. .text-style {
  574. color: #3787fe;
  575. font-weight: bold;
  576. }
  577. .text-style1 {
  578. color: #000000;
  579. font-size: large;
  580. font-weight: bold;
  581. }
  582. .datacard {
  583. width: 48%;
  584. margin: 1%;
  585. float: left;
  586. height: 120rpx;
  587. border-radius: 10px;
  588. }
  589. .time {
  590. background: url(/static/filecenter/time.png),
  591. linear-gradient(
  592. to right,
  593. rgba(55, 135, 254, 0.08),
  594. rgba(4, 184, 255, 0.08),
  595. rgba(60, 161, 237, 0.08)
  596. );
  597. background-size: auto 100%;
  598. background-position: right;
  599. background-repeat: no-repeat;
  600. }
  601. .laiyuan {
  602. background: url(/static/filecenter/laiyuan.png),
  603. linear-gradient(
  604. to right,
  605. rgba(55, 135, 254, 0.08),
  606. rgba(4, 184, 255, 0.08),
  607. rgba(60, 161, 237, 0.08)
  608. );
  609. background-size: auto 100%;
  610. background-position: right;
  611. background-repeat: no-repeat;
  612. }
  613. .user {
  614. background: url(/static/filecenter/user.png),
  615. linear-gradient(
  616. to right,
  617. rgba(55, 135, 254, 0.08),
  618. rgba(4, 184, 255, 0.08),
  619. rgba(60, 161, 237, 0.08)
  620. );
  621. background-size: auto 100%;
  622. background-position: right;
  623. background-repeat: no-repeat;
  624. }
  625. .zhuangtai {
  626. background: url(/static/filecenter/zhuangtai.png),
  627. linear-gradient(
  628. to right,
  629. rgba(55, 135, 254, 0.08),
  630. rgba(4, 184, 255, 0.08),
  631. rgba(60, 161, 237, 0.08)
  632. );
  633. background-size: auto 100%;
  634. background-position: right;
  635. background-repeat: no-repeat;
  636. }
  637. .datacard1 {
  638. width: 100%;
  639. margin: 1%;
  640. float: left;
  641. height: 100rpx;
  642. text-align: center;
  643. border-radius: 10px;
  644. background: linear-gradient(
  645. to right,
  646. rgba(55, 135, 254, 0.08),
  647. rgba(4, 184, 255, 0.08),
  648. rgba(60, 161, 237, 0.08)
  649. );
  650. }
  651. .title {
  652. width: 100%;
  653. height: 50rpx;
  654. background: url(/static/warndata/title.png);
  655. background-repeat: no-repeat;
  656. background-size: 100% 100%;
  657. display: flex; /* 将父级元素设置为 Flex 容器 */
  658. align-items: center; /* 垂直居中子元素 */
  659. }
  660. .firetext {
  661. margin: 20px;
  662. font-weight: bold;
  663. }
  664. .custom-header-class {
  665. background-color: #f8f8f8;
  666. color: #333;
  667. }
  668. .table-container {
  669. overflow-x: auto; /* 允许横向滚动 */
  670. }
  671. .table {
  672. width: 100%;
  673. margin: 10px;
  674. width: max-content; /* 或者设置一个足够大的宽度以容纳所有列 */
  675. display: flex;
  676. flex-direction: column;
  677. }
  678. .table-header,
  679. .table-row {
  680. display: flex; /* 启用Flex布局 */
  681. }
  682. .table-cell {
  683. padding: 8px;
  684. flex: 1;
  685. text-align: center;
  686. border: 1px solid #ccc; /* 底部边框 */
  687. }
  688. </style>