lamphua преди 1 година
родител
ревизия
59e084872d
променени са 1 файла, в които са добавени 252 реда и са изтрити 88 реда
  1. 252
    88
      oa-ui/src/views/oa/budget/addBudget.vue

+ 252
- 88
oa-ui/src/views/oa/budget/addBudget.vue Целия файл

@@ -2,7 +2,7 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-03-25 15:05:59
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-03-25 17:28:17
5
+ * @LastEditTime: 2024-03-26 17:51:38
6 6
 -->
7 7
 <template>
8 8
   <div>
@@ -12,23 +12,50 @@
12 12
       </div>
13 13
       <div class="title">
14 14
         <div class="title-text">新增预算</div>
15
-        <div class="title-tips">请精准填写预算标准,对应的人员、设备、车辆可直接选择生成固定成本</div>
15
+        <div class="title-tips">
16
+          请精准填写预算标准,对应的人员、设备、车辆可直接选择生成固定成本
17
+        </div>
16 18
       </div>
17 19
     </div>
18 20
     <div class="add-main">
19 21
       <el-steps :active="activeStep" align-center finish-status="success">
20
-        <el-step title="选择项目" description="选择想要生成预算的项目"></el-step>
21
-        <el-step title="选择参与人员" description="选择参与的人员,得到人员预算"></el-step>
22
-        <el-step title="选择车辆和设备" description="选择车辆和设备,得到对应预算"></el-step>
23
-        <el-step title="其他预算开支项" description="项目预算其他项"></el-step>
24
-        <el-step title="生成预算表" description="生成最终的项目预算表"></el-step>
22
+        <el-step
23
+          title="选择项目"
24
+          description="选择想要生成预算的项目"
25
+        ></el-step>
26
+        <el-step
27
+          title="选择参与人员"
28
+          description="选择参与的人员,得到人员预算"
29
+        ></el-step>
30
+        <el-step
31
+          title="选择车辆和设备"
32
+          description="选择车辆和设备,得到对应预算"
33
+        ></el-step>
34
+        <el-step
35
+          title="其他预算开支项"
36
+          description="包含绩效预算和其他预算"
37
+        ></el-step>
38
+        <el-step
39
+          title="生成预算表"
40
+          description="生成最终的项目预算表"
41
+        ></el-step>
25 42
       </el-steps>
26 43
       <!-- 选择项目 -->
27 44
       <div class="project" v-if="activeStep == 0">
28
-        <el-form ref="form1" :model="projectForm" :rules="projectRule" label-width="120px">
45
+        <el-form
46
+          ref="form1"
47
+          :model="projectForm"
48
+          :rules="projectRule"
49
+          label-width="120px"
50
+        >
29 51
           <el-form-item label="项目编号:" prop="projectNumber">
30
-            <div style="display: flex;">
31
-              <el-input v-model="projectForm.projectNumber" placeholder="请选择项目编号" disabled style="width:300px" />
52
+            <div style="display: flex">
53
+              <el-input
54
+                v-model="projectForm.projectNumber"
55
+                placeholder="请选择项目编号"
56
+                disabled
57
+                style="width: 300px"
58
+              />
32 59
               <el-button @click="openProject = true">选择</el-button>
33 60
             </div>
34 61
           </el-form-item>
@@ -44,11 +71,11 @@
44 71
           <el-form-item label="项目概况:">
45 72
             <table border="1">
46 73
               <tr>
47
-                <td style="width:250px;">工作内容</td>
74
+                <td style="width: 250px">工作内容</td>
48 75
                 <td>等级或比例尺</td>
49 76
                 <td>单位</td>
50 77
                 <td>工作量</td>
51
-                <td style="width:100px;">要求完成时间</td>
78
+                <td style="width: 100px">要求完成时间</td>
52 79
                 <td>备注</td>
53 80
               </tr>
54 81
               <tr v-for="(work, index) in workList" :key="index">
@@ -93,35 +120,120 @@
93 120
           </el-form-item>
94 121
         </el-form>
95 122
       </div>
123
+
96 124
       <!-- 选择参与人员 -->
97 125
       <div class="staff" v-if="activeStep == 1">
98 126
         <el-breadcrumb separator-class="el-icon-arrow-right">
99 127
           <el-breadcrumb-item>选择项目</el-breadcrumb-item>
100
-          <el-breadcrumb-item>{{ projectForm.projectNumber }}</el-breadcrumb-item>
128
+          <el-breadcrumb-item>{{
129
+            projectForm.projectNumber
130
+          }}</el-breadcrumb-item>
101 131
           <el-breadcrumb-item>{{ projectForm.projectName }}</el-breadcrumb-item>
102
-          <el-breadcrumb-item>{{ projectForm.projectLeader }}</el-breadcrumb-item>
132
+          <el-breadcrumb-item>{{
133
+            projectForm.projectLeader
134
+          }}</el-breadcrumb-item>
103 135
         </el-breadcrumb>
104
-        <el-form ref="form2" :model="peopleForm">
136
+        <el-form ref="form2" :model="peopleForm" style="padding: 20px 100px 0">
105 137
           <el-form-item label="选择人员:">
106
-
138
+            <span v-if="chooseUser.length != 0">
139
+              <el-tag
140
+                type="success"
141
+                v-for="item in chooseUser"
142
+                style="margin: 5px"
143
+                >{{ item.nickName }}</el-tag
144
+              >
145
+            </span>
146
+            <el-button
147
+              type="primary"
148
+              plain
149
+              icon="el-icon-plus"
150
+              @click="openPeople = true"
151
+              size="mini"
152
+              >选择</el-button
153
+            >
154
+          </el-form-item>
155
+          <el-form-item label="人员预算:" v-if="chooseUser.length != 0">
156
+            <table border="1">
157
+              <tr>
158
+                <td>姓名</td>
159
+                <td>岗位工资</td>
160
+                <td>人员成本(天)</td>
161
+                <td>进出场单价</td>
162
+                <td>预算天数</td>
163
+                <td style="width: 100px">总额</td>
164
+                <td></td>
165
+              </tr>
166
+              <tr v-for="user in chooseUser" :key="user.userId">
167
+                <td>{{ user.nickName }}</td>
168
+                <td>{{ user.salary.salary }}</td>
169
+                <td>{{ parseFloat(user.salary.salary / 31).toFixed(2) }}</td>
170
+                <td>
171
+                  <el-input
172
+                    v-model="user.inOutPrice"
173
+                    placeholder="请输入进出场单价"
174
+                  ></el-input>
175
+                </td>
176
+                <td>
177
+                  <el-input
178
+                    v-model="user.days"
179
+                    placeholder="请输入天数"
180
+                  ></el-input>
181
+                </td>
182
+                <td class="staffCost">{{ user.staffCost }}</td>
183
+                <td>
184
+                  <el-button type="text" @click="calculateUserTotal(user)"
185
+                    >计算</el-button
186
+                  >
187
+                </td>
188
+              </tr>
189
+              <tr>
190
+                <td colspan="5">合计</td>
191
+                <td>{{ budgetForm.staffCost }}</td>
192
+                <td>
193
+                  <el-button type="text" @click="calculateTotal"
194
+                    >计算</el-button
195
+                  >
196
+                </td>
197
+              </tr>
198
+            </table>
107 199
           </el-form-item>
108 200
         </el-form>
109 201
       </div>
202
+
110 203
       <el-divider></el-divider>
111 204
       <div class="btn">
112
-        <el-button @click="activeStep -= 1" :disabled="activeStep == 0">上一步</el-button>
113
-        <el-button @click="confirmStep" type="primary" v-if="activeStep < 4">下一步</el-button>
114
-        <el-button @click="activeStep += 1" type="primary" v-if="activeStep == 4">生成预算表</el-button>
205
+        <el-button @click="activeStep -= 1" :disabled="activeStep == 0"
206
+          >上一步</el-button
207
+        >
208
+        <el-button @click="confirmStep" type="primary" v-if="activeStep < 4"
209
+          >下一步</el-button
210
+        >
211
+        <el-button
212
+          @click="activeStep += 1"
213
+          type="primary"
214
+          v-if="activeStep == 4"
215
+          >生成预算表</el-button
216
+        >
115 217
       </div>
116 218
     </div>
117 219
 
118
-    <el-dialog title="选择项目" :visible.sync="openProject" width="700px" append-to-body>
220
+    <!-- 项目选择对话框 -->
221
+    <el-dialog
222
+      title="选择项目"
223
+      :visible.sync="openProject"
224
+      width="700px"
225
+      append-to-body
226
+    >
119 227
       <el-form :inline="true">
120 228
         <el-form-item label="项目编号" prop="projectNumber">
121
-          <el-input v-model="queryParams.projectNumber" placeholder="请输入项目编号" clearable
122
-            @keyup.enter.native="getProjectList" />
229
+          <el-input
230
+            v-model="queryParams.projectNumber"
231
+            placeholder="请输入项目编号"
232
+            clearable
233
+            @keyup.enter.native="getProjectList"
234
+          />
123 235
         </el-form-item>
124
-        <el-form-item style="margin-bottom:0;display:none;">
236
+        <el-form-item style="margin-bottom: 0; display: none">
125 237
           <el-input></el-input>
126 238
         </el-form-item>
127 239
 
@@ -129,101 +241,181 @@
129 241
           <el-button @click="getProjectList" type="primary">搜索</el-button>
130 242
         </el-form-item>
131 243
       </el-form>
132
-      <el-table :data="projectList" style="margin-top: 30px;" height="600px">
133
-        <el-table-column type="index" width="50">
134
-        </el-table-column>
244
+      <el-table :data="projectList" style="margin-top: 30px" height="600px">
245
+        <el-table-column type="index" width="50"> </el-table-column>
135 246
         <el-table-column prop="isFinshed" label="状态" width="90px">
136 247
           <template slot-scope="scope">
137
-            <el-tag :type="scope.row.isFinished === '0' ? 'success' : 'warning'" disable-transitions>
138
-              {{ scope.row.isFinished == '0' ? '进行中' : '已结束' }}
248
+            <el-tag
249
+              :type="scope.row.isFinished === '0' ? 'success' : 'warning'"
250
+              disable-transitions
251
+            >
252
+              {{ scope.row.isFinished == "0" ? "进行中" : "已结束" }}
139 253
             </el-tag>
140 254
           </template>
141 255
         </el-table-column>
142
-        <el-table-column label="项目编号" align="center" key="projectNumber" prop="projectNumber" />
143
-        <el-table-column label="项目名称" align="center" key="projectName" prop="projectName" width="200px" />
144
-        <el-table-column label="项目负责人" align="center" key="projectLeaderName" prop="projectLeaderName" />
256
+        <el-table-column
257
+          label="项目编号"
258
+          align="center"
259
+          key="projectNumber"
260
+          prop="projectNumber"
261
+        />
262
+        <el-table-column
263
+          label="项目名称"
264
+          align="center"
265
+          key="projectName"
266
+          prop="projectName"
267
+          width="200px"
268
+        />
269
+        <el-table-column
270
+          label="项目负责人"
271
+          align="center"
272
+          key="projectLeaderName"
273
+          prop="projectLeaderName"
274
+        />
145 275
         <el-table-column align="center">
146 276
           <template slot-scope="scope">
147
-            <el-button size="mini" type="text" @click="chooseProject(scope.row)">选择</el-button>
277
+            <el-button size="mini" type="text" @click="chooseProject(scope.row)"
278
+              >选择</el-button
279
+            >
148 280
           </template>
149 281
         </el-table-column>
150 282
       </el-table>
151
-      <div style="text-align: right;">
152
-        <el-pagination @current-change="getProjectList" :current-page.sync="queryParams.pageNum"
153
-          :page-size="queryParams.pageSize" layout="total, prev, pager, next" :total="projectTotal">
283
+      <div style="text-align: right">
284
+        <el-pagination
285
+          @current-change="getProjectList"
286
+          :current-page.sync="queryParams.pageNum"
287
+          :page-size="queryParams.pageSize"
288
+          layout="total, prev, pager, next"
289
+          :total="projectTotal"
290
+        >
154 291
         </el-pagination>
155 292
       </div>
156 293
     </el-dialog>
294
+    <!-- 选择人员对话框 -->
295
+    <el-dialog
296
+      title="选择人员"
297
+      :visible.sync="openPeople"
298
+      width="700px"
299
+      append-to-body
300
+    >
301
+      <choosePeople @chooseUser="getChooseUser"></choosePeople>
302
+    </el-dialog>
157 303
   </div>
158 304
 </template>
159 305
 
160 306
 <script>
161 307
 import { listProject } from "@/api/oa/project/project";
308
+import choosePeople from "./components/choosePeople.vue";
309
+import { getSalary } from "@/api/oa/staff/salary";
162 310
 export default {
311
+  components: {
312
+    choosePeople,
313
+  },
163 314
   data() {
164 315
     return {
165 316
       activeStep: 0,
166 317
       form: {},
318
+      budgetForm: {}, // 预算表
167 319
       openProject: false,
168 320
       projectList: [],
169 321
       queryParams: {
170 322
         pageNum: 1,
171 323
         pageSize: 10,
172
-        projectNumber: '',
173
-        projectLeader: '',
324
+        projectNumber: "",
325
+        projectLeader: "",
174 326
         projectLeaderName: undefined,
175
-        projectName: '',
327
+        projectName: "",
176 328
       },
177 329
       projectTotal: 0,
178 330
       projectForm: {},
179 331
       workList: [
180 332
         {
181
-          content: '实景三维制作(影像分辨率优于5cm)',
182
-          scale: '1:500',
183
-          workload: '81',
184
-          unit: 'km²',
185
-          deadline: '2024-01-31',
186
-          remark: '此为备注此为备注此为备注此为备注此为备注此为备注'
187
-        }
333
+          content: "实景三维制作(影像分辨率优于5cm)",
334
+          scale: "1:500",
335
+          workload: "81",
336
+          unit: "km²",
337
+          deadline: "2024-01-31",
338
+          remark: "此为备注此为备注此为备注此为备注此为备注此为备注",
339
+        },
188 340
       ],
189 341
       projectRule: {
190
-        projectNumber: [{ required: true, message: '请选择项目编号', trigger: 'blur' }],
342
+        projectNumber: [
343
+          { required: true, message: "请选择项目编号", trigger: "blur" },
344
+        ],
191 345
       },
192
-      peopleForm: {}
193
-    }
346
+      peopleForm: {},
347
+      openPeople: false,
348
+      chooseUser: [],
349
+    };
194 350
   },
195 351
   created() {
196 352
     this.getProjectList();
197 353
   },
198 354
   methods: {
199 355
     goBack() {
200
-      let obj = { path: "/budget/add" }
356
+      let obj = { path: "/budget/add" };
201 357
       this.$tab.closeOpenPage(obj);
202
-      this.$router.push({ path: '/budget' });
358
+      this.$router.push({ path: "/budget" });
203 359
     },
204 360
     // 查询项目列表
205 361
     getProjectList() {
206
-      listProject(this.queryParams).then(response => {
362
+      listProject(this.queryParams).then((response) => {
207 363
         this.projectList = response.rows;
208 364
         this.projectTotal = response.total;
209
-      })
365
+      });
210 366
     },
211 367
     // 选择项目
212 368
     chooseProject(row) {
213 369
       this.projectForm = row;
214
-      this.openProject = false
370
+      this.budgetForm.projectId = row.projectId;
371
+      this.openProject = false;
215 372
     },
216 373
     confirmStep() {
217 374
       if (this.projectForm.projectNumber == undefined) {
218 375
         this.activeStep = 0;
219 376
         this.$message.error(`请选择项目编号!`);
220 377
       }
221
-      if(this.projectForm.projectNumber){
378
+      if (this.projectForm.projectNumber) {
222 379
         this.activeStep += 1;
223 380
       }
224
-    }
381
+    },
382
+    getChooseUser(val) {
383
+      this.chooseUser = val;
384
+      this.openPeople = false;
385
+    },
386
+    getUserSalary(userId) {
387
+      getSalary(userId).then((res) => {
388
+        console.log(res);
389
+        return res.data.salary;
390
+      });
391
+    },
392
+    // 计算单个人员的成本
393
+    calculateUserTotal(user) {
394
+      console.log(user);
395
+      if (user.inOutPrice == undefined) {
396
+        this.$message.error("请输入进出场单价");
397
+        return;
398
+      }
399
+      let total =
400
+        (parseFloat(user.salary.salary / 30).toFixed(2) +
401
+          Number(user.inOutPrice)) *
402
+        Number(user.days);
403
+      this.$set(user, "staffCost", total.toFixed(2));
404
+    },
405
+    // 合计
406
+    calculateTotal() {
407
+      const elements = document.querySelectorAll(".staffCost");
408
+      let sum = 0;
409
+      if (elements.length > 0) {
410
+        for (let e of elements) {
411
+          sum = sum + Number(e.innerHTML);
412
+        }
413
+        console.log(sum);
414
+        this.$set(this.budgetForm, "staffCost", sum.toFixed(2));
415
+      }
416
+    },
225 417
   },
226
-}
418
+};
227 419
 </script>
228 420
 
229 421
 <style lang="scss" scoped>
@@ -232,7 +424,7 @@ export default {
232 424
   height: 110px;
233 425
   display: flex;
234 426
   align-items: center;
235
-  border-bottom: 1px solid #EBEEF5;
427
+  border-bottom: 1px solid #ebeef5;
236 428
 
237 429
   .back {
238 430
     margin-left: 30px;
@@ -263,33 +455,6 @@ export default {
263 455
     padding-top: 50px;
264 456
     width: 1000px;
265 457
     margin: 0 auto;
266
-
267
-    .info-item {
268
-      line-height: 30px;
269
-      color: #5A5A5A;
270
-      font-size: 14px;
271
-      padding-left: 30px;
272
-      display: flex;
273
-      align-items: start;
274
-
275
-      .info-icon {
276
-        font-size: 20px;
277
-        margin-right: 10px;
278
-        vertical-align: middle;
279
-      }
280
-
281
-      .item-label {
282
-        max-width: 120px;
283
-        display: flex;
284
-        align-items: center;
285
-        font-size: 16px;
286
-      }
287
-
288
-      .item-value {
289
-        max-width: 260px;
290
-        // display: inline-block;
291
-      }
292
-    }
293 458
   }
294 459
 
295 460
   .staff {
@@ -297,7 +462,6 @@ export default {
297 462
     margin: 0 auto;
298 463
     padding-top: 50px;
299 464
   }
300
-
301 465
 }
302 466
 
303 467
 .btn {
@@ -307,7 +471,7 @@ export default {
307 471
 
308 472
 table {
309 473
   /*居中*/
310
-  margin: 0 auto;
474
+  // margin: 0 auto;
311 475
   /*边框*/
312 476
   /* border: 1px solid black; */
313 477
   text-align: center;
@@ -322,6 +486,6 @@ table {
322 486
 
323 487
 ::v-deep .el-input.is-disabled .el-input__inner {
324 488
   background-color: #fff;
325
-  color: #5A5A5A;
489
+  color: #5a5a5a;
326 490
 }
327
-</style>
491
+</style>

Loading…
Отказ
Запис