|
|
@@ -0,0 +1,441 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="form">
|
|
|
+
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="form.datasource"
|
|
|
+ :needPage="false"
|
|
|
+ :toolkit="[]"
|
|
|
+ :minHeight="100"
|
|
|
+ :maxHeight="300"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ cache-key="eomContactPageTable"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ v-if="dialogType!=='view'"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="handleAddInfo">
|
|
|
+ 新增项目阶段
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:action="{row,$index}">
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除此信息吗?"
|
|
|
+ :disabled="form.datasource.length==1"
|
|
|
+ @confirm="handleDelInfo($index)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link
|
|
|
+ :disabled="form.datasource.length==1"
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ <template v-slot:name="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.name'"
|
|
|
+ :rules="{required:true,message:'请选择',trigger:['blur','change']}">
|
|
|
+ <el-input v-model="row.name" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:content="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.content'">
|
|
|
+ <el-input v-model="row.content" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:planStartDate="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.planStartDate'"
|
|
|
+ :rules="{required:true,message:'请选择',trigger:['blur','change']}">
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="dialogType=='view'"
|
|
|
+ v-model="row.planStartDate"
|
|
|
+ :picker-options="{disabledDate:(time)=>{return row.planEndDate&&time.getTime()>new Date(row.planEndDate)}}"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:planEndDate="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.planEndDate'"
|
|
|
+ :rules="{required:true,message:'请选择',trigger:['blur','change']}">
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="dialogType=='view'"
|
|
|
+ :picker-options="{disabledDate:(time)=>{return row.planStartDate&&time.getTime()<new Date(row.planStartDate)}}"
|
|
|
+ v-model="row.planEndDate"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:responsibleUserId="{row,$index}">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.responsibleUserId'">
|
|
|
+ <personSelect
|
|
|
+ :disabled="dialogType=='view'"
|
|
|
+ :ref="'directorRef'+$index"
|
|
|
+ v-model="row.responsibleUserId"
|
|
|
+ :init="false"
|
|
|
+ @selfChange="(val, info)=>personChange(val,info,$index)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:responsibleDeptId="{row,$index}">
|
|
|
+ <el-form-item :prop="'datasource.'+$index+'.responsibleDeptId'">
|
|
|
+ <ele-tree-select
|
|
|
+ :disabled="dialogType=='view'"
|
|
|
+ clearable
|
|
|
+ :data="deptTreeList"
|
|
|
+ :ref="'deptTreeRef'+$index"
|
|
|
+ v-model="row.responsibleDeptId"
|
|
|
+ valueKey="id"
|
|
|
+ labelKey="name"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="(id)=>changeDeptInfo(id,$index)"
|
|
|
+ default-expand-all
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:isMilepost="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item>
|
|
|
+ <el-select v-model="row.isMilepost">
|
|
|
+ <el-option label="否" :value="0"/>
|
|
|
+ <el-option label="是" :value="1"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:milepost="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input v-model="row.milepost" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:isOverTime="{ row }">
|
|
|
+ <el-tag v-if="row.isOverTime==0" type="success">正常</el-tag>
|
|
|
+ <el-tag v-else type="danger">超时</el-tag>
|
|
|
+ </template>
|
|
|
+ <template v-slot:speedPercent="{ row }">
|
|
|
+ <el-progress :stroke-width="20" text-color="#606266" :text-inside="true" :percentage="row.speedPercent||0"
|
|
|
+ :color="customColorMethod"></el-progress>
|
|
|
+ </template>
|
|
|
+ <template v-slot:remark="{row,$index}" v-if="dialogType!=='view'">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input type="textarea" v-model="row.remark" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:headerRequired="{column}">
|
|
|
+ <span class="is-required">{{ column.label }}</span>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import fileUpload from "@/components/upload/fileUpload.vue";
|
|
|
+import {getFile} from "@/api/system/file";
|
|
|
+import PersonSelect from "@/components/CommomSelect/person-select.vue";
|
|
|
+import {proStatusEnum} from "@/enum/dict";
|
|
|
+
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "projectInfoTable",
|
|
|
+ components: {
|
|
|
+ PersonSelect,
|
|
|
+ fileUpload,
|
|
|
+
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ dialogForm: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ ...this.form
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dialogType: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ deptList: {
|
|
|
+ type: Array,
|
|
|
+ default() {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deptTreeList: {
|
|
|
+ type: Array,
|
|
|
+ default() {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ dialogForm: {
|
|
|
+ handler(val) {
|
|
|
+ this.form.datasource = this.dialogForm.stageList
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
+ this.getUserList(item.responsibleDeptId,index);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ editIndex: undefined,//当前修改数据的下标
|
|
|
+ form: {
|
|
|
+ datasource: []
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ columns() {
|
|
|
+ let list = [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '阶段名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 120,
|
|
|
+ slot: 'name',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'content',
|
|
|
+ label: '阶段说明',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 120,
|
|
|
+ slot: 'content',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planStartDate',
|
|
|
+ label: '开始时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 170,
|
|
|
+ slot: 'planStartDate',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planEndDate',
|
|
|
+ label: '结束时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 170,
|
|
|
+ slot: 'planEndDate',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'realStartTime',
|
|
|
+ label: '实际开始时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 170,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'realEndTime',
|
|
|
+ label: '实际结束时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 170,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'responsibleDeptId',
|
|
|
+ label: '负责部门',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ slot: 'responsibleDeptId',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'responsibleUserId',
|
|
|
+ label: '负责人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ slot: 'responsibleUserId',
|
|
|
+ headerSlot: 'headerRequired',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'remark',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'isOverTime',
|
|
|
+ label: '是否超时',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100,
|
|
|
+ slot: 'isOverTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'speedPercent',
|
|
|
+ label: '进度',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 150,
|
|
|
+ slot: 'speedPercent'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'status',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return proStatusEnum[_row.status].label;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ ]
|
|
|
+ let action = [{
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ label: '操作',
|
|
|
+ resizable: false,
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'right'
|
|
|
+ },]
|
|
|
+ this.dialogType === 'view' ? list = [...list] : list = [...list, ...action]
|
|
|
+ return list
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ // 选择负责人部门
|
|
|
+ changeDeptInfo(id, index) {
|
|
|
+ const info = this.deptList.find((e) => e.id == id) || {};
|
|
|
+
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleDeptName', info.name);
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleUserId', '');
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleUserName', '');
|
|
|
+ this.getUserList(id, index);
|
|
|
+ },
|
|
|
+ // 获取人员数据
|
|
|
+ getUserList(groupId, index) {
|
|
|
+ if (groupId) {
|
|
|
+ this.$refs['directorRef' + index].getList({groupId});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ personChange(val, info, index) {
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
|
|
|
+ },
|
|
|
+ downloadFile(file) {
|
|
|
+ getFile({objectName: file.storePath}, file.name);
|
|
|
+ },
|
|
|
+ //新增计划数据
|
|
|
+ handleAddInfo() {
|
|
|
+ this.form.datasource.push(
|
|
|
+ {
|
|
|
+ milepost: '',
|
|
|
+ isMilepost: 0,
|
|
|
+ responsibleUserId: '',
|
|
|
+ responsibleUserName: '',
|
|
|
+ responsibleDeptId: '',
|
|
|
+ responsibleDeptName: '',
|
|
|
+ planStartDate: '',
|
|
|
+ planEndDate: '',
|
|
|
+ name: '',
|
|
|
+ content: '',
|
|
|
+ status: 0,
|
|
|
+ isOverTime: 0,
|
|
|
+ speedPercent: 0,
|
|
|
+ remark: '',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ //
|
|
|
+ clearData() {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
+ this.$set(this.form.datasource[index], 'milepost', '')
|
|
|
+ this.$set(this.form.datasource[index], 'isMilepost', 0)
|
|
|
+ this.$set(this.form.datasource[index], 'isOverTime', 0)
|
|
|
+ this.$set(this.form.datasource[index], 'speedPercent', 0)
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleUserId', '')
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleUserName', '')
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleDeptId', '')
|
|
|
+ this.$set(this.form.datasource[index], 'responsibleDeptName', '')
|
|
|
+ this.$set(this.form.datasource[index], 'planStartDate', '')
|
|
|
+ this.$set(this.form.datasource[index], 'planEndDate', '')
|
|
|
+ this.$set(this.form.datasource[index], 'name', '')
|
|
|
+ this.$set(this.form.datasource[index], 'content', '')
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //删除关联信息数据
|
|
|
+ handleDelInfo(index) {
|
|
|
+ this.form.datasource.splice(index, 1)
|
|
|
+ },
|
|
|
+ customColorMethod(percentage) {
|
|
|
+ if (percentage < 30) {
|
|
|
+ return '#909399';
|
|
|
+ } else if (percentage < 70) {
|
|
|
+ return '#e6a23c';
|
|
|
+ } else {
|
|
|
+ return '#67c23a';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getTableValidate() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (this.form.datasource.length == 0) return this.$message.warning('请填写计划节点')
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ this.$message.warning('有必填项未填,请检查')
|
|
|
+ reject('有必填项未填,请检查')
|
|
|
+ } else {
|
|
|
+ resolve(this.form.datasource)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+:deep(.el-form-item) {
|
|
|
+ margin-bottom: 0;
|
|
|
+}
|
|
|
+</style>
|