ProjectManagement5.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <!-- 项目管理 项目结题附件 -->
  3. <div class="ProjectManagement5" v-loading="loading">
  4. <div class="pmInp">
  5. <!-- <el-button type="primary" class="btn" @click="addFile" size="mini">上传文件</el-button> -->
  6. <beUpload @getFile="getFile" v-show="state==0" :navName="'上传文件'" :accept="accept" :progress="progress"></beUpload>
  7. <beUpload @getFile="getFile" v-show="state==1" :navName="'上传文件'" :accept="accept" :progress="progress"></beUpload>
  8. <el-button v-show="state==2" style="background: #ccc !important;cursor: no-drop;color: #fff !important;border: 0;font-size: 16px;">上传文件</el-button>
  9. </div>
  10. <el-progress v-show="progress.show" :percentage="progress.value" :format="ProgressFormat"></el-progress>
  11. <!-- 表格部分开始 -->
  12. <el-table
  13. :data="tableData"
  14. tooltip-effect="dark"
  15. stripe
  16. class="fontSize"
  17. :header-cell-style="{ background: '#f2f2f2',color:'#000' }"
  18. >
  19. <!-- <el-table-column
  20. prop="projectTitle"
  21. label="项目名称"
  22. align="center"
  23. >
  24. <template>
  25. <span>{{ title }}</span>
  26. </template>
  27. </el-table-column> -->
  28. <el-table-column
  29. prop="fileName"
  30. label="项目中期报告"
  31. align="center"
  32. >
  33. </el-table-column>
  34. <el-table-column
  35. prop="size"
  36. label="大小"
  37. align="center"
  38. >
  39. </el-table-column>
  40. <el-table-column
  41. prop="uploadTime"
  42. label="时间"
  43. align="center"
  44. >
  45. </el-table-column>
  46. <el-table-column
  47. prop="operation"
  48. align="center"
  49. label="操作"
  50. >
  51. <template #default="scope">
  52. <div class="operations">
  53. <el-button type="primary" size="mini" @click="checkFile(scope.row.url)" style="background: #477edd">明细查看</el-button>
  54. <el-button type="primary" size="mini" @click="DelFile(scope.$index)" style="background: #477edd">删除</el-button>
  55. </div>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!-- 展示文档开始 -->
  60. <el-dialog
  61. title="展示文件"
  62. :visible.sync="showFile"
  63. width="80vw"
  64. class="addDialog showDialog"
  65. >
  66. <div class="addDialogLogo">LOGO</div>
  67. <div class="showFileArea">
  68. <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
  69. <vword
  70. style="width: 100%; height: 100%; overflow: auto"
  71. class="fullStyle"
  72. v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
  73. :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
  74. ></vword>
  75. <vpdf
  76. style="width: 100%; height: 100%; overflow: auto"
  77. class="fullStyle"
  78. :pdfUrl="showFileUrl"
  79. v-if="Wordss['type']=='pdf'"
  80. ></vpdf>
  81. <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
  82. </div>
  83. </el-dialog>
  84. <!-- 分页 -->
  85. <!-- <el-pagination
  86. @current-change="handleCurrentChange"
  87. :current-page="table.currentPage"
  88. :page-size="table.packageSize"
  89. layout=" prev, pager, next"
  90. background
  91. class="paginations"
  92. :total="table.total">
  93. </el-pagination> -->
  94. <!-- 分页结束 -->
  95. </div>
  96. </template>
  97. <script>
  98. import beUpload from '../../components/tool/beUpload'
  99. import vpdf from "@/components/vpdf.vue";
  100. import vword from "@/components/vword.vue";
  101. export default {
  102. components: { beUpload, vpdf, vword },
  103. data() {
  104. return {
  105. accept:"*",
  106. // table:{ // 分页数据
  107. // total:0,
  108. // packageSize:8,
  109. // currentPage:1
  110. // },
  111. loading:false,
  112. state:0,
  113. showFile:false,
  114. showFileType: 0,
  115. showFileUrl: "",
  116. Wordss:{type:"",name:""},
  117. canonical:{
  118. Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
  119. File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
  120. },
  121. title:"",
  122. tableData:[], //附件列表
  123. file:'',
  124. progress:{
  125. value:0,
  126. show:false
  127. },
  128. }
  129. },
  130. methods:{
  131. DelFile(index){
  132. this.$confirm("你确定要删除该文件吗?",'确定文件删除').then(res=>{
  133. this.tableData.splice(index,1);
  134. this.ajax.post(this.$store.state.api+"/UpdateProjectEndFile",{
  135. uid:this.$store.state.userInfo.userid,
  136. pid:JSON.parse(localStorage.getItem('pid')),
  137. file:JSON.stringify(this.tableData)
  138. }).then(res=>{
  139. console.log(res)
  140. if(res.data==1){
  141. this.$message.success("删除文件成功")
  142. }else{
  143. this.$message.error("删除文件失败")
  144. }
  145. this.getData();
  146. })
  147. }).catch(err=>{
  148. console.log("取消删除文件")
  149. })
  150. },
  151. ProgressFormat(value){ //进度条
  152. return value ==100?'100%':`${value}%`
  153. },
  154. //展示文件
  155. checkFile(url) {
  156. this.showFileUrl = url;
  157. this.showFile = true;
  158. if(typeof url=='undefined')return {type:"",name:""};
  159. let urlSplit = url.split(".");
  160. const type = urlSplit[urlSplit.length-1]
  161. if(this.canonical.Image.test(url)){
  162. this.Wordss={type:type,name:"图片"}
  163. return console.log(this.Wordss);
  164. }
  165. if(this.canonical.File.test(url)){
  166. this.Wordss={type:type,name:"文档"}
  167. return console.log(this.Wordss);
  168. }
  169. else return this.Wordss={type:type,name:type}
  170. },
  171. getFile(val) { //上传文件
  172. this.file = val;
  173. let oldData = [];
  174. if (this.tableData!=null) {
  175. this.tableData.forEach(item=>oldData.push(item))
  176. oldData.push(val)
  177. }else{
  178. oldData.push(val)
  179. }
  180. let param={
  181. uid:this.$store.state.userInfo.userid,
  182. cid:JSON.parse(localStorage.getItem('pid')),
  183. projectFile:JSON.stringify(oldData)
  184. }
  185. this.ajax
  186. .post(this.$store.state.api+'/AddProjectManageFile',param)
  187. .then(res=>{
  188. console.log(res);
  189. if (res.data==1) {
  190. this.getData()
  191. this.$message.success('上传成功')
  192. this.progress.show = false;
  193. }else{
  194. this.$message.error('上传失败')
  195. }
  196. },err=>{
  197. console.log(err);
  198. })
  199. },
  200. // handleCurrentChange(val) { //当页数发生改变的时候调用获取列表数据请求
  201. // // console.log(`当前页: ${val}`);
  202. // this.table.currentPage=val
  203. // this.getData()
  204. // },
  205. getData(){ //获取基础信息
  206. this.loading = true;
  207. let param={
  208. uid:this.$store.state.userInfo.userid,
  209. pid:JSON.parse(localStorage.getItem('pid')),
  210. }
  211. // console.log(param);
  212. this.ajax
  213. .get(this.$store.state.api+'/SelectProjectManageFile',param)
  214. .then(res=>{
  215. console.log(res.data[0][0]);
  216. this.state=res.data[0][0].isupload;
  217. let file = JSON.parse(res.data[0][0]['endFile']);
  218. this.tableData=file
  219. this.loading = false;
  220. },err=>{
  221. console.log(err);
  222. })
  223. },
  224. content(){
  225. this.$router.push('/ProjectManagement1')
  226. },
  227. remark(){
  228. this.$router.push('/ProjectManagement2')
  229. },
  230. remark2(){
  231. this.$router.push('/ProjectManagement3')
  232. },
  233. remark4(){
  234. this.$router.push('/ProjectManagement4')
  235. },
  236. remark5(){
  237. this.$router.push('/ProjectManagement5')
  238. },
  239. // backBtn2(){
  240. // this.$router.push('/ProjectManagement1')
  241. // },
  242. // detail(){
  243. // },
  244. back(){
  245. this.$router.push('/ProjectManagement')
  246. },
  247. },
  248. mounted(){
  249. this.getData()
  250. }
  251. }
  252. </script>
  253. <style lang="less">
  254. .ProjectManagement5{
  255. .pagination{
  256. float: right;
  257. margin: 20px 55px 10px;
  258. }
  259. .addDialog {
  260. font-size: 18px;
  261. .el-dialog {
  262. border-radius: 5px;
  263. overflow: hidden;
  264. }
  265. .deleteContent {
  266. width: 100%;
  267. margin: 30px 0;
  268. font-size: 22px;
  269. color: #000;
  270. }
  271. .addDialogLogo {
  272. width: 60px;
  273. height: 30px;
  274. display: flex;
  275. justify-content: center;
  276. line-height: 30px;
  277. border-radius: 5px;
  278. background: #f2f2f2;
  279. position: absolute;
  280. left: 20px; top: 15px;
  281. }
  282. .el-dialog__header {
  283. display: flex;
  284. justify-content: center;
  285. background: #32455b;
  286. }
  287. .el-dialog__title {
  288. color:#fff;
  289. display: flex;
  290. justify-content: center;
  291. font-size: 18px;
  292. position: relative;
  293. top: -2px;
  294. }
  295. .addDialogMid {
  296. box-sizing: border-box;
  297. padding: 0 60px 0 10px;
  298. .addDialogTit {
  299. display: flex;
  300. span {
  301. width: 80px;
  302. font-size: 16px;
  303. line-height: 40px;
  304. text-align: left;
  305. }
  306. }
  307. .addDialogTit1 {
  308. display: flex;
  309. justify-content: space-between;
  310. margin-bottom: 15px;
  311. }
  312. .addDialogTit2 {
  313. margin-top: 10px;
  314. font-size: 16px;
  315. color: #000;
  316. text-indent: 2em;
  317. }
  318. .addDialogCon {
  319. margin-top: 20px;
  320. }
  321. }
  322. .dialog-footer {
  323. display: flex;
  324. justify-content: center;
  325. box-sizing: border-box;
  326. // .btn5 {
  327. // font-size: 16px;
  328. // }
  329. }
  330. }
  331. .pm5footer{
  332. float: right;
  333. margin-top: 30px;
  334. .backBtn{
  335. background: #169bd5;
  336. float: right;
  337. width: 100px;
  338. }
  339. }
  340. .pm1Tit{
  341. display: flex;
  342. margin-left: 20px;
  343. div{
  344. width: 130px;
  345. cursor: pointer;
  346. font-weight: 550;
  347. }
  348. .pr1TitBass{
  349. height: 2px;
  350. width: 100%;
  351. background: #3D67BC;
  352. }
  353. }
  354. .pmInp{
  355. width: 100%;
  356. margin: 10px 0 10px 0;
  357. display: flex;
  358. justify-content: flex-end;
  359. .btn{
  360. height: 30px;
  361. width: 100px;
  362. font-size: 16px;
  363. background: #477edd;
  364. // margin-left: 10px;
  365. }
  366. }
  367. }
  368. </style>