Commit fca1826a authored by Damon's avatar Damon

feat: 维修单字段隐藏切换

parent 51227e1b
......@@ -64,9 +64,7 @@
:prop="item.fieldsName"
:border-bottom="false"
v-show="
((item.fieldsName != 'actualPaid' &&
item.fieldsName != 'eSerialNum') ||
show200) &&
checkFields(item.fieldsName) &&
((readOnly &&
!$u.test.isEmpty(form[item.fieldsName])) ||
!readOnly)
......@@ -442,6 +440,24 @@ const actions = (name, pass, type, submit) => {
}
}
const fields = {
'paymentMethodsType': { // 基本信息-不需要收款
fieldsName: ['actualPaid', 'eSerialNum'],
value: '03'
},
'usePart': { // 维修工单-是否使用配件
fieldsName: ['partName'],
value: '02'
},
'getMoney': { // 维修工单-是否收款
fieldsName: ['feeValue', 'feeProject'],
value: '02'
}
}
const fieldsNameArr = Object.values(fields).map(v => v.fieldsName).reduce((acc, cur) => [...acc, ...cur], [])
export default {
data() {
return {
......@@ -606,6 +622,17 @@ export default {
},
},
methods: {
checkFields(name) {
let status = true
if (fieldsNameArr.includes(name)) {
Object.entries(fields).forEach(v => {
if (v[1].fieldsName.includes(name)) {
status = this.form[v[0]] ? this.form[v[0]] !== v[1].value : false
}
})
}
return status
},
getCompleteData() {
//获取工单配置的完工项目
uni.showLoading({
......@@ -630,6 +657,7 @@ export default {
const data = Object.create(res.data.config, {})
const list = data.sort((a, b) => a.order - b.order)
if (this.readOnly) this.tabIndex = 0
list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.tabIndex = index
......@@ -640,16 +668,8 @@ export default {
const formMap = formType.get(type) || formType.get('text')
d.formType = formMap[0]
d.inputType = formMap[1]
if (d.fieldsName === 'actualPaid' && res.data.value) {
d.required = res.data.value['paymentMethodsType']
? res.data.value['paymentMethodsType'] != '03'
: false
}
if (d.fieldsName === 'eSerialNum' && res.data.value) {
d.required = res.data.value['paymentMethodsType']
? res.data.value['paymentMethodsType'] != '03'
: false
}
d.required = this.checkFields(d.fieldsName)
if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
// 申请费用计算
this.calcMoney()
......@@ -1126,17 +1146,13 @@ export default {
}
}
if (innerItem.fieldsName === 'paymentMethodsType') {
// 选不需要收款的时候,收款金额修改为非必选
const actualPaid = groupItem.items.find(
(v) => v.fieldsName === 'actualPaid'
)
if (actualPaid) actualPaid.required = data.value != '03'
const eSerialNum = groupItem.items.find(
(v) => v.fieldsName === 'eSerialNum'
)
if (eSerialNum) eSerialNum.required = data.value != '03'
// 根据选择的值隐藏对应的项
if (fields[innerItem.fieldsName]) {
groupItem.items.forEach(c => {
if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) {
c.required = data.value !== fields[innerItem.fieldsName]['value']
}
})
}
if (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment