generated from Leo_Ding/web-template
招聘岗位
This commit is contained in:
parent
f6eec94b31
commit
38e2fca3f8
@ -19,6 +19,12 @@
|
|||||||
<a-input v-model:value="formData.link" :placeholder="'请输入链接'" />
|
<a-input v-model:value="formData.link" :placeholder="'请输入链接'" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'日期'" name="pushAt">
|
||||||
|
<a-date-picker v-model:value="formData.pushAt" :format="'YYYY-MM-DD'" placeholder="选择日期" style="width: 100%;">
|
||||||
|
</a-date-picker>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'状态'" name="status">
|
<a-form-item :label="'状态'" name="status">
|
||||||
<a-radio-group v-model:value="formData.status" :options="[
|
<a-radio-group v-model:value="formData.status" :options="[
|
||||||
@ -29,7 +35,7 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'图片'" name="imgUrl">
|
<a-form-item :label="'图片'" name="imgUrl">
|
||||||
<x-upload-image v-model="imgUrl" @imgChange="imgChange"/>
|
<x-upload-image v-model="imgUrl" @imgChange="imgChange" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@ -55,12 +61,13 @@ const cancelText = ref(t('button.cancel'))
|
|||||||
const okText = ref(t('button.confirm'))
|
const okText = ref(t('button.confirm'))
|
||||||
const rolesValue = ref([])
|
const rolesValue = ref([])
|
||||||
const roles = ref([])
|
const roles = ref([])
|
||||||
const imgUrl=ref('')
|
const imgUrl = ref('')
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
title: { required: true, message: '请输入标题' },
|
title: { required: true, message: '请输入标题' },
|
||||||
content: { required: true, message: '请输入内容' },
|
content: { required: true, message: '请输入内容' },
|
||||||
link: { required: true, message: '请输入链接' },
|
link: { required: true, message: '请输入链接' },
|
||||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||||
|
pushAt: [{ required: true, message: '请选择发布日期', trigger: 'change' }],
|
||||||
// imgUrl: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
// imgUrl: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +79,8 @@ formRules.value = {
|
|||||||
const handleChange = (value) => {
|
const handleChange = (value) => {
|
||||||
rolesValue.value = value
|
rolesValue.value = value
|
||||||
}
|
}
|
||||||
const imgChange=(value)=>{
|
const imgChange = (value) => {
|
||||||
formData.value.img=value
|
formData.value.img = value
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新建
|
* 新建
|
||||||
@ -100,49 +107,51 @@ async function handleEdit(record = {}) {
|
|||||||
hideModal()
|
hideModal()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
formData.value = {...data}
|
formData.value = { ...data }
|
||||||
imgUrl.value=config('http.apiBasic')+data.img
|
formData.value.pushAt=dayjs(data.pushAt)
|
||||||
|
console.log(formData.value)
|
||||||
|
imgUrl.value = config('http.apiBasic') + data.img
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确定
|
* 确定
|
||||||
*/
|
*/
|
||||||
function handleOk() {
|
function handleOk() {
|
||||||
if(!formData.value.img) return message.error('请上传图片');
|
if (!formData.value.img) return message.error('请上传图片');
|
||||||
formRef.value.validateFields().then(async (values) => {
|
formRef.value.validateFields().then(async (values) => {
|
||||||
console.log(values)
|
console.log(values)
|
||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
img:formData.value.img,
|
img: formData.value.img,
|
||||||
pushAt:dayjs().format('YYYY-MM-DD'),
|
pushAt:dayjs(formData.value.pushAt).format("YYYY-MM-DD"),
|
||||||
type:'news'
|
type: 'news'
|
||||||
}
|
|
||||||
let result = null
|
|
||||||
console.log(modal.value.type)
|
|
||||||
switch (modal.value.type) {
|
|
||||||
case 'create':
|
|
||||||
result = await apis.dynamic.createDynamic(params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case 'edit':
|
|
||||||
result = await apis.dynamic.updateItem(formData.value.id, params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
hideLoading()
|
|
||||||
if (config('http.code.success') === result?.success) {
|
|
||||||
hideModal()
|
|
||||||
emit('ok')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
hideLoading()
|
|
||||||
}
|
}
|
||||||
})
|
let result = null
|
||||||
|
console.log(modal.value.type)
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.dynamic.createDynamic(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.dynamic.updateItem(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
hideLoading()
|
hideLoading()
|
||||||
@ -180,7 +189,7 @@ function formatArr(data, type = '') {
|
|||||||
* 取消
|
* 取消
|
||||||
*/
|
*/
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
imgUrl.value=''
|
imgUrl.value = ''
|
||||||
hideModal()
|
hideModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const { t } = useI18n() // 解构出t方法
|
|||||||
const columns = [
|
const columns = [
|
||||||
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' },
|
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' },
|
||||||
{ title: '标题', dataIndex: 'title', key: 'title' },
|
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||||
{ title: '内容', dataIndex: 'content', key: 'content' },
|
{ title: '简介', dataIndex: 'content', key: 'content' },
|
||||||
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
{ title: '发布日期', dataIndex: 'pushAt', width: 120, align: 'center' },
|
{ title: '发布日期', dataIndex: 'pushAt', width: 120, align: 'center' },
|
||||||
{ title: '链接', dataIndex: 'link', align: 'center' },
|
{ title: '链接', dataIndex: 'link', align: 'center' },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user