info3.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div>
  3. <div class="padding top flex flex-center flex-justify-between">
  4. <span>入库附件清单</span>
  5. </div>
  6. <div class="padding-left padding-right mt-20" style="padding: 20px">
  7. <avue-crud
  8. :option="option"
  9. :data="data"
  10. ref="crud"
  11. v-model="form"
  12. v-model:page="page"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad"
  17. >
  18. <template #menu-left>
  19. <div>
  20. <el-dropdown @command="openFile">
  21. <el-button type="primary">
  22. 上传附件
  23. <el-icon class="el-icon--right">
  24. <arrow-down />
  25. </el-icon>
  26. </el-button>
  27. <template #dropdown>
  28. <el-dropdown-menu>
  29. <el-dropdown-item command="1"
  30. >备案证/可研批复
  31. </el-dropdown-item>
  32. <el-dropdown-item command="2">合同</el-dropdown-item>
  33. <el-dropdown-item command="3">工程量清单</el-dropdown-item>
  34. <el-dropdown-item command="4">现场照片</el-dropdown-item>
  35. <el-dropdown-item command="5"
  36. >项目核实认定表
  37. </el-dropdown-item>
  38. <el-dropdown-item command="6">其他资料</el-dropdown-item>
  39. </el-dropdown-menu>
  40. </template>
  41. </el-dropdown>
  42. <el-button type="primary" plain @click="exportFile"
  43. >导 出</el-button
  44. >
  45. </div>
  46. </template>
  47. <template #menu-right>
  48. <el-button icon="Refresh" circle @click="onLoad"></el-button>
  49. </template>
  50. <template #menu="{ row }">
  51. <div>
  52. <el-button
  53. icon="Download"
  54. type="primary"
  55. size="mini"
  56. text
  57. @click="showDetail(row)"
  58. >查 看
  59. </el-button>
  60. <el-button
  61. icon="View"
  62. type="primary"
  63. size="mini"
  64. text
  65. @click="previewFile(row)"
  66. >预 览
  67. </el-button>
  68. <el-button
  69. icon="Download"
  70. type="primary"
  71. size="mini"
  72. text
  73. @click="downLoad(row)"
  74. >下 载
  75. </el-button>
  76. <el-button
  77. icon="Download"
  78. type="primary"
  79. size="mini"
  80. text
  81. @click="openFolder(row)"
  82. >打开文件夹
  83. </el-button>
  84. <el-button
  85. icon="Delete"
  86. type="primary"
  87. size="mini"
  88. text
  89. @click="rowDel(row)"
  90. >删 除
  91. </el-button>
  92. </div>
  93. </template>
  94. </avue-crud>
  95. </div>
  96. <el-image-viewer
  97. v-if="showImage"
  98. :url-list="preList"
  99. @close="showImage = false"
  100. />
  101. <!--dialog-->
  102. <el-dialog v-model="show" width="800px" title="附件要素">
  103. <sub-info v-if="itemDetail.type === 1" :info="itemDetail" />
  104. <sub-info2 v-else-if="itemDetail.type === 2" :info="itemDetail" />
  105. <sub-info3 v-else-if="itemDetail.type === 4" :info="itemDetail" />
  106. <div v-else>
  107. <el-empty description="暂无数据"></el-empty>
  108. </div>
  109. </el-dialog>
  110. </div>
  111. </template>
  112. <script>
  113. import api from '@/api/index.js'
  114. import { ElMessageBox } from 'element-plus'
  115. import subInfo from '@/views/store/component/subInfo1.vue'
  116. import subInfo2 from '@/views/store/component/subInfo2.vue'
  117. import subInfo3 from '@/views/store/component/subInfo3.vue'
  118. export default {
  119. props: {
  120. info: {
  121. type: Object,
  122. default: null
  123. }
  124. },
  125. components: { subInfo, subInfo2, subInfo3 },
  126. data() {
  127. return {
  128. pid: '',
  129. itemDetail: '',
  130. showImage: false,
  131. uploadShow: false,
  132. show: false,
  133. preList: [],
  134. form: {},
  135. data: [],
  136. page: {
  137. current: 1,
  138. size: 10
  139. },
  140. option: {
  141. align: 'center',
  142. menuWidth: 420,
  143. height: 525,
  144. size: 'mini',
  145. addBtn: false,
  146. delBtn: false,
  147. editBtn: false,
  148. refreshBtn: false,
  149. columnBtn: false,
  150. labelWidth: 140,
  151. border: true,
  152. column: [
  153. {
  154. label: '附件类型',
  155. prop: 'type',
  156. type: 'select',
  157. dicData: [
  158. {
  159. label: '备案证/可研批复',
  160. value: 1
  161. },
  162. {
  163. label: '合同',
  164. value: 2
  165. },
  166. {
  167. label: '工程量清单',
  168. value: 3
  169. },
  170. {
  171. label: '现场照片',
  172. value: 4
  173. },
  174. {
  175. label: '项目核实认定表',
  176. value: 5
  177. },
  178. {
  179. label: '其他资料',
  180. value: 6
  181. }
  182. ]
  183. },
  184. {
  185. label: '附件名称',
  186. prop: 'title',
  187. type: 'input'
  188. },
  189. {
  190. label: '上传时间',
  191. prop: 'createTime'
  192. },
  193. {
  194. label: '识别状态',
  195. prop: 'ocrStatus',
  196. dicData: [
  197. {
  198. label: '识别中',
  199. value: 0
  200. },
  201. {
  202. label: '识别完成',
  203. value: 1
  204. }
  205. ]
  206. }
  207. ]
  208. }
  209. }
  210. },
  211. created() {
  212. this.pid = this.$route.query.id
  213. },
  214. methods: {
  215. onLoad() {
  216. const data = Object.assign(this.page, { id: this.pid })
  217. this.$api.store.fileList(data).then(res => {
  218. if (res.code === 200) {
  219. if (res.data.files.length === 0) {
  220. this.data.length = 0
  221. return
  222. }
  223. this.data = res.data.files.map(ele => {
  224. delete ele.fileId
  225. const tmp = ele.fileFolder
  226. tmp.folderId = tmp.id
  227. delete tmp.id
  228. return Object.assign(tmp, ele)
  229. })
  230. }
  231. })
  232. },
  233. currentChange(currentPage) {
  234. this.page.current = currentPage
  235. },
  236. sizeChange(pageSize) {
  237. this.page.size = pageSize
  238. },
  239. refreshChange() {
  240. this.onLoad()
  241. },
  242. /**
  243. * 文件下载
  244. * @param row
  245. */
  246. downLoad(row) {
  247. window.open(row.url, '_blank')
  248. },
  249. /**
  250. * 文件预览
  251. * @param item
  252. */
  253. previewFile(item) {
  254. if (api.offices.includes(item.suffix)) {
  255. const routeData = this.$router.resolve({
  256. path: '/home/file_detail',
  257. query: { id: item.fileId }
  258. })
  259. window.open(routeData.href, '_blank')
  260. } else {
  261. this.preList.length = 0
  262. this.preList.push(item.url)
  263. this.showImage = true
  264. }
  265. },
  266. /**
  267. * 打开文件夹
  268. * @param item
  269. */
  270. openFolder(item) {
  271. console.log(item)
  272. const data = this.$router.resolve({
  273. path: '/home/files',
  274. query: {
  275. id: item.parentId,
  276. projectId: item.projectId
  277. }
  278. })
  279. window.open(data.href, '_blank')
  280. },
  281. /**
  282. * 打开文件
  283. * @param row
  284. */
  285. openFile(row) {
  286. const routeUrl = this.$router.resolve({
  287. path: '/home/details',
  288. query: {
  289. pid: this.pid,
  290. id: this.info.id,
  291. dispatchType: row,
  292. type: 4
  293. }
  294. })
  295. window.open(routeUrl.href, '_blank')
  296. },
  297. exportFile() {
  298. console.log('export')
  299. this.$api.store
  300. .exportFile({ projectId: this.info.projectId })
  301. .then(res => {
  302. if (res.code === 200) {
  303. ElMessageBox.alert(
  304. '智能生成文档中,生成完成后系统将会发送通知消息给您!',
  305. ''
  306. )
  307. }
  308. })
  309. },
  310. rowDel(row) {
  311. ElMessageBox.confirm('确定要执行删除操作?', '提示', {
  312. confirmButtonText: '确定',
  313. cancelButtonText: '取消',
  314. type: 'warning'
  315. }).then(res => {
  316. if (res === 'confirm') {
  317. const data = {
  318. id: row.id,
  319. projectId: row.projectId,
  320. fileId: row.folderId
  321. }
  322. this.$api.store.removeFile(data).then(res => {
  323. if (res.code === 200) {
  324. this.$message.success('删除成功')
  325. this.onLoad()
  326. } else {
  327. this.$message.error(res.msg)
  328. }
  329. })
  330. }
  331. })
  332. },
  333. /**
  334. * 查看 文件要素
  335. * @param row
  336. */
  337. showDetail(row) {
  338. this.$api.store
  339. .showDetail({ fileId: row.folderId, projectId: row.projectId })
  340. .then(res => {
  341. if (res.code === 200) {
  342. if (Object.keys(res.data).length === 0) {
  343. this.$message.error('文件正在解析中或者文件解析失败,暂无数据')
  344. } else {
  345. this.itemDetail = res.data
  346. this.show = true
  347. }
  348. } else {
  349. this.$message.error(res.msg)
  350. }
  351. })
  352. }
  353. }
  354. }
  355. </script>
  356. <style lang="scss" scoped>
  357. .top {
  358. height: 35px;
  359. border-radius: var(--el-card-border-radius);
  360. background-color: #f5f5f3;
  361. }
  362. </style>