<template>
	<el-tabs v-model="activeName" @tab-click="handleClick">
		<el-tab-pane label="用户消息" name="first">
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userName" label="用户名" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.userId)">
							{{scope.row.userName}}
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="title" label="标题">
				</el-table-column>	
				<el-table-column prop="content" label="内容">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="系统消息" name="firstJb">
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userName" label="接收用户" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.userId)">
							{{scope.row.userName}}
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="title" label="标题">
				</el-table-column>
				<el-table-column prop="content" label="内容">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="投诉消息" name="second">
			<!-- <span>投诉类型：</span>
			<el-select v-model="platform1" style="width:150px;margin-left: 10px;" @change="animeDat4(platform1)">
				<el-option v-for="item in platformList" :key="item.id" :label="item.name" :value="item.id">
				</el-option>
			</el-select>&nbsp;&nbsp;&nbsp; -->
			<el-table v-loading="tableDataLoading" :data="tableData.records">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userName" label="投诉用户" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.userId)">
							{{scope.row.userName}}
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="被投诉用户" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.byUserId)">
							{{scope.row.byUserName}}
						</div>
					</template>
				</el-table-column>
				<!-- <el-table-column prop="platform" label="投诉类型">
					<template slot-scope="scope">
						<div v-if="scope.row.platform==1">聊天投诉</div>
						<div v-if="scope.row.platform==2">用户投诉</div>
						<div v-if="scope.row.platform==3">动态投诉</div>
						<div v-if="scope.row.platform==4">服务投诉</div>
					</template>
				</el-table-column> -->
				<el-table-column prop="content.content" label="投诉内容">
				</el-table-column>
				<el-table-column prop="imgs" label="图片">
					<template slot-scope="scope">
						<div v-if="scope.row.content&&scope.row.content.imgs">
							<div v-for="(item,index) in scope.row.content.imgs.split(',')" :key="index"
								style="display: inline-block; margin: 3px;">
								<el-popover placement="top-start" title="" trigger="hover">
									<img style="width: 50px; height: 50px" :src="item" alt="" slot="reference">
									<img style="width: 300px; height: auto" :src="item" alt="">
								</el-popover>
							</div>
						</div>
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="状态">
					<template slot-scope="scope">
						<div v-if="scope.row.status==0">待审核</div>
						<div v-else>已审核</div>
					</template>
				</el-table-column>
				<el-table-column prop="status" label="处理结果">
					<template slot-scope="scope">
						<div v-if="scope.row.status==0">待处理</div>
						<div v-if="scope.row.status==1">不处理</div>
						<div v-if="scope.row.status==2">已封号</div>
						<div v-if="scope.row.status==3">已删除</div>
					</template>
				</el-table-column>
				<el-table-column prop="auditContent" label="审核内容">
				</el-table-column> -->
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<!-- <el-table-column label="操作">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" v-if="scope.row.status==0"
							@click="refuseClick(scope.row)">处理
						</el-button>
					</template>
				</el-table-column> -->
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1"
					:page-sizes="[10, 20, 30, 50, 100]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.total">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="简历投诉" name="secondJl">
			<el-table v-loading="tableDataLoading" :data="tableData.records">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userName" label="投诉用户" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.userId)">
							{{scope.row.userName}}
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="被投诉用户" width="160">
					<template slot-scope="scope">
						<div style="color: #0066CC;cursor: pointer;" @click="updataDetails(scope.row.byUserId)">
							{{scope.row.byUserName}}
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="content.content" label="投诉内容">
				</el-table-column>
				<el-table-column prop="imgs" label="图片">
					<template slot-scope="scope">
						<div v-if="scope.row.content&&scope.row.content.imgs">
							<div v-for="(item,index) in scope.row.content.imgs.split(',')" :key="index"
								style="display: inline-block; margin: 3px;">
								<el-popover placement="top-start" title="" trigger="hover">
									<img style="width: 50px; height: 50px" :src="item" alt="" slot="reference">
									<img style="width: 300px; height: auto" :src="item" alt="">
								</el-popover>
							</div>
						</div>
					</template>
				</el-table-column>
				<!-- <el-table-column prop="status" label="状态">
					<template slot-scope="scope">
						<div v-if="scope.row.status==0">待审核</div>
						<div v-else>已审核</div>
					</template>
				</el-table-column>
				<el-table-column prop="status" label="处理结果">
					<template slot-scope="scope">
						<div v-if="scope.row.status==0">待处理</div>
						<div v-if="scope.row.status==1">不处理</div>
						<div v-if="scope.row.status==2">已封号</div>
						<div v-if="scope.row.status==3">已删除</div>
					</template>
				</el-table-column>
				<el-table-column prop="auditContent" label="审核内容">
				</el-table-column> -->
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<!-- <el-table-column label="操作">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" v-if="scope.row.status==0"
							@click="refuseClick(scope.row)">处理
						</el-button>
					</template>
				</el-table-column> -->
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1"
					:page-sizes="[10, 20, 30, 50, 100]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.total">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="公告中心" name="gonggap">
			<div style="float: right;margin-right:2%;">
				<el-button style='margin: 10px 0;' :disabled="!isAuth('message:add')" size="mini" type="primary"
					icon="document" @click="addNotice()">添加</el-button>
			</div>
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="type" label="类型">
					<template slot-scope="scope">
						<span v-if="scope.row.type==1">个人</span>
						<span v-else-if="scope.row.type==2">企业</span>
					</template>
				</el-table-column>
				<el-table-column prop="title" label="标题">
				</el-table-column>
				<!-- <el-table-column prop="url" label="地址">
				</el-table-column> -->
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<el-table-column fixed='right' label="操作" width="100">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" :disabled="!isAuth('message:update')"
							@click="addNotice(scope.row)" style="margin: 5px;">
							修改
						</el-button>
						<el-button size="mini" type="danger" :disabled="!isAuth('message:delete')"
							@click="deleteNotice(scope.row)" style="margin: 5px;">
							删除
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="意见反馈" name="fourth">
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<!-- <el-table-column prop="userName" label="用户名称">
				 <template slot-scope="scope">
				 	<div>{{scope.row.userName?scope.row.userName:'未绑定'}}</div>
				 </template>
				</el-table-column> -->
				<el-table-column prop="title" label="消息标题">
				</el-table-column>
				<el-table-column prop="content" label="消息内容">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<!-- <el-table-column label="操作">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" @click="updataDetails(scope.row)">用户详情
						</el-button>
					</template>
				</el-table-column> -->
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="求职者常用短语" name="erMessage">
			<el-button style="margin:10px;" size="mini" type="primary" icon="document"
				:disabled="!isAuth('message:add')" @click="erMessageAdd(0)">添加
			</el-button>
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="title" label="消息标题">
				</el-table-column>
				<el-table-column prop="content" label="消息内容">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<el-table-column label="操作" prop="id" width="200" fixed='right' align="center">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" :disabled="!isAuth('positionList:update')" style="margin: 5px;"
							@click="erMessageAdd(1,scope.row)">修改
						</el-button>
						<el-button size="mini" type="danger" :disabled="!isAuth('positionList:delete')" style="margin: 5px;"
							@click="erMessageDelete(scope.row)">删除
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<el-tab-pane label="企业方常用短语" name="eeMessage">
			<el-button style="margin:10px;" size="mini" type="primary" icon="document"
				:disabled="!isAuth('message:add')" @click="eeMessageAdd(0)">添加
			</el-button>
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="title" label="消息标题">
				</el-table-column>
				<el-table-column prop="content" label="消息内容">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间" width="160">
				</el-table-column>
				<el-table-column label="操作" prop="id" width="200" fixed='right' align="center">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" :disabled="!isAuth('positionList:update')" style="margin: 5px;"
							@click="eeMessageAdd(1,scope.row)">修改
						</el-button>
						<el-button size="mini" type="danger" :disabled="!isAuth('positionList:delete')" style="margin: 5px;"
							@click="eeMessageDelete(scope.row)">删除
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div>
		</el-tab-pane>
		<!-- 添加、修改求职者常用短语 -->
		<el-dialog :title="titles" :visible.sync="dialogFormVisible9" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">消息内容：</span>
				<el-input style="width:50%;" v-model="content" type="text" placeholder="请输入消息内容"></el-input>
			</div>

			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible9 = false">取 消</el-button>
				<el-button type="primary" @click="addErMessage()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 添加、修改企业方常用短语 -->
		<el-dialog :title="titles" :visible.sync="dialogFormVisible10" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">消息内容：</span>
				<el-input style="width:50%;" v-model="content" type="text" placeholder="请输入消息内容"></el-input>
			</div>

			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible10 = false">取 消</el-button>
				<el-button type="primary" @click="addEeMessage()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- <el-tab-pane label="消息推送" name="seventh">
			<div style="float: right;margin-right:2%;">
				<el-button style='margin: 10px 0;' :disabled="!isAuth('message:push')" size="mini" type="primary"
					icon="document" @click="magNotice">消息推送</el-button>
			</div>
			<el-table v-loading="tableDataLoading" :data="tableData.list">
				<el-table-column fixed prop="id" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userName" label="用户名称">
				</el-table-column>
				<el-table-column prop="title" label="消息标题">
				</el-table-column>
				<el-table-column prop="content" label="消息内容" width="280">
				</el-table-column>
				<el-table-column prop="createAt" label="创建时间">
				</el-table-column>
				<el-table-column label="操作" width="120">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" @click="updataDetails(scope.row)">用户详情
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[5, 10, 15, 20]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
				</el-pagination>
			</div> -->
		<!-- 消息推送 -->
		<!-- <el-dialog title="消息推送" :visible.sync="dialogFormVisible2" center>
				<div style="margin-bottom: 10px;">
					<span style="width: 200px;display: inline-block;text-align: right;">选择：</span>
					<el-select v-model="flag" placeholder="请选择类型" style="width:50%" >
					  <el-option v-for="item in flags" :key="item.value" :label="item.label" :value="item.value">
					  </el-option>
					</el-select>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<div style="margin-bottom: 10px;" v-if="flag == 1">
					<span style="width: 200px;display: inline-block;text-align: right;">用户手机号：</span>
					<el-input style="width: 50%;" v-model="phone" placeholder="请输入用户手机号"></el-input>
				</div>
				<div style="margin-bottom: 10px;">
					<span style="width: 200px;display: inline-block;text-align: right;">消息标题：</span>
					<el-input style="width: 50%;" v-model="title" placeholder="请输入消息标题"></el-input>
				</div>
				<div style="margin-bottom: 10px;">
					<span style="width: 200px;display: inline-block;text-align: right;position: relative;top: -65px;">消息内容：</span>
					<el-input style="width: 50%;" type="textarea" rows="4" v-model="content" placeholder="请输入消息内容"></el-input>
				</div>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogFormVisible2 = false">取 消</el-button>
					<el-button type="primary" @click="magNoticeTo()">确 定</el-button>
				</div>
			</el-dialog>
		</el-tab-pane> -->
		<el-dialog title="投诉处理" :visible.sync="dialogFormVisible" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">审核结果：</span>
				<el-radio-group v-model="radio">
					<el-radio :label="0">通过</el-radio>
					<el-radio :label="1">驳回</el-radio>
				</el-radio-group>
			</div>
			<div style="margin-bottom: 10px;" v-if="radio===1">
				<span
					style="width: 200px;display: inline-block;text-align: right;position: relative;top: -70px;">驳回理由：</span>
				<el-input style="width:50%;" v-model="content" type="textarea" :rows="4" placeholder="请输入驳回理由">
				</el-input>
			</div>
			<div style="margin-bottom: 10px;" v-if="radio===0">
				<span style="width: 200px;display: inline-block;text-align: right;">处理结果：</span>
				<el-radio-group v-model="clStatus">
					<el-radio :label="0">封号</el-radio>
					<el-radio :label="1" v-if="platform==3||platform==4">删除</el-radio>
				</el-radio-group>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible = false">取 消</el-button>
				<el-button type="primary" @click="refuseto()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 添加/修改公告 -->
		<el-dialog :title="titles" :visible.sync="dialogFormVisible1" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">类型：</span>
				<el-radio-group v-model="type">
					<el-radio :label="1">个人</el-radio>
					<el-radio :label="2">企业</el-radio>
				</el-radio-group>
			</div>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">标题：</span>
				<el-input style="width:50%;" v-model="titleMsg" placeholder="请输入标题">
				</el-input>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible1 = false">取 消</el-button>
				<el-button type="primary" @click="refusetoGg()">确 定</el-button>
			</div>
		</el-dialog>
	</el-tabs>
</template>

<script>
	export default {
		data() {
			return {
				limit: 10,
				page: 1,
				state: 5,
				url: '',
				title: '',
				type: 1,
				id: '',
				form: {
					id: '',
					title: '',
					url: '',
					type: '',
					state: '',
					types: [{
							value: 'word',
							label: '文字'
						},
						{
							value: 'url',
							label: '链接'
						}
					],
				},
				phone: '',
				content: '',
				flag: '',
				flags: [{
						value: 1,
						label: '单个用户'
					},
					{
						value: 2,
						label: '全部用户'
					}
				],
				formLabelWidth: '200px',
				activeName: 'first',
				tableDataLoading: false,
				dialogFormVisible1: false,
				dialogFormVisible2: false,
				dialogFormVisible: false,
				dialogFormVisible9: false,
				dialogFormVisible10: false,
				tableData: [],
				radio: '',
				clStatus: '',
				messageId: '',
				platform: '',
				platform1: '',
				platformList: [{
						id: '',
						name: '全部'
					},
					{
						id: 1,
						name: '聊天投诉'
					},
					{
						id: 2,
						name: '用户投诉'
					},
					{
						id: 3,
						name: '动态投诉'
					},
					{
						id: 4,
						name: '服务投诉'
					}
				],
				titles: '添加',
				titleMsg: '',
				urlMsg: '',
				idMsg: '',
			}
		},
		methods: {
			// 详情跳转
			updataDetails(userId) {
				if (userId) {
					this.$router.push({
						path: '/userDetail',
						query: {
							userId: userId
						}
					});
				} else {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '当前用户未绑定',
						type: 'warning'
					});
				}

			},
			handleSizeChange(val) {
				this.limit = val;
				this.dataSelect()
			},
			handleCurrentChange(val) {
				this.page = val;
				this.dataSelect()
			},
			handleSizeChange1(val) {
				this.limit = val;
				this.dataSelect1()
			},
			handleCurrentChange1(val) {
				this.page = val;
				this.dataSelect1()
			},
			handleClick(tab, event) {
				if (tab._props.label == '意见反馈') {
					this.page = 1
					this.limit = 10
					this.state = 2
					this.dataSelect()
				}
				if (tab._props.label == '用户消息') {
					this.page = 1
					this.limit = 10
					this.state = 5
					this.dataSelect()
				}
				if (tab._props.label == '系统消息') {
					this.page = 1
					this.limit = 10
					this.state = 4
					this.dataSelect()
				}

				if (tab._props.label == '消息推送') {
					this.page = 1
					this.limit = 10
					this.state = 8
					this.dataSelect()
				}
				if (tab._props.label == '投诉消息') {
					this.page = 1
					this.limit = 10
					this.state = 3
					this.platform1 = 1
					this.dataSelect1()
				}
				if (tab._props.label == '公告中心') {
					this.page = 1
					this.limit = 10
					this.state = 1
					this.dataSelect()
				}
				if (tab._props.label == '简历投诉') {
					this.page = 1
					this.limit = 10
					this.state = 6
					this.platform1 = 1
					this.dataSelect1()
				}
				if (tab._props.label == '求职者常用短语') {
					this.page = 1
					this.limit = 10
					this.state = 70
					this.platform1 = 1
					this.dataSelect2()
				}
				if (tab._props.label == '企业方常用短语') {
					this.page = 1
					this.limit = 10
					this.state = 80
					this.platform1 = 1
					this.dataSelect2()
				}
			},
			// 消息推送
			magNotice() {
				this.dialogFormVisible2 = true
			},
			// 消息推送
			magNoticeTo() {
				if (this.flag == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请选择类型',
						type: 'warning'
					});
					return
				}
				if (this.title == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入标题',
						type: 'warning'
					});
					return
				}
				if (this.content == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入内容',
						type: 'warning'
					});
					return
				}
				if (this.flag == 1) {
					if (this.phone == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入用户手机号',
							type: 'warning'
						});
						return
					}
					this.$http({
						url: this.$http.adornUrl('/cash/sendMsg'),
						method: 'get',
						params: this.$http.adornParams({
							'title': this.title,
							'content': this.content,
							'phone': this.phone,
							'flag': this.flag
						})
					}).then(({
						data
					}) => {
						this.dialogFormVisible2 = false
						if (data.code == -100) {
							this.$message({
								message: data.msg,
								type: 'error',
								duration: 1500,
								onClose: () => {
									this.title = ''
									this.content = ''
									this.phone = ''
									this.flag = ''
									this.dataSelect()
								}
							})
						}
						if (data.code == 0) {
							this.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.title = ''
									this.content = ''
									this.phone = ''
									this.flag = ''
									this.dataSelect()
								}
							})
						}
					})
				}
				if (this.flag == 2) {
					this.$http({
						url: this.$http.adornUrl('/cash/sendMsg'),
						method: 'get',
						params: this.$http.adornParams({
							'title': this.title,
							'content': this.content,
							'flag': this.flag,
						})
					}).then(({
						data
					}) => {
						this.dialogFormVisible2 = false
						if (data.code == 0) {
							this.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.title = ''
									this.content = ''
									this.flag = ''
									this.dataSelect()
								}
							})
						}
					})
				}
			},
			// 获取数据列表
			dataSelect() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl(`message/page/${this.state}/${this.page}/${this.limit}`),
					method: 'get',
					params: this.$http.adornParams({})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					if (this.state == 2||this.state == 6) {
						for (var i in data.data.list) {
							if (data.data.list[i].content) {
								var a = data.data.list[i].content.toString()
								var b = JSON.parse(a)
								data.data.list[i].content = b.content
								console.log('key', b.content)
							}

						}
					}

					let returnData = data.data;
					this.tableData = returnData

				})
			},
			// 获取数据列表
			dataSelect1() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl(`message/selectComplaintByType`),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'state': this.state,
						// 'type': this.platform1
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					if (this.state == 3||this.state == 6) {
						for (var i in data.data.records) {
							var a = data.data.records[i].content.toString()
							var b = JSON.parse(a)
							data.data.records[i].content = b
							console.log('key', data.data.records[i].content)
						}
					}
					// for (var i in data.data.records) {
					// 	if (data.data.records[i].imgs) {
					// 		data.data.records[i].imgs = data.data.list[i].imgs.split(',')
					// 	}

					// }

					let returnData = data.data;
					this.tableData = returnData

				})
			},
			// 获取求职者常用短语
			dataSelect2() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl(`message/selectMessageByType`),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'state': this.state,
						// 'type': this.platform1
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					if (this.state == 70) {
						for (var i in data.data.records) {
							var a = data.data.records[i].content.toString()
							var b = JSON.parse(a)
							data.data.records[i].content = b
							console.log('key', data.data.records[i].content)
						}
					}

					let returnData = data.data;
					this.tableData = returnData

				})
			},
			// 添加/修改企业方常用短语
			eeMessageAdd(index, row) {  // index 0 添加,1 修改
				this.title = '企业方常用短语'
				this.state = 80
				if (index==1) {
					this.id = row.id
					this.titles = '修改常用短语'
					this.content = row.content
				} else {
					this.titles = '添加常用短语'
					this.id = ''
					this.content = ''
				}
				this.dialogFormVisible10 = true

			},
			// 提交修改、添加企业方常用短语
			addEeMessage() {

				if (this.content == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入消息内容',
						type: 'warning'
					})
					return
				}
				if (this.content.indexOf('【')!=-1 && this.content.indexOf('】')==-1
					|| this.content.indexOf('【')==-1 && this.content.indexOf('】')!=-1) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入正确的消息内容格式，包含【】',
						type: 'warning'
					})
					return
				}

				if (this.titles == '添加常用短语') {
					var urls = 'message/add'
				} else {
					var urls = 'message/update'
				}
				this.$http({
					url: this.$http.adornUrl(urls),
					method: 'post',
					data : this.$http.adornParams({
						'id': this.id,
						'content': this.content,
						'state': 80,
						'title': this.title
					})
				}).then(({
					data
				}) => {
					if(data.code==0){
						this.dialogFormVisible10 = false
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect2()
							}
						})
					}else{
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {
							}
						})
					}

				})
			},
			// 删除分类
			eeMessageDelete(row) {
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`message/delete/${row.id}`),
						method: 'get',
					}).then(({
						data
					}) => {
						if(data.code==0){
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect2()
								}
							})
						}else{
							this.$message({
								message: data.msg,
								type: 'warning',
								duration: 1500,
								onClose: () => {
								}
							})
						}

					})
				}).catch(() => {})
			},
			// 添加/修改求职者常用短语
			erMessageAdd(index, row) {  // index 0 添加,1 修改
				this.title = '求职者常用短语'
				this.state = 70
				if (index==1) {
					this.id = row.id
					this.titles = '修改常用短语'
					this.content = row.content
				} else {
					this.titles = '添加常用短语'
					this.id = ''
					this.content = ''
				}
				this.dialogFormVisible9 = true

			},
						// 提交修改、添加服务分类
			addErMessage() {

				if (this.content == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入消息内容',
						type: 'warning'
					})
					return
				}

				if (this.titles == '添加常用短语') {
					var urls = 'message/add'
				} else {
					var urls = 'message/update'
				}
				this.$http({
					url: this.$http.adornUrl(urls),
					method: 'post',
					data : this.$http.adornParams({
						'id': this.id,
						'content': this.content,
						'state': 70,
						'title': this.title
					})
				}).then(({
					data
				}) => {
					if(data.code==0){
						this.dialogFormVisible9 = false
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect2()
							}
						})
					}else{
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {
							}
						})
					}

				})
			},
			// 删除求职者常用短语
			erMessageDelete(row) {
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`message/delete/${row.id}`),
						method: 'get',
						// params: this.$http.adornParams({
						// 	'postPreferenceId': row.postPreferenceId
						// })
					}).then(({
						data
					}) => {
						if(data.code==0){
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect2()
								}
							})
						}else{
							this.$message({
								message: data.msg,
								type: 'warning',
								duration: 1500,
								onClose: () => {
								}
							})
						}

					})
				}).catch(() => {})
			},
			//审核弹框
			refuseClick(rows) {
				this.radio = ''
				this.clStatus = ''
				this.content = ''
				this.messageId = rows.id
				this.platform = rows.platform
				this.dialogFormVisible = true
			},
			//提交审核
			refuseto() {
				if (this.radio === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请选择审核结果',
						type: 'warning'
					});
					return
				}
				if (this.radio === 1) {
					if (this.content == '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请输入拒绝理由',
							type: 'warning'
						});
						return
					}
				}
				if (this.radio === 0) {
					if (this.clStatus === '') {
						this.$notify({
							title: '提示',
							duration: 1800,
							message: '请选择处理结果',
							type: 'warning'
						});
						return
					}
				}
				var status = ''
				if (this.radio === 1) {
					status = 1
				} else {
					if (this.clStatus === 0) {
						status = 2
					}
					if (this.clStatus === 1) {
						status = 3
					}
				}

				this.$http({
					url: this.$http.adornUrl('message/auditMessage'),
					method: 'post',
					params: this.$http.adornParams({
						'messageId': this.messageId,
						'status': status,
						'auditContent': this.content
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.dialogFormVisible = false
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.content = ''
								this.status = -1
								this.dataSelect1()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
					}

				})
			},
			animeDat4() {
				this.dataSelect1()
			},
			// 添加公告
			addNotice(row) {
				if (row) {
					this.titles = '修改',
						this.titleMsg = row.title
					this.urlMsg = row.url
					this.idMsg = row.id
					this.type = Number(row.type)
				} else {
					this.titles = '添加',
						this.titleMsg = ''
					this.urlMsg = ''
					this.idMsg = ''
					this.type = 1
				}
				this.dialogFormVisible1 = true
			},
			refusetoGg() {

				if (this.titleMsg == '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '请输入标题',
						type: 'warning'
					});
					return
				}
				// if (this.urlMsg === '') {
				// 	this.$notify({
				// 		title: '提示',
				// 		duration: 1800,
				// 		message: '请输入地址',
				// 		type: 'warning'
				// 	});
				// 	return
				// }
				var url = ''
				if (this.titles == '添加') {
					url = 'message/insertMessage'
				} else {
					url = 'message/updateMessage'
				}

				this.$http({
					url: this.$http.adornUrl(url),
					method: 'post',
					data: this.$http.adornData({
						'title': this.titleMsg,
						'url': this.urlMsg,
						'type': this.type,
						'id': this.idMsg,
						'state': 1
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.dialogFormVisible1 = false
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
					}

				})
			},
			deleteNotice(row) {
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl('message/deleteMessageById'),
						method: 'post',
						params: this.$http.adornParams({
							'id': row.id
						})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'error',
								duration: 1500,
								onClose: () => {}
							})
						}
					})
				}).catch(() => {})
			}
		},
		mounted() {
			this.dataSelect()
		}
	};
</script>

<style>

</style>