flat: 咨询信箱、等70%

This commit is contained in:
Apcallover
2024-04-28 22:18:03 +08:00
parent 3e5eba833a
commit b4b8fc7ed0
11 changed files with 1335 additions and 421 deletions

View File

@@ -6,6 +6,8 @@
:data="data"
:page.sync="page"
ref="crud"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@current-change="currentChange"
@size-change="sizeChange"
@@ -13,267 +15,294 @@
@search-reset="searchReset"
@on-load="onLoad"
>
<template slot="search" slot-scope="{row,size}">
<div style="width: 500px;">
<el-date-picker
v-model="row.applTime"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
@change="dateChange">
</el-date-picker>
</div>
<!-- <template slot="search" slot-scope="{row,size}">-->
<!-- <div style="width: 500px;">-->
<!-- <el-date-picker-->
<!-- v-model="row.applTime"-->
<!-- type="daterange"-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期"-->
<!-- format="yyyy 年 MM 月 dd 日"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- @change="dateChange">-->
<!-- </el-date-picker>-->
<!-- </div>-->
<!-- </template>-->
<template slot="status" slot-scope="{ row }">
<el-switch
:value="row.status"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
@change="changeStatus(row)"
>
</el-switch>
</template>
<template slot="menu" slot-scope="{row}">
<el-button size="small" type="text" @click="look(row)">查看</el-button>
<el-button size="small" type="text" @click="look(row)">
<i class="el-icon-view"></i>
查看回答
</el-button>
</template>
</avue-crud>
<!-- 新增编辑 -->
<el-drawer :title="drawerTitle" :visible.sync="viewDrawer" size="60%">
<div>
<p>申请信息</p>
<el-table
:data="lookData"
style="width: 100%;min-height: 120px !important;">
<el-table-column
prop="name"
label="姓名">
</el-table-column>
<el-table-column
prop="telephone"
label="手机号码"
width="180">
</el-table-column>
<el-table-column
prop="type"
label="申请类型">
<template slot-scope="{ row }">
<span v-if="row.type==1">法律咨询</span>
<span v-if="row.type==2">技能提升</span>
</template>
</el-table-column>
<el-table-column
prop="applTime"
label="申请时间">
<template slot-scope="{ row }">
<span>{{dateFormat(new Date(row.applTime), "yyyy/MM/dd")}}</span>
</template>
</el-table-column>
</el-table>
<p>申请内容</p>
<Tinymce v-if="viewDrawer" v-model="formOption.content" ref="tinymce"></Tinymce>
</div>
</el-drawer>
<Detail :visible.sync="viewDrawer" :rowData="selectPushServiceData"></Detail>
</basic-container>
</template>
<script>
import {dateFormat} from '@/util/date'
import Tinymce from "@/components/Tinymce";
import {getApplContentList} from '@/api/help/applicationsRecord/applicationsRecord'
import {
getAllContentCategoryFirstList,
getAllContentCategorySecondList
} from '@/api/help/classify'
import {dateFormat} from '@/util/date'
import Tinymce from "@/components/Tinymce";
import {
getApplContentList,
addApplContentList,
changePublish,
deleteQuestionnaireSurveyInfo
} from '@/api/help/applicationsRecord/applicationsRecord'
import Detail from './sub/detail.vue'
export default {
name: "index",
components: {
Tinymce
},
mounted() {
this.firstList()
},
data () {
const initPages = {
pageSize: 10,
currentPage: 1,
total: 100,
}
const classStatus = {
0: '未发布',
1: '发布',
2: '关闭'
}
const classIsRead = {
0: '未阅读',
1: '已阅读',
}
const classEnumStatus = Object.keys(classStatus).map((item) => ({
label: classStatus[item], value: Number(item)
}))
const classEnumIsRead = Object.keys(classIsRead).map((item) => ({
label: classIsRead[item], value: Number(item)
}))
export default {
name: "index",
components: {
Tinymce,
Detail
},
mounted() {
},
data() {
return {
applTime: '',
selectPushServiceData: null,
loading: false,
viewDrawer: false,
query: {},
data: [],
page: Object.assign({}, initPages),
}
},
computed: {
option() {
return {
applTime: '',
loading:false,
viewDrawer:false,
drawerTitle: '新增内容',
formOption: {},
query: {},
rules: {
name: [
{ required: true, message: '请输入内容标题', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择分类', trigger: 'blur' }
],
content: [
{ required: true, message: '请输入内容', trigger: 'blur' }
],
},
option: {
height: "auto",
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
indexLabel: "序号",
selection: false,
viewBtn: false,
addBtn: false,
editBtn:false,
delBtn: false,
columnBtn: false,
menuWidth: 300,
labelWidth: 151,
dialogClickModal: false,
dialogType: "drawer",
dialogFullscreen: true,
column: [
{
label: "姓名",
prop: "name",
display: false,
search: true
},
{
label: "手机号码",
prop: "telephone",
display: false,
search: true
},
{
label: "申请类型",
prop: "type",
display: false,
search: true,
type: "tree",
dicData: [
{
name: '法律咨询',
type: 1
},
{
name: '技能提升',
type: 2
}
],
props: {
label: "name",
value: "type",
height: "auto",
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
indexLabel: "序号",
selection: false,
viewBtn: true,
viewBtnText: "查看问卷",
addBtn: true,
editBtn: false,
delBtn: true,
columnBtn: false,
menuWidth: 300,
labelWidth: 151,
dialogClickModal: false,
dialogType: "drawer",
dialogFullscreen: true,
align: 'center',
column: [
{
label: "机构名称",
prop: "companyName",
addDisplay: false,
span: 24,
},
{
label: "问卷题目",
prop: "surveyTitle",
span: 24,
search: true,
rules: [
{
required: true,
message: "输入问卷题目",
trigger: "change",
},
},
{
label: "申请时间",
prop: "applTime",
display: false,
type:'datetime',
searchSpan:8,
searchRange:true,
format: "yyyy/MM/dd",
}
]
},
data: [],
lookData: [],
page: {
pageSize: 10,
currentPage: 1,
total: 100,
},
}
},
methods: {
dateFormat,
dateChange(val){
if(val){
this.query.applTimeStart = val[0] + "00:00:00";
this.query.applTimeEnd = val[1] + "23:59:59";
}else{
this.query.applTimeStart = '';
this.query.applTimeEnd = '';
}
},
firstList(){
getAllContentCategoryFirstList().then(res => {
this.first = res.data.data
})
},
secondList (id) {
getAllContentCategorySecondList (id).then(res => {
this.formOption.secondId = ''
this.second = res.data.data
})
},
add () {
this.formOption = {}
this.drawerTitle = '新增内容'
this.viewDrawer = true
this.$nextTick(() => {
this.$refs.ruleForm.clearValidate();
})
},
look(row){
this.drawerTitle = '查看'
this.lookData = JSON.parse(JSON.stringify([row]))
this.formOption = JSON.parse(JSON.stringify(row))
this.viewDrawer = true
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.formOption);
this.viewDrawer = false
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.viewDrawer = false
},
/* 表格方法 */
onLoad(page, params = {}) {
this.loading = true;
getApplContentList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params)
).then((res) => {
this.data = res.data.data.records;
this.page.total = res.data.data.total;
this.loading = false;
});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params,done) {
console.log(params);
if (params.applTime) {
var val = JSON.parse(JSON.stringify(params.applTime))
params.applTimeStart = val[0] + " 00:00:00";
params.applTimeEnd = val[1] + " 23:59:59";
delete params.applTime
}
this.query = params;
console.log(this.query);
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
currentChange(val) {
this.page.currentPage = val
},
sizeChange(val) {
this.page.currentPage = 1
this.page.pageSize = val
},
refreshChange () {
this.page.currentPage = 1;
this.onLoad(this.page)
]
},
{
label: "问卷内容",
prop: "surveyContent",
span: 24,
search: false,
rules: [
{
required: true,
message: "输入问卷内容",
trigger: "change",
},
]
},
{
label: "创建人",
prop: "createUser",
addDisplay: false,
},
{
label: "创建时间",
prop: "createTime",
type: 'datetime',
addDisplay: false,
searchSpan: 8,
searchRange: true,
search: false,
format: "yyyy/MM/dd",
},
{
label: '发布状态',
prop: 'status',
type: 'select',
addDisplay: false,
dicData: [
{label: '未发布', value: 0},
{label: '已发布', value: 1},
],
slot: true,
width: 100
},
]
}
}
},
methods: {
dateFormat,
searchReset() {
this.query = {};
this.page.currentPage = 1
this.onLoad();
},
searchChange(params, done) {
console.log(params);
this.query = params;
this.page.currentPage = 1;
this.onLoad();
done();
},
currentChange(val) {
this.page.currentPage = val
this.onLoad()
},
sizeChange(val) {
this.page.currentPage = 1
this.page.pageSize = val
this.onLoad()
},
refreshChange() {
this.page.currentPage = 1;
this.onLoad()
},
look(row) {
this.selectPushServiceData = row
this.viewDrawer = true
},
async changeStatus(row) {
const status = row.status ? 0 : 1
let params = {id: row.id, status}
console.log(params)
let resData = await changePublish(params)
if (resData.data.code === 200) {
this.$message.success('状态修改成功');
this.onLoad()
}
},
rowDel(row) {
const h = this.$createElement;
this.$confirm(
h("div", null, [
h("p", {style: "font-size: 16px"}, "您确定要删除此问卷吗? "),
h("p", {style: "color: red"}, "一旦删除则无法找回"),
]),
{
type: "warning",
showClose: false,
showCancelButton: true,
confirmButtonText: "确定",
cancelButtonText: "取消",
beforeClose: async (action, instance, done) => {
if (action === "confirm") {
let resData = await deleteQuestionnaireSurveyInfo({id: row.id})
if (resData.data.code === 200) {
this.onLoad()
this.$message({
type: "success",
message: "操作成功!",
});
}
done()
} else {
done();
}
},
}
)
},
rowSave(row, done, loading) {
const params = {
surveyTitle: row.surveyTitle,
surveyContent: row.surveyContent,
};
addApplContentList(params).then(
() => {
this.page.currentPage = 1
this.onLoad();
this.$message({
type: "success",
message: "操作成功!",
});
done();
},
(error) => {
window.console.log(error);
loading();
})
},
/* 表格方法 */
onLoad() {
return new Promise(async (resolve, reject) => {
this.loading = true;
let params = {
current: this.page.currentPage,
size: this.page.pageSize,
...this.query,
}
let resData = await getApplContentList(params)
if (resData.data.code === 200) {
const {current, records, total, size} = resData.data.data
this.data = records;
this.page.total = total;
this.loading = false;
}
resolve()
})
},
}
}
</script>
<style scoped>