Commit fca1826a authored by Damon's avatar Damon

feat: 维修单字段隐藏切换

parent 51227e1b
...@@ -64,9 +64,7 @@ ...@@ -64,9 +64,7 @@
:prop="item.fieldsName" :prop="item.fieldsName"
:border-bottom="false" :border-bottom="false"
v-show=" v-show="
((item.fieldsName != 'actualPaid' && checkFields(item.fieldsName) &&
item.fieldsName != 'eSerialNum') ||
show200) &&
((readOnly && ((readOnly &&
!$u.test.isEmpty(form[item.fieldsName])) || !$u.test.isEmpty(form[item.fieldsName])) ||
!readOnly) !readOnly)
...@@ -442,6 +440,24 @@ const actions = (name, pass, type, submit) => { ...@@ -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 { export default {
data() { data() {
return { return {
...@@ -606,6 +622,17 @@ export default { ...@@ -606,6 +622,17 @@ export default {
}, },
}, },
methods: { 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() { getCompleteData() {
//获取工单配置的完工项目 //获取工单配置的完工项目
uni.showLoading({ uni.showLoading({
...@@ -630,6 +657,7 @@ export default { ...@@ -630,6 +657,7 @@ export default {
const data = Object.create(res.data.config, {}) const data = Object.create(res.data.config, {})
const list = data.sort((a, b) => a.order - b.order) const list = data.sort((a, b) => a.order - b.order)
if (this.readOnly) this.tabIndex = 0 if (this.readOnly) this.tabIndex = 0
list.forEach((item, index) => { list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName && !this.readOnly) { if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.tabIndex = index this.tabIndex = index
...@@ -640,16 +668,8 @@ export default { ...@@ -640,16 +668,8 @@ export default {
const formMap = formType.get(type) || formType.get('text') const formMap = formType.get(type) || formType.get('text')
d.formType = formMap[0] d.formType = formMap[0]
d.inputType = formMap[1] d.inputType = formMap[1]
if (d.fieldsName === 'actualPaid' && res.data.value) { d.required = this.checkFields(d.fieldsName)
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
}
if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') { if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
// 申请费用计算 // 申请费用计算
this.calcMoney() this.calcMoney()
...@@ -1126,17 +1146,13 @@ export default { ...@@ -1126,17 +1146,13 @@ export default {
} }
} }
if (innerItem.fieldsName === 'paymentMethodsType') { // 根据选择的值隐藏对应的项
// 选不需要收款的时候,收款金额修改为非必选 if (fields[innerItem.fieldsName]) {
const actualPaid = groupItem.items.find( groupItem.items.forEach(c => {
(v) => v.fieldsName === 'actualPaid' if (fields[innerItem.fieldsName]['fieldsName'].includes(c.fieldsName)) {
) c.required = data.value !== fields[innerItem.fieldsName]['value']
if (actualPaid) actualPaid.required = data.value != '03' }
})
const eSerialNum = groupItem.items.find(
(v) => v.fieldsName === 'eSerialNum'
)
if (eSerialNum) eSerialNum.required = data.value != '03'
} }
if ( 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