dispatch.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <basic-container>
  3. <div class="flex flex-col padding-left" style="width: 95%">
  4. <div class="text-left grey-6 font-18 bold">
  5. {{ year }}年{{ month }}月项目进度信息填报
  6. </div>
  7. <!------进度描述------>
  8. <div>
  9. <div class="flex flex-center flex-justify-between mt-20">
  10. <span class="bold font-18 main-color">进度描述</span>
  11. <div class="flex flex-center">
  12. <base-button type="0" title="批量导出" icon="upload" />
  13. <base-button
  14. class="ml-10"
  15. :title="btnTitle"
  16. icon="upload"
  17. @click="edit"
  18. />
  19. </div>
  20. </div>
  21. <div class="mt-20">
  22. <el-input
  23. v-model="progress"
  24. :rows="10"
  25. type="textarea"
  26. :disabled="btnTitle === '编辑'"
  27. placeholder="填写项目进度信息"
  28. />
  29. </div>
  30. </div>
  31. <!------相关文件------>
  32. <div class="mt-20">
  33. <div class="flex flex-center flex-justify-between mt-20">
  34. <span class="bold font-18 main-color">相关文件</span>
  35. </div>
  36. <avue-crud
  37. ref="crud"
  38. v-model="form"
  39. v-model:page="page"
  40. :data="data"
  41. :option="option"
  42. :table-loading="loading"
  43. class="curd"
  44. @row-del="rowDel"
  45. @on-load="onLoad"
  46. >
  47. <template #menu="{ row }">
  48. <el-button icon="Upload" type="primary" text @click="openFile(row)">
  49. 上传
  50. </el-button>
  51. <el-button
  52. text
  53. type="primary"
  54. icon="Download"
  55. @click="projectReport(row)"
  56. >下载
  57. </el-button>
  58. </template>
  59. </avue-crud>
  60. </div>
  61. <!------现场图片------>
  62. <div class="mb-20">
  63. <div class="flex flex-center flex-justify-between mt-20">
  64. <span class="bold font-18 main-color">施工现场图</span>
  65. <div class="flex flex-center">
  66. <base-button type="0" title="上传" icon="upload" />
  67. </div>
  68. </div>
  69. <div class="mt-20">
  70. <el-carousel :interval="4000" type="card" height="400px">
  71. <el-carousel-item v-for="(item, index) in srcList" :key="item">
  72. <el-image
  73. :src="item"
  74. fit="cover"
  75. @click="showImageView(item, index)"
  76. />
  77. </el-carousel-item>
  78. </el-carousel>
  79. </div>
  80. </div>
  81. </div>
  82. <el-image-viewer
  83. v-if="showImage"
  84. :url-list="srcList"
  85. :initial-index="imageIndex"
  86. @close="showImage = false"
  87. />
  88. </basic-container>
  89. </template>
  90. <script>
  91. import BasicContainer from '@/components/basic-container/main.vue'
  92. import baseButton from '@/components/base-button.vue'
  93. export default {
  94. name: 'dispatch',
  95. components: { BasicContainer, baseButton },
  96. props: {
  97. year: {
  98. type: Number,
  99. default: 0
  100. },
  101. month: {
  102. type: Number,
  103. default: 0
  104. }
  105. },
  106. watch: {
  107. year: {
  108. handler(val) {
  109. if (val) {
  110. this.detail()
  111. }
  112. },
  113. immediate: false
  114. },
  115. month: {
  116. handler(val) {
  117. if (val) {
  118. this.detail()
  119. }
  120. },
  121. immediate: false
  122. }
  123. },
  124. data() {
  125. return {
  126. projectId: '',
  127. btnTitle: '编辑',
  128. showImage: false,
  129. imageIndex: 0,
  130. progress: '',
  131. loading: false,
  132. srcList: [
  133. 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
  134. 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
  135. 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
  136. ],
  137. data: [
  138. {
  139. fileName: '支付情况表'
  140. },
  141. {
  142. fileName: '工程完工月报表'
  143. },
  144. {
  145. fileName: '工程量清单'
  146. }
  147. ],
  148. form: {},
  149. option: {
  150. menuBtnTitle: '操作',
  151. refreshBtn: false,
  152. tip: false,
  153. columnBtn: false,
  154. selection: false,
  155. editBtn: true,
  156. editBtnText: '打开',
  157. editBtnIcon: 'FolderOpened',
  158. addBtn: false,
  159. delBtn: true,
  160. border: true,
  161. reserveSelection: true,
  162. align: 'center',
  163. viewBtn: true,
  164. menuWidth: 500,
  165. viewBtnText: '预览',
  166. dialogClickModal: false,
  167. column: [
  168. {
  169. label: '文件名称',
  170. prop: 'fileName'
  171. },
  172. {
  173. label: '上传状态',
  174. prop: 'year'
  175. },
  176. {
  177. label: '上传时间',
  178. prop: 'year'
  179. }
  180. ]
  181. },
  182. images: []
  183. }
  184. },
  185. created() {
  186. this.projectId = this.$route.query.id
  187. this.detail()
  188. },
  189. methods: {
  190. detail() {
  191. this.$api.dispatch
  192. .home({
  193. projectId: this.projectId,
  194. year: this.year,
  195. month: this.month
  196. })
  197. .then(res => {
  198. if (res.code === 200) {
  199. this.progress = res.data.processDescribe
  200. } else {
  201. this.$message.error(res.msg)
  202. }
  203. })
  204. },
  205. showImageView(res, index) {
  206. this.imageIndex = index
  207. this.showImage = true
  208. },
  209. edit() {
  210. if (this.btnTitle === '保存' && this.progress.length > 0) {
  211. const data = {
  212. projectId: this.projectId,
  213. year: this.year,
  214. month: this.month,
  215. processDescribe: this.progress
  216. }
  217. this.$api.dispatch.saveOrUpdate(data).then(res => {
  218. if (res.code === 200) {
  219. console.log(res)
  220. this.$message.success(res.msg)
  221. } else {
  222. this.$message.error(res.msg)
  223. }
  224. })
  225. }
  226. this.btnTitle = this.btnTitle === '编辑' ? '保存' : '编辑'
  227. },
  228. rowDel(row, index, done) {
  229. this.$confirm('确定将选择数据删除?', {
  230. confirmButtonText: '确定',
  231. cancelButtonText: '取消',
  232. type: 'warning'
  233. })
  234. .then(() => {
  235. return this.$api.inspect.remove({ ids: row.id })
  236. })
  237. .then(() => {
  238. this.$message({
  239. type: 'success',
  240. message: '操作成功!'
  241. })
  242. // 数据回调进行刷新
  243. done(row)
  244. this.onLoad()
  245. })
  246. .catch(() => {})
  247. },
  248. openFile(row) {
  249. const routeUrl = this.$router.resolve({
  250. path: '/home/details',
  251. query: {
  252. id: this.projectId,
  253. type: '0'
  254. }
  255. })
  256. window.open(routeUrl.href, '_blank')
  257. }
  258. }
  259. }
  260. </script>
  261. <style scoped></style>