master
parent
55e26d4000
commit
5ef8b5112c
@ -1,8 +1,7 @@
|
||||
export function statusFormatter(row) {
|
||||
switch(row.status) {
|
||||
case 0: return '未开始';
|
||||
case 1: return '进行中';
|
||||
case 2: return '已终止';
|
||||
switch(row.type) {
|
||||
case 1: return '视频';
|
||||
case 2: return '图片';
|
||||
default: return '';
|
||||
}
|
||||
};
|
@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<div class="form-area">
|
||||
<el-form size="default" :model="form" label-width="120px">
|
||||
<el-form-item label="分组" style="width: 80%">
|
||||
<el-select v-model="form.groupId" placeholder="请选择">
|
||||
<el-option :value="0" label="不分组"></el-option>
|
||||
<el-option v-for="(item) in groupData" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="车系" style="width: 80%">
|
||||
<div>
|
||||
<el-checkbox-group v-model="form.brandList">
|
||||
<el-checkbox v-for="(item,index) in brandData" :key="index" :label="item.id">
|
||||
{{item.name}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" style="width: 80%">
|
||||
<el-select v-model="form.type" placeholder="请选择">
|
||||
<el-option :value="1" label="视频"></el-option>
|
||||
<el-option :value="2" label="图片"></el-option>
|
||||
<el-option :value="3" label="文字"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" style="width: 80%" v-if="form.type == 1">
|
||||
<uploadFile @change="coverUpload" :config="{ limit: 1, accept: '.jpg, .jpeg, .png, .gif,'}">
|
||||
<el-icon v-if="form.coverUrl == ''" class="img-upload"><Plus /></el-icon>
|
||||
<img v-else class="img-upload" :src="$ImgUrl(form.coverUrl)" />
|
||||
</uploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" style="width: 80%">
|
||||
<el-checkbox-group v-model="form.tagList">
|
||||
<el-checkbox v-for="(item,index) in tagData" :key="index" :label="item.id">
|
||||
{{item.title}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="素材描述" style="width: 80%">
|
||||
<el-input type="textarea" v-model="form.title" />
|
||||
</el-form-item>
|
||||
<el-form-item label="素材内容" style="width: 100%">
|
||||
<uploadFile @change="handlerUpload" :config="{ limit: 1, accept: '.jpg, .jpeg, .png, .gif, .mp4'}">
|
||||
<el-button>上传文件</el-button>
|
||||
</uploadFile>
|
||||
<el-link :href="$ImgUrl(form.fileUrl)" target="_blank">
|
||||
{{form.fileUrl}}
|
||||
</el-link>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {defineComponent,reactive,ref,getCurrentInstance} from 'vue'
|
||||
export default defineComponent({
|
||||
name: 'v-matUpload',
|
||||
setup() {
|
||||
const activeId = reactive({
|
||||
value: 0
|
||||
});
|
||||
const form = reactive({
|
||||
groupId: 0,
|
||||
title: '',
|
||||
type: undefined,
|
||||
tagList: [],
|
||||
brandList: [],
|
||||
coverUrl: '',
|
||||
fileUrl: '',
|
||||
duration: undefined,
|
||||
});
|
||||
const tagData = ref([]);
|
||||
const brandData = ref([]);
|
||||
const groupData = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
return {
|
||||
form,proxy,
|
||||
tagData,brandData,groupData,
|
||||
activeId
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getApi()
|
||||
},
|
||||
methods: {
|
||||
getApi() {
|
||||
this.proxy.$post("/tag/list", {}).then(res => {
|
||||
this.tagData = res.data.records;
|
||||
}).catch(() => {});
|
||||
this.proxy.$post("/brand/list", {}).then(res => {
|
||||
this.brandData = res.data.records;
|
||||
}).catch(() => {});
|
||||
this.proxy.$post("/referenceGroup/list", {}).then(res => {
|
||||
this.groupData = res.data.records;
|
||||
}).catch(() => {});
|
||||
if(this.$route.params.id) {
|
||||
this.proxy.$post("/reference/detail", {id: this.$route.params.id}).then(res => {
|
||||
this.form.groupId = res.data.groupId;
|
||||
this.form.type = res.data.type;
|
||||
this.form.title = res.data.title;
|
||||
res.data.brandList.forEach(ele => {this.form.brandList.push(ele.id)});
|
||||
res.data.tagList.forEach(ele => {this.form.tagList.push(ele.id)});
|
||||
this.form.fileUrl = res.data.fileUrl;
|
||||
this.form.coverUrl = res.data.coverUrl;
|
||||
this.form.duration = res.data.duration;
|
||||
}).catch(() => {});
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
if(this.$route.params.id) {
|
||||
let obj = Object.assign(this.form, {id: this.$route.params.id})
|
||||
this.proxy.$post("/reference/upd", obj).then(res => {
|
||||
this.$message.success(res.data)
|
||||
this.$router.go(-1);
|
||||
}).catch(() => {});
|
||||
} else {
|
||||
this.proxy.$post("/reference/add", this.form).then(res => {
|
||||
this.$message.success(res.data)
|
||||
this.$router.go(-1);
|
||||
}).catch(() => {});
|
||||
}
|
||||
},
|
||||
//素材上传
|
||||
handlerUpload(data) {
|
||||
if(data.fileUrl != null) {
|
||||
this.form.fileUrl = data.fileUrl
|
||||
};
|
||||
if(data.duration) {
|
||||
this.form.duration = data.duration;
|
||||
}
|
||||
},
|
||||
coverUpload(data) {
|
||||
this.form.coverUrl = data.fileUrl
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.form-area {
|
||||
width: 600px
|
||||
}
|
||||
.img-upload {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 135px;
|
||||
height: 135px;
|
||||
text-align: center;
|
||||
border: 1px solid;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,8 @@
|
||||
export function statusFormatter(row) {
|
||||
switch(row.type) {
|
||||
case 1: return '视频';
|
||||
case 2: return '图片';
|
||||
case 3: return '图文';
|
||||
default: return '';
|
||||
}
|
||||
};
|
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<div class="area-form">
|
||||
<el-form :inline="true" size="default">
|
||||
<el-form-item label="员工名">
|
||||
<el-input v-model="form.name" placeholder="请输入"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门">
|
||||
<el-input v-model="form.department" placeholder="请输入"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="confirm">查 询</el-button>
|
||||
<el-button @click="reset">重 置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="area-table">
|
||||
<el-table :data="tableData.data" size="default" border :header-cell-style="{background: '#EEE'}">
|
||||
<el-table-column prop="name" label="员工" width="360"></el-table-column>
|
||||
<el-table-column prop="main_departmentName" label="部门"></el-table-column>
|
||||
<el-table-column prop="sub_departmentName" label="上级部门"></el-table-column>
|
||||
<el-table-column prop="point" label="积分"></el-table-column>
|
||||
<el-table-column prop="action" label="操作" fixed="right" width="240">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="changePoint(scope.row.id)">修改积分</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-model:currentPage="pagination.current"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 30, 40]"
|
||||
background
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pagination.total"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {defineComponent, reactive, watch, getCurrentInstance} from 'vue'
|
||||
import {statusFormatter} from './config.js'
|
||||
export default defineComponent({
|
||||
name: 'v-questList',
|
||||
setup() {
|
||||
const form = reactive({
|
||||
name: undefined,
|
||||
department: undefined,
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
});
|
||||
const pagination = reactive({
|
||||
total: 0,
|
||||
current: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
const { proxy } = getCurrentInstance();
|
||||
return {
|
||||
form,proxy,
|
||||
tableData,pagination,
|
||||
statusFormatter
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.getApi()
|
||||
// this.getData()
|
||||
watch(() => (this.pagination.pageSize), () => {
|
||||
this.getData()
|
||||
});
|
||||
watch(() => (this.pagination.current), () => {
|
||||
this.getData()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getApi() {
|
||||
let obj = Object.assign(this.form,{pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
|
||||
this.proxy.$post("/user/department", obj).then(res => {
|
||||
const data = res.data
|
||||
}).catch(() => {});
|
||||
},
|
||||
getData() {
|
||||
let obj = Object.assign(this.form,{pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
|
||||
this.proxy.$post("/user/list", obj).then(res => {
|
||||
if(res.code == 200) {
|
||||
const data = res.data
|
||||
this.tableData.data = data.records;
|
||||
this.pagination.total = data.total
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
}).catch(() => {});
|
||||
},
|
||||
confirm() {
|
||||
this.getData()
|
||||
},
|
||||
reset() {
|
||||
this.form.name = undefined;
|
||||
this.form.department = undefined;
|
||||
this.getData();
|
||||
},
|
||||
changePoint(value) {
|
||||
|
||||
},
|
||||
//删除
|
||||
singleDel(id) {
|
||||
this.$alert(
|
||||
'是否删除'+id+'?', //文字
|
||||
'删除', //标题
|
||||
{type: 'warning'}
|
||||
).then(() => {
|
||||
this.$message.success('删除成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.area-table {
|
||||
margin-top: 16px
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue