综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

budgetAdjust.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-05-07 11:01:39
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-05-14 18:27:04
  6. -->
  7. <template>
  8. <div class="main" v-loading="loading">
  9. <h2 class="text-center">项目直接生产成本预算—核算表</h2>
  10. <p style="text-align: center">编制人:{{ budgetForm.compilerUser ? budgetForm.compilerUser.nickName : '' }}</p>
  11. <el-divider></el-divider>
  12. <el-descriptions :column="3" border class="descriptions">
  13. <el-descriptions-item label="项目编号">
  14. {{ project.projectNumber }}
  15. </el-descriptions-item>
  16. <el-descriptions-item label="项目名称">
  17. {{ project.projectName }}
  18. </el-descriptions-item>
  19. <el-descriptions-item label="项目负责人">
  20. {{ getUserName(project.projectLeader) }}
  21. </el-descriptions-item>
  22. <el-descriptions-item label="承担部门">
  23. {{ getDeptNames(project.undertakingDept) }}
  24. </el-descriptions-item>
  25. <el-descriptions-item label="项目备注" :span="3">
  26. {{ project.remark }}
  27. </el-descriptions-item>
  28. <el-descriptions-item label="预算表单备注" :span="5">
  29. {{ budgetForm.remark }}
  30. </el-descriptions-item>
  31. <el-descriptions-item label="项目计划工作量" :span="3">
  32. <div>
  33. <table border="1" style="width: 100%;">
  34. <tr style="background-color:#f8f8f9">
  35. <td style="width: 250px">工作内容</td>
  36. <td style="width: 100px">比例尺/等级</td>
  37. <td style="width: 100px">单位</td>
  38. <td style="width: 100px">工作量</td>
  39. <td style="width: 100px">要求完成时间</td>
  40. <td style="width: 200px">备注</td>
  41. </tr>
  42. <tr v-for="(work, index) in workContentList" :key="index">
  43. <td>
  44. {{ work.content }}
  45. </td>
  46. <td>
  47. {{ work.scale }}
  48. </td>
  49. <td>
  50. {{ work.unit }}
  51. </td>
  52. <td>
  53. {{ work.workload }}
  54. </td>
  55. <td>
  56. {{ work.deadline }}
  57. </td>
  58. <td>
  59. {{ work.remark }}
  60. </td>
  61. </tr>
  62. </table>
  63. </div>
  64. </el-descriptions-item>
  65. <el-descriptions-item label="内业绩效额" :span="3">
  66. <table border="1" style="width:100%">
  67. <tr style="background-color:#f8f8f9" v-if="workList.length != 0">
  68. <td style="min-width:50px">工作简述</td>
  69. <td style="min-width:50px">工作内容</td>
  70. <td style="min-width:50px">比例尺/等级</td>
  71. <td style="min-width:50px">数量</td>
  72. <td style="min-width:50px">单价</td>
  73. <td style="min-width:50px">单位</td>
  74. <td style="min-width:50px">系数</td>
  75. <td style="min-width:80px">金额</td>
  76. <td style="min-width: 150px;">备注</td>
  77. </tr>
  78. <tr v-for="work in workList">
  79. <td>{{ work.content }}</td>
  80. <td>{{ work.cmcPrice ? work.cmcPrice.workItem : '' }}</td>
  81. <td>
  82. {{ work.scaleGrade }}
  83. </td>
  84. <td>
  85. {{ work.workload }}
  86. </td>
  87. <td>{{ work.price }}</td>
  88. <td>{{ work.unit }}</td>
  89. <td>
  90. {{ work.coefficient }}
  91. </td>
  92. <td style="text-align:right;">{{ work.settle ? work.settle.toFixed(2) : '0.00' }}</td>
  93. <td>{{ work.remark ? work.remark : '' }}</td>
  94. </tr>
  95. <tr>
  96. <td :colspan="7" class="head">内业绩效额合计</td>
  97. <td :colspan="1" class="head" style="text-align:right;">
  98. {{ budgetForm.settleExpense ? budgetForm.settleExpense.toFixed(2) : '0.00' }}
  99. </td>
  100. <td></td>
  101. </tr>
  102. <tr style="color:#F56C6C">
  103. <td :colspan="7" class="head">内业核算绩效额</td>
  104. <td :colspan="1" class="head">
  105. <el-input-number v-model="budgetForm.settleAdjust" :controls="false" style="width:100%"></el-input-number>
  106. </td>
  107. </tr>
  108. </table>
  109. </el-descriptions-item>
  110. <el-descriptions-item label="内业人员成本" :span="3" v-if="innerStaffList.length > 0">
  111. <inner-staff-cost :staffList.sync="innerStaffList" :settleExpense="budgetForm.settleExpense"
  112. @update:staffList="handleInnerStaffChange"></inner-staff-cost>
  113. </el-descriptions-item>
  114. <el-descriptions-item label="外业人员成本" :span="3" v-if="outerStaffList.length > 0">
  115. <outer-staff-cost :staffList.sync="outerStaffList"
  116. @update:staffList="handleOuterStaffChange"></outer-staff-cost>
  117. </el-descriptions-item>
  118. <el-descriptions-item label="车辆成本" :span="3" v-if="carList.length > 0">
  119. <car-cost :carList.sync="carList"></car-cost>
  120. </el-descriptions-item>
  121. <el-descriptions-item label="设备成本" :span="3" v-if="deviceList.length > 0">
  122. <device-cost :deviceList.sync="deviceList"></device-cost>
  123. </el-descriptions-item>
  124. <el-descriptions-item label="现场开支" :span="3">
  125. <table border="1" style="width:100%;">
  126. <tr style="background-color:#f8f8f9">
  127. <td>开支项</td>
  128. <td>金额</td>
  129. <td class="adjust">核算金额</td>
  130. </tr>
  131. <tr>
  132. </tr>
  133. </table>
  134. </el-descriptions-item>
  135. <el-descriptions-item label="经营相关" :span="3">
  136. </el-descriptions-item>
  137. <el-descriptions-item label="预算外开销" :span="3">
  138. </el-descriptions-item>
  139. </el-descriptions>
  140. <div class="text-center mt20 mb20">
  141. <el-button type="warning" @click="preserve()">保 存</el-button>
  142. <el-button type="success" @click="confirmSucess()">提交下一个流程</el-button>
  143. </div>
  144. </div>
  145. </template>
  146. <script>
  147. import { listCheck, getCheck, delCheck, addCheck, updateCheck } from "@/api/oa/budget/check";
  148. import { listBudget, updateBudget } from "@/api/oa/budget/budget";
  149. import { listBudgetCar, updateBudgetCar, addBudgetCar, delBudgetCar } from "@/api/oa/budget/budgetCar";
  150. import { listBudgetDevice, updateBudgetDevice, addBudgetDevice, delBudgetDevice } from "@/api/oa/budget/budgetDevice";
  151. import { listBudgetSettle, updateBudgetSettle, addBudgetSettle, delBudgetSettle } from "@/api/oa/budget/budgetSettle";
  152. import { listBudgetStaff, addBudgetStaff, delBudgetStaff } from "@/api/oa/budget/budgetStaff";
  153. import { listProjectWork } from "@/api/oa/project/projectWork";
  154. import { listSite, delSite, addSite } from "@/api/oa/budget/budgetSite";
  155. import { getProject } from "@/api/oa/project/project";
  156. import InnerStaffCost from './components/InnerStaffCost.vue';
  157. import OuterStaffCost from './components/OuterStaffCost.vue';
  158. import CarCost from './components/CarCost.vue';
  159. import DeviceCost from './components/DeviceCost.vue';
  160. export default {
  161. components: {
  162. InnerStaffCost,
  163. OuterStaffCost,
  164. CarCost,
  165. DeviceCost
  166. },
  167. props: {
  168. taskForm: {
  169. type: Object,
  170. require: true
  171. },
  172. taskName: {
  173. type: String,
  174. },
  175. row: {
  176. type: Object,
  177. }
  178. },
  179. data() {
  180. return {
  181. loading: true,
  182. budgetForm: {},
  183. project: {},
  184. workContentList: [],
  185. workList: [],
  186. innerStaffList: [],
  187. outerStaffList: [],
  188. carList: [],
  189. deviceList: [],
  190. }
  191. },
  192. created() {
  193. this.initBudgetForm();
  194. this.getProjectWorkList();
  195. },
  196. methods: {
  197. initBudgetForm() {
  198. this.loading = true;
  199. listBudget({ pageNum: 1, pageSize: 20, projectId: this.row.projectId }).then(async res => {
  200. this.budgetForm = res.rows[0];
  201. if (this.budgetForm) {
  202. const budgetId = this.budgetForm.budgetId;
  203. // 获取设备数据
  204. let deviceRes = await listBudgetDevice({ pageSize: 100, budgetId });
  205. this.deviceList = deviceRes.rows;
  206. // 获取车辆数据
  207. let carRes = await listBudgetCar({ pageSize: 100, budgetId });
  208. this.carList = carRes.rows;
  209. // 获取内业人员数据
  210. let innerStaffRes = await listBudgetStaff({ pageSize: 100, budgetId, type: '内业' });
  211. this.innerStaffList = innerStaffRes.rows;
  212. this.innerStaffList = this.innerStaffList.map(staff => {
  213. return {
  214. ...staff,
  215. dayCost: Number(staff.dayCost).toFixed(2),
  216. performance: Number(staff.performance).toFixed(2),
  217. amount: Number(staff.amount).toFixed(2),
  218. staffCost: Number(staff.staffCost).toFixed(2),
  219. daysAdjust: staff.daysAdjust ? Number(staff.daysAdjust).toFixed(2) : 0,
  220. performanceAdjust: staff.performanceAdjust ? Number(staff.performanceAdjust).toFixed(2) : 0,
  221. amountAdjust: staff.amountAdjust ? Number(staff.amountAdjust).toFixed(2) : 0
  222. };
  223. });
  224. // 获取外业人员数据
  225. let outerStaffRes = await listBudgetStaff({ pageSize: 100, budgetId, type: '外业' });
  226. this.outerStaffList = outerStaffRes.rows;
  227. this.outerStaffList = this.outerStaffList.map(staff => {
  228. return {
  229. ...staff,
  230. dayCost: Number(staff.dayCost).toFixed(2),
  231. performance: Number(staff.performance).toFixed(2),
  232. amount: Number(staff.amount).toFixed(2),
  233. staffCost: Number(staff.staffCost).toFixed(2),
  234. daysAdjust: staff.daysAdjust ? Number(staff.daysAdjust).toFixed(2) : 0,
  235. performanceAdjust: staff.performanceAdjust ? Number(staff.performanceAdjust).toFixed(2) : 0,
  236. amountAdjust: staff.amountAdjust ? Number(staff.amountAdjust).toFixed(2) : 0
  237. };
  238. });
  239. // 获取内业绩效额数据
  240. let settleRes = await listBudgetSettle({ pageSize: 100, budgetId });
  241. this.workList = settleRes.rows;
  242. for (let work of this.workList) {
  243. if (work.groundType == '0') {
  244. work.price = work.cmcPrice.commonPrice
  245. work.scaleGrade = work.cmcPrice.scaleGrade
  246. work.unit = work.cmcPrice.unit
  247. } else {
  248. work.price = work.cmcPrice.complexPrice
  249. work.scaleGrade = work.cmcPrice.scaleGrade
  250. work.unit = work.cmcPrice.unit
  251. }
  252. }
  253. }
  254. this.loading = false;
  255. }).catch(() => {
  256. this.loading = false;
  257. });
  258. },
  259. getProjectWorkList() {
  260. getProject(this.row.projectId).then(res => {
  261. this.project = res.data;
  262. })
  263. listProjectWork({ pageSize: 999, projectId: this.row.projectId }).then(res => {
  264. this.workContentList = res.rows;
  265. })
  266. },
  267. // 处理内业人员数据变化
  268. handleInnerStaffChange(newList) {
  269. this.innerStaffList = newList;
  270. // 计算内业人员总成本
  271. const totalAmount = this.innerStaffList.reduce((sum, staff) => {
  272. return sum + (staff.amountAdjust || 0);
  273. }, 0);
  274. // 更新预算表单中的内业人员成本
  275. if (this.budgetForm) {
  276. this.budgetForm.innerStaffAmount = totalAmount;
  277. // 可以在这里调用API保存数据
  278. // updateBudget(this.budgetForm);
  279. }
  280. },
  281. // 处理外业人员数据变化
  282. handleOuterStaffChange(newList) {
  283. this.outerStaffList = newList;
  284. // 计算外业人员总成本
  285. const totalAmount = this.outerStaffList.reduce((sum, staff) => {
  286. return sum + (staff.amountAdjust || 0);
  287. }, 0);
  288. // 更新预算表单中的外业人员成本
  289. if (this.budgetForm) {
  290. this.budgetForm.outerStaffAmount = totalAmount;
  291. // 可以在这里调用API保存数据
  292. // updateBudget(this.budgetForm);
  293. }
  294. },
  295. async preserve() {
  296. let obj = {
  297. budgetId: this.row.budgetId,
  298. projectId: this.row.projectId,
  299. checkId: this.taskForm.formId
  300. }
  301. let checkRes = await getCheck(this.taskForm.formId);
  302. if (!checkRes.data) {
  303. await addCheck(obj);
  304. this.$emit('preserve');
  305. }
  306. await updateBudget(this.budgetForm);
  307. let staffList = this.innerStaffList.concat(this.outerStaffList);
  308. delBudgetStaff(this.row.budgetId).then(async res => {
  309. for (let staff of staffList) {
  310. staff.budgetId = this.row.budgetId;
  311. await addBudgetStaff(staff);
  312. }
  313. })
  314. this.$message.success('保存成功');
  315. },
  316. confirmSucess() {
  317. }
  318. },
  319. }
  320. </script>
  321. <style lang="scss" scoped>
  322. .mylabel {
  323. font-weight: bold;
  324. }
  325. .main {
  326. width: 90%;
  327. margin: 0 auto;
  328. text-align: center;
  329. }
  330. .descriptions {
  331. width: 100%;
  332. margin: 0 auto;
  333. }
  334. table {
  335. text-align: center;
  336. border-collapse: collapse;
  337. margin: 0 auto;
  338. /*设置背景颜色*/
  339. /* background-color: #bfa; */
  340. td {
  341. padding: 5px;
  342. }
  343. }
  344. .adjust {
  345. color: #F56C6C;
  346. width: 120px;
  347. }
  348. ::v-deep .el-descriptions .is-bordered .el-descriptions-item__cell {
  349. border: 1px solid #838894;
  350. }
  351. ::v-deep .el-descriptions-item__label.is-bordered-label {
  352. color: #434141;
  353. background: #eaeaea;
  354. }
  355. </style>