index.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. <template>
  2. <template-page ref="pageRef" :getList="getList" :optionsEvensGroup="optionsEvensGroup" :columnParsing="columnParsing"
  3. :tableAttributes="tableAttributes" :tableEvents="tableEvents" :moreParameters="moreParameters"
  4. :screeningAnalysis="screeningAnalysis" :filterMethod="filterMethod" :replaceOrNotMap="true">
  5. </template-page>
  6. </template>
  7. <script>
  8. import TemplatePage from '@/components/template/template-page-1.vue'
  9. import import_mixin from '@/components/template/import_mixin.js'
  10. import operation_mixin from '@/components/template/operation_mixin.js'
  11. import { listPageV2 as listPageV3 } from "@/api/workOrder/settlementStandardInstall";
  12. import { listPageV2 as listPageV2Repair } from "@/api/workOrder/settlementStandardRepair";
  13. import { orderBaseList2, orderBaseStatusCount2, orderBaseSettleNormDetail2, settleNormInstallQuery, orderBaseSettleNormConfirm, settleNormOtherQuery, orderBaseSettleNormReset } from "@/api/workOrderPool.js"
  14. import { listPageV2 } from "@/api/workOrder/orderType";
  15. import ywgdjs from "@/assets/ywgdjs.png"
  16. import yjs from "@/assets/yjs.png"
  17. import { required } from '@/components/template/rules_verify.js'
  18. export default {
  19. components: {
  20. TemplatePage,
  21. },
  22. mixins: [import_mixin, operation_mixin],
  23. data() {
  24. return {
  25. // 表格属性
  26. tableAttributes: {
  27. columnExpand: this.columnExpand
  28. },
  29. // 表格事件
  30. tableEvents: {
  31. 'expand-change': this.expandChange
  32. },
  33. orderTypeList: [],
  34. orderStatusList: [],
  35. }
  36. },
  37. computed: {
  38. moreParameters() {
  39. return [
  40. {
  41. name: '工单类型',
  42. key: 'orderSmallType',
  43. value: '',
  44. conditions: [{
  45. label: "全部",
  46. value: ""
  47. }, ...this.orderTypeList]
  48. },
  49. {
  50. name: '工单状态',
  51. key: 'orderStatus',
  52. value: this.$route.query.orderStatus || "",
  53. conditions: [{
  54. label: "全部",
  55. value: ""
  56. }, ...this.orderStatusList]
  57. }
  58. ]
  59. },
  60. // 用户信息
  61. userInfo() {
  62. return JSON.parse(localStorage.getItem('greemall_user'))
  63. },
  64. // 事件组合
  65. optionsEvensGroup() {
  66. return []
  67. }
  68. },
  69. created() {
  70. // 获取工单类型
  71. listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
  72. this.orderTypeList = res.data.records.map(item => ({
  73. value: item.id,
  74. label: item.orderSmallTypeText
  75. }))
  76. })
  77. },
  78. methods: {
  79. screeningAnalysis(jname, val) {
  80. if (jname == 'orderFlags') {
  81. return (val || []).map(item => item.tagName).join(',')
  82. } else {
  83. return val
  84. }
  85. },
  86. filterMethod(value, row, column) {
  87. if (column['property'] == 'orderFlags') {
  88. return (row[column['property']] || []).map(item => item.tagName).join(',') === value
  89. }
  90. return row[column['property']] === value
  91. },
  92. // 获取统计
  93. getOrderBaseStatusCount(...p) {
  94. orderBaseStatusCount2(...p).then(res => {
  95. this.orderStatusList = [{
  96. label: "已完工待结算",
  97. value: "YWG"
  98. }, {
  99. label: "已结算",
  100. value: "YJS"
  101. }].map(item => {
  102. var data = res.data.find(val => val.orderStatus == item.value)
  103. if (data) {
  104. item.label = `${item.label}(${data.total})`
  105. }
  106. return item
  107. })
  108. })
  109. },
  110. // 列表请求函数
  111. getList(p, cb) {
  112. var pam = JSON.parse(JSON.stringify(p))
  113. try {
  114. if (pam.orderStatus) {
  115. pam.params.push({ "param": "a.order_status", "compare": "=", "value": pam.orderStatus })
  116. }
  117. if (pam.orderSmallType) {
  118. pam.params.push({ "param": "a.order_small_type", "compare": "=", "value": pam.orderSmallType })
  119. }
  120. cb && cb(pam)
  121. return orderBaseList2(pam)
  122. } catch (err) {
  123. } finally {
  124. this.$nextTick(() => {
  125. this.getOrderBaseStatusCount({ orderSmallType: pam.orderSmallType || "" })
  126. })
  127. }
  128. },
  129. // 表格列解析渲染数据更改
  130. columnParsing(item, defaultData) {
  131. if (item.jname === 'orderFlags') {
  132. defaultData.render = (h, { row, index, column }) => {
  133. return (
  134. <div style="padding:0 6px;display:flex;align-items:center;">
  135. {(row[column.columnAttributes.prop] || []).map(item => {
  136. if (item.tagName == "已完工") {
  137. return (
  138. <img src={ywgdjs} style="width:22px;height:22px;" />
  139. )
  140. } else if (item.tagName == "已结算") {
  141. return (
  142. <img src={yjs} style="width:22px;height:22px;" />
  143. )
  144. } else {
  145. return (
  146. <div style="display: inline-block;border:1px solid #409EFF; color:#409EFF;padding:0 2px;border-radius: 4px;margin:2px 2px 0 0;">
  147. {item.tagName}
  148. </div>
  149. )
  150. }
  151. })}
  152. </div>
  153. )
  154. }
  155. }
  156. if (item.jname === 'appointmentTime') {
  157. defaultData.render = (h, { row, index, column }) => {
  158. return (
  159. <div style="padding:0 6px;cursor: pointer;">
  160. {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
  161. </div>
  162. )
  163. }
  164. }
  165. return defaultData
  166. },
  167. expandChange(row) {
  168. if (!row.expandData) {
  169. orderBaseSettleNormDetail2({
  170. id: row.id,
  171. orderProductId: row.pgOrderProductId
  172. }).then(res => {
  173. this.zhuzhuang(res.data).then(res => {
  174. row.expandData = res
  175. })
  176. })
  177. }
  178. },
  179. columnExpand(h, { row, column, index }) {
  180. var expandDataForm = row.expandData
  181. var rowZhu = row
  182. return expandDataForm ? (<div style="box-sizing: border-box;padding: 10px 10px 0px 50px;">
  183. <zj-form-container form-data={expandDataForm}
  184. formAttributes={{ 'label-position': 'top' }}
  185. styleSwitch={false}>
  186. <zj-form-module title="费用结算" showHade={false} form-data={expandDataForm}
  187. form-items={[{
  188. md: 24,
  189. name: 'slot-component',
  190. formItemAttributes: {
  191. label: '费用结算',
  192. prop: 'normList',
  193. },
  194. render: (h, { props, onInput }) => {
  195. var { formData } = props
  196. var columns = [{
  197. columnAttributes: {
  198. label: '工单类型',
  199. prop: 'typeName'
  200. },
  201. },
  202. {
  203. columnAttributes: {
  204. label: '结算工单来源',
  205. prop: 'channelId',
  206. width: '110'
  207. },
  208. render: (h, { row, column, index }) => {
  209. return this.panfuan(row) ? <div class="redbordererr">
  210. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  211. <el-select
  212. disabled={expandDataForm.normListBj || !row.bianji}
  213. value={row[column.columnAttributes.prop]}
  214. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  215. onChange={(val) => {
  216. row.parentCategoryId = ""
  217. row.parentCategoryName = ""
  218. row.categoryId = ""
  219. row.categoryName = ""
  220. row.label = ""
  221. row.normAmount = ""
  222. row.repairAmount = ""
  223. row.settleNormId = ""
  224. if (val) {
  225. var data = this.classifyListChuLi(expandDataForm.classifyList, "orderChannelId", "orderChannelText").find(item => item.value == val)
  226. row.channelText = data.label
  227. } else {
  228. row.channelText = ""
  229. }
  230. }}
  231. placeholder="请选择">
  232. {this.classifyListChuLi(expandDataForm.classifyList, "orderChannelId", "orderChannelText").map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  233. </el-select>
  234. </el-form-item>
  235. </div> : null
  236. }
  237. },
  238. {
  239. columnAttributes: {
  240. label: '结算产品大类',
  241. prop: 'parentCategoryId',
  242. width: '110'
  243. },
  244. render: (h, { row, column, index }) => {
  245. return this.panfuan(row) ? <div class="redbordererr">
  246. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  247. <el-select
  248. disabled={expandDataForm.normListBj || !row.bianji}
  249. value={row[column.columnAttributes.prop]}
  250. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  251. onChange={(val) => {
  252. row.categoryId = ""
  253. row.categoryName = ""
  254. row.label = ""
  255. row.normAmount = ""
  256. row.repairAmount = ""
  257. row.settleNormId = ""
  258. if (val) {
  259. var data = this.classifyListChuLi(expandDataForm.classifyList, "parentCategoryId", "parentCategoryName", (item) => item.orderChannelId == row.channelId).find(item => item.value == val)
  260. row.parentCategoryName = data.label
  261. } else {
  262. row.parentCategoryName = ""
  263. }
  264. }}
  265. placeholder="请选择">
  266. {this.classifyListChuLi(expandDataForm.classifyList, "parentCategoryId", "parentCategoryName", (item) => item.orderChannelId == row.channelId).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  267. </el-select>
  268. </el-form-item>
  269. </div> : null
  270. }
  271. },
  272. {
  273. columnAttributes: {
  274. label: '结算产品小类',
  275. prop: 'categoryId',
  276. width: '110'
  277. },
  278. render: (h, { row, column, index }) => {
  279. return this.panfuan(row) ? <div class="redbordererr">
  280. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  281. <el-select
  282. disabled={expandDataForm.normListBj || !row.bianji}
  283. value={row[column.columnAttributes.prop]}
  284. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  285. onChange={(val) => {
  286. row.label = ""
  287. row.normAmount = ""
  288. row.repairAmount = ""
  289. row.settleNormId = ""
  290. if (val) {
  291. var data = this.classifyListChuLi(expandDataForm.classifyList, "categoryId", "categoryName", (item) => item.orderChannelId == row.channelId && item.parentCategoryId == row.parentCategoryId).find(item => item.value == val)
  292. row.categoryName = data.label
  293. } else {
  294. row.categoryName = ""
  295. }
  296. }}
  297. placeholder="请选择">
  298. {this.classifyListChuLi(expandDataForm.classifyList, "categoryId", "categoryName", (item) => item.orderChannelId == row.channelId && item.parentCategoryId == row.parentCategoryId).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  299. </el-select>
  300. </el-form-item>
  301. </div> : null
  302. }
  303. },
  304. ...(() => {
  305. if (expandDataForm.orderType == 'INSTALL') {
  306. return [
  307. {
  308. columnAttributes: {
  309. label: '结算功率',
  310. prop: 'label'
  311. },
  312. render: (h, { row, column, index }) => {
  313. return this.panfuan(row) ? <div class="redbordererr">
  314. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  315. <el-select
  316. disabled={expandDataForm.normListBj || !row.bianji}
  317. value={row[column.columnAttributes.prop]}
  318. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  319. onChange={(val) => {
  320. if (val) {
  321. var data = this.getflList(expandDataForm.gonglv, row).find(item => item.label == val)
  322. row.normAmount = data.normAmount
  323. row.settleNormId = data.id
  324. } else {
  325. row.normAmount = ""
  326. row.settleNormId = ""
  327. }
  328. }}
  329. placeholder="请选择">
  330. {this.getflList(expandDataForm.gonglv, row).map((item, index_) => <el-option key={index_} label={item.label} value={item.label}></el-option>)}
  331. </el-select>
  332. </el-form-item>
  333. </div> : null
  334. }
  335. },
  336. {
  337. columnAttributes: {
  338. label: '结算标准(元/套)',
  339. prop: 'normAmount',
  340. width: "160px"
  341. },
  342. },
  343. {
  344. columnAttributes: {
  345. label: '结算数量',
  346. prop: 'settleNum',
  347. width: "160px"
  348. },
  349. render: (h, { row, column, index }) => {
  350. return this.panfuan(row) ? <div class="redbordererr">
  351. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  352. <el-input
  353. type="number"
  354. disabled={expandDataForm.normListBj || !row.bianji}
  355. value={row[column.columnAttributes.prop]}
  356. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  357. placeholder="请输入内容"
  358. >
  359. </el-input>
  360. </el-form-item>
  361. </div> : null
  362. }
  363. },
  364. {
  365. columnAttributes: {
  366. label: '结算金额(元)',
  367. prop: 'settleAmount',
  368. width: "160px"
  369. },
  370. render: (h, { row, column, index }) => {
  371. row.settleAmount = (((Number(row.normAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
  372. return this.panfuan(row) ? <div class="redbordererr">
  373. {row.settleAmount}
  374. </div> : null
  375. }
  376. },
  377. ]
  378. }
  379. return []
  380. })(),
  381. ...(() => {
  382. if (expandDataForm.orderType == 'REPAIR') {
  383. return [
  384. {
  385. columnAttributes: {
  386. label: '质保类型',
  387. prop: 'label'
  388. },
  389. render: (h, { row, column, index }) => {
  390. return this.panfuan(row) ? <div class="redbordererr">
  391. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  392. <el-select
  393. disabled={expandDataForm.normListBj || !row.bianji}
  394. value={row[column.columnAttributes.prop]}
  395. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  396. onChange={(val) => {
  397. if (val) {
  398. var data = this.getflList(expandDataForm.gonglr, row).find(item => item.label == val)
  399. row.repairAmount = data.repairAmount
  400. row.normAmount = data.normAmount
  401. row.settleNormId = data.id
  402. } else {
  403. row.repairAmount = ""
  404. row.normAmount = ""
  405. row.settleNormId = ""
  406. }
  407. }}
  408. placeholder="请选择">
  409. {this.getflList(expandDataForm.gonglr, row).map((item, index_) => <el-option key={index_} label={({ INSIDE: '保内', OUT: '保外' })[item.label]} value={item.label}></el-option>)}
  410. </el-select>
  411. </el-form-item>
  412. </div> : null
  413. }
  414. },
  415. {
  416. columnAttributes: {
  417. label: '上门费(元/单)',
  418. prop: 'repairAmount',
  419. width: '110'
  420. },
  421. render: (h, { row, column, index }) => {
  422. return this.panfuan(row) ? <div class="redbordererr">
  423. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  424. <el-input
  425. disabled={expandDataForm.normListBj || !row.bianji}
  426. type="number"
  427. value={row[column.columnAttributes.prop]}
  428. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  429. placeholder="请输入内容"
  430. >
  431. </el-input>
  432. </el-form-item>
  433. </div> : null
  434. }
  435. },
  436. {
  437. columnAttributes: {
  438. label: '维修费结算比例%',
  439. prop: 'normAmount',
  440. width: '110'
  441. },
  442. render: (h, { row, column, index }) => {
  443. return this.panfuan(row) ? <div class="redbordererr">
  444. {row[column.columnAttributes.prop]}%
  445. </div> : null
  446. }
  447. },
  448. {
  449. columnAttributes: {
  450. label: '维修费用结算',
  451. prop: 'repairNormAmount',
  452. width: '110'
  453. },
  454. render: (h, { row, column, index }) => {
  455. return this.panfuan(row) ? <div class="redbordererr">
  456. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  457. <el-input
  458. disabled={expandDataForm.normListBj || !row.bianji}
  459. type="number"
  460. value={row[column.columnAttributes.prop]}
  461. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  462. placeholder="请输入内容"
  463. >
  464. </el-input>
  465. </el-form-item>
  466. </div> : null
  467. }
  468. },
  469. {
  470. columnAttributes: {
  471. label: '结算数量',
  472. prop: 'settleNum',
  473. width: "160px"
  474. },
  475. render: (h, { row, column, index }) => {
  476. return this.panfuan(row) ? <div class="redbordererr">
  477. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  478. <el-input
  479. type="number"
  480. disabled={expandDataForm.normListBj || !row.bianji}
  481. value={row[column.columnAttributes.prop]}
  482. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  483. placeholder="请输入内容"
  484. >
  485. </el-input>
  486. </el-form-item>
  487. </div> : null
  488. }
  489. },
  490. {
  491. columnAttributes: {
  492. label: '结算金额(元)',
  493. prop: 'settleAmount',
  494. width: "160px"
  495. },
  496. render: (h, { row, column, index }) => {
  497. row.settleAmount = (((Number(row.repairAmount || 0) + (Number(row.normAmount || 0) / 100) * Number(row.repairNormAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
  498. return this.panfuan(row) ? <div class="redbordererr">
  499. {row.settleAmount}
  500. </div> : null
  501. }
  502. },
  503. ]
  504. }
  505. return []
  506. })(),
  507. {
  508. columnAttributes: {
  509. label: '备注',
  510. prop: 'remark',
  511. width: "200px"
  512. },
  513. render: (h, { row, column, index }) => {
  514. return this.panfuan(row) ? <div class="redbordererr">
  515. <el-form-item label="" label-width="0px">
  516. <el-input
  517. disabled={expandDataForm.normListBj || !row.bianji}
  518. value={row[column.columnAttributes.prop]}
  519. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  520. placeholder="请输入内容"
  521. >
  522. </el-input>
  523. </el-form-item>
  524. </div> : null
  525. }
  526. },
  527. {
  528. columnAttributes: {
  529. label: '工程师名称',
  530. prop: 'workerName',
  531. width: "140px"
  532. },
  533. render: (h, { row, column, index }) => {
  534. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  535. {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  536. </div>
  537. }
  538. },
  539. {
  540. columnAttributes: {
  541. label: '联系电话',
  542. prop: 'workerMobile',
  543. width: '140px'
  544. },
  545. render: (h, { row, column, index }) => {
  546. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  547. {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  548. </div>
  549. }
  550. },
  551. {
  552. columnAttributes: {
  553. label: '结算费用',
  554. prop: 'settleAmount',
  555. width: "140px"
  556. },
  557. render: (h, { row, column, index }) => {
  558. return <div class="redbordererr">
  559. <el-form-item label="" label-width="0px" prop={`normList.${row.pfuqinid}.workerList.${row.zijideid}.${column.columnAttributes.prop}`} rules={required}>
  560. <el-input
  561. type="number"
  562. disabled={!expandDataForm.normList[row.pfuqinid].bianji || expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.["poolStatus"] == "YES"}
  563. value={expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  564. onInput={(val) => {
  565. expandDataForm.normList[row.pfuqinid].workerList[row.zijideid][column.columnAttributes.prop] = val
  566. }}
  567. placeholder="请输入内容"
  568. >
  569. </el-input>
  570. </el-form-item>
  571. </div>
  572. }
  573. }, {
  574. columnAttributes: {
  575. label: '确认人',
  576. prop: 'confirmBy',
  577. width: "100px"
  578. },
  579. render: (h, { row, column, index }) => {
  580. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  581. {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  582. </div>
  583. }
  584. },
  585. {
  586. columnAttributes: {
  587. label: '确认时间',
  588. prop: 'confirmTime',
  589. width: "140px"
  590. },
  591. render: (h, { row, column, index }) => {
  592. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  593. {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  594. </div>
  595. }
  596. },
  597. {
  598. columnAttributes: {
  599. label: '汇总状态',
  600. prop: 'poolStatus',
  601. width: "100px"
  602. },
  603. render: (h, { row, column, index }) => {
  604. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  605. {({ "NO": "未汇总", "YES": "已汇总" })[expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]]}
  606. </div>
  607. }
  608. }, {
  609. columnAttributes: {
  610. label: '操作',
  611. prop: '',
  612. fixed: 'right',
  613. width: "120px"
  614. },
  615. render: (h, { row, column, index }) => {
  616. return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.normList[row.pfuqinid]?.workerList.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;">
  617. {expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  618. () => {
  619. var yjsje = [0, 0, 0, expandDataForm?.normList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
  620. return prev + curr;
  621. })
  622. var nou = expandDataForm?.normList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
  623. var qian = ((((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
  624. var rongyu = ((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
  625. nou.map((item, index) => {
  626. if (index === 0) {
  627. item.settleAmount = (Number(qian) + Number(rongyu)).toFixed(2)
  628. } else {
  629. item.settleAmount = qian
  630. }
  631. })
  632. }
  633. }>平分费用</el-button> : null}
  634. {expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  635. () => {
  636. this.itemOrderBaseSettleNormReset(rowZhu, "normList", () => {
  637. expandDataForm.normList[row.pfuqinid].bianji = false
  638. })
  639. }
  640. }>确定</el-button> : null}
  641. {!expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  642. () => {
  643. expandDataForm.normList[row.pfuqinid].bianji = true
  644. }
  645. }>修改</el-button> : null}
  646. {!expandDataForm.showOtherNormList ? <el-button type="text" onClick={
  647. () => {
  648. expandDataForm.showOtherNormList = true
  649. }
  650. }>添加其他费用</el-button> : null}
  651. </div>) : null
  652. }
  653. }]
  654. return (
  655. <zj-table
  656. columns={columns}
  657. table-data={formData.normList}
  658. tableAttributes={{
  659. 'span-method': ({ row, column, rowIndex, columnIndex }) => {
  660. if (columnIndex === columns.length - 1) {
  661. if (row.zijideid == 0) {
  662. return {
  663. rowspan: formData.normList[row.pfuqinid].workerList.length,
  664. colspan: 1
  665. };
  666. } else {
  667. return {
  668. rowspan: 0,
  669. colspan: 0
  670. };
  671. }
  672. }
  673. }
  674. }}
  675. />
  676. )
  677. }
  678. },
  679. {
  680. md: 24,
  681. isShow: expandDataForm.showOtherNormList,
  682. name: 'slot-component',
  683. formItemAttributes: {
  684. label: '其他费用结算',
  685. prop: 'otherNormList',
  686. },
  687. render: (h, { props, onInput }) => {
  688. var { formData } = props
  689. var columns = [{
  690. columnAttributes: {
  691. label: '结算工单来源',
  692. prop: 'channelId',
  693. width: '110'
  694. },
  695. render: (h, { row, column, index }) => {
  696. return this.panfuan(row) ? <div class="redbordererr">
  697. <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
  698. <el-select
  699. disabled={expandDataForm.otherNormListBj || !row.bianji}
  700. value={row[column.columnAttributes.prop]}
  701. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  702. onChange={(val) => {
  703. row.type = ""
  704. row.label = ""
  705. row.normAmount = ""
  706. row.settleNormId = ""
  707. row.settleNum = ""
  708. if (val) {
  709. var data = this.otherListChuLi(expandDataForm.otherList, "orderChannelId", "orderChannelText").find(item => item.value == val)
  710. row.channelText = data.label
  711. } else {
  712. row.channelText = ""
  713. }
  714. }}
  715. placeholder="请选择">
  716. {this.otherListChuLi(expandDataForm.otherList, "orderChannelId", "orderChannelText").map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  717. </el-select>
  718. </el-form-item>
  719. </div> : null
  720. }
  721. },
  722. {
  723. columnAttributes: {
  724. label: '费用类型',
  725. prop: 'type'
  726. },
  727. render: (h, { row, column, index }) => {
  728. return this.panfuan(row) ? <div class="redbordererr">
  729. <el-form-item label="" label-width="0px">
  730. <el-select
  731. disabled={expandDataForm.otherNormListBj || !row.bianji}
  732. value={row[column.columnAttributes.prop]}
  733. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  734. onChange={(val) => {
  735. row.label = ""
  736. row.normAmount = ""
  737. row.settleNormId = ""
  738. row.settleNum = ""
  739. }}
  740. placeholder="请选择">
  741. {this.otherListChuLi(expandDataForm.otherList, "type", "typeName", (item) => item.orderChannelId == row.channelId).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  742. </el-select>
  743. </el-form-item>
  744. </div> : null
  745. }
  746. },
  747. {
  748. columnAttributes: {
  749. label: '规格',
  750. prop: 'label'
  751. },
  752. render: (h, { row, column, index }) => {
  753. return this.panfuan(row) ? <div class="redbordererr">
  754. <el-form-item label="" label-width="0px">
  755. <el-select
  756. disabled={expandDataForm.otherNormListBj || !row.bianji}
  757. value={row[column.columnAttributes.prop]}
  758. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  759. onChange={(val) => {
  760. row.settleNum = ""
  761. if (val) {
  762. var data = this.otherListChuLi(expandDataForm.otherList, "label", "label", (item) => { return item.orderChannelId == row.channelId && item.type == row.type }, "normAmount", "id").find(item => item.label == val)
  763. row.normAmount = data.normAmount
  764. row.settleNormId = data.id
  765. } else {
  766. row.normAmount = ""
  767. row.settleNormId = ""
  768. }
  769. }}
  770. placeholder="请选择">
  771. {this.otherListChuLi(expandDataForm.otherList, "label", "label", (item) => item.orderChannelId == row.channelId && item.type == row.type).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
  772. </el-select>
  773. </el-form-item>
  774. </div> : null
  775. }
  776. },
  777. {
  778. columnAttributes: {
  779. label: '单价(元/套)',
  780. prop: 'normAmount',
  781. width: "160px"
  782. },
  783. },
  784. {
  785. columnAttributes: {
  786. label: '数量',
  787. prop: 'settleNum',
  788. width: "160px"
  789. },
  790. render: (h, { row, column, index }) => {
  791. return this.panfuan(row) ? <div class="redbordererr">
  792. <el-form-item label="" label-width="0px">
  793. <el-input
  794. type="number"
  795. disabled={expandDataForm.otherNormListBj || !row.bianji}
  796. value={row[column.columnAttributes.prop]}
  797. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  798. placeholder="请输入内容"
  799. >
  800. </el-input>
  801. </el-form-item>
  802. </div> : null
  803. }
  804. },
  805. {
  806. columnAttributes: {
  807. label: '结算金额(元)',
  808. prop: 'settleAmount',
  809. width: "160px"
  810. },
  811. render: (h, { row, column, index }) => {
  812. row.settleAmount = (((Number(row.normAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
  813. return this.panfuan(row) ? <div class="redbordererr">
  814. {row.settleAmount}
  815. </div> : null
  816. }
  817. },
  818. {
  819. columnAttributes: {
  820. label: '备注',
  821. prop: 'remark',
  822. width: "200px"
  823. },
  824. render: (h, { row, column, index }) => {
  825. return this.panfuan(row) ? <div class="redbordererr">
  826. <el-form-item label="" label-width="0px">
  827. <el-input
  828. disabled={expandDataForm.otherNormListBj || !row.bianji}
  829. value={row[column.columnAttributes.prop]}
  830. onInput={(val) => { row[column.columnAttributes.prop] = val }}
  831. placeholder="请输入内容"
  832. >
  833. </el-input>
  834. </el-form-item>
  835. </div> : null
  836. }
  837. },
  838. {
  839. columnAttributes: {
  840. label: '工程师名称',
  841. prop: 'workerName',
  842. width: "140px"
  843. },
  844. render: (h, { row, column, index }) => {
  845. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  846. {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  847. </div>
  848. }
  849. },
  850. {
  851. columnAttributes: {
  852. label: '联系电话',
  853. prop: 'workerMobile',
  854. width: '140px'
  855. },
  856. render: (h, { row, column, index }) => {
  857. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  858. {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  859. </div>
  860. }
  861. },
  862. {
  863. columnAttributes: {
  864. label: '结算费用',
  865. prop: 'settleAmount',
  866. width: "140px"
  867. },
  868. render: (h, { row, column, index }) => {
  869. return <div class="redbordererr">
  870. <el-form-item label="" label-width="0px" prop={`otherNormList.${row.pfuqinid}.workerList.${row.zijideid}.${column.columnAttributes.prop}`} rules={required}>
  871. <el-input
  872. type="number"
  873. disabled={!expandDataForm.otherNormList[row.pfuqinid].bianji || expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.["poolStatus"] == "YES"}
  874. value={expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  875. onInput={(val) => {
  876. expandDataForm.otherNormList[row.pfuqinid].workerList[row.zijideid][column.columnAttributes.prop] = val
  877. }}
  878. placeholder="请输入内容"
  879. >
  880. </el-input>
  881. </el-form-item>
  882. </div>
  883. }
  884. }, {
  885. columnAttributes: {
  886. label: '确认人',
  887. prop: 'confirmBy',
  888. width: "100px"
  889. },
  890. render: (h, { row, column, index }) => {
  891. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  892. {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  893. </div>
  894. }
  895. },
  896. {
  897. columnAttributes: {
  898. label: '确认时间',
  899. prop: 'confirmTime',
  900. width: "140px"
  901. },
  902. render: (h, { row, column, index }) => {
  903. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  904. {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
  905. </div>
  906. }
  907. },
  908. {
  909. columnAttributes: {
  910. label: '汇总状态',
  911. prop: 'poolStatus',
  912. width: "100px"
  913. },
  914. render: (h, { row, column, index }) => {
  915. return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
  916. {({ "NO": "未汇总", "YES": "已汇总" })[expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]]}
  917. </div>
  918. }
  919. }, {
  920. columnAttributes: {
  921. label: '操作',
  922. prop: '',
  923. fixed: 'right',
  924. width: "120px"
  925. },
  926. render: (h, { row, column, index }) => {
  927. return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.otherNormList[row.pfuqinid]?.workerList.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;display:flex;align-items:center;">
  928. {expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  929. () => {
  930. var yjsje = [0, 0, 0, expandDataForm?.otherNormList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
  931. return prev + curr;
  932. })
  933. var nou = expandDataForm?.otherNormList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
  934. var qian = ((((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
  935. var rongyu = ((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
  936. nou.map((item, index) => {
  937. if (index === 0) {
  938. item.settleAmount = (Number(qian) + Number(rongyu)).toFixed(2)
  939. } else {
  940. item.settleAmount = qian
  941. }
  942. })
  943. }
  944. }>平分费用</el-button> : null}
  945. {expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  946. () => {
  947. this.itemOrderBaseSettleNormReset(rowZhu, "otherNormList", () => {
  948. expandDataForm.otherNormList[row.pfuqinid].bianji = false
  949. })
  950. }
  951. }>确定</el-button> : null}
  952. {!expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
  953. () => {
  954. expandDataForm.otherNormList[row.pfuqinid].bianji = true
  955. }
  956. }>修改</el-button> : null}
  957. </div>) : null
  958. }
  959. }]
  960. return (
  961. <zj-table
  962. columns={columns}
  963. table-data={formData.otherNormList}
  964. tableAttributes={{
  965. 'span-method': ({ row, column, rowIndex, columnIndex }) => {
  966. if (columnIndex === columns.length - 1) {
  967. if (row.zijideid == 0) {
  968. return {
  969. rowspan: formData.otherNormList[row.pfuqinid].workerList.length,
  970. colspan: 1
  971. };
  972. } else {
  973. return {
  974. rowspan: 0,
  975. colspan: 0
  976. };
  977. }
  978. }
  979. }
  980. }}
  981. />
  982. )
  983. }
  984. }]} />
  985. </zj-form-container>
  986. </div>) : null
  987. },
  988. itemOrderBaseSettleNormReset(data, type, cb) {
  989. try {
  990. data.expandData.normList.filter(item => !!item.id).map(item => {
  991. if ([0, 0, 0, ...item.workerList?.map(val => Number(val.settleAmount))].reduce(function (prev, curr, idx, arr) {
  992. return prev + curr;
  993. }) !== Number(item.settleAmount)) {
  994. throw new Error(`费用信息-${item.channelText}-${item.parentCategoryName}-${item.categoryName}-${item.label}:合计结算总金额与总金额不等`);
  995. }
  996. })
  997. data.expandData.otherNormList.filter(item => !!item.id).map(item => {
  998. if ([0, 0, 0, ...item.workerList?.map(val => Number(val.settleAmount))].reduce(function (prev, curr, idx, arr) {
  999. return prev + curr;
  1000. }) !== Number(item.settleAmount)) {
  1001. throw new Error(`其他费用信息-${item.channelText}-${item.type}-${item.label}:合计结算总金额与总金额不等`);
  1002. }
  1003. })
  1004. } catch (err) {
  1005. this.$message.warning(err.message)
  1006. return
  1007. }
  1008. var { classifyList, gonglr, gonglv, otherList, normListBj, otherNormListBj, showOtherNormList, ...pam } = data.expandData;
  1009. ([orderBaseSettleNormConfirm, orderBaseSettleNormReset])[pam.settleStatus == 'YWG' ? 0 : 1]({
  1010. ...pam,
  1011. ...(() => {
  1012. if (type == "normList") {
  1013. return {
  1014. normList: pam.normList.filter(item => !!item.id),
  1015. }
  1016. }
  1017. return {
  1018. normList: [],
  1019. }
  1020. })(),
  1021. ...(() => {
  1022. if (type == "otherNormList") {
  1023. return {
  1024. otherNormList: pam.otherNormList.filter(item => !!item.id),
  1025. }
  1026. }
  1027. return {
  1028. otherNormList: [],
  1029. }
  1030. })(),
  1031. }).then(res => {
  1032. orderBaseSettleNormDetail2({
  1033. id: data.id,
  1034. orderProductId: data.pgOrderProductId
  1035. }).then(res => {
  1036. this.zhuzhuang(res.data).then(res => {
  1037. data.expandData = res
  1038. })
  1039. })
  1040. cb && cb()
  1041. this.$message({
  1042. type: 'success',
  1043. message: '结算成功'
  1044. })
  1045. })
  1046. },
  1047. zhuzhuang(data) {
  1048. return new Promise((r, j) => {
  1049. var orderChannelId
  1050. var normList = []
  1051. var pfuqinid = 0
  1052. data.normListBj = false
  1053. data.otherNormListBj = false
  1054. data.showOtherNormList = false
  1055. data.normList.map((item, index) => {
  1056. if (!orderChannelId) { orderChannelId = item.orderChannelId }
  1057. item.settleNum = item.settleNum || ""
  1058. normList.push({ ...item, pfuqinid: pfuqinid, zijideid: 0, bianji: !item.workerList.find(resdata => !!resdata.settleOrderId) })
  1059. item.workerList?.map((resdata, ind_) => {
  1060. if (resdata.settleOrderId) { data.normListBj = true }
  1061. if (ind_ !== 0) { normList.push({ pfuqinid: pfuqinid, zijideid: ind_ }) }
  1062. if (ind_ == item.workerList.length - 1) { pfuqinid += (ind_ + 1) }
  1063. })
  1064. })
  1065. var otherNormList = []
  1066. var qtpfuqinid = 0
  1067. data.otherNormList.map((item, index) => {
  1068. item.settleNum = item.settleNum || ""
  1069. otherNormList.push({ ...item, pfuqinid: qtpfuqinid, zijideid: 0, bianji: !item.workerList.find(resdata => !!resdata.settleOrderId) })
  1070. if (!data.showOtherNormList) {
  1071. data.showOtherNormList = !!item.workerList.find(resdata => !!resdata.settleOrderId)
  1072. }
  1073. item.workerList?.map((resdata, ind_) => {
  1074. if (resdata.settleOrderId) { data.otherNormListBj = true }
  1075. if (ind_ !== 0) { otherNormList.push({ pfuqinid: qtpfuqinid, zijideid: ind_ }) }
  1076. if (ind_ == item.workerList.length - 1) { qtpfuqinid += (ind_ + 1) }
  1077. })
  1078. })
  1079. Promise.all([
  1080. listPageV3({ "pageNum": 1, "pageSize": -1 }),
  1081. listPageV2Repair({ "pageNum": 1, "pageSize": -1 }),
  1082. settleNormInstallQuery({
  1083. settleNormType: data.orderType,
  1084. type: data.orderSmallType
  1085. }),
  1086. settleNormOtherQuery()
  1087. ]).then(([res1, res2, res3, res4]) => {
  1088. r({
  1089. ...data,
  1090. normList,
  1091. otherNormList,
  1092. gonglv: res1.data.records,
  1093. gonglr: res2.data.records,
  1094. classifyList: res3.data,
  1095. otherList: res4.data,
  1096. })
  1097. }).catch(j)
  1098. })
  1099. },
  1100. panfuan(item) {
  1101. if (!!item.id) {
  1102. return true
  1103. } else {
  1104. return false
  1105. }
  1106. },
  1107. // 产品类型过滤筛选
  1108. classifyListChuLi(list, value, label, func, ...keys) {
  1109. var obj = {};
  1110. list.map(item => {
  1111. if (func && !func(item)) {
  1112. return
  1113. }
  1114. obj[item[value]] = {
  1115. label: item[label]
  1116. }
  1117. for (var key of keys) {
  1118. obj[item[value]][key] = item[key]
  1119. }
  1120. })
  1121. return Object.keys(obj).map(value => {
  1122. return {
  1123. value: value,
  1124. ...obj[value]
  1125. }
  1126. })
  1127. },
  1128. // 其他类型筛选
  1129. otherListChuLi(list, value, label, func, ...keys) {
  1130. var obj = {};
  1131. list.map(item => {
  1132. if (func && !func(item)) {
  1133. return
  1134. }
  1135. obj[item[value]] = {
  1136. label: item[label]
  1137. }
  1138. for (var key of keys) {
  1139. obj[item[value]][key] = item[key]
  1140. }
  1141. })
  1142. return Object.keys(obj).map(value => {
  1143. return {
  1144. value: value,
  1145. ...obj[value]
  1146. }
  1147. })
  1148. },
  1149. getflList(list = [], row = {},) {
  1150. return list.filter(item => (
  1151. item.type == row.type &&
  1152. item.parentCategoryId == row.parentCategoryId &&
  1153. item.categoryId == row.categoryId
  1154. ))
  1155. },
  1156. }
  1157. }
  1158. </script>
  1159. <style lang="scss">
  1160. .redbordererranniuright {
  1161. .el-button {
  1162. margin-left: 0px;
  1163. margin-right: 10px;
  1164. }
  1165. }
  1166. </style>