自动费用模板 调整

feature-JimuReport-1106-yjl
张同海 1 month ago
parent da4656284b
commit b63f8c81cb

@ -53,6 +53,7 @@
import { formSchema } from './columns' import { formSchema } from './columns'
// //
import { ApiEdit, ApiInfo } from './api' import { ApiEdit, ApiInfo } from './api'
import { feeUnitDict } from '/@/hooks/dict/index'
// //
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { useUserStore } from '/@/store/modules/user' import { useUserStore } from '/@/store/modules/user'
@ -90,6 +91,14 @@
setFieldsValue({ setFieldsValue({
...res.data, ...res.data,
}) })
const UnitList = await feeUnitDict()
res.data.details.forEach((item) => {
UnitList.forEach((e: any) => {
if (e.value == item.unit) {
item.unitText = e.name
}
})
})
feeField.value.SetData(res.data.details) feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition feeField.value.condition = res.data.condition
detailId.value = res.data.id detailId.value = res.data.id
@ -103,8 +112,14 @@
...res.data, ...res.data,
id: '', id: '',
}) })
const UnitList = await feeUnitDict()
res.data.details.forEach((item) => { res.data.details.forEach((item) => {
delete item.id delete item.id
UnitList.forEach((e: any) => {
if (e.value == item.unit) {
item.unitText = e.name
}
})
}) })
feeField.value.SetData(res.data.details) feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition feeField.value.condition = res.data.condition

@ -58,9 +58,9 @@ export const columns: BasicColumn[] = [
dataIndex: 'isDisabled', dataIndex: 'isDisabled',
width: 120, width: 120,
customRender: ({ text }) => { customRender: ({ text }) => {
if (text === true) { if (text === false) {
return <Tag color="success"></Tag> return <Tag color="success"></Tag>
} else if (text == false) { } else if (text == true) {
return <Tag color="error"></Tag> return <Tag color="error"></Tag>
} }
return text return text
@ -145,11 +145,10 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
componentProps: { componentProps: {
checkedChildren: '启用', checkedChildren: '启用',
checkedValue: 1, checkedValue: 0,
unCheckedChildren: '禁用', unCheckedChildren: '禁用',
unCheckedValue: 0, unCheckedValue: 1,
}, },
defaultValue: 1,
}, },
{ {
field: 'priority', field: 'priority',
@ -476,9 +475,9 @@ export const formSchema: FormSchema[] = [
component: 'Switch', component: 'Switch',
componentProps: { componentProps: {
checkedChildren: '启用', checkedChildren: '启用',
checkedValue: true, checkedValue: false,
unCheckedChildren: '禁用', unCheckedChildren: '禁用',
unCheckedValue: false, unCheckedValue: true,
}, },
defaultValue: true, defaultValue: true,
colProps: { colProps: {

@ -53,6 +53,7 @@
import { formSchema } from './columns' import { formSchema } from './columns'
// //
import { ApiEdit, ApiInfo } from './api' import { ApiEdit, ApiInfo } from './api'
import { feeUnitDict } from '/@/hooks/dict/index'
// //
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { useUserStore } from '/@/store/modules/user' import { useUserStore } from '/@/store/modules/user'
@ -92,13 +93,20 @@
setFieldsValue({ setFieldsValue({
...res.data, ...res.data,
}) })
const UnitList = await feeUnitDict()
res.data.details.forEach((item) => {
UnitList.forEach((e: any) => {
if (e.value == item.unit) {
item.unitText = e.name
}
})
})
feeField.value.SetData(res.data.details) feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition feeField.value.condition = res.data.condition
detailId.value = res.data.id detailId.value = res.data.id
} }
} else { } else {
if (unref(isSave)) { if (unref(isSave)) {
console.log(data.record, 1111111111111)
setModalProps({ confirmLoading: true }) setModalProps({ confirmLoading: true })
// const res: API.DataResult = await ApiInfo({ id: unref(data.record.id) }) // const res: API.DataResult = await ApiInfo({ id: unref(data.record.id) })
// if (res.succeeded) { // if (res.succeeded) {
@ -127,8 +135,14 @@
...res.data, ...res.data,
id: '', id: '',
}) })
const UnitList = await feeUnitDict()
res.data.details.forEach((item) => { res.data.details.forEach((item) => {
delete item.id delete item.id
UnitList.forEach((e: any) => {
if (e.value == item.unit) {
item.unitText = e.name
}
})
}) })
feeField.value.SetData(res.data.details) feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition feeField.value.condition = res.data.condition

@ -63,9 +63,9 @@ export const columns: BasicColumn[] = [
dataIndex: 'isDisabled', dataIndex: 'isDisabled',
width: 120, width: 120,
customRender: ({ text }) => { customRender: ({ text }) => {
if (text === true) { if (text === false) {
return <Tag color="success"></Tag> return <Tag color="success"></Tag>
} else if (text == false) { } else if (text == true) {
return <Tag color="error"></Tag> return <Tag color="error"></Tag>
} }
return text return text
@ -150,11 +150,10 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
componentProps: { componentProps: {
checkedChildren: '启用', checkedChildren: '启用',
checkedValue: 1, checkedValue: 0,
unCheckedChildren: '禁用', unCheckedChildren: '禁用',
unCheckedValue: 0, unCheckedValue: 1,
}, },
defaultValue: 1,
}, },
{ {
field: 'priority', field: 'priority',
@ -516,9 +515,9 @@ export const formSchema: FormSchema[] = [
component: 'Switch', component: 'Switch',
componentProps: { componentProps: {
checkedChildren: '启用', checkedChildren: '启用',
checkedValue: true, checkedValue: false,
unCheckedChildren: '禁用', unCheckedChildren: '禁用',
unCheckedValue: false, unCheckedValue: true,
}, },
defaultValue: true, defaultValue: true,
colProps: { colProps: {

@ -280,11 +280,12 @@
{ {
title: '单位标准', title: '单位标准',
width: 130, width: 130,
data: 'unit', data: 'unitText',
type: 'dropdown', type: 'dropdown',
source: async (query, process) => { source: async (query, process) => {
if (unitDict.value && unitDict.value.length) { if (unitDict.value && unitDict.value.length) {
const dict = unitDict.value.map((item) => { const dict = unitDict.value.map((item) => {
console.log(item, 11111111111111)
return item.name return item.name
}) })
process(dict) process(dict)
@ -292,6 +293,7 @@
const results = await feeUnitDict() const results = await feeUnitDict()
unitDict.value = results unitDict.value = results
const dict = results.map((item) => { const dict = results.map((item) => {
console.log(item, 11111111111111)
return item.name return item.name
}) })
process(dict) process(dict)
@ -632,12 +634,13 @@
} }
}) })
// //
if (changes[0][1] === 'unit') { if (changes[0][1] === 'unitText') {
const item = unitDict.value.filter((item) => { const item = unitDict.value.filter((item) => {
return changes[0][3].includes(item.name) return changes[0][3].includes(item.name)
}) })
if (item) dict = item[0] if (item) dict = item[0]
list.value[changes[0][0]]['unit'] = dict?.value list.value[changes[0][0]]['unit'] = dict?.value
list.value[changes[0][0]]['unitText'] = dict?.label
// list.value[changes[0][0]]['unitText'] = changes[0][3].split('-')[1] // list.value[changes[0][0]]['unitText'] = changes[0][3].split('-')[1]
// //
// const text = list.value[changes[0][0]]['unitText'] // const text = list.value[changes[0][0]]['unitText']

Loading…
Cancel
Save