mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-24 08:33:14 +08:00
flow_template 转setup
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="setting-container">
|
<div class="setting-container">
|
||||||
<el-form
|
<el-form
|
||||||
ref="elForm"
|
ref="elFormRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
@@ -50,66 +50,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, ref, shallowRef } from 'vue'
|
||||||
|
import type { FormInstance } from 'element-plus'
|
||||||
import { useDictData } from '@/hooks/useDictOptions'
|
import { useDictData } from '@/hooks/useDictOptions'
|
||||||
export default {
|
defineOptions({
|
||||||
name: 'BasicSetting',
|
name: 'BasicSetting'
|
||||||
components: {},
|
})
|
||||||
props: ['tabName', 'conf'],
|
const { dictData } = useDictData(['flow_group'])
|
||||||
data() {
|
const props = defineProps(['tabName', 'conf'])
|
||||||
return {
|
const formData = ref({
|
||||||
formData: {
|
flowName: '',
|
||||||
flowName: '',
|
flowImg: '',
|
||||||
flowImg: '',
|
flowGroup: undefined,
|
||||||
flowGroup: undefined,
|
flowRemark: undefined
|
||||||
flowRemark: undefined
|
})
|
||||||
},
|
const rules = {
|
||||||
rules: {
|
flowName: [
|
||||||
flowName: [
|
{
|
||||||
{
|
required: true,
|
||||||
required: true,
|
message: '请输入审批名称',
|
||||||
message: '请输入审批名称',
|
trigger: 'blur'
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
flowGroup: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择选择分组',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
dictData: {
|
|
||||||
flow_group: []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
|
flowGroup: [
|
||||||
created() {
|
{
|
||||||
if (typeof this.conf === 'object' && this.conf !== null) {
|
required: true,
|
||||||
Object.assign(this.formData, this.conf)
|
message: '请选择选择分组',
|
||||||
|
trigger: 'change'
|
||||||
}
|
}
|
||||||
const { dictData } = useDictData(['flow_group'])
|
]
|
||||||
this.dictData = dictData
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 给父级页面提供得获取本页数据得方法
|
|
||||||
getData() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.$refs['elForm'].validate((valid) => {
|
|
||||||
if (!valid) {
|
|
||||||
reject({ target: this.tabName })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// this.formData.flowImg = this.activeIcon
|
|
||||||
resolve({ formData: { ...this.formData }, target: this.tabName }) // TODO 提交表单
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
if (typeof props.conf === 'object' && props.conf !== null) {
|
||||||
|
Object.assign(formData.value, props.conf)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const elFormRef = shallowRef<FormInstance>()
|
||||||
|
function getData() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
elFormRef.value.validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
reject({ target: this.tabName })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// this.formData.flowImg = this.activeIcon
|
||||||
|
resolve({ formData: { ...formData.value }, target: props.tabName }) // TODO 提交表单
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
getData
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user