|
@@ -3,23 +3,29 @@
|
|
|
:title="title"
|
|
|
v-model="addLinksModVis"
|
|
|
:confirmLoading="confirmLoading"
|
|
|
- @ok="handleOk"
|
|
|
+ @ok="onSubmit"
|
|
|
@cancel="handleCancel"
|
|
|
width="86%"
|
|
|
>
|
|
|
- <!-- tabel 加载 :form="addLinkform" -->
|
|
|
+ <!-- tabel 加载 -->
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
- <a-form :model="linkForm" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
|
|
|
+ <a-form :form="addLinkform" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
|
|
|
<!-- 名称 地址 -->
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="名称">
|
|
|
- <a-input v-model="linkForm.name" placeholder="请输入名称" />
|
|
|
+ <a-input
|
|
|
+ v-decorator="['name', { rules: [{ required: true, message: '请输入名称' }] }]"
|
|
|
+ placeholder="请输入名称"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="地址">
|
|
|
- <a-input v-model="linkForm.address" placeholder="请输入地址" />
|
|
|
+ <a-input
|
|
|
+ v-decorator="['address', { rules: [{ required: true, message: '请输入地址' }] }]"
|
|
|
+ placeholder="请输入地址"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -29,7 +35,7 @@
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="创建人">
|
|
|
- <a-input disabled v-model="linkForm.createBy" placeholder="系统回显" />
|
|
|
+ <a-input disabled placeholder="系统回显" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
|
|
@@ -43,7 +49,6 @@
|
|
|
placeholder="系统回显"
|
|
|
@change="createTimeChange"
|
|
|
@ok="createTimeOk"
|
|
|
- v-model="linkForm.createBy"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
@@ -55,23 +60,20 @@
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="创建人">
|
|
|
- <a-input disabled v-model="linkForm.createBy" placeholder="回显创建人" />
|
|
|
+ <a-input disabled placeholder="回显创建人" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
|
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="创建时间">
|
|
|
- <a-form-item label="创建日期">
|
|
|
- <a-date-picker
|
|
|
- disabled
|
|
|
- v-model="linkForm.createTime"
|
|
|
- style="width:100%"
|
|
|
- showTime
|
|
|
- format="YYYY-MM-DD HH:mm:ss"
|
|
|
- @change="createTimeChange"
|
|
|
- @ok="createTimeOk"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
+ <a-form-item label="创建日期">
|
|
|
+ <a-date-picker
|
|
|
+ disabled
|
|
|
+ style="width:100%"
|
|
|
+ showTime
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ @change="createTimeChange"
|
|
|
+ @ok="createTimeOk"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -80,12 +82,16 @@
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="简介:" style="marginBottom:0;">
|
|
|
- <a-textarea v-model="memo" placeholder="请输入简介" style="minHeight:200px;width:1200px;" />
|
|
|
+ <a-textarea
|
|
|
+ v-decorator="['memo', { rules: [{ required: true, message: '请输入入简介' }] }]"
|
|
|
+ placeholder="请输入简介"
|
|
|
+ style="minHeight:200px;width:1200px;"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="是否发布:">
|
|
|
- <a-radio-group v-model="linkForm.isRelease">
|
|
|
+ <a-radio-group v-decorator="['isRelease', { rules: [{ required: true, message: '请选择发布状态' }] }]">
|
|
|
<a-radio value="0">
|
|
|
仅存稿
|
|
|
</a-radio>
|
|
@@ -102,39 +108,69 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { Moment } from 'moment'
|
|
|
-// import { defineComponent } from 'vue'
|
|
|
-import RichText from '@views/jeecg/RichText.vue'
|
|
|
+import moment from 'moment'
|
|
|
+import 'moment/locale/zh-cn'
|
|
|
+import { linksUpdate, linksAdd } from '@api/oa/cd_links.js'
|
|
|
export default {
|
|
|
name: 'AddLinksModal',
|
|
|
components: {
|
|
|
- RichText
|
|
|
+ // RichText
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- // addLinkform: this.$form.createForm(this),
|
|
|
- linkForm: {
|
|
|
- name: '',
|
|
|
- address: '',
|
|
|
- createBy: '',
|
|
|
- createTime: {},
|
|
|
- isRelease: '',
|
|
|
- memo: ''
|
|
|
- },
|
|
|
+ addLinkform: this.$form.createForm(this),
|
|
|
+ title: '', // 弹框标题
|
|
|
confirmLoading: false,
|
|
|
addLinksModVis: false,
|
|
|
- memo: '', // 简介
|
|
|
- title: '',
|
|
|
- formData: {}
|
|
|
+ linkInfo: {} // 表单数据(回显)
|
|
|
}
|
|
|
},
|
|
|
created () {},
|
|
|
methods: {
|
|
|
- // 弹框保存
|
|
|
- handleOk () {
|
|
|
- // 触发表单验证 判断是否有空值 包含 简介 赋值到表单上 判断是编辑还是新增 或者没有输入
|
|
|
- console.log('弹框点击了保存')
|
|
|
+ // 弹框确定
|
|
|
+ onSubmit () {
|
|
|
+ this.addLinkform.validateFields((err, res) => {
|
|
|
+ console.log('err, res', err, res)
|
|
|
+ if (res) {
|
|
|
+ console.log('>>>>>>', res)
|
|
|
+ var linkObj = {}
|
|
|
+ linkObj.name = res.name
|
|
|
+ linkObj.address = res.address
|
|
|
+ linkObj.createBy = res.createBy
|
|
|
+ linkObj.isRelease = res.isRelease
|
|
|
+ linkObj.memo = this.memo
|
|
|
+ // 编辑--------------------------------------
|
|
|
+ if (this.linkInfo.id) {
|
|
|
+ linkObj.id = this.linkInfo.id
|
|
|
+ console.log('这是修改')
|
|
|
+ linksUpdate(linkObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.addLinksModVis = false
|
|
|
+ this.addLinkform.resetFields() // 清空表单
|
|
|
+ this.fatherGetList() // 调用父组件的查询方法
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 新增--------------------------------------
|
|
|
+ linksAdd(linkObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ console.log('新增的内容', res)
|
|
|
+ this.addLinksModVis = false
|
|
|
+ this.$message.success('新增成功')
|
|
|
+ this.addLinkform.resetFields() // 清空
|
|
|
+ this.memo = '' // 清空富文本
|
|
|
+ this.fatherGetList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.addLinkform.resetFields() // 清空表单
|
|
|
+ this.$message.error('请填写友情链接必要信息')
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
+
|
|
|
close () {
|
|
|
this.$emit('close')
|
|
|
this.visible = false
|