123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185 |
- <template>
- <template-page ref="pageRef" :getList="getList" :optionsEvensGroup="optionsEvensGroup" :columnParsing="columnParsing"
- :tableAttributes="tableAttributes" :tableEvents="tableEvents" :moreParameters="moreParameters"
- :screeningAnalysis="screeningAnalysis" :filterMethod="filterMethod" :replaceOrNotMap="true">
- </template-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- import { listPageV2 as listPageV3 } from "@/api/workOrder/settlementStandardInstall";
- import { listPageV2 as listPageV2Repair } from "@/api/workOrder/settlementStandardRepair";
- import { orderBaseList2, orderBaseStatusCount2, orderBaseSettleNormDetail2, settleNormInstallQuery, orderBaseSettleNormConfirm, settleNormOtherQuery, orderBaseSettleNormReset } from "@/api/workOrderPool.js"
- import { listPageV2 } from "@/api/workOrder/orderType";
- import ywgdjs from "@/assets/ywgdjs.png"
- import yjs from "@/assets/yjs.png"
- import { required } from '@/components/template/rules_verify.js'
- export default {
- components: {
- TemplatePage,
- },
- mixins: [import_mixin, operation_mixin],
- data() {
- return {
- // 表格属性
- tableAttributes: {
- columnExpand: this.columnExpand
- },
- // 表格事件
- tableEvents: {
- 'expand-change': this.expandChange
- },
- orderTypeList: [],
- orderStatusList: [],
- }
- },
- computed: {
- moreParameters() {
- return [
- {
- name: '工单类型',
- key: 'orderSmallType',
- value: '',
- conditions: [{
- label: "全部",
- value: ""
- }, ...this.orderTypeList]
- },
- {
- name: '工单状态',
- key: 'orderStatus',
- value: this.$route.query.orderStatus || "",
- conditions: [{
- label: "全部",
- value: ""
- }, ...this.orderStatusList]
- }
- ]
- },
- // 用户信息
- userInfo() {
- return JSON.parse(localStorage.getItem('greemall_user'))
- },
- // 事件组合
- optionsEvensGroup() {
- return []
- }
- },
- created() {
- // 获取工单类型
- listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
- this.orderTypeList = res.data.records.map(item => ({
- value: item.id,
- label: item.orderSmallTypeText
- }))
- })
- },
- methods: {
- screeningAnalysis(jname, val) {
- if (jname == 'orderFlags') {
- return (val || []).map(item => item.tagName).join(',')
- } else {
- return val
- }
- },
- filterMethod(value, row, column) {
- if (column['property'] == 'orderFlags') {
- return (row[column['property']] || []).map(item => item.tagName).join(',') === value
- }
- return row[column['property']] === value
- },
- // 获取统计
- getOrderBaseStatusCount(...p) {
- orderBaseStatusCount2(...p).then(res => {
- this.orderStatusList = [{
- label: "已完工待结算",
- value: "YWG"
- }, {
- label: "已结算",
- value: "YJS"
- }].map(item => {
- var data = res.data.find(val => val.orderStatus == item.value)
- if (data) {
- item.label = `${item.label}(${data.total})`
- }
- return item
- })
- })
- },
- // 列表请求函数
- getList(p, cb) {
- var pam = JSON.parse(JSON.stringify(p))
- try {
- if (pam.orderStatus) {
- pam.params.push({ "param": "a.order_status", "compare": "=", "value": pam.orderStatus })
- }
- if (pam.orderSmallType) {
- pam.params.push({ "param": "a.order_small_type", "compare": "=", "value": pam.orderSmallType })
- }
- cb && cb(pam)
- return orderBaseList2(pam)
- } catch (err) {
- } finally {
- this.$nextTick(() => {
- this.getOrderBaseStatusCount({ orderSmallType: pam.orderSmallType || "" })
- })
- }
- },
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- if (item.jname === 'orderFlags') {
- defaultData.render = (h, { row, index, column }) => {
- return (
- <div style="padding:0 6px;display:flex;align-items:center;">
- {(row[column.columnAttributes.prop] || []).map(item => {
- if (item.tagName == "已完工") {
- return (
- <img src={ywgdjs} style="width:22px;height:22px;" />
- )
- } else if (item.tagName == "已结算") {
- return (
- <img src={yjs} style="width:22px;height:22px;" />
- )
- } else {
- return (
- <div style="display: inline-block;border:1px solid #409EFF; color:#409EFF;padding:0 2px;border-radius: 4px;margin:2px 2px 0 0;">
- {item.tagName}
- </div>
- )
- }
- })}
- </div>
- )
- }
- }
- if (item.jname === 'appointmentTime') {
- defaultData.render = (h, { row, index, column }) => {
- return (
- <div style="padding:0 6px;cursor: pointer;">
- {row[column.columnAttributes.prop] ? row[column.columnAttributes.prop].split(" ")[0] : ""}
- </div>
- )
- }
- }
- return defaultData
- },
- expandChange(row) {
- if (!row.expandData) {
- orderBaseSettleNormDetail2({
- id: row.id,
- orderProductId: row.pgOrderProductId
- }).then(res => {
- this.zhuzhuang(res.data).then(res => {
- row.expandData = res
- })
- })
- }
- },
- columnExpand(h, { row, column, index }) {
- var expandDataForm = row.expandData
- var rowZhu = row
- return expandDataForm ? (<div style="box-sizing: border-box;padding: 10px 10px 0px 50px;">
- <zj-form-container form-data={expandDataForm}
- formAttributes={{ 'label-position': 'top' }}
- styleSwitch={false}>
- <zj-form-module title="费用结算" showHade={false} form-data={expandDataForm}
- form-items={[{
- md: 24,
- name: 'slot-component',
- formItemAttributes: {
- label: '费用结算',
- prop: 'normList',
- },
- render: (h, { props, onInput }) => {
- var { formData } = props
- var columns = [{
- columnAttributes: {
- label: '工单类型',
- prop: 'typeName'
- },
- },
- {
- columnAttributes: {
- label: '结算工单来源',
- prop: 'channelId',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.parentCategoryId = ""
- row.parentCategoryName = ""
- row.categoryId = ""
- row.categoryName = ""
- row.label = ""
- row.normAmount = ""
- row.repairAmount = ""
- row.settleNormId = ""
- if (val) {
- var data = this.classifyListChuLi(expandDataForm.classifyList, "orderChannelId", "orderChannelText").find(item => item.value == val)
- row.channelText = data.label
- } else {
- row.channelText = ""
- }
- }}
- placeholder="请选择">
- {this.classifyListChuLi(expandDataForm.classifyList, "orderChannelId", "orderChannelText").map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算产品大类',
- prop: 'parentCategoryId',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.categoryId = ""
- row.categoryName = ""
- row.label = ""
- row.normAmount = ""
- row.repairAmount = ""
- row.settleNormId = ""
- if (val) {
- var data = this.classifyListChuLi(expandDataForm.classifyList, "parentCategoryId", "parentCategoryName", (item) => item.orderChannelId == row.channelId).find(item => item.value == val)
- row.parentCategoryName = data.label
- } else {
- row.parentCategoryName = ""
- }
- }}
- placeholder="请选择">
- {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>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算产品小类',
- prop: 'categoryId',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.label = ""
- row.normAmount = ""
- row.repairAmount = ""
- row.settleNormId = ""
- if (val) {
- var data = this.classifyListChuLi(expandDataForm.classifyList, "categoryId", "categoryName", (item) => item.orderChannelId == row.channelId && item.parentCategoryId == row.parentCategoryId).find(item => item.value == val)
- row.categoryName = data.label
- } else {
- row.categoryName = ""
- }
- }}
- placeholder="请选择">
- {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>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- ...(() => {
- if (expandDataForm.orderType == 'INSTALL') {
- return [
- {
- columnAttributes: {
- label: '结算功率',
- prop: 'label'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- if (val) {
- var data = this.getflList(expandDataForm.gonglv, row).find(item => item.label == val)
- row.normAmount = data.normAmount
- row.settleNormId = data.id
- } else {
- row.normAmount = ""
- row.settleNormId = ""
- }
- }}
- placeholder="请选择">
- {this.getflList(expandDataForm.gonglv, row).map((item, index_) => <el-option key={index_} label={item.label} value={item.label}></el-option>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算标准(元/套)',
- prop: 'normAmount',
- width: "160px"
- },
- },
- {
- columnAttributes: {
- label: '结算数量',
- prop: 'settleNum',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- type="number"
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算金额(元)',
- prop: 'settleAmount',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- row.settleAmount = (((Number(row.normAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
- return this.panfuan(row) ? <div class="redbordererr">
- {row.settleAmount}
- </div> : null
- }
- },
- ]
- }
- return []
- })(),
- ...(() => {
- if (expandDataForm.orderType == 'REPAIR') {
- return [
- {
- columnAttributes: {
- label: '质保类型',
- prop: 'label'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- if (val) {
- var data = this.getflList(expandDataForm.gonglr, row).find(item => item.label == val)
- row.repairAmount = data.repairAmount
- row.normAmount = data.normAmount
- row.settleNormId = data.id
- } else {
- row.repairAmount = ""
- row.normAmount = ""
- row.settleNormId = ""
- }
- }}
- placeholder="请选择">
- {this.getflList(expandDataForm.gonglr, row).map((item, index_) => <el-option key={index_} label={({ INSIDE: '保内', OUT: '保外' })[item.label]} value={item.label}></el-option>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '上门费(元/单)',
- prop: 'repairAmount',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- disabled={expandDataForm.normListBj || !row.bianji}
- type="number"
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '维修费结算比例%',
- prop: 'normAmount',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- {row[column.columnAttributes.prop]}%
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '维修费用结算',
- prop: 'repairNormAmount',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- disabled={expandDataForm.normListBj || !row.bianji}
- type="number"
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算数量',
- prop: 'settleNum',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- type="number"
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算金额(元)',
- prop: 'settleAmount',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- row.settleAmount = (((Number(row.repairAmount || 0) + (Number(row.normAmount || 0) / 100) * Number(row.repairNormAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
- return this.panfuan(row) ? <div class="redbordererr">
- {row.settleAmount}
- </div> : null
- }
- },
- ]
- }
- return []
- })(),
- {
- columnAttributes: {
- label: '备注',
- prop: 'remark',
- width: "200px"
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px">
- <el-input
- disabled={expandDataForm.normListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '工程师名称',
- prop: 'workerName',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '联系电话',
- prop: 'workerMobile',
- width: '140px'
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '结算费用',
- prop: 'settleAmount',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${row.pfuqinid}.workerList.${row.zijideid}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- type="number"
- disabled={!expandDataForm.normList[row.pfuqinid].bianji || expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.["poolStatus"] == "YES"}
- value={expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- onInput={(val) => {
- expandDataForm.normList[row.pfuqinid].workerList[row.zijideid][column.columnAttributes.prop] = val
- }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div>
- }
- }, {
- columnAttributes: {
- label: '确认人',
- prop: 'confirmBy',
- width: "100px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '确认时间',
- prop: 'confirmTime',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '汇总状态',
- prop: 'poolStatus',
- width: "100px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {({ "NO": "未汇总", "YES": "已汇总" })[expandDataForm?.normList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]]}
- </div>
- }
- }, {
- columnAttributes: {
- label: '操作',
- prop: '',
- fixed: 'right',
- width: "120px"
- },
- render: (h, { row, column, index }) => {
- 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;">
- {expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- 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) {
- return prev + curr;
- })
- var nou = expandDataForm?.normList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
- var qian = ((((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
- var rongyu = ((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
- nou.map((item, index) => {
- if (index === 0) {
- item.settleAmount = (Number(qian) + Number(rongyu)).toFixed(2)
- } else {
- item.settleAmount = qian
- }
- })
- }
- }>平分费用</el-button> : null}
- {expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- this.itemOrderBaseSettleNormReset(rowZhu, "normList", () => {
- expandDataForm.normList[row.pfuqinid].bianji = false
- })
- }
- }>确定</el-button> : null}
- {!expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- expandDataForm.normList[row.pfuqinid].bianji = true
- }
- }>修改</el-button> : null}
- {!expandDataForm.showOtherNormList ? <el-button type="text" onClick={
- () => {
- expandDataForm.showOtherNormList = true
- }
- }>添加其他费用</el-button> : null}
- </div>) : null
- }
- }]
- return (
- <zj-table
- columns={columns}
- table-data={formData.normList}
- tableAttributes={{
- 'span-method': ({ row, column, rowIndex, columnIndex }) => {
- if (columnIndex === columns.length - 1) {
- if (row.zijideid == 0) {
- return {
- rowspan: formData.normList[row.pfuqinid].workerList.length,
- colspan: 1
- };
- } else {
- return {
- rowspan: 0,
- colspan: 0
- };
- }
- }
- }
- }}
- />
- )
- }
- },
- {
- md: 24,
- isShow: expandDataForm.showOtherNormList,
- name: 'slot-component',
- formItemAttributes: {
- label: '其他费用结算',
- prop: 'otherNormList',
- },
- render: (h, { props, onInput }) => {
- var { formData } = props
- var columns = [{
- columnAttributes: {
- label: '结算工单来源',
- prop: 'channelId',
- width: '110'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`normList.${index}.${column.columnAttributes.prop}`} rules={required}>
- <el-select
- disabled={expandDataForm.otherNormListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.type = ""
- row.label = ""
- row.normAmount = ""
- row.settleNormId = ""
- row.settleNum = ""
- if (val) {
- var data = this.otherListChuLi(expandDataForm.otherList, "orderChannelId", "orderChannelText").find(item => item.value == val)
- row.channelText = data.label
- } else {
- row.channelText = ""
- }
- }}
- placeholder="请选择">
- {this.otherListChuLi(expandDataForm.otherList, "orderChannelId", "orderChannelText").map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '费用类型',
- prop: 'type'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px">
- <el-select
- disabled={expandDataForm.otherNormListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.label = ""
- row.normAmount = ""
- row.settleNormId = ""
- row.settleNum = ""
- }}
- placeholder="请选择">
- {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>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '规格',
- prop: 'label'
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px">
- <el-select
- disabled={expandDataForm.otherNormListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- onChange={(val) => {
- row.settleNum = ""
- if (val) {
- 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)
- row.normAmount = data.normAmount
- row.settleNormId = data.id
- } else {
- row.normAmount = ""
- row.settleNormId = ""
- }
- }}
- placeholder="请选择">
- {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>)}
- </el-select>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '单价(元/套)',
- prop: 'normAmount',
- width: "160px"
- },
- },
- {
- columnAttributes: {
- label: '数量',
- prop: 'settleNum',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px">
- <el-input
- type="number"
- disabled={expandDataForm.otherNormListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '结算金额(元)',
- prop: 'settleAmount',
- width: "160px"
- },
- render: (h, { row, column, index }) => {
- row.settleAmount = (((Number(row.normAmount || 0) * Number(row.settleNum || 0)) * 100) / 100).toFixed(2)
- return this.panfuan(row) ? <div class="redbordererr">
- {row.settleAmount}
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '备注',
- prop: 'remark',
- width: "200px"
- },
- render: (h, { row, column, index }) => {
- return this.panfuan(row) ? <div class="redbordererr">
- <el-form-item label="" label-width="0px">
- <el-input
- disabled={expandDataForm.otherNormListBj || !row.bianji}
- value={row[column.columnAttributes.prop]}
- onInput={(val) => { row[column.columnAttributes.prop] = val }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div> : null
- }
- },
- {
- columnAttributes: {
- label: '工程师名称',
- prop: 'workerName',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '联系电话',
- prop: 'workerMobile',
- width: '140px'
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '结算费用',
- prop: 'settleAmount',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr">
- <el-form-item label="" label-width="0px" prop={`otherNormList.${row.pfuqinid}.workerList.${row.zijideid}.${column.columnAttributes.prop}`} rules={required}>
- <el-input
- type="number"
- disabled={!expandDataForm.otherNormList[row.pfuqinid].bianji || expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.["poolStatus"] == "YES"}
- value={expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- onInput={(val) => {
- expandDataForm.otherNormList[row.pfuqinid].workerList[row.zijideid][column.columnAttributes.prop] = val
- }}
- placeholder="请输入内容"
- >
- </el-input>
- </el-form-item>
- </div>
- }
- }, {
- columnAttributes: {
- label: '确认人',
- prop: 'confirmBy',
- width: "100px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '确认时间',
- prop: 'confirmTime',
- width: "140px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]}
- </div>
- }
- },
- {
- columnAttributes: {
- label: '汇总状态',
- prop: 'poolStatus',
- width: "100px"
- },
- render: (h, { row, column, index }) => {
- return <div class="redbordererr" style="padding:0 6px;display:flex;align-items:center;">
- {({ "NO": "未汇总", "YES": "已汇总" })[expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.[row.zijideid]?.[column.columnAttributes.prop]]}
- </div>
- }
- }, {
- columnAttributes: {
- label: '操作',
- prop: '',
- fixed: 'right',
- width: "120px"
- },
- render: (h, { row, column, index }) => {
- 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;">
- {expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- 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) {
- return prev + curr;
- })
- var nou = expandDataForm?.otherNormList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
- var qian = ((((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
- var rongyu = ((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
- nou.map((item, index) => {
- if (index === 0) {
- item.settleAmount = (Number(qian) + Number(rongyu)).toFixed(2)
- } else {
- item.settleAmount = qian
- }
- })
- }
- }>平分费用</el-button> : null}
- {expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- this.itemOrderBaseSettleNormReset(rowZhu, "otherNormList", () => {
- expandDataForm.otherNormList[row.pfuqinid].bianji = false
- })
- }
- }>确定</el-button> : null}
- {!expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
- () => {
- expandDataForm.otherNormList[row.pfuqinid].bianji = true
- }
- }>修改</el-button> : null}
- </div>) : null
- }
- }]
- return (
- <zj-table
- columns={columns}
- table-data={formData.otherNormList}
- tableAttributes={{
- 'span-method': ({ row, column, rowIndex, columnIndex }) => {
- if (columnIndex === columns.length - 1) {
- if (row.zijideid == 0) {
- return {
- rowspan: formData.otherNormList[row.pfuqinid].workerList.length,
- colspan: 1
- };
- } else {
- return {
- rowspan: 0,
- colspan: 0
- };
- }
- }
- }
- }}
- />
- )
- }
- }]} />
- </zj-form-container>
- </div>) : null
- },
- itemOrderBaseSettleNormReset(data, type, cb) {
- try {
- data.expandData.normList.filter(item => !!item.id).map(item => {
- if ([0, 0, 0, ...item.workerList?.map(val => Number(val.settleAmount))].reduce(function (prev, curr, idx, arr) {
- return prev + curr;
- }) !== Number(item.settleAmount)) {
- throw new Error(`费用信息-${item.channelText}-${item.parentCategoryName}-${item.categoryName}-${item.label}:合计结算总金额与总金额不等`);
- }
- })
- data.expandData.otherNormList.filter(item => !!item.id).map(item => {
- if ([0, 0, 0, ...item.workerList?.map(val => Number(val.settleAmount))].reduce(function (prev, curr, idx, arr) {
- return prev + curr;
- }) !== Number(item.settleAmount)) {
- throw new Error(`其他费用信息-${item.channelText}-${item.type}-${item.label}:合计结算总金额与总金额不等`);
- }
- })
- } catch (err) {
- this.$message.warning(err.message)
- return
- }
- var { classifyList, gonglr, gonglv, otherList, normListBj, otherNormListBj, showOtherNormList, ...pam } = data.expandData;
- ([orderBaseSettleNormConfirm, orderBaseSettleNormReset])[pam.settleStatus == 'YWG' ? 0 : 1]({
- ...pam,
- ...(() => {
- if (type == "normList") {
- return {
- normList: pam.normList.filter(item => !!item.id),
- }
- }
- return {
- normList: [],
- }
- })(),
- ...(() => {
- if (type == "otherNormList") {
- return {
- otherNormList: pam.otherNormList.filter(item => !!item.id),
- }
- }
- return {
- otherNormList: [],
- }
- })(),
- }).then(res => {
- orderBaseSettleNormDetail2({
- id: data.id,
- orderProductId: data.pgOrderProductId
- }).then(res => {
- this.zhuzhuang(res.data).then(res => {
- data.expandData = res
- })
- })
- cb && cb()
- this.$message({
- type: 'success',
- message: '结算成功'
- })
- })
- },
- zhuzhuang(data) {
- return new Promise((r, j) => {
- var orderChannelId
- var normList = []
- var pfuqinid = 0
- data.normListBj = false
- data.otherNormListBj = false
- data.showOtherNormList = false
- data.normList.map((item, index) => {
- if (!orderChannelId) { orderChannelId = item.orderChannelId }
- item.settleNum = item.settleNum || ""
- normList.push({ ...item, pfuqinid: pfuqinid, zijideid: 0, bianji: !item.workerList.find(resdata => !!resdata.settleOrderId) })
- item.workerList?.map((resdata, ind_) => {
- if (resdata.settleOrderId) { data.normListBj = true }
- if (ind_ !== 0) { normList.push({ pfuqinid: pfuqinid, zijideid: ind_ }) }
- if (ind_ == item.workerList.length - 1) { pfuqinid += (ind_ + 1) }
- })
- })
- var otherNormList = []
- var qtpfuqinid = 0
- data.otherNormList.map((item, index) => {
- item.settleNum = item.settleNum || ""
- otherNormList.push({ ...item, pfuqinid: qtpfuqinid, zijideid: 0, bianji: !item.workerList.find(resdata => !!resdata.settleOrderId) })
- if (!data.showOtherNormList) {
- data.showOtherNormList = !!item.workerList.find(resdata => !!resdata.settleOrderId)
- }
- item.workerList?.map((resdata, ind_) => {
- if (resdata.settleOrderId) { data.otherNormListBj = true }
- if (ind_ !== 0) { otherNormList.push({ pfuqinid: qtpfuqinid, zijideid: ind_ }) }
- if (ind_ == item.workerList.length - 1) { qtpfuqinid += (ind_ + 1) }
- })
- })
- Promise.all([
- listPageV3({ "pageNum": 1, "pageSize": -1 }),
- listPageV2Repair({ "pageNum": 1, "pageSize": -1 }),
- settleNormInstallQuery({
- settleNormType: data.orderType,
- type: data.orderSmallType
- }),
- settleNormOtherQuery()
- ]).then(([res1, res2, res3, res4]) => {
- r({
- ...data,
- normList,
- otherNormList,
- gonglv: res1.data.records,
- gonglr: res2.data.records,
- classifyList: res3.data,
- otherList: res4.data,
- })
- }).catch(j)
- })
- },
- panfuan(item) {
- if (!!item.id) {
- return true
- } else {
- return false
- }
- },
- // 产品类型过滤筛选
- classifyListChuLi(list, value, label, func, ...keys) {
- var obj = {};
- list.map(item => {
- if (func && !func(item)) {
- return
- }
- obj[item[value]] = {
- label: item[label]
- }
- for (var key of keys) {
- obj[item[value]][key] = item[key]
- }
- })
- return Object.keys(obj).map(value => {
- return {
- value: value,
- ...obj[value]
- }
- })
- },
- // 其他类型筛选
- otherListChuLi(list, value, label, func, ...keys) {
- var obj = {};
- list.map(item => {
- if (func && !func(item)) {
- return
- }
- obj[item[value]] = {
- label: item[label]
- }
- for (var key of keys) {
- obj[item[value]][key] = item[key]
- }
- })
- return Object.keys(obj).map(value => {
- return {
- value: value,
- ...obj[value]
- }
- })
- },
- getflList(list = [], row = {},) {
- return list.filter(item => (
- item.type == row.type &&
- item.parentCategoryId == row.parentCategoryId &&
- item.categoryId == row.categoryId
- ))
- },
- }
- }
- </script>
- <style lang="scss">
- .redbordererranniuright {
- .el-button {
- margin-left: 0px;
- margin-right: 10px;
- }
- }
- </style>
|