|
@@ -1,290 +1,190 @@
|
1
|
|
-
|
|
1
|
+<!--
|
|
2
|
+ * @Author: ysh
|
|
3
|
+ * @Date: 2024-02-27 14:49:15
|
|
4
|
+ * @LastEditors: Please set LastEditors
|
|
5
|
+ * @LastEditTime: 2024-02-27 17:12:57
|
|
6
|
+-->
|
2
|
7
|
<template>
|
3
|
|
- <div class="app-container">
|
4
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
5
|
|
- <el-form-item label="项目编号" prop="projectNumber">
|
6
|
|
- <el-input
|
7
|
|
- v-model="queryParams.projectNumber"
|
8
|
|
- placeholder="请输入项目编号"
|
9
|
|
- clearable
|
10
|
|
- @keyup.enter.native="handleQuery"
|
11
|
|
- />
|
12
|
|
- </el-form-item>
|
13
|
|
- <el-form-item label="项目名称" prop="projectName">
|
14
|
|
- <el-input
|
15
|
|
- v-model="queryParams.projectName"
|
16
|
|
- placeholder="请输入项目名称"
|
17
|
|
- clearable
|
18
|
|
- @keyup.enter.native="handleQuery"
|
19
|
|
- />
|
20
|
|
- </el-form-item>
|
21
|
|
- <el-form-item label="项目负责人" prop="projectLeader">
|
22
|
|
- <el-input
|
23
|
|
- v-model="queryParams.projectLeader"
|
24
|
|
- placeholder="请输入项目负责人"
|
25
|
|
- clearable
|
26
|
|
- @keyup.enter.native="handleQuery"
|
27
|
|
- />
|
28
|
|
- </el-form-item>
|
29
|
|
- <el-form-item label="项目状态" prop="isFinished">
|
30
|
|
- <el-input
|
31
|
|
- v-model="queryParams.isFinished"
|
32
|
|
- placeholder="请输入项目状态"
|
33
|
|
- clearable
|
34
|
|
- @keyup.enter.native="handleQuery"
|
35
|
|
- />
|
36
|
|
- </el-form-item>
|
37
|
|
- <el-form-item>
|
38
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
39
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
40
|
|
- </el-form-item>
|
41
|
|
- </el-form>
|
42
|
|
-
|
43
|
|
- <el-row :gutter="10" class="mb8">
|
44
|
|
- <el-col :span="1.5">
|
45
|
|
- <el-button
|
46
|
|
- type="primary"
|
47
|
|
- plain
|
48
|
|
- icon="el-icon-plus"
|
49
|
|
- size="mini"
|
50
|
|
- @click="handleAdd"
|
51
|
|
- v-hasPermi="['oa:project:add']"
|
52
|
|
- >新增</el-button>
|
53
|
|
- </el-col>
|
54
|
|
- <el-col :span="1.5">
|
55
|
|
- <el-button
|
56
|
|
- type="success"
|
57
|
|
- plain
|
58
|
|
- icon="el-icon-edit"
|
59
|
|
- size="mini"
|
60
|
|
- :disabled="single"
|
61
|
|
- @click="handleUpdate"
|
62
|
|
- v-hasPermi="['oa:project:edit']"
|
63
|
|
- >修改</el-button>
|
64
|
|
- </el-col>
|
65
|
|
- <el-col :span="1.5">
|
66
|
|
- <el-button
|
67
|
|
- type="danger"
|
68
|
|
- plain
|
69
|
|
- icon="el-icon-delete"
|
70
|
|
- size="mini"
|
71
|
|
- :disabled="multiple"
|
72
|
|
- @click="handleDelete"
|
73
|
|
- v-hasPermi="['oa:project:remove']"
|
74
|
|
- >删除</el-button>
|
75
|
|
- </el-col>
|
76
|
|
- <el-col :span="1.5">
|
77
|
|
- <el-button
|
78
|
|
- type="warning"
|
79
|
|
- plain
|
80
|
|
- icon="el-icon-download"
|
81
|
|
- size="mini"
|
82
|
|
- @click="handleExport"
|
83
|
|
- v-hasPermi="['oa:project:export']"
|
84
|
|
- >导出</el-button>
|
85
|
|
- </el-col>
|
86
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
87
|
|
- </el-row>
|
88
|
|
-
|
89
|
|
- <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
|
90
|
|
- <el-table-column type="selection" width="55" align="center" />
|
91
|
|
- <el-table-column label="项目编号" align="center" prop="projectNumber" />
|
92
|
|
- <el-table-column label="项目名称" align="center" prop="projectName" />
|
93
|
|
- <el-table-column label="项目负责人" align="center" prop="projectLeader" />
|
94
|
|
- <el-table-column label="项目状态" align="center" prop="isFinished" ></el-table-column>
|
95
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
96
|
|
- <template slot-scope="scope">
|
97
|
|
- <el-button
|
98
|
|
- size="mini"
|
99
|
|
- type="text"
|
100
|
|
- icon="el-icon-edit"
|
101
|
|
- @click="handleUpdate(scope.row)"
|
102
|
|
- v-hasPermi="['oa:project:edit']"
|
103
|
|
- >修改</el-button>
|
104
|
|
- <el-button
|
105
|
|
- size="mini"
|
106
|
|
- type="text"
|
107
|
|
- icon="el-icon-delete"
|
108
|
|
- @click="handleDelete(scope.row)"
|
109
|
|
- v-hasPermi="['oa:project:remove']"
|
110
|
|
- >删除</el-button>
|
111
|
|
- </template>
|
112
|
|
- </el-table-column>
|
113
|
|
- </el-table>
|
114
|
|
-
|
115
|
|
- <pagination
|
116
|
|
- v-show="total>0"
|
117
|
|
- :total="total"
|
118
|
|
- :page.sync="queryParams.pageNum"
|
119
|
|
- :limit.sync="queryParams.pageSize"
|
120
|
|
- @pagination="getList"
|
121
|
|
- />
|
122
|
|
-
|
123
|
|
- <!-- 添加或修改项目管理对话框 -->
|
124
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
125
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
8
|
+ <div class="project-wrapper">
|
|
9
|
+ <!-- 搜索栏 -->
|
|
10
|
+ <el-row>
|
|
11
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="88px">
|
126
|
12
|
<el-form-item label="项目编号" prop="projectNumber">
|
127
|
|
- <el-input v-model="form.projectNumber" placeholder="请输入项目编号" />
|
|
13
|
+ <el-input v-model="queryParams.projectNumber" placeholder="请输入项目编号" clearable
|
|
14
|
+ @keyup.enter.native="handleQuery" />
|
|
15
|
+ </el-form-item>
|
|
16
|
+ <el-form-item label="项目负责人" prop="projectLeader">
|
|
17
|
+ <el-input v-model="queryParams.projectLeader" placeholder="请输入项目负责人" clearable
|
|
18
|
+ @keyup.enter.native="handleQuery" />
|
128
|
19
|
</el-form-item>
|
129
|
20
|
<el-form-item label="项目名称" prop="projectName">
|
130
|
|
- <el-input v-model="form.projectName" placeholder="请输入项目名称" />
|
|
21
|
+ <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" />
|
131
|
22
|
</el-form-item>
|
132
|
|
- <el-form-item label="项目负责人" prop="projectLeader">
|
133
|
|
- <el-input v-model="form.projectLeader" placeholder="请输入项目负责人" />
|
|
23
|
+ <el-form-item>
|
|
24
|
+ <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
25
|
+ </el-form-item>
|
|
26
|
+ </el-form>
|
|
27
|
+ </el-row>
|
|
28
|
+ <!-- 项目统计 -->
|
|
29
|
+ <el-row>
|
|
30
|
+ <el-col>
|
|
31
|
+ <el-row :gutter="10">
|
|
32
|
+ <el-col :span="8">
|
|
33
|
+ <el-card>
|
|
34
|
+ <el-col :span="12">
|
|
35
|
+ <div>项目数量</div>
|
|
36
|
+ <h2>127</h2>
|
|
37
|
+ </el-col>
|
|
38
|
+ <el-col :span="12"></el-col>
|
|
39
|
+ </el-card>
|
|
40
|
+ </el-col>
|
|
41
|
+ <el-col :span="8">
|
|
42
|
+ <el-card>
|
|
43
|
+ <el-col :span="12">
|
|
44
|
+ <div>预算金额</div>
|
|
45
|
+ <h2>679999</h2>
|
|
46
|
+ </el-col>
|
|
47
|
+ <el-col :span="12"></el-col>
|
|
48
|
+ </el-card>
|
|
49
|
+ </el-col>
|
|
50
|
+ <el-col :span="8">
|
|
51
|
+ <el-card>
|
|
52
|
+ <el-col :span="12">
|
|
53
|
+ <div>项目成本</div>
|
|
54
|
+ <h2>679999</h2>
|
|
55
|
+ </el-col>
|
|
56
|
+ <el-col :span="12"></el-col>
|
|
57
|
+ </el-card>
|
|
58
|
+ </el-col>
|
|
59
|
+ </el-row>
|
|
60
|
+ </el-col>
|
|
61
|
+ </el-row>
|
|
62
|
+ <!-- 项目列表 -->
|
|
63
|
+ <el-card style="margin-top: 20px;">
|
|
64
|
+ <div slot="header" class="card-header">
|
|
65
|
+ <div style="font-weight: bold;font-size: 20px;">项目列表</div>
|
|
66
|
+ <div>
|
|
67
|
+ <el-button style="float: right;margin-right: 10px;" type="warning" size="mini" icon="el-icon-plus"
|
|
68
|
+ @click="handleAdd">新增项目</el-button>
|
|
69
|
+ </div>
|
|
70
|
+ </div>
|
|
71
|
+ <el-table v-loading="loading" :data="projectList" style="margin-top: 30px;" header-row-class-name="table-header">
|
|
72
|
+ <el-table-column type="index" width="50">
|
|
73
|
+ </el-table-column>
|
|
74
|
+ <el-table-column prop="isFinshed" label="状态" width="90px">
|
|
75
|
+ <template slot-scope="scope">
|
|
76
|
+ <el-tag :type="scope.row.isFinished === '0' ? 'success' : 'warning'" disable-transitions>
|
|
77
|
+ {{ scope.row.isFinished == '0' ? '进行中' : '已结束' }}
|
|
78
|
+ </el-tag>
|
|
79
|
+ </template>
|
|
80
|
+ </el-table-column>
|
|
81
|
+ <el-table-column label="项目编号" align="center" key="projectNumber" prop="projectNumber" />
|
|
82
|
+ <el-table-column label="项目名称" align="center" key="projectName" prop="projectName" />
|
|
83
|
+ <el-table-column label="项目负责人" align="center" key="projectLeader" prop="projectLeader" />
|
|
84
|
+ <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
|
|
85
|
+ <template slot-scope="scope" v-if="scope.row.userId !== 1">
|
|
86
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
87
|
+ v-hasPermi="['system:user:edit']">修改</el-button>
|
|
88
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
89
|
+ v-hasPermi="['system:user:remove']">删除</el-button>
|
|
90
|
+ </template>
|
|
91
|
+ </el-table-column>
|
|
92
|
+ </el-table>
|
|
93
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
94
|
+ @pagination="getList" />
|
|
95
|
+ </el-card>
|
|
96
|
+ <!-- 新建项目 -->
|
|
97
|
+ <el-dialog :title="title" :visible.sync="addOpen" :rules="rules" append-to-body>
|
|
98
|
+ <el-form :model="addForm" label-width="100px">
|
|
99
|
+ <el-form-item label="项目编号:" prop="projectNumber">
|
|
100
|
+ <el-input v-model="addForm.projectNumber"></el-input>
|
|
101
|
+ </el-form-item>
|
|
102
|
+ <el-form-item label="项目名称:" prop="projectName">
|
|
103
|
+ <el-input v-model="addForm.projectName"></el-input>
|
134
|
104
|
</el-form-item>
|
135
|
|
- <el-form-item label="项目状态" prop="isFinished">
|
136
|
|
- <el-radio-group v-model="form.isFinished">
|
137
|
|
- <el-radio :label="0" size="large">进行中</el-radio>
|
138
|
|
- <el-radio :label="1" size="large">已结束</el-radio>
|
139
|
|
- </el-radio-group>
|
|
105
|
+ <el-form-item label="项目负责人:" prop="projectNumber">
|
|
106
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini">选择</el-button>
|
140
|
107
|
</el-form-item>
|
141
|
108
|
</el-form>
|
142
|
|
- <div slot="footer" class="dialog-footer">
|
143
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
144
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
109
|
+ <div slot="footer" class="dialog-footer" style="text-align: center;">
|
|
110
|
+ <el-button type="primary" @click="confirmAddForm">确 定</el-button>
|
|
111
|
+ <el-button @click="addOpen = false">取 消</el-button>
|
145
|
112
|
</div>
|
146
|
113
|
</el-dialog>
|
147
|
114
|
</div>
|
148
|
115
|
</template>
|
149
|
116
|
|
150
|
117
|
<script>
|
151
|
|
-import { listProject, getProject, delProject, addProject, updateProject } from "@/api/oa/project/project";
|
|
118
|
+import { listProject } from "@/api/oa/project/project";
|
152
|
119
|
|
153
|
120
|
export default {
|
154
|
|
- name: "Project",
|
155
|
121
|
data() {
|
156
|
122
|
return {
|
157
|
|
- // 遮罩层
|
158
|
|
- loading: true,
|
159
|
|
- // 选中数组
|
160
|
|
- ids: [],
|
161
|
|
- // 非单个禁用
|
162
|
|
- single: true,
|
163
|
|
- // 非多个禁用
|
164
|
|
- multiple: true,
|
165
|
|
- // 显示搜索条件
|
166
|
|
- showSearch: true,
|
167
|
|
- // 总条数
|
168
|
|
- total: 0,
|
169
|
|
- // 项目管理表格数据
|
170
|
|
- projectList: [],
|
171
|
|
- // 弹出层标题
|
172
|
|
- title: "",
|
173
|
|
- // 是否显示弹出层
|
174
|
|
- open: false,
|
175
|
123
|
// 查询参数
|
176
|
124
|
queryParams: {
|
177
|
125
|
pageNum: 1,
|
178
|
126
|
pageSize: 10,
|
179
|
|
- projectNumber: null,
|
180
|
|
- projectName: null,
|
181
|
|
- projectLeader: null,
|
182
|
|
- isFinished: null
|
|
127
|
+ projectNumber: undefined,
|
|
128
|
+ projectLeader: undefined,
|
|
129
|
+ projectName: undefined,
|
183
|
130
|
},
|
184
|
|
- // 表单参数
|
185
|
|
- form: {},
|
186
|
|
- // 表单校验
|
|
131
|
+ projectList: [],
|
|
132
|
+ total: 0,
|
|
133
|
+ loading: true,
|
|
134
|
+ addOpen: false,
|
|
135
|
+ title: '',
|
|
136
|
+ addForm: {},
|
187
|
137
|
rules: {
|
|
138
|
+ projectNumber: [{ required: true, message: '请输入项目编号', trigger: 'blur' }]
|
188
|
139
|
}
|
189
|
|
- };
|
|
140
|
+ }
|
190
|
141
|
},
|
191
|
142
|
created() {
|
192
|
143
|
this.getList();
|
193
|
144
|
},
|
194
|
145
|
methods: {
|
195
|
|
- /** 查询项目管理列表 */
|
|
146
|
+ // 查询项目列表
|
196
|
147
|
getList() {
|
197
|
|
- this.loading = true;
|
198
|
|
- listProject(this.queryParams).then(response => {
|
|
148
|
+ this.loading = true
|
|
149
|
+ listProject(this.queryForm).then(response => {
|
199
|
150
|
this.projectList = response.rows;
|
200
|
151
|
this.total = response.total;
|
201
|
152
|
this.loading = false;
|
202
|
|
- });
|
203
|
|
- },
|
204
|
|
- // 取消按钮
|
205
|
|
- cancel() {
|
206
|
|
- this.open = false;
|
207
|
|
- this.reset();
|
|
153
|
+ })
|
208
|
154
|
},
|
209
|
|
- // 表单重置
|
210
|
|
- reset() {
|
211
|
|
- this.form = {
|
212
|
|
- projectId: null,
|
213
|
|
- projectNumber: null,
|
214
|
|
- projectName: null,
|
215
|
|
- projectLeader: null,
|
216
|
|
- isFinished: null
|
217
|
|
- };
|
218
|
|
- this.resetForm("form");
|
219
|
|
- },
|
220
|
|
- /** 搜索按钮操作 */
|
221
|
155
|
handleQuery() {
|
222
|
156
|
this.queryParams.pageNum = 1;
|
223
|
157
|
this.getList();
|
224
|
158
|
},
|
225
|
|
- /** 重置按钮操作 */
|
226
|
|
- resetQuery() {
|
227
|
|
- this.resetForm("queryForm");
|
228
|
|
- this.handleQuery();
|
229
|
|
- },
|
230
|
|
- // 多选框选中数据
|
231
|
|
- handleSelectionChange(selection) {
|
232
|
|
- this.ids = selection.map(item => item.projectId)
|
233
|
|
- this.single = selection.length!==1
|
234
|
|
- this.multiple = !selection.length
|
235
|
|
- },
|
236
|
|
- /** 新增按钮操作 */
|
237
|
159
|
handleAdd() {
|
238
|
|
- this.reset();
|
239
|
|
- this.open = true;
|
240
|
|
- this.title = "添加项目管理";
|
|
160
|
+ this.title = '新增项目'
|
|
161
|
+ this.addOpen = true
|
241
|
162
|
},
|
242
|
|
- /** 修改按钮操作 */
|
243
|
163
|
handleUpdate(row) {
|
244
|
|
- this.reset();
|
245
|
|
- const projectId = row.projectId || this.ids
|
246
|
|
- getProject(projectId).then(response => {
|
247
|
|
- this.form = response.data;
|
248
|
|
- this.open = true;
|
249
|
|
- this.title = "修改项目管理";
|
250
|
|
- });
|
251
|
|
- },
|
252
|
|
- /** 提交按钮 */
|
253
|
|
- submitForm() {
|
254
|
|
- this.$refs["form"].validate(valid => {
|
255
|
|
- if (valid) {
|
256
|
|
- if (this.form.projectId != null) {
|
257
|
|
- updateProject(this.form).then(response => {
|
258
|
|
- this.$modal.msgSuccess("修改成功");
|
259
|
|
- this.open = false;
|
260
|
|
- this.getList();
|
261
|
|
- });
|
262
|
|
- } else {
|
263
|
|
- addProject(this.form).then(response => {
|
264
|
|
- this.$modal.msgSuccess("新增成功");
|
265
|
|
- this.open = false;
|
266
|
|
- this.getList();
|
267
|
|
- });
|
268
|
|
- }
|
269
|
|
- }
|
270
|
|
- });
|
|
164
|
+
|
271
|
165
|
},
|
272
|
|
- /** 删除按钮操作 */
|
273
|
166
|
handleDelete(row) {
|
274
|
|
- const projectIds = row.projectId || this.ids;
|
275
|
|
- this.$modal.confirm('是否确认删除项目管理编号为"' + projectIds + '"的数据项?').then(function() {
|
276
|
|
- return delProject(projectIds);
|
277
|
|
- }).then(() => {
|
278
|
|
- this.getList();
|
279
|
|
- this.$modal.msgSuccess("删除成功");
|
280
|
|
- }).catch(() => {});
|
|
167
|
+
|
281
|
168
|
},
|
282
|
|
- /** 导出按钮操作 */
|
283
|
|
- handleExport() {
|
284
|
|
- this.download('oa/project/export', {
|
285
|
|
- ...this.queryParams
|
286
|
|
- }, `project_${new Date().getTime()}.xlsx`)
|
|
169
|
+ confirmAddForm(){
|
|
170
|
+
|
287
|
171
|
}
|
288
|
|
- }
|
289
|
|
-};
|
|
172
|
+ },
|
|
173
|
+}
|
290
|
174
|
</script>
|
|
175
|
+
|
|
176
|
+<style lang="scss" scoped>
|
|
177
|
+.project-wrapper {
|
|
178
|
+ padding: 25px;
|
|
179
|
+}
|
|
180
|
+
|
|
181
|
+.table-header {
|
|
182
|
+ background-color: #f5f5f5;
|
|
183
|
+}
|
|
184
|
+
|
|
185
|
+.card-header {
|
|
186
|
+ display: flex;
|
|
187
|
+ justify-content: space-between;
|
|
188
|
+ padding: 0 10px;
|
|
189
|
+}
|
|
190
|
+</style>
|