feat: 空流程分类展示新建按钮、回显分类逻辑

pull/582/head
GoldenZqqq 2024-10-17 09:40:40 +08:00
parent 708e12b6ce
commit 4bc79c382b
2 changed files with 26 additions and 1 deletions

View File

@ -23,6 +23,16 @@
<Icon icon="fa:sort-amount-desc" class="mr-5px" /> <Icon icon="fa:sort-amount-desc" class="mr-5px" />
排序 排序
</el-button> </el-button>
<el-button
v-else
link
type="info"
class="mr-20px"
@click.stop="handleAddModel('create')"
>
<Icon icon="fa:plus" class="mr-5px" />
新建
</el-button>
<el-dropdown <el-dropdown
@command="(command) => handleCategoryCommand(command)" @command="(command) => handleCategoryCommand(command)"
placement="bottom" placement="bottom"
@ -228,9 +238,12 @@
</div> </div>
</template> </template>
</Dialog> </Dialog>
<!-- 表单弹窗添加流程模型 -->
<ModelForm :categoryId="categoryInfo.code" ref="modelFormRef" @success="emit('success')" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import ModelForm from './ModelForm.vue'
import { CategoryApi } from '@/api/bpm/category' import { CategoryApi } from '@/api/bpm/category'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
@ -480,6 +493,12 @@ const handleDeleteGroup = async () => {
} catch {} } catch {}
} }
//
const modelFormRef = ref()
const handleAddModel = (type: string) => {
modelFormRef.value.open(type)
}
watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true }) watch(() => props.categoryInfo.modelList, updateTableData, { immediate: true })
watch( watch(
() => props.isCategorySorting, () => props.isCategorySorting,

View File

@ -155,6 +155,7 @@
</Dialog> </Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
import { DICT_TYPE, getBoolDictOptions, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getBoolDictOptions, getIntDictOptions } from '@/utils/dict'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import * as ModelApi from '@/api/bpm/model' import * as ModelApi from '@/api/bpm/model'
@ -170,7 +171,9 @@ defineOptions({ name: 'ModelForm' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const userStore = useUserStoreWithOut() // const userStore = useUserStoreWithOut() //
const props = defineProps({
categoryId: propTypes.number
})
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
@ -232,6 +235,9 @@ const open = async (type: string, id?: string) => {
categoryList.value = await CategoryApi.getCategorySimpleList() categoryList.value = await CategoryApi.getCategorySimpleList()
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
if (props.categoryId) {
formData.value.category = props.categoryId
}
} }
defineExpose({ open }) // open defineExpose({ open }) // open