info3.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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. <el-descriptions title="合同">
  104. <el-descriptions-item label="Username"
  105. >kooriookami
  106. </el-descriptions-item>
  107. <el-descriptions-item label="Telephone"
  108. >18100000000
  109. </el-descriptions-item>
  110. <el-descriptions-item label="Place">Suzhou</el-descriptions-item>
  111. <el-descriptions-item label="Remarks">
  112. <el-tag size="small">School</el-tag>
  113. </el-descriptions-item>
  114. <el-descriptions-item label="Address"
  115. >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
  116. </el-descriptions-item>
  117. </el-descriptions>
  118. </el-dialog>
  119. </div>
  120. </template>
  121. <script>
  122. import api from '@/api/index.js'
  123. import { ElMessageBox } from 'element-plus'
  124. import subInfo from '@/views/store/component/subInfo.vue'
  125. export default {
  126. props: {
  127. info: {
  128. type: Object,
  129. default: null
  130. }
  131. },
  132. components: { subInfo },
  133. data() {
  134. return {
  135. pid: '',
  136. showImage: false,
  137. uploadShow: false,
  138. show: false,
  139. preList: [],
  140. form: {},
  141. data: [],
  142. page: {
  143. current: 1,
  144. size: 10
  145. },
  146. option: {
  147. align: 'center',
  148. menuWidth: 420,
  149. height: 525,
  150. size: 'mini',
  151. addBtn: false,
  152. delBtn: false,
  153. editBtn: false,
  154. refreshBtn: false,
  155. columnBtn: false,
  156. labelWidth: 140,
  157. border: true,
  158. column: [
  159. {
  160. label: '附件类型',
  161. prop: 'type',
  162. type: 'select',
  163. dicData: [
  164. {
  165. label: '备案证/可研批复',
  166. value: 1
  167. },
  168. {
  169. label: '合同',
  170. value: 2
  171. },
  172. {
  173. label: '工程量清单',
  174. value: 3
  175. },
  176. {
  177. label: '现场照片',
  178. value: 4
  179. },
  180. {
  181. label: '项目核实认定表',
  182. value: 5
  183. },
  184. {
  185. label: '其他资料',
  186. value: 6
  187. }
  188. ]
  189. },
  190. {
  191. label: '附件名称',
  192. prop: 'title',
  193. type: 'input'
  194. },
  195. {
  196. label: '上传时间',
  197. prop: 'createTime'
  198. }
  199. ]
  200. }
  201. }
  202. },
  203. created() {
  204. this.pid = this.$route.query.id
  205. },
  206. methods: {
  207. onLoad() {
  208. const data = Object.assign(this.page, { id: this.pid })
  209. this.$api.store.fileList(data).then(res => {
  210. if (res.code === 200) {
  211. if (res.data.files.length === 0) {
  212. this.data.length = 0
  213. return
  214. }
  215. this.data = res.data.files.map(ele => {
  216. delete ele.fileId
  217. const tmp = ele.fileFolder
  218. tmp.folderId = tmp.id
  219. delete tmp.id
  220. return Object.assign(tmp, ele)
  221. })
  222. }
  223. })
  224. },
  225. currentChange(currentPage) {
  226. this.page.current = currentPage
  227. },
  228. sizeChange(pageSize) {
  229. this.page.size = pageSize
  230. },
  231. refreshChange() {
  232. this.onLoad()
  233. },
  234. /**
  235. * 文件下载
  236. * @param row
  237. */
  238. downLoad(row) {
  239. window.open(row.url, '_blank')
  240. },
  241. /**
  242. * 文件预览
  243. * @param item
  244. */
  245. previewFile(item) {
  246. if (api.offices.includes(item.suffix)) {
  247. const routeData = this.$router.resolve({
  248. path: '/home/file_detail',
  249. query: { id: item.fileId }
  250. })
  251. window.open(routeData.href, '_blank')
  252. } else {
  253. this.preList.length = 0
  254. this.preList.push(item.url)
  255. this.showImage = true
  256. }
  257. },
  258. /**
  259. * 打开文件夹
  260. * @param item
  261. */
  262. openFolder(item) {
  263. console.log(item)
  264. const data = this.$router.resolve({
  265. path: '/home/files',
  266. query: {
  267. id: item.parentId,
  268. projectId: item.projectId
  269. }
  270. })
  271. window.open(data.href, '_blank')
  272. },
  273. /**
  274. * 打开文件
  275. * @param row
  276. */
  277. openFile(row) {
  278. const routeUrl = this.$router.resolve({
  279. path: '/home/details',
  280. query: {
  281. pid: this.pid,
  282. id: this.info.id,
  283. dispatchType: row,
  284. type: 4
  285. }
  286. })
  287. window.open(routeUrl.href, '_blank')
  288. },
  289. exportFile() {
  290. console.log('export')
  291. this.$api.store
  292. .exportFile({ projectId: this.info.projectId })
  293. .then(res => {
  294. if (res.code === 200) {
  295. ElMessageBox.alert(
  296. '智能生成文档中,生成完成后系统将会发送通知消息给您!',
  297. ''
  298. )
  299. }
  300. })
  301. },
  302. rowDel(row) {
  303. ElMessageBox.confirm('确定要执行删除操作?', '提示', {
  304. confirmButtonText: '确定',
  305. cancelButtonText: '取消',
  306. type: 'warning'
  307. }).then(res => {
  308. if (res === 'confirm') {
  309. const data = {
  310. id: row.id,
  311. projectId: row.projectId,
  312. fileId: row.folderId
  313. }
  314. this.$api.store.removeFile(data).then(res => {
  315. if (res.code === 200) {
  316. this.$message.success('删除成功')
  317. this.onLoad()
  318. } else {
  319. this.$message.error(res.msg)
  320. }
  321. })
  322. }
  323. })
  324. },
  325. /**
  326. * 查看 文件要素
  327. * @param row
  328. */
  329. showDetail(row) {
  330. this.$api.store
  331. .showDetail({ fileId: row.folderId, projectId: row.projectId })
  332. .then(res => {
  333. if (res.code === 200) {
  334. if (Object.keys(res.data).length === 0) {
  335. this.$message.error('文件正在解析中或者文件解析失败,暂无数据')
  336. } else {
  337. this.show = true
  338. }
  339. } else {
  340. this.$message.error(res.msg)
  341. }
  342. })
  343. }
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. .top {
  349. height: 35px;
  350. border-radius: var(--el-card-border-radius);
  351. background-color: #f5f5f3;
  352. }
  353. </style>