fix: 修改作品模块字段
This commit is contained in:
parent
ef80e5486f
commit
a5feb47ecc
@ -14,27 +14,19 @@
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作品名称" prop="works_name">
|
||||
<el-input v-model='formData.works_name' type="text" placeholder='请输入作品名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者名称" prop="works_author">
|
||||
<el-input v-model='formData.works_author' type="text" placeholder='请输入作品作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width="labelWidth" prop="classes_guid" label="所属班型">
|
||||
<el-select v-model='formData.classes_guid' clearable placeholder="请选择所属班型">
|
||||
<el-option v-for="item in classesData" :key="item.classes_guid" :label="item.classes_name"
|
||||
:value="item.classes_guid"></el-option>
|
||||
<el-form-item :label-width="labelWidth" label="作者类型" prop="works_author_type">
|
||||
<el-select v-model="formData.works_author_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in works_author_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width='labelWidth' label='作品图片' prop='works_img'>
|
||||
@ -77,9 +69,8 @@
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addWorks } from "~/service/works";
|
||||
import { getWorksTypeList } from "~/service/works_type"
|
||||
import { getWorksTypeList, getDictionary } from "~/service/works_type"
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getClassesList } from '~/service/classes';
|
||||
|
||||
// --业务参数
|
||||
|
||||
@ -95,12 +86,16 @@ async function getList() {
|
||||
}
|
||||
})
|
||||
}
|
||||
//班型
|
||||
const classesData = ref([]);
|
||||
async function getClassesData() {
|
||||
await getClassesList().then((res) => classesData.value = res.data)
|
||||
|
||||
// 字典获取
|
||||
const works_author_type = ref([]);
|
||||
async function get_works_author_type() {
|
||||
await getDictionary({ dictionary_value: 'works_author_type' }).then((res) => {
|
||||
works_author_type.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
@ -117,7 +112,7 @@ const props = defineProps({
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({
|
||||
works_order: 0,
|
||||
works_order: 1,
|
||||
works_likes_count: 0,
|
||||
});
|
||||
|
||||
@ -136,30 +131,12 @@ const rules = reactive({
|
||||
message: '作品图片不能为空'
|
||||
}
|
||||
],
|
||||
works_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '作品名称不能为空'
|
||||
}
|
||||
],
|
||||
works_author: [
|
||||
{
|
||||
required: true,
|
||||
message: '作品作者不能为空'
|
||||
}
|
||||
],
|
||||
classes_guid: [
|
||||
{
|
||||
required: true,
|
||||
message: '作品所属班型不能为空'
|
||||
}
|
||||
],
|
||||
works_intro: [
|
||||
{
|
||||
required: true,
|
||||
message: '作品介绍不能为空'
|
||||
}
|
||||
],
|
||||
// works_intro: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '作品介绍不能为空'
|
||||
// }
|
||||
// ],
|
||||
works_type_guid: [
|
||||
{
|
||||
required: true,
|
||||
@ -178,6 +155,12 @@ const rules = reactive({
|
||||
message: '排序不能为空'
|
||||
}
|
||||
],
|
||||
works_author_type: [
|
||||
{
|
||||
required: true,
|
||||
message: '作者类型不能为空'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
@ -186,7 +169,7 @@ const rules = reactive({
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
getList()
|
||||
getClassesData()
|
||||
get_works_author_type()
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
@ -203,7 +186,7 @@ const handleAddClick = async (formEl) => {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
const { code,msg } = await addWorks(formData);
|
||||
const { code, msg } = await addWorks(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
|
@ -14,23 +14,13 @@
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作品名称" prop="works_name">
|
||||
<el-input v-model='formData.works_name' type="text" placeholder='请输入作品名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者名称" prop="works_author">
|
||||
<el-input v-model='formData.works_author' type="text" placeholder='请输入作品作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width="labelWidth" prop="classes_guid" label="所属班型">
|
||||
<el-select v-model='formData.classes_guid' clearable placeholder="请选择所属班型">
|
||||
<el-option v-for="item in classesData" :key="item.classes_guid" :label="item.classes_name"
|
||||
:value="item.classes_guid"></el-option>
|
||||
<el-form-item :label-width="labelWidth" label="作者类型" prop="works_author_type">
|
||||
<el-select v-model="formData.works_author_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in works_author_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -69,12 +59,16 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { isEmptyObject } from "~/utils/index";
|
||||
import { getWorksTypeList } from "~/service/works_type";
|
||||
import { getClassesList } from '~/service/classes';
|
||||
import { getWorksTypeList,getDictionary } from "~/service/works_type";
|
||||
|
||||
// --业务参数
|
||||
|
||||
// 字典获取
|
||||
const works_author_type = ref([]);
|
||||
async function get_works_author_type() {
|
||||
await getDictionary({ dictionary_value: 'works_author_type' }).then((res) => {
|
||||
works_author_type.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// --业务方法
|
||||
@ -87,11 +81,6 @@ async function getList() {
|
||||
}
|
||||
})
|
||||
}
|
||||
//班型
|
||||
const classesData = ref([]);
|
||||
async function getClassesData() {
|
||||
await getClassesList().then((res) => classesData.value = res.data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -120,7 +109,7 @@ watch(props, (v) => {
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
getList();
|
||||
getClassesData()
|
||||
get_works_author_type()
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
|
@ -14,23 +14,13 @@
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作品名称" prop="works_name">
|
||||
<el-input v-model='formData.works_name' type="text" placeholder='请输入作品名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者名称" prop="works_author">
|
||||
<el-input v-model='formData.works_author' type="text" placeholder='请输入作品作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width="labelWidth" prop="classes_guid" label="所属班型">
|
||||
<el-select v-model='formData.classes_guid' clearable placeholder="请选择所属班型">
|
||||
<el-option v-for="item in classesData" :key="item.classes_guid" :label="item.classes_name"
|
||||
:value="item.classes_guid"></el-option>
|
||||
<el-form-item :label-width="labelWidth" label="作者类型" prop="works_author_type">
|
||||
<el-select v-model="formData.works_author_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in works_author_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -76,13 +66,13 @@
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editWorks } from "~/service/works";
|
||||
import { getWorksTypeList } from "~/service/works_type";
|
||||
import { getWorksTypeList,getDictionary } from "~/service/works_type";
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getClassesList } from '~/service/classes';
|
||||
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
// --业务方法
|
||||
//作品类型
|
||||
const dataList = ref();
|
||||
@ -99,6 +89,14 @@ async function getClassesData() {
|
||||
await getClassesList().then((res) => classesData.value = res.data)
|
||||
}
|
||||
|
||||
// 字典获取
|
||||
const works_author_type = ref([]);
|
||||
async function get_works_author_type() {
|
||||
await getDictionary({ dictionary_value: 'works_author_type' }).then((res) => {
|
||||
works_author_type.value = res
|
||||
})
|
||||
}
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
@ -131,6 +129,7 @@ watch(props, (v) => {
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
getList();
|
||||
get_works_author_type()
|
||||
getClassesData()
|
||||
};
|
||||
|
||||
|
@ -5,16 +5,11 @@
|
||||
<el-breadcrumb-item to="/works/list">作品列表</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
|
||||
<el-form inline :model="params">
|
||||
<el-form-item label="作品名称">
|
||||
<el-input v-model='params.works_name' placeholder='请输入作品名称'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者名称">
|
||||
<el-input v-model='params.works_author' placeholder='请输入作者名称'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="作品类型" prop="works_type_guid">
|
||||
<el-cascader class="w100" filterable :options="dataList"
|
||||
:props="{ checkStrictly: true, value: 'works_type_guid', label: 'works_type_name', emitPath: false }"
|
||||
:props="{ checkStrictly: false, value: 'works_type_guid', label: 'works_type_name', emitPath: false }"
|
||||
placeholder="请选择作品类型" clearable v-model="params.works_type_guid">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.works_type_name }}</span>
|
||||
@ -22,12 +17,14 @@
|
||||
</template>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item prop="classes_guid" label="所属班型">
|
||||
<el-select v-model='params.classes_guid' clearable placeholder="请选择所属班型">
|
||||
<el-option v-for="item in classesData" :key="item.classes_guid" :label="item.classes_name"
|
||||
:value="item.classes_guid"></el-option>
|
||||
|
||||
<el-form-item :label-width="labelWidth" label="作者类型" prop="works_author_type">
|
||||
<el-select v-model="params.works_author_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in works_author_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||
搜索
|
||||
@ -83,9 +80,9 @@
|
||||
<template #works_type_name="scope">
|
||||
<el-tag> {{ scope.row.works_type_name }} </el-tag>
|
||||
</template>
|
||||
<!-- 班型 -->
|
||||
<template #classes_name="scope">
|
||||
<el-tag type='danger'> {{ scope.row.classes_name }} </el-tag>
|
||||
<!-- 作者类型 -->
|
||||
<template #works_author_type='scope'>
|
||||
<dict-tag :options='works_author_type' :value='scope.row.works_author_type' />
|
||||
</template>
|
||||
<!-- 作品点赞数 -->
|
||||
<template #works_likes_count="scope">
|
||||
@ -129,8 +126,7 @@ import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getWorksList, deleteWorks, downloadTemplate, importExcel, exportExcel, editWorks } from '~/service/works';
|
||||
import { getWorksTypeList } from "~/service/works_type";
|
||||
import { getClassesList } from '~/service/classes';
|
||||
import { getWorksTypeList,getDictionary } from "~/service/works_type";
|
||||
import AddWorksDialog from './components/AddWorksDialog.vue';
|
||||
import EditWorksDialog from './components/EditWorksDialog.vue';
|
||||
import DetailWorksDialog from './components/DetailWorksDialog.vue';
|
||||
@ -154,10 +150,8 @@ const headers = {
|
||||
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
works_name: "",
|
||||
works_author: "",
|
||||
works_type_guid: "",
|
||||
classes_guid: "",
|
||||
works_author_type: ""
|
||||
});
|
||||
const column = [
|
||||
|
||||
@ -170,27 +164,16 @@ const column = [
|
||||
label: '作品图片',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "works_name",
|
||||
label: '作品名称',
|
||||
width: '150',
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: "works_type_name",
|
||||
label: '作品类型',
|
||||
width: '125'
|
||||
},
|
||||
{
|
||||
prop: "works_author",
|
||||
label: '作者',
|
||||
prop: "works_author_type",
|
||||
label: '作者类型',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "classes_name",
|
||||
label: '班型',
|
||||
width: '125'
|
||||
},
|
||||
{
|
||||
prop: "works_likes_count",
|
||||
label: '点赞数',
|
||||
@ -218,16 +201,10 @@ async function getList() {
|
||||
getWorksTypeList({ limit: 10000 }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
dataList.value = res.data
|
||||
params.works_type_guid = res.data[0].works_type_guid
|
||||
}
|
||||
})
|
||||
}
|
||||
//班型
|
||||
const classesData = ref([]);
|
||||
getClassesData()
|
||||
async function getClassesData() {
|
||||
await getClassesList().then((res) => classesData.value = res.data)
|
||||
}
|
||||
|
||||
|
||||
//表格数据获取及拖拽处理
|
||||
let drag = ref(false)
|
||||
@ -337,6 +314,13 @@ const handleExcelSuccess = (value) => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// 字典获取
|
||||
const works_author_type = ref([]);
|
||||
async function get_works_author_type() {
|
||||
await getDictionary({ dictionary_value: 'works_author_type' }).then((res) => {
|
||||
works_author_type.value = res
|
||||
})
|
||||
}
|
||||
get_works_author_type()
|
||||
|
||||
</script>
|
||||
|
@ -75,4 +75,14 @@ export function editWorksType(data) {
|
||||
// isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getDictionary(data) {
|
||||
return api.post('Dictionary.Dictionary/getDictionary', data, {
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user