|
|
@@ -7,32 +7,25 @@ meta:
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import { dataType } from '@/utils/tool'
|
|
|
-import {
|
|
|
- createObjectAttr,
|
|
|
- deleteObjectAttrById,
|
|
|
- getObjectAttrListById,
|
|
|
- updateObjectAttr,
|
|
|
-} from '@/api/biz/bizObjectParamsApi'
|
|
|
+import { createObjectOAMParams, deleteObjectOAMParamsById, getObjectOAMParamsListByOamId, updateObjectOAMParams } from '@/api/biz/bizObjectOAMParamsApi'
|
|
|
const props = withDefaults(defineProps<{
|
|
|
bizId: number
|
|
|
objectId: number
|
|
|
+ oamId: number
|
|
|
}>(), {
|
|
|
bizId: 0,
|
|
|
objectId: 0,
|
|
|
+ oamId: 0,
|
|
|
})
|
|
|
|
|
|
-interface ObjectAttr {
|
|
|
+interface ObjectOAMParams {
|
|
|
bizId: number
|
|
|
objectId: number
|
|
|
- attrId: number
|
|
|
- attrTitle: string
|
|
|
- attrCode: string
|
|
|
- mappingCode: string
|
|
|
- attrType: number
|
|
|
- attrLength: number
|
|
|
- attrDecimals: number
|
|
|
- isNotNull: number
|
|
|
- comment: string
|
|
|
+ oamId: number
|
|
|
+ paramsId: number
|
|
|
+ paramsTarget: string
|
|
|
+ paramsOperator: string
|
|
|
+ paramsValue: string
|
|
|
sortNo: number
|
|
|
isEdit: boolean
|
|
|
}
|
|
|
@@ -42,61 +35,53 @@ const state = reactive({
|
|
|
title: '',
|
|
|
dialogVisible: false,
|
|
|
loading: false,
|
|
|
- search: {
|
|
|
- keywords: '',
|
|
|
- },
|
|
|
conditions: {
|
|
|
+ keywords: '',
|
|
|
bizId: props.bizId,
|
|
|
objectId: props.objectId,
|
|
|
+ oamId: props.oamId,
|
|
|
},
|
|
|
- attrs: [] as ObjectAttr[],
|
|
|
+ params: [] as ObjectOAMParams[],
|
|
|
actionType: 1,
|
|
|
})
|
|
|
|
|
|
const formRef = ref<FormInstance>()
|
|
|
const formRules = reactive<FormRules>({
|
|
|
- objectTitle: [
|
|
|
+ paramsTarget: [
|
|
|
{ required: true, message: '请输入对象标题', trigger: 'blur' },
|
|
|
],
|
|
|
- objectType: [
|
|
|
+ paramsOperator: [
|
|
|
{ required: true, message: '请输入对象类型', trigger: 'blur' },
|
|
|
],
|
|
|
- objectCode: [
|
|
|
+ paramsValue: [
|
|
|
{ required: true, message: '请输入对像代码', trigger: 'blur' },
|
|
|
],
|
|
|
- comment: [
|
|
|
- { required: false, message: '请输入简要描述', trigger: 'blur' },
|
|
|
- ],
|
|
|
})
|
|
|
|
|
|
// 查询数据
|
|
|
const getData = async () => {
|
|
|
state.loading = true
|
|
|
- const { bizId, objectId } = state.conditions
|
|
|
- const { data } = await getObjectAttrListById(bizId, objectId)
|
|
|
+ const { bizId, objectId, oamId } = state.conditions
|
|
|
+ const { data } = await getObjectOAMParamsListByOamId(bizId, objectId, oamId)
|
|
|
state.loading = false
|
|
|
- state.attrs = data
|
|
|
- data.forEach((attr: ObjectAttr) => {
|
|
|
- attr.isEdit = false
|
|
|
+ state.params = data
|
|
|
+ data.forEach((param: ObjectOAMParams) => {
|
|
|
+ param.isEdit = false
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const attrsTableRef = ref()
|
|
|
-const attrsTableKey = ref(0)
|
|
|
+const paramsTableRef = ref()
|
|
|
+const paramsTableKey = ref(0)
|
|
|
|
|
|
function onAttrAdd() {
|
|
|
- state.attrs.push({
|
|
|
+ state.params.push({
|
|
|
bizId: props.bizId,
|
|
|
objectId: props.objectId,
|
|
|
- attrId: 0,
|
|
|
- attrTitle: '', // 名称
|
|
|
- attrCode: '', // 代码
|
|
|
- mappingCode: '',
|
|
|
- attrType: 0, // 类型
|
|
|
- attrLength: 0, // 长度
|
|
|
- attrDecimals: 0, // 小数位数
|
|
|
- isNotNull: 0, // 是否为空
|
|
|
- comment: '', // 注释
|
|
|
+ oamId: props.oamId,
|
|
|
+ paramsId: 0,
|
|
|
+ paramsTarget: '', // 名称
|
|
|
+ paramsOperator: '', // 代码
|
|
|
+ paramsValue: '',
|
|
|
sortNo: 0,
|
|
|
isEdit: true,
|
|
|
})
|
|
|
@@ -109,16 +94,16 @@ function onAttrEdit(row: any) {
|
|
|
}
|
|
|
|
|
|
async function onAttrDelete(row: any) {
|
|
|
- const { bizId, objectId } = state.conditions
|
|
|
- const attrId = row.attrId
|
|
|
- await deleteObjectAttrById(bizId, objectId, attrId)
|
|
|
+ const { bizId, objectId, oamId } = state.conditions
|
|
|
+ const paramsId = row.paramsId
|
|
|
+ await deleteObjectOAMParamsById(bizId, objectId, oamId, paramsId)
|
|
|
ElMessage.success('删除成功')
|
|
|
}
|
|
|
|
|
|
function onAttrCancel(row: any, index: number) {
|
|
|
row.isEdit = false
|
|
|
if (state.actionType === 1) {
|
|
|
- state.attrs.splice(index, 1)
|
|
|
+ state.params.splice(index, 1)
|
|
|
}
|
|
|
state.actionType = 0
|
|
|
}
|
|
|
@@ -126,40 +111,22 @@ function onAttrCancel(row: any, index: number) {
|
|
|
async function onAttrSave(row: any) {
|
|
|
row.isEdit = false
|
|
|
if (state.actionType === 1) {
|
|
|
- await createObjectAttr(row)
|
|
|
+ await createObjectOAMParams(row)
|
|
|
state.dialogVisible = false
|
|
|
ElMessage.success('新增成功')
|
|
|
}
|
|
|
else {
|
|
|
- await updateObjectAttr(row)
|
|
|
+ await updateObjectOAMParams(row)
|
|
|
state.dialogVisible = false
|
|
|
ElMessage.success('修改成功')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getData()
|
|
|
- nextTick(() => {
|
|
|
- })
|
|
|
+ // getData()
|
|
|
+ // nextTick(() => {
|
|
|
+ // })
|
|
|
})
|
|
|
-
|
|
|
-// 保存
|
|
|
-function onSubmit() {
|
|
|
- formRef.value && formRef.value.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- if (state.actionType === 1) {
|
|
|
- await createObjectAttr(state.attrs)
|
|
|
- state.dialogVisible = false
|
|
|
- ElMessage.success('新增成功')
|
|
|
- }
|
|
|
- else {
|
|
|
- await updateObjectAttr(state.attrs)
|
|
|
- state.dialogVisible = false
|
|
|
- ElMessage.success('修改成功')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -170,7 +137,7 @@ function onSubmit() {
|
|
|
<h4>对象属性</h4>
|
|
|
</template>
|
|
|
<template #right>
|
|
|
- <el-input v-model="state.search.keywords" placeholder="请输入关键词筛选" clearable style="width: 200px;" />
|
|
|
+ <el-input placeholder="请输入关键词筛选" clearable style="width: 200px;" />
|
|
|
<el-button style="margin-left:10px" @click="getData">
|
|
|
<template #icon>
|
|
|
<el-icon>
|
|
|
@@ -189,81 +156,41 @@ function onSubmit() {
|
|
|
</template>
|
|
|
</tool-bar>
|
|
|
|
|
|
- <el-table ref="attrsTableRef" :key="attrsTableKey" :data="state.attrs" class="list-table" size="small" border stripe highlight-current-row>
|
|
|
+ <el-table ref="paramsTableRef" :key="paramsTableKey" :data="state.params" class="list-table" size="small" border stripe highlight-current-row>
|
|
|
<el-table-column type="index" label="序号" header-align="center" align="center" width="60" />
|
|
|
|
|
|
- <el-table-column label="名称" header-align="center" align="center" width="150">
|
|
|
+ <el-table-column label="参数名称" header-align="center" align="center" width="150">
|
|
|
<template #default="scope">
|
|
|
- <el-input v-if="scope.row.isEdit" v-model="scope.row.attrTitle" size="small" />
|
|
|
- <span v-else>{{ scope.row.attrTitle }}</span>
|
|
|
+ <el-input v-if="scope.row.isEdit" v-model="scope.row.paramsTarget" size="small" />
|
|
|
+ <span v-else>{{ scope.row.paramsTarget }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="代码" header-align="center" align="center" width="120">
|
|
|
+ <el-table-column label="运算符" header-align="center" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
- <el-input v-if="scope.row.isEdit" v-model="scope.row.attrCode" size="small" />
|
|
|
- <span v-else>{{ scope.row.attrCode }}</span>
|
|
|
+ <el-input v-if="scope.row.isEdit" v-model="scope.row.paramsOperator" size="small" />
|
|
|
+ <span v-else>{{ scope.row.paramsOperator }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="映射代码" header-align="center" align="center" width="120">
|
|
|
+ <el-table-column label="值" header-align="center" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
- <el-input v-if="scope.row.isEdit" v-model="scope.row.mappingCode" size="small" />
|
|
|
- <span v-else>{{ scope.row.mappingCode }}</span>
|
|
|
+ <el-input v-if="scope.row.isEdit" v-model="scope.row.paramsValue" size="small" />
|
|
|
+ <span v-else>{{ scope.row.paramsValue }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="类型" header-align="center" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
- <data-type-selector v-if="scope.row.isEdit" v-model="scope.row.attrType" />
|
|
|
- <span v-else>{{ dataType(scope.row.attrType) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="长度" header-align="center" align="center" width="120">
|
|
|
- <template #default="scope">
|
|
|
- <el-input-number
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- v-model="scope.row.attrLength" style="width:90px"
|
|
|
- :min="0"
|
|
|
- controls-position="right"
|
|
|
- size="small"
|
|
|
- />
|
|
|
- <span v-else>{{ scope.row.attrLength }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="小数位数" header-align="center" align="center" width="120">
|
|
|
- <template #default="scope">
|
|
|
- <el-input-number
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- v-model="scope.row.attrDecimals" style="width:90px"
|
|
|
- :min="0"
|
|
|
- controls-position="right"
|
|
|
- size="small"
|
|
|
- />
|
|
|
- <span v-else>{{ scope.row.attrDecimals }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="是否为空" header-align="center" align="center" width="90">
|
|
|
- <template #default="scope">
|
|
|
- <el-checkbox
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- v-model="scope.row.isNotNull"
|
|
|
- :true-label="1"
|
|
|
- :false-label="0"
|
|
|
- >
|
|
|
- {{ scope.row.isNotNull === 1 ? '是' : '否' }}
|
|
|
- </el-checkbox>
|
|
|
- <span v-else>{{ scope.row.isNotNull === 1 ? '是' : '否' }}</span>
|
|
|
+ <data-type-selector v-if="scope.row.isEdit" v-model="scope.row.paramsType" />
|
|
|
+ <span v-else>{{ dataType(scope.row.paramsType) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="注释">
|
|
|
+ <el-table-column label="备注">
|
|
|
<template #default="scope">
|
|
|
- <el-input v-if="scope.row.isEdit" v-model="scope.row.comment" size="small" />
|
|
|
- <span v-else>{{ scope.row.comment }}</span>
|
|
|
+ <el-input v-if="scope.row.isEdit" v-model="scope.row.paramsRemark" size="small" />
|
|
|
+ <span v-else>{{ scope.row.paramsRemark }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|