filecenter.vue 18 KB

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