项目管理

This commit is contained in:
cwchen 2025-09-11 18:16:50 +08:00
parent f717f2ecd2
commit ea33da7442
4 changed files with 344 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import request from '@/utils/request'
// 查询项目数据列表
export function getProListAPI(data) {
return request({
url: '/smartArchives/project/getProjectList',
method: 'GET',
params: data,
})
}

View File

@ -0,0 +1,37 @@
export const formLabel = [
{
isShow: false, // 是否展示label
f_type: 'ipt',
f_label: '项目名称',
f_model: 'proName',
f_max: 32,
},
{
isShow: false, // 是否展示label
f_type: 'sel',
f_label: '项目类型',
f_model: 'proType',
f_selList: [],
f_dict: 'pro_type',
},
{
isShow: false, // 是否展示label
f_type: 'sel',
f_label: '电压等级',
f_model: 'voltageLevel',
f_selList: [],
f_dict: 'voltage_level',
},
]
export const columnsList = [
{ t_props: 'proName', t_label: '项目名称' },
{ t_props: 'singleProName', t_label: '单项工程名称' },
{ t_props: 'proTypeName', t_label: '工程类型' },
{ t_props: 'voltageLevelName', t_label: '电压等级' },
{ t_props: 'planStartDate', t_label: '计划开工日期' },
{ t_props: 'planEndDate', t_label: '计划竣工日期' },
{ t_props: 'planTcDate', t_label: '计划投产日期' },
{ t_props: 'proStatusName', t_label: '工程状态' },
{ t_slot: 'contentsName', t_label: '匹配档案目录类型' },
]

View File

@ -0,0 +1,109 @@
<template>
<!-- 项目管理 -->
<div class="app-container">
<TableModel :formLabel="formLabel" :showOperation="true" :showRightTools="true" ref="proTableRef"
:columnsList="columnsList" :request-api="getProListAPI">
<template slot="contentsName" slot-scope="{ data }">
<el-tag
size="mini"
:type="data.contentsName ? 'success' : 'danger'"
>
{{ data.contentsName ? data.contentsName : '未配置' }}
</el-tag>
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['data:classify:update']"
@click="handleUpdate(data)">
配置档案类型
</el-button>
</template>
</TableModel>
<!-- 新增/编辑 -->
<DataClassForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
</div>
</template>
<script>
import TableModel from '@/components/TableModel'
import { columnsList, formLabel } from './config'
import {
getProListAPI
} from '@/api/archivesManagement/project'
import DataClassForm from './prop/dataClassForm'
export default {
name: 'DataClassManage',
dicts:['pro_type','voltage_level'],
components: {
TableModel,
DataClassForm
},
data() {
return {
formLabel,
columnsList,
getProListAPI,
title: "",
isflag: false,
isAdd: '',
row: {},
loading: false,
}
},
created() {
//
if (Array.isArray(this.formLabel)) {
this.formLabel.forEach((item) => {
if (item.f_dict && this.dict && this.dict.type && this.dict.type[item.f_dict]) {
this.$set(item, 'f_selList', this.dict.type[item.f_dict])
}
})
}
},
methods: {
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
/** 配置档案类型 */
handleUpdate(row) {
this.title = "配置档案类型";
this.isAdd = 'edit';
this.row = row;
this.isflag = true;
},
/* 搜索操作 */
handleQuery() {
this.$refs.proTableRef.getTableList()
},
/** 删除操作 */
handleDelete(row) {
this.$modal.confirm(`是否确认删除数据类型名称为"${row.dataTypeName}"的数据项?`).then(() => {
//
this.$modal.loading("正在删除,请稍候...");
deleteDataClassAPI({ id: row.id }).then(res => {
this.$modal.closeLoading();
if (res.code === 200) {
this.$modal.msgSuccess("删除成功");
this.handleQuery();
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.$modal.closeLoading();
this.$modal.msgError("删除失败,请重试");
console.error('删除失败:', error);
});
}).catch(() => {
//
});
},
},
}
</script>

View File

@ -0,0 +1,187 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
<el-form-item label="数据类型名称" prop="dataTypeName">
<el-input class="form-item" v-model="form.dataTypeName" clearable show-word-limit
placeholder="请输入数据类型名称" maxlength="32"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.remark" clearable show-word-limit placeholder="请输入备注" maxlength="255"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled"
@click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</template>
<script>
import _ from 'lodash'
import {
addDataClassAPI,
updateDataClassAPI,
} from '@/api/data-collect/data-class-manage'
export default {
name: "DataClassForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
dataTypeName: '',
remark: '',
},
loading: null,
rules: {
dataTypeName: [
{ required: true, message: '数据类型名称不能为空', trigger: 'blur' }
],
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
//
this.form = {
dataTypeName: this.rowData.dataTypeName || '',
remark: this.rowData.remark || '',
};
} else {
//
this.form = {
dataTypeName: '',
remark: '',
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**重置表单*/
reset() {
this.form = {
dataTypeName: '',
remark: '',
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
const data = {
dataTypeName: params.dataTypeName,
remark: params.remark,
}
if (this.isAdd === 'add') {
addDataClassAPI(data).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
} else {
const data = {
dataTypeName: params.dataTypeName,
remark: params.remark,
id: this.rowData.id,
}
updateDataClassAPI(data).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
}
}
});
}
}
};
</script>
<style lang="scss">
.w700 .el-dialog {
width: 700px;
}
.w500 .el-dialog {
width: 500px;
}
.w500 .el-dialog__header,
.w700 .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
}
.form-item {
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
}
</style>