|
|
@@ -250,399 +250,415 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-
|
|
|
<script>
|
|
|
-import { mapGetters } from 'vuex';
|
|
|
-import { getByCode } from '@/api/system/dictionary-data';
|
|
|
-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';
|
|
|
-import { listOrganizations } from '@/api/system/organization';
|
|
|
-// import { deepClone } from '@/utils';
|
|
|
-import { deepClone } from '@/components/FormGenerator/utils/index';
|
|
|
-import {
|
|
|
- projectsstageSave,
|
|
|
- projectsstageSaveBatch,
|
|
|
- projectsGetByIdDetailsAPI,
|
|
|
- projectsStageUpdateAPI,
|
|
|
- projectsStageDeleteAPI
|
|
|
-} from '@/api/project-manage';
|
|
|
+ import { mapGetters } from 'vuex';
|
|
|
+ import { getByCode } from '@/api/system/dictionary-data';
|
|
|
+ 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';
|
|
|
+ import { listOrganizations } from '@/api/system/organization';
|
|
|
+ // import { deepClone } from '@/utils';
|
|
|
+ import { deepClone } from '@/components/FormGenerator/utils/index';
|
|
|
+ import {
|
|
|
+ projectsstageSave,
|
|
|
+ projectsstageSaveBatch,
|
|
|
+ projectsGetByIdDetailsAPI,
|
|
|
+ projectsStageUpdateAPI,
|
|
|
+ projectsStageDeleteAPI
|
|
|
+ } from '@/api/project-manage';
|
|
|
|
|
|
-export default {
|
|
|
- name: 'stageInfoTable',
|
|
|
- components: {
|
|
|
- PersonSelect,
|
|
|
- fileUpload
|
|
|
- },
|
|
|
- props: {
|
|
|
- responsibleDeptId: {
|
|
|
- type: String
|
|
|
- },
|
|
|
- dialogForm: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {
|
|
|
- ...this.form
|
|
|
- };
|
|
|
- }
|
|
|
- },
|
|
|
- dialogType: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
+ export default {
|
|
|
+ name: 'stageInfoTable',
|
|
|
+ components: {
|
|
|
+ PersonSelect,
|
|
|
+ fileUpload
|
|
|
},
|
|
|
- deptList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
- }
|
|
|
- },
|
|
|
- userList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
+ props: {
|
|
|
+ responsibleDeptId: {
|
|
|
+ type: String
|
|
|
+ },
|
|
|
+ dialogForm: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ ...this.form
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dialogType: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ deptList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deptTreeList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- deptTreeList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- dialogForm: {
|
|
|
- handler(val) {
|
|
|
- this.form.datasource = deepClone(this.dialogForm.stageList) || [];
|
|
|
- this.form.datasource.forEach((item) => {
|
|
|
- this.$set(item, 'isEdit', true);
|
|
|
- });
|
|
|
- this.$nextTick(async () => {
|
|
|
- if (this.dialogType === 'view') return;
|
|
|
+ watch: {
|
|
|
+ dialogForm: {
|
|
|
+ handler(val) {
|
|
|
+ this.form.datasource = deepClone(this.dialogForm.stageList) || [];
|
|
|
this.form.datasource.forEach((item) => {
|
|
|
this.$set(item, 'isEdit', true);
|
|
|
});
|
|
|
- });
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ if (this.dialogType === 'view') return;
|
|
|
+ this.form.datasource.forEach((item) => {
|
|
|
+ this.$set(item, 'isEdit', true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
},
|
|
|
- deep: true
|
|
|
- },
|
|
|
- deptList: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- console.log('bianhua');
|
|
|
+ deptList: {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ console.log('bianhua');
|
|
|
|
|
|
- console.log(newValue, oldValue);
|
|
|
- },
|
|
|
- deep: true
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- editIndex: undefined, //当前修改数据的下标
|
|
|
- form: {
|
|
|
- datasource: []
|
|
|
- },
|
|
|
- responceUserList: []
|
|
|
- };
|
|
|
- },
|
|
|
- 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: 'responsibleDeptName',
|
|
|
- // label: '负责部门',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 130,
|
|
|
- // slot: 'responsibleDeptId',
|
|
|
- // headerSlot: 'headerRequired',
|
|
|
- // },
|
|
|
- {
|
|
|
- prop: 'responsibleUserNames',
|
|
|
- label: '负责人',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 200,
|
|
|
- slot: 'responsibleUserId',
|
|
|
- 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
|
|
|
+ console.log(newValue, oldValue);
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'remark',
|
|
|
- label: '备注',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 160,
|
|
|
- slot: 'remark'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'isOverTime',
|
|
|
- label: '是否超时',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 100,
|
|
|
- slot: 'isOverTime'
|
|
|
- },
|
|
|
- // {
|
|
|
- // prop: 'proportion',
|
|
|
- // label: '权重占比(%)',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110,
|
|
|
- // slot: 'proportion'
|
|
|
- // },
|
|
|
- {
|
|
|
- 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[cellValue].label;
|
|
|
- }
|
|
|
- }
|
|
|
- ];
|
|
|
- let action = [
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- slot: 'action',
|
|
|
- label: '操作',
|
|
|
- resizable: false,
|
|
|
- minWidth: 180,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'right'
|
|
|
- }
|
|
|
- ];
|
|
|
- this.dialogType === 'view'
|
|
|
- ? (list = [...list])
|
|
|
- : (list = [...list, ...action]);
|
|
|
- return list;
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 选择负责人部门
|
|
|
- changeDeptInfo(id, index) {
|
|
|
- console.log(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, index) {
|
|
|
- const info = this.userList.find((e) => e.id == val) || {};
|
|
|
- console.log(val, info, index);
|
|
|
- console.log(this.dialogForm);
|
|
|
- this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
|
|
|
- // this.$set(
|
|
|
- // this.form.datasource[index],
|
|
|
- // 'responsibleDeptName',
|
|
|
- // this.dialogForm.responsibleDeptName
|
|
|
- // );
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
},
|
|
|
- // personChange(val, index) {
|
|
|
- //
|
|
|
- // // this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
|
|
|
- // },
|
|
|
- downloadFile(file) {
|
|
|
- getFile({ objectName: file.storePath }, file.name);
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ editIndex: undefined, //当前修改数据的下标
|
|
|
+ form: {
|
|
|
+ datasource: []
|
|
|
+ },
|
|
|
+ responceUserList: [],
|
|
|
+ addFlag: false
|
|
|
+ };
|
|
|
},
|
|
|
- //新增计划数据
|
|
|
- handleAddInfo() {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.form.datasource.push({
|
|
|
- projectId: localStorage.getItem('projectId'),
|
|
|
- milepost: '',
|
|
|
- isMilepost: 0,
|
|
|
- responsibleUserList: [],
|
|
|
- responsibleUserId: '',
|
|
|
- responsibleDeptId: this.responsibleDeptId,
|
|
|
- responsibleDeptName: this.dialogForm.responsibleDeptName,
|
|
|
- planStartDate: '',
|
|
|
- planEndDate: '',
|
|
|
- name: '',
|
|
|
- content: '',
|
|
|
- status: 0,
|
|
|
- isOverTime: 0,
|
|
|
- speedPercent: 0,
|
|
|
- remark: ''
|
|
|
- });
|
|
|
- console.log(this.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: 'responsibleDeptName',
|
|
|
+ // label: '负责部门',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 130,
|
|
|
+ // slot: 'responsibleDeptId',
|
|
|
+ // headerSlot: 'headerRequired',
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ prop: 'responsibleUserNames',
|
|
|
+ label: '负责人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200,
|
|
|
+ slot: 'responsibleUserId',
|
|
|
+ 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: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'remark'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'isOverTime',
|
|
|
+ label: '是否超时',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100,
|
|
|
+ slot: 'isOverTime'
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // prop: 'proportion',
|
|
|
+ // label: '权重占比(%)',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 110,
|
|
|
+ // slot: 'proportion'
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ 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[cellValue].label;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ let action = [
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ label: '操作',
|
|
|
+ resizable: false,
|
|
|
+ minWidth: 180,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ this.dialogType === 'view'
|
|
|
+ ? (list = [...list])
|
|
|
+ : (list = [...list, ...action]);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
},
|
|
|
- //
|
|
|
- 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);
|
|
|
+ methods: {
|
|
|
+ // 选择负责人部门
|
|
|
+ changeDeptInfo(id, index) {
|
|
|
+ console.log(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.$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', '');
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- //删除关联信息数据
|
|
|
- async handleDelInfo(row, index) {
|
|
|
- if (!row.id) {
|
|
|
- this.form.datasource.splice(index, 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- const res = await projectsStageDeleteAPI([row.id]);
|
|
|
- this.init();
|
|
|
- },
|
|
|
- customColorMethod(percentage) {
|
|
|
- if (percentage < 30) {
|
|
|
- return '#909399';
|
|
|
- } else if (percentage < 70) {
|
|
|
- return '#e6a23c';
|
|
|
- } else {
|
|
|
- return '#67c23a';
|
|
|
- }
|
|
|
- },
|
|
|
- async save() {
|
|
|
- let form = await this.getTableValidate();
|
|
|
- let saveForm = form.filter((item) => !item.id);
|
|
|
- console.log(form);
|
|
|
- const res = await projectsstageSaveBatch(saveForm);
|
|
|
+ // this.getUserList(id, index);
|
|
|
+ },
|
|
|
+ // 获取人员数据
|
|
|
+ getUserList(groupId, index) {
|
|
|
+ // if (groupId) {
|
|
|
+ // this.$refs['directorRef' + index].getList({groupId});
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ personChange(val, index) {
|
|
|
+ const info = this.userList.find((e) => e.id == val) || {};
|
|
|
+ console.log(val, info, index);
|
|
|
+ console.log(this.dialogForm);
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'responsibleUserName',
|
|
|
+ info.name
|
|
|
+ );
|
|
|
+ // this.$set(
|
|
|
+ // this.form.datasource[index],
|
|
|
+ // 'responsibleDeptName',
|
|
|
+ // this.dialogForm.responsibleDeptName
|
|
|
+ // );
|
|
|
+ },
|
|
|
+ // personChange(val, index) {
|
|
|
+ //
|
|
|
+ // // this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
|
|
|
+ // },
|
|
|
+ downloadFile(file) {
|
|
|
+ getFile({ objectName: file.storePath }, file.name);
|
|
|
+ },
|
|
|
+ //新增计划数据
|
|
|
+ handleAddInfo() {
|
|
|
+ this.addFlag = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.form.datasource.push({
|
|
|
+ projectId: localStorage.getItem('projectId'),
|
|
|
+ milepost: '',
|
|
|
+ isMilepost: 0,
|
|
|
+ responsibleUserList: [],
|
|
|
+ responsibleUserId: '',
|
|
|
+ responsibleDeptId: this.responsibleDeptId,
|
|
|
+ responsibleDeptName: this.dialogForm.responsibleDeptName,
|
|
|
+ planStartDate: '',
|
|
|
+ planEndDate: '',
|
|
|
+ name: '',
|
|
|
+ content: '',
|
|
|
+ status: 0,
|
|
|
+ isOverTime: 0,
|
|
|
+ speedPercent: 0,
|
|
|
+ remark: ''
|
|
|
+ });
|
|
|
+ console.log(this.form.datasource);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //
|
|
|
+ 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', '');
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- if (res) {
|
|
|
+ //删除关联信息数据
|
|
|
+ async handleDelInfo(row, index) {
|
|
|
+ if (!row.id) {
|
|
|
+ this.form.datasource.splice(index, 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await projectsStageDeleteAPI([row.id]);
|
|
|
this.init();
|
|
|
- }
|
|
|
- },
|
|
|
- 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);
|
|
|
- }
|
|
|
+ },
|
|
|
+ customColorMethod(percentage) {
|
|
|
+ if (percentage < 30) {
|
|
|
+ return '#909399';
|
|
|
+ } else if (percentage < 70) {
|
|
|
+ return '#e6a23c';
|
|
|
+ } else {
|
|
|
+ return '#67c23a';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async save() {
|
|
|
+ let form = await this.getTableValidate();
|
|
|
+ let saveForm = form.filter((item) => !item.id);
|
|
|
+ console.log(form);
|
|
|
+ const res = await projectsstageSaveBatch(saveForm);
|
|
|
+
|
|
|
+ if (res) {
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- init() {
|
|
|
- this.$nextTick(async () => {
|
|
|
- const res = await projectsGetByIdDetailsAPI(
|
|
|
- localStorage.getItem('projectId')
|
|
|
- );
|
|
|
- console.log(res);
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ const res = await projectsGetByIdDetailsAPI(
|
|
|
+ localStorage.getItem('projectId')
|
|
|
+ );
|
|
|
+ console.log(res);
|
|
|
|
|
|
- this.form.datasource = res.allStageList || [];
|
|
|
- this.form.datasource.forEach((item) => {
|
|
|
- this.$set(item, 'isEdit', true);
|
|
|
+ this.form.datasource = res.allStageList || [];
|
|
|
+ this.form.datasource.forEach((item) => {
|
|
|
+ this.$set(item, 'isEdit', true);
|
|
|
+ });
|
|
|
+ console.log(this.form);
|
|
|
});
|
|
|
- console.log(this.form);
|
|
|
- });
|
|
|
|
|
|
- // projectsGetByIdDetailsAPI
|
|
|
- // this.form.datasource=
|
|
|
- },
|
|
|
- editFn(row, index) {
|
|
|
- console.log('xiugai', index, this.form.datasource);
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$set(this.form.datasource[index], 'isEdit', false);
|
|
|
- });
|
|
|
- },
|
|
|
- async updateFn() {
|
|
|
- let form = await this.getTableValidate();
|
|
|
- let updateForm = form.filter((item) => !item.isEdit);
|
|
|
- console.log(updateForm);
|
|
|
+ // projectsGetByIdDetailsAPI
|
|
|
+ // this.form.datasource=
|
|
|
+ },
|
|
|
+ editFn(row, index) {
|
|
|
+ console.log('xiugai', index, this.form.datasource);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$set(this.form.datasource[index], 'isEdit', false);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async updateFn() {
|
|
|
+ let form = await this.getTableValidate();
|
|
|
+ let findItem = form.find((item) => !item.id);
|
|
|
+ console.log(findItem);
|
|
|
|
|
|
- // const res = await projectsStageUpdateAPI(updateForm[0]);
|
|
|
+ if(findItem){
|
|
|
+ this.$message('请先保存新增的数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let updateForm = form.filter((item) => !item.isEdit);
|
|
|
+ console.log(updateForm);
|
|
|
|
|
|
- for (const item of updateForm) {
|
|
|
- await projectsStageUpdateAPI(item);
|
|
|
- }
|
|
|
- this.init();
|
|
|
+ // const res = await projectsStageUpdateAPI(updateForm[0]);
|
|
|
+
|
|
|
+ for (const item of updateForm) {
|
|
|
+ await projectsStageUpdateAPI(item);
|
|
|
+ }
|
|
|
+ this.init();
|
|
|
|
|
|
- // const res = await projectsStageUpdateAPI(saveForm);
|
|
|
+ // const res = await projectsStageUpdateAPI(saveForm);
|
|
|
|
|
|
- // if (res) {
|
|
|
- // this.init();
|
|
|
- // }
|
|
|
+ // if (res) {
|
|
|
+ // this.init();
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.init();
|
|
|
}
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.init();
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
-
|
|
|
<style scoped lang="scss">
|
|
|
-:deep(.el-form-item) {
|
|
|
- margin-bottom: 0;
|
|
|
-}
|
|
|
+ :deep(.el-form-item) {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
</style>
|