filecenter.vue 19 KB

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