浏览代码

月报申请

sangwenwei 1 年之前
父节点
当前提交
698d4af1ce

+ 1 - 1
src/api/jy/InscriptionService.js

@@ -1,7 +1,7 @@
 import request from '@/utils/httpRequest'
 import { BUSINESS_PATH as prefix } from "../AppPath";
 
-export default class GoOutService{
+export default class InscriptionService{
 	list (param) {
 		return request({
 			url: prefix +'/inscription/findList',

+ 55 - 0
src/api/jy/MonthlyService.js

@@ -0,0 +1,55 @@
+import request from '@/utils/httpRequest'
+import { BUSINESS_PATH as prefix } from "../AppPath";
+
+export default class MonthlyList{
+	list (param) {
+		return request({
+			url: prefix +'/monthly/findList',
+			method: 'get',
+			params: param
+		})
+	}
+
+	saveForm (inputForm) {
+		return request({
+			url: prefix + `/monthly/saveForm`,
+			method: 'post',
+			data: inputForm
+		})
+	}
+
+	queryById (id) {
+		return request({
+			url: prefix +'/monthly/findById',
+			method: 'get',
+			params: {id: id}
+		})
+	}
+
+	delete (ids) {
+		return request({
+			url: prefix+"/monthly/delete",
+			method: 'delete',
+			params: {id: ids}
+		})
+	}
+
+
+	adminEditForm(param){
+		return request({
+			url: prefix + "/monthly/adminEditForm",
+			method: "post",
+			data: param,
+		})
+	}
+
+	exportFile(params) {
+		return request({
+			url: prefix + "/monthly/export",
+			method: "get",
+			params: params,
+			responseType: "blob",
+		});
+	}
+
+}

+ 346 - 0
src/views/jy/monthly/MonthlyForm.vue

@@ -0,0 +1,346 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+	<div>
+		<el-dialog
+			:title="title"
+			:close-on-click-modal="false"
+			draggable
+			append-to-body
+			width="1300px"
+			@close="close"
+			@keyup.enter.native="doSubmit"
+			v-model="visible">
+		<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method === 'view'"
+				 label-width="160px" @submit.native.prevent>
+			<el-row  :gutter="15">
+				<el-col :span="24">
+					<el-form-item label="项目情况:" prop="projectStatus"
+								  :rules="[
+							   {required: true, message:'请选择项目情况', trigger:'blur'}
+                 ]">
+						<el-radio-group v-model="inputForm.projectStatus">
+							<el-radio label="1"  >有项目</el-radio> <el-radio label="0"  >无项目</el-radio>
+						</el-radio-group>
+					</el-form-item>
+				</el-col>
+			</el-row>
+			<el-divider content-position="left"><i class="el-icon-document"></i>
+				基本信息
+			</el-divider>
+			<el-row  :gutter="15">
+
+				<el-col :span="12">
+					<el-form-item label="月报时间" prop="monthDate"
+					>
+						<el-input :disabled="true" v-model="inputForm.monthDate" placeholder="请输入月报时间" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="发起人" prop="createName"
+					>
+						<el-input :disabled="true" v-model="inputForm.createName" placeholder="请输入申请人名称" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="发起人部门" prop="officeName"
+					>
+						<el-input :disabled="true" v-model="inputForm.officeName" placeholder="请输入申请人部门" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="发起时间" prop="createTime">
+						<el-input :disabled="true" v-model="inputForm.createTime" placeholder="请输入申请时间" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24">
+					<el-form-item label="备注" prop="remarks"
+								  :rules="[ ]">
+						<el-input :disabled="method === 'view'" type="textarea" placeholder="请输入备注"  maxlength="500"  style="width:100%" v-model="inputForm.remarks" show-word-limit></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+			<el-row  :gutter="15" v-show="inputForm.projectStatus === '1'">
+				<el-divider content-position="left"><i class="el-icon-document"></i>
+					项目进度信息
+				</el-divider>
+				<el-col :span="24">
+					<vxe-table
+						border
+						:footer-method="footerMethod2"
+						show-overflow
+						show-footer
+						ref="baseTable"
+						:key="baseKey"
+						class="vxe-table-element"
+						:data="inputForm.processList"
+						style="margin-left: 5em"
+						@cell-click=""
+						@edit-closed=""
+						keep-source
+						:readonly="true"
+						highlight-current-row
+						:edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
+					>
+						<vxe-table-column field="projectName" align="center" title="项目名称" :edit-render="{}" show-overflow="title">
+							<template v-slot:edit="scope">
+								<el-input  :disabled="true" placeholder="请填写项目名称" :readonly="true" v-model="scope.row.projectName"/>
+							</template>
+						</vxe-table-column>
+						<vxe-table-column field="no" align="center" title="报告号" :edit-render="{}">
+							<template v-slot:edit="scope">
+								<el-input :disabled="true" :readonly="true" placeholder="请填写报告号" v-model="scope.row.no"/>
+							</template>
+						</vxe-table-column>
+						<vxe-table-column  field="projectLeader" align="center" title="项目负责人" :edit-render="{}">
+							<template v-slot:edit="scope">
+								<el-input :disabled="true" placeholder="请填写项目负责人" v-model="scope.row.projectLeader"/>
+							</template>
+						</vxe-table-column>
+						<vxe-table-column  field="officeName" align="center" title="部门" :edit-render="{}">
+							<template v-slot:edit="scope">
+								<el-input :disabled="true" placeholder="请填写部门" v-model="scope.row.officeName"/>
+							</template>
+						</vxe-table-column>
+						<vxe-table-column  field="process" align="center" title="当前项目进度" :edit-render="{}">
+							<template v-slot:edit="scope">
+								<el-input :disabled="true" placeholder="请填写项目负责人" v-model="scope.row.process"/>
+							</template>
+						</vxe-table-column>
+						<vxe-table-column field="processTime" align="center" title="进度完成时间" :edit-render="{}">
+							<template v-slot:edit="scope">
+								<el-input :disabled="true" placeholder="请填写创建时间" v-model="scope.row.processTime"/>
+							</template>
+						</vxe-table-column>
+					</vxe-table>
+				</el-col>
+			</el-row>
+		</el-form>
+		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+			<template #footer>
+			<span class="dialog-footer">
+			  <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
+			  <el-button type="primary" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+			</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+	import XEUtils from 'xe-utils'
+	import MonthlyService from '@/api/jy/MonthlyService'
+	import { ElDatePicker } from 'element-plus';
+	import UpLoadComponent from '@/views/common/UpLoadComponent'
+	export default {
+		props: {
+			businessId: {
+				type: String,
+				default: ''
+			},
+			formReadOnly: {
+				type: Boolean,
+				default: false
+			},
+			status: {
+				type: String,
+				default: ''
+			}
+		},
+		data () {
+			return {
+				title: '',
+				method: '',
+				loading: false,
+				visible: false,
+				inputForm: {
+					id: '',
+					createName:'',
+					officeName:'',
+					createTime:'',
+					monthDate:'',
+					files: [], // 附件信息
+					processList:[],
+					remarks:'',
+					projectStatus:'1'
+				},
+				baseKey: '',
+				keyWatch: '',
+				programRow:'',
+
+			}
+		},
+		MonthlyService:null,
+		created () {
+			this.monthlyService=new MonthlyService()
+		},
+		mounted () {
+		},
+		activated () {
+		},
+		components: {
+			ElDatePicker,
+			UpLoadComponent,
+		},
+		computed: {
+			bus: {
+				get () {
+					this.$refs.uploadComponent.setDividerName('附件')
+					return this.businessId
+				},
+				set (val) {
+					this.businessId = val
+				}
+			}
+		},
+		watch: {
+			'keyWatch': {
+				handler (newVal) {
+					console.log('几里路')
+					if (this.bus) {
+						if (this.bus !== 'false') {
+							this.init('', this.bus)
+						}
+					} else {
+						this.$nextTick(() => {
+							this.$refs.inputForm.resetFields()
+						})
+					}
+				}
+			},
+			'loading': {
+				handler (newVal) {
+					this.$emit('changeLoading', newVal)
+					this.$refs.uploadComponent.changeLoading(newVal)
+				}
+			}
+		},
+		methods: {
+			getKeyWatch(keyWatch) {
+				this.keyWatch = keyWatch
+			},
+			init(method, id) {
+				this.method = method
+				console.log('method',this.method)
+				this.inputForm={
+					id: '',
+					createName:this.$store.state.user.name,
+					officeName:this.$store.state.user.office.name,
+					createTime:'',
+					monthDate:'',
+					files: [], // 附件信息
+					processList:[],
+					remarks:'',
+					projectStatus:'1'
+				}
+				this.inputForm.id = id
+				console.log('this.inputForm.id', this.inputForm.id)
+				this.loading = false
+				this.visible = true
+				this.$nextTick(() => {
+					this.$refs.inputForm.resetFields()
+					this.loading = true
+					this.$refs.uploadComponent.clearUpload()
+						this.monthlyService.queryById(this.inputForm.id).then((data)=>{
+							this.inputForm = this.recover(this.inputForm, data)
+							if (this.commonJS.isEmpty(this.inputForm.createName)){
+								this.inputForm.createName=this.$store.state.user.name
+							}
+							if (this.commonJS.isEmpty(this.inputForm.officeName)){
+								this.inputForm.officeName=this.$store.state.user.office.name							}
+							if (this.commonJS.isEmpty(this.inputForm.createTime)){
+								this.inputForm.createTime=this.moment(new Date()).format('YYYY-MM-DD')
+							}
+							if (this.commonJS.isEmpty(this.inputForm.projectStatus)){
+								this.inputForm.projectStatus='1'
+							}
+							if (this.commonJS.isEmpty(this.inputForm.monthDate)){
+								this.modifiedDateTime()
+							}
+							this.inputForm.remarks=data.remarks
+							this.inputForm.files=data.files
+							console.log('s',this.inputForm)
+							this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'monthly',null,null,null,null,null)
+							this.loading = false
+						})
+				})
+			},
+			// 表单提交
+			async doSubmit(status, callback) {
+				this.loading = true
+				this.$refs['inputForm'].validate((valid) => {
+					if (valid) {
+						this.loading = true
+						console.log('form',this.inputForm)
+						this.inputForm.createTime=''
+						this.inputForm.files = this.$refs.uploadComponent.getDataList()
+						this.monthlyService.saveForm(this.inputForm).then((data) => {
+							this.visible=false
+							this.$emit('refreshList')
+						}).catch(() => {
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						})
+					} else {
+						this.loading = false
+					}
+				})
+			},
+			close() {
+				this.inputForm = {
+					id:'',
+					processList:[],
+					name:'',
+					no:'',
+					projectLeader:'',
+					projectCreateDate:'',
+					createById:'',
+					createByName:'',
+					createDate:'',
+					remarks:'',
+					files: [], // 附件信息
+					types:[], //用印类型
+					number:'', //用印份数
+					projectId:'',
+				}
+				this.visible = false
+			},
+			modifiedDateTime() {
+				const now=new Date()
+				let month =now.getMonth()+1 ; // 月份从0开始,所以需要加1
+				let year = now.getFullYear()
+				let dayOfMonth = now.getDate();
+
+				// 如果当月为12月,年份加1,月份从1开始
+				if (month === 12) {
+					// 如果当天为25号之后,月份加1
+					if (dayOfMonth > 25) {
+						year = year +1;
+						month = 1; // 月份重新从0开始
+					}
+				}else {
+					// 如果当天为25号之后,月份加1
+					if (dayOfMonth >= 25) {
+						month = month + 1;
+					}
+				}
+				if (month<10){
+					this.inputForm.monthDate = year+"-0"+month;
+				}else {
+					this.inputForm.monthDate = year+"-"+month;
+				}
+
+			},
+
+
+
+		}
+
+	}
+</script>
+<style scoped>
+	/deep/ .el-input-number .el-input__inner {
+		text-align: left;
+	}
+	/deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
+		font-weight:700;
+	}
+</style>

+ 328 - 0
src/views/jy/monthly/MonthlyList.vue

@@ -0,0 +1,328 @@
+<template>
+	<div class="page">
+		<el-form :inline="true"  v-if="searchVisible" class="query-form m-b-10" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+			<!-- 搜索框-->
+			<el-form-item  label="申请人" prop="createById">
+				<UserSelectSignatory style="width: 100%" ref="userSelect2" :limit="1"
+									 :readonly="true" :modelValue="searchForm.createById"
+									 @update:modelValue='(value) => {searchForm.createById = value}'></UserSelectSignatory>			</el-form-item>
+			<el-form-item   prop="officeId" label="申请人部门">
+				<SelectTree
+					ref="officeTree"
+					:props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+
+					:url="`/system-server/sys/office/treeData?type=2`"
+					:value="searchForm.officeId"
+					size="default"
+					:accordion="true"
+					@getValue="(value) => {searchForm.officeId=value}"/>
+			</el-form-item>
+
+			<el-form-item  label="申请时间" prop="createDates">
+				<el-date-picker
+					placement="bottom-start"
+					format="YYYY-MM-DD"
+					value-format="YYYY-MM-DD"
+					v-model="searchForm.createDates"
+					type="daterange"
+					range-separator="至"
+					start-placeholder="开始日期"
+					end-placeholder="结束日期">
+				</el-date-picker>
+			</el-form-item>
+
+			<el-form-item>
+<!--				<el-button type="default" @click="showHide" :icon="showHideIcon">{{showHideName}}</el-button>-->
+				<el-button type="primary" @click="refreshList()" icon="el-icon-search">查询</el-button>
+				<el-button @click="resetSearch()" icon="el-icon-refresh-right">重置</el-button>
+			</el-form-item>
+		</el-form>
+		<div class="jp-table top" style="">
+			<vxe-toolbar :refresh="{query: refreshList}" ref="toolbarRef" export custom>
+				<template #buttons>
+					<el-button v-if="hasPermission('monthly:add')" :disabled="isAdmin" type="primary" icon="el-icon-plus" @click="add()">新建</el-button>
+				</template>
+				<template #tools>
+					<vxe-button
+						text
+						type="primary"
+						:title="searchVisible ? '收起检索' : '展开检索'"
+						icon="vxe-icon-search"
+						class="tool-btn"
+						@click="searchVisible = !searchVisible"
+					></vxe-button>
+				</template>
+			</vxe-toolbar>
+			<div style="height: calc(100% - 90px)">
+				<vxe-table
+					border="inner"
+					auto-resize
+					resizable
+					height="auto"
+					:loading="loading"
+					ref="monthlyTable"
+					show-header-overflow
+					show-overflow
+					highlight-hover-row
+					:menu-config="{}"
+					@sort-change="sortChangeHandle"
+					:export-config="{
+									remote: true,
+									filename: `嘉溢月报数据${moment(new Date()).format('YYYY-MM-DD')}`,
+									sheetName: `嘉溢月报数据${moment(new Date()).format('YYYY-MM-DD')}`,
+									exportMethod: exportMethod,
+									types: ['xls'],
+									modes: ['current', 'selected', 'all']
+								  }"
+					:sort-config="{remote:true}"
+					:data="dataList"
+					:checkbox-config="{}">
+					<vxe-column type="seq" width="60" title="序号"></vxe-column>
+					<vxe-column min-width="160" align="center" title="月报时间" field="monthDate"></vxe-column>
+					<vxe-column min-width="160" align="center" title="月报名称" field="name">
+						<template  #default="scope">
+							<el-link  type="primary" :underline="false"  @click="view(scope.row)">{{scope.row.name}}</el-link>
+						</template>
+					</vxe-column>
+					<vxe-column min-width="160" align="center" title="申请人" field="createName"></vxe-column>
+					<vxe-column min-width="160" align="center" title="申请人部门" field="officeName"></vxe-column>
+					<vxe-column min-width="160" align="center" title="申请时间" field="createTime"></vxe-column>
+					<vxe-column title="操作" width="150px" fixed="right" align="center">
+						<template  #default="scope">
+							<div v-if="isAdmin">
+								<el-button text type="primary" size="small" v-if="scope.row.status==='0' || scope.row.status==='5'" @click="del(scope.row.id)">删除</el-button>
+								<el-button  size="small" text type="primary"  @click="adminEdit(scope.row)">修改</el-button>
+							</div>
+							<div v-else>
+								<el-button text type="primary" size="small"  @click="del(scope.row.id)">删除</el-button>
+								<el-button  size="small" text type="primary"  @click="edit(scope.row)">修改</el-button>
+							</div>
+						</template>
+					</vxe-column>
+				</vxe-table>
+				<vxe-pager
+					background
+					:current-page="tablePage.currentPage"
+					:page-size="tablePage.pageSize"
+					:total="tablePage.total"
+					:page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+					:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+					@page-change="currentChangeHandle">
+				</vxe-pager>
+
+			</div>
+		</div>
+			<MonthlyForm ref="monthlyForm" @refreshList="refreshList"></MonthlyForm>
+	</div>
+
+</template>
+
+<script>
+	import UserSelect from '@/components/userSelect'
+	import SelectTree from '@/components/treeSelect/treeSelect.vue'
+	import MonthlyService from '@/api/jy/MonthlyService'
+	import taskService from '@/api/flowable/taskService'
+	import processService from '@/api/flowable/processService'
+	import userService from '@/api/sys/userService'
+	import pick from 'lodash.pick'
+	import SupplierChooseForm from '@/views/materialManagement/supplier/SupplierChooseForm'
+	import UserSelectSignatory from '../workClientInfo/clientUserSelect'
+	import MonthlyForm from './MonthlyForm'
+	export default {
+		data () {
+			return {
+				dialogTableVisible:false,
+				searchVisible: true,
+				showHideItem: false,
+				showHideIcon: 'el-icon-arrow-down',
+				showHideName: '展示',
+				num: 0,
+				searchForm: {
+					projectId: '',
+					projectName: '',
+					outMen: '',
+					officeId: '',
+					createById: '',
+					createDates:[],
+					targetCity:''
+				},
+				dataList: [],
+				tablePage: {
+					total: 0,
+					currentPage: 1,
+					pageSize: 10,
+					orders: []
+				},
+				tableKey: '',
+				loading: false,
+				processDefinitionId: '',
+				procDefKey: '',
+				isAdmin: false,
+				create: '',
+				gridData:[],
+				typeData:[]
+			}
+		},
+		MonthlyService:null,
+		created () {
+			this.monthlyService=new MonthlyService()
+		},
+		components: {
+			SelectTree,
+			UserSelect,
+			SupplierChooseForm,
+			UserSelectSignatory,
+			MonthlyForm,
+		},
+		computed: {
+			userName () {
+				return this.$store.state.user.name
+			},
+			user () {
+				this.createName = this.$store.state.user.name
+				return this.$store.state.user
+			}
+		},
+		mounted () {
+			this.$nextTick(() => {
+				//将表格和工具栏进行关联
+				const $table = this.$refs.monthlyTable;
+				const $toolbar = this.$refs.toolbarRef;
+				$table.connect($toolbar);
+			})
+			this.refreshList()
+		},
+		activated () {
+			this.refreshList()
+		},
+		methods: {
+			showHide () {
+				if (this.showHideItem === false) {
+					this.showHideItem = true
+					this.showHideIcon = 'el-icon-arrow-up'
+					this.showHideName = '隐藏'
+				} else {
+					this.showHideItem = false
+					this.showHideIcon = 'el-icon-arrow-down'
+					this.showHideName = '展示'
+				}
+			},
+			// 新增
+			add () {
+				this.$refs.monthlyForm.init('add','')
+			},
+			// 修改
+			edit (row) {
+				this.$refs.monthlyForm.init('edit',row.id)
+			},
+			// 查看
+			view (row) {
+				this.$refs.monthlyForm.init('view',row.id);
+			},
+			// 查询当前用户是否是管理员用户
+			checkIsAdmin () {
+				userService.is().then((data) => {
+					this.isAdmin = data
+				})
+			},
+			// 获取数据列表
+			refreshList () {
+				this.loading = true
+				this.monthlyService.list({
+					'current': this.tablePage.currentPage,
+					'size': this.tablePage.pageSize,
+					'orders': this.tablePage.orders,
+					...this.searchForm
+				}).then((data) => {
+					console.log('x',data.records)
+					this.dataList = data.records
+					this.tablePage.total = data.total
+					this.tableKey = Math.random()
+					this.loading = false
+				})
+				this.checkIsAdmin()
+				processService.getByName('嘉溢-文印申请').then((data) => {
+					if (!this.commonJS.isEmpty(data.id)) {
+						this.processDefinitionId = data.id
+						this.procDefKey = data.key
+					}
+				})
+			},
+			// 当前页
+			currentChangeHandle ({ currentPage, pageSize }) {
+				this.tablePage.currentPage = currentPage
+				this.tablePage.pageSize = pageSize
+				this.refreshList()
+			},
+			// 排序
+			sortChangeHandle (column) {
+				this.tablePage.orders = []
+				if (column.order != null) {
+					this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
+				}
+				this.refreshList()
+			},
+			// 删除
+			del (id) {
+				let ids = id || this.$refs.clientTable.getCheckboxRecords().map(item => {
+					return item.id
+				}).join(',')
+				this.$confirm(`确定删除所选项吗?`, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.loading = true
+					this.monthlyService.delete(ids).then((data) => {
+						this.$message.success(data)
+						this.refreshList()
+						this.loading = false
+					})
+				})
+			},
+			resetSearch () {
+				this.$refs.searchForm.resetFields()
+				this.searchForm.projectId = '' // 重置时清空项目id
+				this.refreshList()
+			},
+
+
+			adminEdit(row){
+				this.$refs.inscriptionDia.init('edit',row.id);
+			},
+			// 自定义服务端导出
+			exportMethod ({ options }) {
+				// 传给服务端的参数
+				const params = {
+					'current': this.tablePage.currentPage,
+					'size': this.tablePage.pageSize,
+					'orders': this.tablePage.orders,
+					...this.searchForm,
+					filename: options.filename,
+					sheetName: options.sheetName,
+					isHeader: options.isHeader,
+					original: options.original,
+					mode: options.mode,
+					selectIds: options.mode === 'selected' ? options.map(item => item.id) : [],
+					exportFields: options.columns.map(column => column.property)
+				}
+				return this.monthlyService.exportFile(params).then((res) => {
+					// 将二进制流文件写入excel表,以下为重要步骤
+					this.$utils.downloadExcel(res, options.filename+ ".xls")
+				}).catch(function (err) {
+					if (err.response) {
+						console.log(err.response)
+					}
+				})
+			},
+
+
+
+
+		}
+	}
+</script>