|
@@ -121,15 +121,38 @@
|
|
</el-form>
|
|
</el-form>
|
|
</hc-card-item>
|
|
</hc-card-item>
|
|
<template #action>
|
|
<template #action>
|
|
- <el-button type="info">取消</el-button>
|
|
|
|
- <el-button color="#20C98B" type="primary" class="text-white">创建</el-button>
|
|
|
|
- <el-button type="warning">保存</el-button>
|
|
|
|
|
|
+ <el-button v-if="formInfo.id" type="info" @click="cancelClick">取消</el-button>
|
|
|
|
+ <el-button v-if="!formInfo.id" color="#20C98B" type="primary" class="text-white" @click="createClick">创建</el-button>
|
|
|
|
+ <el-button type="warning" @click="saveClick">保存</el-button>
|
|
</template>
|
|
</template>
|
|
</hc-card>
|
|
</hc-card>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref } from 'vue'
|
|
|
|
|
|
+import { onMounted, ref, watch } from 'vue'
|
|
|
|
+import { isNullES } from 'js-fast-way'
|
|
|
|
+
|
|
|
|
+const props = defineProps({
|
|
|
|
+ form: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: () => ({}),
|
|
|
|
+ },
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+//事件
|
|
|
|
+const emit = defineEmits(['back'])
|
|
|
|
+
|
|
|
|
+//监听权限
|
|
|
|
+const formInfo = ref(props.form)
|
|
|
|
+watch(() => props.form, (data) => {
|
|
|
|
+ formInfo.value = data
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+//渲染完成
|
|
|
|
+onMounted(() => {
|
|
|
|
+ console.log(formInfo.value)
|
|
|
|
+})
|
|
|
|
+
|
|
const baseForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'' })
|
|
const baseForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'' })
|
|
const baseFormRules = {
|
|
const baseFormRules = {
|
|
key1: {
|
|
key1: {
|
|
@@ -167,6 +190,25 @@ const selectYear = ref('')
|
|
|
|
|
|
const yearForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'' })
|
|
const yearForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'' })
|
|
const yearFormRules = {}
|
|
const yearFormRules = {}
|
|
|
|
+
|
|
|
|
+//取消
|
|
|
|
+const cancelClick = () => {
|
|
|
|
+ emit('back')
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//创建
|
|
|
|
+const createClick = () => {
|
|
|
|
+ const form = formInfo.value
|
|
|
|
+ if (isNullES(form.id)) cancelClick()
|
|
|
|
+ console.log('创建')
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//保存
|
|
|
|
+const saveClick = () => {
|
|
|
|
+ const form = formInfo.value
|
|
|
|
+ if (isNullES(form.id)) cancelClick()
|
|
|
|
+ console.log('保存')
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|