Newer
Older
KaiFengPC / src / views / project / projectJinDu / monthReport.vue
@zhangdeliang zhangdeliang on 24 Jul 14 KB update
  1. <template>
  2. <!-- 项目综合管理 项目进度管理 月度上报-->
  3. <div class="publicContainer">
  4. <!-- 搜索区域 -->
  5. <el-form :model="queryParams" ref="queryRef" :inline="true">
  6. <el-form-item label="月份选择:" prop="reportMonth">
  7. <el-date-picker type="month" v-model="queryParams.reportMonth" value-format="YYYY-MM" placeholder="请选择日期"> </el-date-picker>
  8. </el-form-item>
  9. <el-form-item label="项目名称:" prop="projectNo">
  10. <el-select v-model="queryParams.projectNo" filterable clearable placeholder="请选择">
  11. <el-option v-for="dict in projectList" :key="dict.projectNo" :label="dict.projectName" :value="dict.projectNo" />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="建设状态:" prop="buildStatus">
  15. <el-select v-model="queryParams.buildStatus" clearable placeholder="请选择">
  16. <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  21. <el-button type="success" icon="Refresh" @click="resetQuery">重置</el-button>
  22. <el-button type="warning" icon="Upload" @click="importData">导入</el-button>
  23. </el-form-item>
  24. </el-form>
  25.  
  26. <!-- 表格 -->
  27. <el-table v-loading="tableLoading" :data="tableData" max-height="650">
  28. <el-table-column label="月份" prop="reportMonth" />
  29. <el-table-column label="项目名称" prop="projectName" />
  30. <el-table-column label="项目类别" prop="projectTypeCode">
  31. <template #default="scope">
  32. <span>
  33. {{ !!scope.row.projectTypeCode ? projectType.filter(item => item.value == scope.row.projectTypeCode)[0].label : '--' }}
  34. </span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="责任单位" prop="chargeDepartment" />
  38. <el-table-column label="建设状态" prop="buildStatusName" />
  39. <el-table-column label="建设进度(%)" prop="projectProgress" />
  40. <el-table-column label="累计完成项目总投资(含主体工程)(万元)" prop="accomplishTotalInvest" />
  41. <el-table-column label="累计完成海绵投资(不含主体工程)(万元)" prop="accomplishSpongeInvest" />
  42. <el-table-column label="本月完成投资(万元)" prop="monthAccomplishTotalInvest" />
  43. <el-table-column label="本月完成海绵投资(万元)" prop="monthAccomplishSpongeInvest" />
  44. <el-table-column label="项目照片" prop="publishTime">
  45. <template #default="scope">
  46. <div v-if="scope.row.sysFileSaveRequestList && scope.row.sysFileSaveRequestList.length > 0">
  47. <el-image
  48. :src="item.url"
  49. v-for="(item, index) in scope.row.sysFileSaveRequestList"
  50. :key="index"
  51. style="width: 100px; height: 100px"
  52. ></el-image>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="备注" prop="remark" />
  57. <el-table-column label="操作" width="240" class-name="small-padding fixed-width">
  58. <template #default="scope">
  59. <el-button link type="warning" icon="Comment" @click="handleNotice(scope.row)">通知提醒</el-button>
  60. <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row)">修改</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64.  
  65. <!-- 分页 -->
  66. <pagination
  67. v-show="total > 0"
  68. :total="total"
  69. v-model:page="queryParams.pageNum"
  70. v-model:limit="queryParams.pageSize"
  71. @pagination="getDataList"
  72. />
  73.  
  74. <!-- 文件导入 -->
  75. <el-dialog title="导入月报进度" v-model="dialogShowDR" width="500px" append-to-body>
  76. <el-form ref="formRefDR" :model="formExport" :rules="rulesFormDR" label-width="110px" class="publicForm">
  77. <el-form-item label="月份:" prop="reportMonth">
  78. <el-date-picker type="month" v-model="formExport.reportMonth" value-format="YYYY-MM" placeholder="请选择日期"> </el-date-picker>
  79. </el-form-item>
  80. <el-form-item label="月度报表:" prop="file" style="width: 100%">
  81. <el-upload
  82. ref="uploadRef"
  83. :limit="1"
  84. accept=".xlsx, .xls"
  85. action="/"
  86. :on-change="uploadFile"
  87. :on-progress="handleFileUploadProgress"
  88. :on-success="handleFileSuccess"
  89. :auto-upload="false"
  90. drag
  91. >
  92. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  93. <div class="el-upload__text"><em>将文件拖到此处,或点击上传</em></div>
  94. </el-upload>
  95. </el-form-item>
  96. </el-form>
  97. <template #footer>
  98. <div class="dialog-footer">
  99. <el-button type="info" @click="dialogShowDR = false">取 消</el-button>
  100. <el-button type="primary" @click="submitFormExport">确 定</el-button>
  101. </div>
  102. </template>
  103. </el-dialog>
  104.  
  105. <!-- 修改弹窗 -->
  106. <el-dialog title="修改进度" v-model="dialogShow" width="900px" append-to-body>
  107. <el-form ref="formRef" :model="formData" :rules="rulesForm" label-width="170px" class="publicForm flex50">
  108. <el-form-item label="项目名称:" prop="projectName">
  109. <el-input type="text" v-model="formData.projectName" placeholder="请输入" clearable disabled />
  110. </el-form-item>
  111. <el-form-item label="责任单位:" prop="chargeDepartment">
  112. <el-input type="text" v-model="formData.chargeDepartment" placeholder="请输入" clearable disabled />
  113. </el-form-item>
  114. <el-form-item label="累计完成总投资(万元):" prop="accomplishTotalInvest">
  115. <el-input type="number" :min="0" v-model="formData.accomplishTotalInvest" placeholder="请输入" clearable />
  116. </el-form-item>
  117. <el-form-item label="累计完成海绵投资(万元):" prop="accomplishSpongeInvest">
  118. <el-input type="number" :min="0" v-model="formData.accomplishSpongeInvest" placeholder="请输入" clearable />
  119. </el-form-item>
  120. <el-form-item label="本月完成投资(万元):" prop="monthAccomplishTotalInvest">
  121. <el-input type="number" :min="0" v-model="formData.monthAccomplishTotalInvest" placeholder="请输入" clearable />
  122. </el-form-item>
  123. <el-form-item label="本月完成海绵投资(万元):" prop="monthAccomplishSpongeInvest">
  124. <el-input type="number" :min="0" v-model="formData.monthAccomplishSpongeInvest" placeholder="请输入" clearable />
  125. </el-form-item>
  126. <el-form-item label="建设进度(%):" prop="projectProgress">
  127. <el-input type="number" :min="0" v-model="formData.projectProgress" placeholder="请输入" clearable />
  128. </el-form-item>
  129. <el-form-item label="建设状态:" prop="buildStatus">
  130. <el-select v-model="formData.buildStatus" clearable placeholder="请选择">
  131. <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  132. </el-select>
  133. </el-form-item>
  134. <el-form-item label="项目照片:" prop="sysFileSaveRequestList" style="width: 100%">
  135. <ImageFileUpload
  136. :limit="5"
  137. :listType="'picture-card'"
  138. :saveFileArr="formData.sysFileSaveRequestList"
  139. :refField="'pjdPhotos'"
  140. :refType="'projectMonthReportImages'"
  141. ></ImageFileUpload>
  142. </el-form-item>
  143. <el-form-item label="备注:" prop="remark" style="width: 100%">
  144. <el-input type="textarea" v-model="formData.remark" placeholder="请输入" clearable />
  145. </el-form-item>
  146. </el-form>
  147. <template #footer>
  148. <div class="dialog-footer">
  149. <el-button type="info" @click="dialogShow = false">取 消</el-button>
  150. <el-button type="primary" @click="submitForm">确 定</el-button>
  151. </div>
  152. </template>
  153. </el-dialog>
  154.  
  155. <!-- 通知提醒弹窗 -->
  156. <el-dialog title="通知提醒" v-model="dialogShowTZ" width="600px" append-to-body>
  157. <el-form ref="formRefTZ" :model="formDataTZ" :rules="rulesFormTZ" label-width="120px" class="publicForm">
  158. <el-form-item label="责任人:" prop="userName">
  159. <el-input type="text" v-model="formDataTZ.userName" placeholder="请输入" clearable />
  160. </el-form-item>
  161. <el-form-item label="责任人电话:" prop="userPhone">
  162. <el-input type="text" v-model="formDataTZ.userPhone" placeholder="请输入" clearable maxlength="11" />
  163. </el-form-item>
  164. <el-form-item label="通知单:" prop="fileList">
  165. <ImageFileUpload
  166. :limit="1"
  167. :saveFileArr="formDataTZ.fileList"
  168. :listType="'text'"
  169. :fileType="['pdf']"
  170. :refField="'coverPhotos'"
  171. :refType="'rtu_site_info'"
  172. ></ImageFileUpload>
  173. </el-form-item>
  174. </el-form>
  175. <template #footer>
  176. <div class="dialog-footer">
  177. <el-button type="info" @click="dialogShowTZ = false">取 消</el-button>
  178. <el-button type="primary" @click="submitFormTZ">确 定</el-button>
  179. </div>
  180. </template>
  181. </el-dialog>
  182. </div>
  183. </template>
  184.  
  185. <script setup name="月度上报">
  186. import { getProjectInfoNewList } from '@/api/document/projectTransfer';
  187. import { MonthReportImport, MonthReportPage, MonthReportEdit } from '@/api/project/monthJD.js';
  188. import { useDicts } from '@/hooks';
  189. import { getToken } from '@/utils/auth';
  190. import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
  191. import { projectTypeList } from '@/api/project/projectInformationNew';
  192.  
  193. const { proxy } = getCurrentInstance();
  194. const { build_status } = useDicts(proxy);
  195. const tableData = ref([]);
  196. const tableLoading = ref(false);
  197. const total = ref(0);
  198. const dialogShow = ref(false);
  199. const dialogShowTZ = ref(false);
  200. const dialogShowDR = ref(false);
  201. const projectList = ref([]);
  202. const allData = reactive({
  203. queryParams: {
  204. pageNum: 1,
  205. pageSize: 10,
  206. reportMonth: null,
  207. projectNo: '',
  208. buildStatus: '',
  209. },
  210. formData: {},
  211. rulesForm: {
  212. title: [{ required: true, message: '请输入', trigger: 'blur' }],
  213. },
  214. formDataTZ: {
  215. userName: '',
  216. fileList: [],
  217. userPhone: '',
  218. },
  219. rulesFormTZ: {
  220. userName: [{ required: true, message: '请输入', trigger: 'blur' }],
  221. userPhone: [
  222. {
  223. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  224. message: '请输入正确的手机号码',
  225. trigger: 'blur',
  226. required: true,
  227. },
  228. ],
  229. fileList: [{ required: true, message: '请输入', trigger: 'blur', type: 'array' }],
  230. },
  231. formExport: {
  232. file: '',
  233. reportMonth: proxy.moment(new Date()).format('YYYY-MM'),
  234. },
  235. rulesFormDR: {
  236. reportMonth: [{ required: true, message: '请选择', trigger: 'change' }],
  237. },
  238. });
  239. const { queryParams, formData, rulesForm, formDataTZ, rulesFormTZ, formExport, rulesFormDR } = toRefs(allData);
  240. const formExportData = ref({});
  241. const projectType = ref([]);
  242.  
  243. /*** 导入参数 */
  244. const upload = reactive({
  245. // 是否显示弹出层(用户导入)
  246. open: false,
  247. // 弹出层标题(用户导入)
  248. title: '',
  249. // 是否禁用上传
  250. isUploading: false,
  251. // 是否更新已经存在的用户数据
  252. updateSupport: 0,
  253. // 设置上传的请求头部
  254. headers: { Authorization: 'Bearer ' + getToken() },
  255. });
  256.  
  257. /** 获取查询数据列表 */
  258. function getDataList() {
  259. tableLoading.value = true;
  260. MonthReportPage(queryParams.value).then(response => {
  261. tableData.value = response.data;
  262. total.value = response.total;
  263. tableLoading.value = false;
  264. });
  265. }
  266. /** 搜索按钮操作 */
  267. function handleQuery() {
  268. queryParams.value.pageNum = 1;
  269. getDataList();
  270. }
  271. /** 重置按钮操作 */
  272. function resetQuery() {
  273. proxy.resetForm('queryRef');
  274. handleQuery();
  275. }
  276. // 修改保存
  277. function submitForm() {
  278. proxy.$refs['formRef'].validate(valid => {
  279. if (valid) {
  280. MonthReportEdit(formData.value).then(res => {
  281. if (res.code == 200) {
  282. proxy.$modal.msgSuccess('修改成功');
  283. getDataList();
  284. dialogShow.value = false;
  285. } else {
  286. proxy.$modal.msgError('修改失败请重试');
  287. }
  288. });
  289. }
  290. });
  291. }
  292. /** 上报当月进度操作 */
  293. function handleEdit(row) {
  294. proxy.resetForm('formRefDR'); //清空表单
  295. formData.value = { ...row };
  296. dialogShow.value = true;
  297. }
  298. /** 上报当月进度提交 */
  299. function submitFormExport() {
  300. proxy.$refs['formRefDR'].validate(valid => {
  301. if (valid) {
  302. MonthReportImport(formExportData.value).then(res => {
  303. if (res.code == 200) {
  304. proxy.$modal.msgSuccess('导入成功');
  305. getDataList();
  306. dialogShowDR.value = false;
  307. } else {
  308. proxy.$modal.msgError('导入失败请重试');
  309. }
  310. });
  311. }
  312. });
  313. }
  314. /**文件上传中处理 */
  315. const handleFileUploadProgress = (event, file, fileList) => {
  316. upload.isUploading = true;
  317. };
  318. /** 文件上传成功处理 */
  319. const handleFileSuccess = (response, file, fileList) => {
  320. upload.isUploading = false;
  321. proxy.$refs['uploadRef'].handleRemove(file);
  322. };
  323. function uploadFile(file) {
  324. formExport.value.file = '';
  325. formExportData.value = new FormData();
  326. formExportData.value.append('file', file.raw);
  327. formExportData.value.append('reportMonth', formExport.value.reportMonth);
  328. }
  329.  
  330. /** 通知提醒操作 */
  331. function handleNotice(row) {
  332. proxy.resetForm('formRefTZ'); //清空表单
  333. dialogShowTZ.value = true;
  334. }
  335. /** 通知提醒提交 */
  336. function submitFormTZ() {
  337. proxy.$refs['formRefTZ'].validate(valid => {
  338. if (valid) {
  339. }
  340. });
  341. }
  342.  
  343. // 导入
  344. function importData() {
  345. dialogShowDR.value = true;
  346. proxy.resetForm('formRefDR'); //清空表单
  347. }
  348.  
  349. // 获取项目列表
  350. const getProjectList = async () => {
  351. const res = await getProjectInfoNewList();
  352. if (res?.code == 200) {
  353. projectList.value = res.data || [];
  354. }
  355. };
  356. // 获取项目类别
  357. const projectTypeGet = async () => {
  358. let { data } = await projectTypeList();
  359. data.map(item => {
  360. projectType.value.push({
  361. value: item.projectTypeCode,
  362. label: item.projectTypeName,
  363. });
  364. });
  365. };
  366. onMounted(() => {
  367. projectTypeGet();
  368. getProjectList();
  369. getDataList();
  370. });
  371. </script>