itdmXnJiesuan.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <div>
  3. <div class="head">第五部分 试验虚拟结算</div>
  4. <table class="main-table">
  5. <tr>
  6. <td rowspan="6" style="width: 100px">市场部<br/>核准</td>
  7. <td class="title" style="width: 100px">核准<br/>虚拟结算额</td>
  8. <td class="content" style="width: 360px">
  9. <div>
  10. <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.typeName }}:{{ item.price }};</div>
  11. </div>
  12. </td>
  13. <td class="title white" style="width: 100px">核准<br/>虚拟结算毛利</td>
  14. <td class="content">
  15. <!-- <input v-model="tableData.xnMaoli" style="text-align: center" /> -->
  16. <div>
  17. <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.typeName }}:{{ item.price * 0.8 }};</div>
  18. </div>
  19. </td>
  20. </tr>
  21. <tr>
  22. <td class="title" style="width: 100px">核准<br/>合同总额</td>
  23. <td class="content" style="width: 360px">
  24. <input v-model="tableData.hetongZonge" style="text-align: center" />
  25. </td>
  26. <td class="title white" style="width: 100px">核准<br/>外协外购</td>
  27. <td class="content" style="width: 350px">
  28. <input v-model="tableData.waixieWaigou" style="text-align: center" />
  29. </td>
  30. </tr>
  31. <tr>
  32. <td class="title" style="width: 100px">销售提成<br/>基数</td>
  33. <td class="content" style="width: 360px">
  34. <input v-model="tableData.tichengJishu" style="text-align: center" />
  35. </td>
  36. <td class="title white" style="width: 100px">项目满意度</td>
  37. <td class="content" style="width: 350px">
  38. <input v-model="tableData.manyidu" style="text-align: center" />
  39. </td>
  40. </tr>
  41. <tr>
  42. <td class="title" style="width: 100px">项目计算<br/>标准</td>
  43. <td class="content" style="width: 360px">
  44. <div>
  45. <div>虚拟结算量化标准</div>
  46. <div>0-5万:5%</div>
  47. <div>5-10万:4%</div>
  48. <div>10-50万:3%</div>
  49. <div>50万以上:2%</div>
  50. </div>
  51. </td>
  52. <td class="title white" style="width: 100px">项目绩效<br/>基数计算</td>
  53. <td class="content" style="width: 350px">
  54. <el-table :data="tableData.jixiaoData" style="width: 100%">
  55. <el-table-column type="index" label="序号"></el-table-column>
  56. <!-- <el-table-column prop="type" label="试验类型"></el-table-column> -->
  57. <el-table-column prop="typeName" label="试验类型"></el-table-column>
  58. <!-- <el-table-column prop="fenduan" label="合同分段"></el-table-column> -->
  59. <el-table-column prop="bili" label="分段比例"></el-table-column>
  60. <el-table-column prop="ticheng" label="分段提成"></el-table-column>
  61. <el-table-column prop="yue" label="分段余额"></el-table-column>
  62. </el-table>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="title" style="width: 100px">项目得分<br/>(百分制)</td>
  67. <td class="content" style="width: 360px">
  68. <input v-model="tableData.fenshu" style="text-align: center" />
  69. </td>
  70. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  71. <td class="title white" style="width: 100px">虚拟结算<br/>绩效总额</td>
  72. <td class="content" style="width: 350px">
  73. <!-- 乘系数之后的数值数组 -->
  74. <!-- <div v-for="(item, index) in tableData.xnJixiaoZongeArr" :key="index">{{ item.typeName }}:{{ item.price }};</div> -->
  75. <!-- 乘满意度之后的总额 -->
  76. <div>{{ (tableData.xnJixiaoZonge * tableData.manyidu)/100 }}</div>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td class="title" style="width: 100px">核准结论</td>
  81. <td class="content" style="width: 360px">
  82. <div></div>
  83. </td>
  84. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  85. <td class="title white" style="width: 100px">核准人 </td>
  86. <td class="content" style="width: 350px">
  87. <input v-model="tableData.shuruLeixing" style="text-align: center" />
  88. </td>
  89. </tr>
  90. <tr>
  91. <td class="title" style="width: 100px; background-color: #E5E0EC;">工程技术部<br/>核准</td>
  92. <td class="title" style="width: 100px">核准结论</td>
  93. <td class="content" style="width: 360px; background-color: #E5E0EC;">
  94. <div></div>
  95. </td>
  96. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  97. <td class="title white" style="width: 100px">核准人 </td>
  98. <td class="content" style="width: 350px; background-color: #E5E0EC;">
  99. <input v-model="tableData.shuruLeixing" style="text-align: center" />
  100. </td>
  101. </tr>
  102. <tr>
  103. <td class="title" style="width: 100px; background-color: #F2DCDB;">财务部<br/>核准</td>
  104. <td class="title" style="width: 100px">核准结论</td>
  105. <td class="content" style="width: 360px; background-color: #F2DCDB;">
  106. <div></div>
  107. </td>
  108. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  109. <td class="title white" style="width: 100px">核准人 </td>
  110. <td class="content" style="width: 350px; background-color: #F2DCDB;">
  111. <input v-model="tableData.shuruLeixing" style="text-align: center" />
  112. </td>
  113. </tr>
  114. <tr>
  115. <td class="title" style="width: 100px; background-color: #E5B9B7;">总经理审批</td>
  116. <td class="title" style="width: 100px">批准结论</td>
  117. <td class="content" style="width: 360px; background-color: #E5B9B7;">
  118. <div></div>
  119. </td>
  120. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  121. <td class="title white" style="width: 100px">总经理 </td>
  122. <td class="content" style="width: 350px; background-color: #E5B9B7;">
  123. <input v-model="tableData.shuruLeixing" style="text-align: center" />
  124. </td>
  125. </tr>
  126. <tr>
  127. <td class="title" style="width: 100px; background-color: #DBEEF3;">归档</td>
  128. <td class="title" style="width: 100px">合同信息</td>
  129. <td class="content" style="width: 360px">
  130. <div></div>
  131. </td>
  132. <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
  133. <td class="title white" style="width: 100px">核准人 </td>
  134. <td class="content" style="width: 350px">
  135. <input v-model="tableData.shuruLeixing" style="text-align: center" />
  136. </td>
  137. </tr>
  138. </table>
  139. </div>
  140. </template>
  141. <script>
  142. export default {
  143. name: 'itdmXnJiesuan',
  144. data() {
  145. return {
  146. defineXishu: [
  147. { type: 0, xishu: 0.40 },
  148. { type: 1, xishu: 0.70 },
  149. { type: 2, xishu: 1 },
  150. ],
  151. tableData: {
  152. xnJiesuanE: [
  153. // { type: 0, typeName: '气候试验', price: 50000 },
  154. // { type: 1, typeName: '力学试验', price: 510000 },
  155. // { type: 2, typeName: '重要试验', price: 100000 },
  156. ],
  157. tichengJishu: null,
  158. manyidu: 100,
  159. fenshu: null,
  160. jixiaoData: [],
  161. xnJixiaoZonge: null,
  162. // hasMYDJixiaoZonge: null,
  163. xnJixiaoZongeArr: []
  164. },
  165. moniData: [
  166. { type: 0, typeName: '气候试验', time: 1, unitPrice: 3, costPrice: 20000 },
  167. { type: 0, typeName: '气候试验', time: 1, unitPrice: 3, costPrice: 30000 },
  168. { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 100000 },
  169. { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 200000 },
  170. { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 210000 },
  171. { type: 2, typeName: '重要试验', time: 1, unitPrice: 3, costPrice: 100000 },
  172. ]
  173. }
  174. },
  175. computed: {
  176. },
  177. created(){
  178. this.getXnJiesuanE()
  179. },
  180. methods: {
  181. // 获取第一部分设置的项目虚拟结算额并计算数据
  182. getXnJiesuanE(){
  183. // 计算核准虚拟结算额
  184. this.tableData.xnJiesuanE = this.changeData(this.moniData, 'costPrice')
  185. // 项目绩效基础计算
  186. this.computeJixiaoData()
  187. // 计算虚拟结算绩效总额
  188. this.computeJXXishuZonge()
  189. },
  190. // 将试验类型相同的金额相加,用于:核准虚拟结算额和虚拟结算绩效总额
  191. changeData(array, key){
  192. let totalArr = []
  193. array.forEach(element => {
  194. var itemObj = { type: element.type, typeName: element.typeName, price: element[key] }
  195. if(totalArr.length === 0){
  196. totalArr.push(itemObj)
  197. } else {
  198. var index = totalArr.findIndex(res => res.type === element.type)
  199. if(index === -1){
  200. // 原来没有 push
  201. totalArr.push(itemObj)
  202. } else {
  203. // 原来有 相加
  204. totalArr[index].price += itemObj.price
  205. }
  206. }
  207. });
  208. // console.log(totalArr)
  209. return totalArr
  210. },
  211. // 项目绩效基础计算
  212. computeJixiaoData(){
  213. var dataLists = []
  214. for (let i = 0; i < this.tableData.xnJiesuanE.length; i++) {
  215. const item = this.tableData.xnJiesuanE[i];
  216. const money = item.price * 0.8
  217. if(money > 500000){
  218. // 50万以上
  219. console.log(money+':50万以上')
  220. var arr = [
  221. {
  222. type: item.type,
  223. typeName: item.typeName,
  224. fenduan: item.fenduan,
  225. bili: 0.05,
  226. ticheng: 50000 * 0.05,
  227. yue: 50000
  228. },
  229. {
  230. type: item.type,
  231. typeName: item.typeName,
  232. fenduan: item.fenduan,
  233. bili: 0.04,
  234. ticheng: 50000 * 0.04,
  235. yue: 50000
  236. },
  237. {
  238. type: item.type,
  239. typeName: item.typeName,
  240. fenduan: item.fenduan,
  241. bili: 0.03,
  242. ticheng: 400000 * 0.03,
  243. yue: 400000
  244. },
  245. {
  246. type: item.type,
  247. typeName: item.typeName,
  248. fenduan: item.fenduan,
  249. bili: 0.02,
  250. ticheng: (money - 500000) * 0.02,
  251. yue: money - 500000
  252. },
  253. ]
  254. dataLists.push(...arr)
  255. } else if (money > 100000){
  256. // 10万-50万之间
  257. console.log(money+':10万-50万之间')
  258. var arr = [
  259. {
  260. type: item.type,
  261. typeName: item.typeName,
  262. fenduan: item.fenduan,
  263. bili: 0.05,
  264. ticheng: 50000 * 0.05,
  265. yue: 50000
  266. },
  267. {
  268. type: item.type,
  269. typeName: item.typeName,
  270. fenduan: item.fenduan,
  271. bili: 0.04,
  272. ticheng: 50000 * 0.04,
  273. yue: 50000
  274. },
  275. {
  276. type: item.type,
  277. typeName: item.typeName,
  278. fenduan: item.fenduan,
  279. bili: 0.03,
  280. ticheng: (money - 100000) * 0.03,
  281. yue: money - 100000
  282. },
  283. ]
  284. dataLists.push(...arr)
  285. } else if (money > 50000){
  286. // 5万-10万(包含)之间
  287. console.log(money+':5万-10万(包含)之间')
  288. var arr = [
  289. {
  290. type: item.type,
  291. typeName: item.typeName,
  292. fenduan: item.fenduan,
  293. bili: 0.05,
  294. ticheng: 50000 * 0.05,
  295. yue: 50000
  296. },
  297. {
  298. type: item.type,
  299. typeName: item.typeName,
  300. fenduan: item.fenduan,
  301. bili: 0.04,
  302. ticheng: (money - 50000) * 0.04,
  303. yue: money - 50000
  304. },
  305. ]
  306. dataLists.push(...arr)
  307. } else if (money >= 0){
  308. // 0-5万(包含)之间
  309. console.log(money+':0-5万(包含)之间')
  310. var arr = [
  311. {
  312. type: item.type,
  313. typeName: item.typeName,
  314. fenduan: item.fenduan,
  315. bili: 0.05,
  316. ticheng: money * 0.05,
  317. yue: money
  318. },
  319. ]
  320. dataLists.push(...arr)
  321. }
  322. }
  323. this.tableData.jixiaoData = dataLists
  324. },
  325. // 计算虚拟结算绩效总额
  326. computeJXXishuZonge(){
  327. // 将试验类型相同的金额相加
  328. var noHasXishuZonge = this.changeData(this.tableData.jixiaoData, 'ticheng')
  329. var total = 0
  330. var arr = noHasXishuZonge.map(item => {
  331. var obj = this.defineXishu.find(res => res.type === item.type)
  332. // 根据试验类型*对应系数
  333. item.price = item.price * obj.xishu
  334. // 计算出总和
  335. total += item.price
  336. return item
  337. })
  338. this.tableData.xnJixiaoZongeArr = arr
  339. console.log(total)
  340. this.tableData.xnJixiaoZonge = total
  341. },
  342. },
  343. }
  344. </script>
  345. <style scoped>
  346. @import '~@assets/less/common.less';
  347. table * {
  348. box-sizing: border-box;
  349. font-size: 14px;
  350. }
  351. table {
  352. border: 1px solid rgb(30, 53, 65);
  353. width: 100%;
  354. }
  355. td {
  356. text-align: center;
  357. border: 1px solid rgb(30, 53, 65);
  358. }
  359. tr {
  360. height: 50px;
  361. }
  362. .main-table {
  363. background-color: #DBEEF3;
  364. }
  365. .title {
  366. background-color: #fff;
  367. }
  368. .addRow {
  369. width: 60px;
  370. height: 24px;
  371. background-color: #fff;
  372. border-radius: 4px;
  373. text-align: center;
  374. line-height: 24px;
  375. font-size: 12px;
  376. margin-left: 20px;
  377. cursor: pointer;
  378. }
  379. .btn {
  380. display: inline-block;
  381. padding: 2px 10px;
  382. font-size: 13px;
  383. border: 1px solid rgb(3, 188, 244);
  384. color: rgb(8, 187, 241);
  385. border-radius: 4px;
  386. cursor: pointer;
  387. position: absolute;
  388. right: 3%;
  389. }
  390. .delBtn {
  391. padding: 3px 10px;
  392. text-align: center;
  393. font-size: 12px;
  394. }
  395. input {
  396. padding: 0 20px;
  397. height: 50px;
  398. outline: none;
  399. border: none;
  400. background: transparent;
  401. }
  402. .head {
  403. height: 35px;
  404. background-color: #FFFF00;
  405. text-align: center;
  406. line-height: 35px;
  407. font-weight: bold;
  408. font-size: 18px;
  409. border: 1px solid rgb(30, 53, 65);
  410. }
  411. </style>