filecenter.vue 17 KB

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