|
@@ -55,6 +55,12 @@
|
|
:props="parentData_2" filterable clearable></el-cascader>
|
|
:props="parentData_2" filterable clearable></el-cascader>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-form-item label="行政区划:" class="custom-align-right" prop="city_arr_id">
|
|
|
|
+ <CityCascader v-model="form.city_arr_id" @update-city-id="update_city_arr_id"></CityCascader>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="行政职能:" class="custom-align-right" prop="department_arr_id">
|
|
|
|
+ <el-cascader :key="searchDepartmentKey" v-model="form.department_arr_id" placeholder="选择导航池所属行政区划" :props="searchDepartmentData" filterable clearable></el-cascader>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="推荐等级:" class="custom-align-right">
|
|
<el-form-item label="推荐等级:" class="custom-align-right">
|
|
<el-select v-model="form.level" clearable placeholder="请选择推荐等级..">
|
|
<el-select v-model="form.level" clearable placeholder="请选择推荐等级..">
|
|
<el-option label="头条" :value="1"></el-option>
|
|
<el-option label="头条" :value="1"></el-option>
|
|
@@ -166,6 +172,7 @@
|
|
<el-select v-model="form.status" placeholder="请选择..">
|
|
<el-select v-model="form.status" placeholder="请选择..">
|
|
<el-option label="已发布" :value="1"></el-option>
|
|
<el-option label="已发布" :value="1"></el-option>
|
|
<el-option label="待发布" :value="0"></el-option>
|
|
<el-option label="待发布" :value="0"></el-option>
|
|
|
|
+ <el-option label="已拒绝" :value="2"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="是否开启投票:" prop="is_survey" class="custom-align-right">
|
|
<el-form-item label="是否开启投票:" prop="is_survey" class="custom-align-right">
|
|
@@ -221,6 +228,8 @@ import { getWebSiteId, getUseType } from '@/utils/auth'
|
|
import tableTitle from './components/tableTitle';
|
|
import tableTitle from './components/tableTitle';
|
|
//引入公用样式
|
|
//引入公用样式
|
|
import '@/styles/global.less';
|
|
import '@/styles/global.less';
|
|
|
|
+//城市级联选择器
|
|
|
|
+import CityCascader from './components/CityCascader';
|
|
|
|
|
|
import { quillEditor } from 'vue-quill-editor';
|
|
import { quillEditor } from 'vue-quill-editor';
|
|
import 'quill/dist/quill.snow.css';
|
|
import 'quill/dist/quill.snow.css';
|
|
@@ -237,7 +246,8 @@ import 'quill/dist/quill.core.css';
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
quillEditor,
|
|
quillEditor,
|
|
- tableTitle
|
|
|
|
|
|
+ tableTitle,
|
|
|
|
+ CityCascader
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
|
|
|
|
@@ -284,12 +294,15 @@ export default {
|
|
user_type: "??",//判断用户类型'
|
|
user_type: "??",//判断用户类型'
|
|
cat_arr_id: 0,//导航池名称
|
|
cat_arr_id: 0,//导航池名称
|
|
nav_add_pool_id: [],//导航池子级
|
|
nav_add_pool_id: [],//导航池子级
|
|
|
|
+ city_arr_id: [],//行政区划
|
|
|
|
+ city_id:"",//区划最后一个数字
|
|
|
|
+ department_arr_id:[],//行政职能部门
|
|
|
|
+ department_id:"",//部门最后一个数字
|
|
//1.1使用了外链
|
|
//1.1使用了外链
|
|
title: '',//资讯标题
|
|
title: '',//资讯标题
|
|
islink: 0,//是否使用外链 0非 1是
|
|
islink: 0,//是否使用外链 0非 1是
|
|
linkurl: "",//外链地址
|
|
linkurl: "",//外链地址
|
|
//1.2没有使用外链
|
|
//1.2没有使用外链
|
|
- cat_arr_id: '',//导航池名称
|
|
|
|
level: "",//推荐等级
|
|
level: "",//推荐等级
|
|
imgurl: "",//缩略图
|
|
imgurl: "",//缩略图
|
|
keyword: "",//关键词
|
|
keyword: "",//关键词
|
|
@@ -323,6 +336,10 @@ export default {
|
|
keyword: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
keyword: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
//描述不能为空
|
|
//描述不能为空
|
|
introduce: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
introduce: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
|
+ //行政区划
|
|
|
|
+ city_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
|
+ //行政职能
|
|
|
|
+ department_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
//内容不能为空
|
|
//内容不能为空
|
|
content: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
content: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
//作者不能为空
|
|
//作者不能为空
|
|
@@ -418,7 +435,6 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
parentKey_2: 0,//获取父级导航
|
|
parentKey_2: 0,//获取父级导航
|
|
parentData_2: {
|
|
parentData_2: {
|
|
checkStrictly: true,
|
|
checkStrictly: true,
|
|
@@ -428,9 +444,7 @@ export default {
|
|
if (data && data.children && data.children.length !== 0) {
|
|
if (data && data.children && data.children.length !== 0) {
|
|
return resolve(node)
|
|
return resolve(node)
|
|
}
|
|
}
|
|
-
|
|
|
|
let parentId;
|
|
let parentId;
|
|
-
|
|
|
|
if (self.ifwebsitId == true) {
|
|
if (self.ifwebsitId == true) {
|
|
console.log("网站选择已经改变!")
|
|
console.log("网站选择已经改变!")
|
|
parentId = 0;
|
|
parentId = 0;
|
|
@@ -440,7 +454,6 @@ export default {
|
|
parentId = level == 0 ? 0 : data.value;
|
|
parentId = level == 0 ? 0 : data.value;
|
|
self.ifwebsitId = false;
|
|
self.ifwebsitId = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
console.log(123123)
|
|
console.log(123123)
|
|
console.log(self.form.web_site_id)
|
|
console.log(self.form.web_site_id)
|
|
// if(data!=undefined){
|
|
// if(data!=undefined){
|
|
@@ -448,14 +461,11 @@ export default {
|
|
// }else{
|
|
// }else{
|
|
// parentId = self.creatNews_pid_num.toString();
|
|
// parentId = self.creatNews_pid_num.toString();
|
|
// }
|
|
// }
|
|
-
|
|
|
|
let parames = {
|
|
let parames = {
|
|
'website_id': self.form.web_site_id,
|
|
'website_id': self.form.web_site_id,
|
|
'pid': parentId
|
|
'pid': parentId
|
|
}
|
|
}
|
|
-
|
|
|
|
self.$store.dispatch('pool/get_creatNews_nav_son_actions', parames).then(res => {
|
|
self.$store.dispatch('pool/get_creatNews_nav_son_actions', parames).then(res => {
|
|
-
|
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
const nodes = res.data.map(item => ({
|
|
const nodes = res.data.map(item => ({
|
|
value: item.category_id,
|
|
value: item.category_id,
|
|
@@ -468,6 +478,34 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ //行政职能部门
|
|
|
|
+ searchDepartmentKey:0, //列表缓存key
|
|
|
|
+ searchDepartmentData: {
|
|
|
|
+ checkStrictly: true,
|
|
|
|
+ lazy: true,
|
|
|
|
+ async lazyLoad (node, resolve) {
|
|
|
|
+ const { level, data } = node;
|
|
|
|
+ if (data && data.children && data.children.length !== 0) {
|
|
|
|
+ return resolve(node)
|
|
|
|
+ }
|
|
|
|
+ console.log(level)
|
|
|
|
+ let parentId = level == 0 ? 0 : data.value
|
|
|
|
+ let parames = {
|
|
|
|
+ 'pid':parentId
|
|
|
|
+ }
|
|
|
|
+ self.$store.dispatch('pool/getDepartment',parames).then(res=> {
|
|
|
|
+ if (res.data) {
|
|
|
|
+ const nodes = res.data.map(item => ({
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name,
|
|
|
|
+ leaf: level >= 3,
|
|
|
|
+ children: []
|
|
|
|
+ }))
|
|
|
|
+ resolve(nodes)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
|
|
inputList: [
|
|
inputList: [
|
|
{ value: '' }
|
|
{ value: '' }
|
|
@@ -476,8 +514,6 @@ export default {
|
|
};
|
|
};
|
|
|
|
|
|
},
|
|
},
|
|
-
|
|
|
|
-
|
|
|
|
methods: {
|
|
methods: {
|
|
//---------------------------
|
|
//---------------------------
|
|
addInput(index) {
|
|
addInput(index) {
|
|
@@ -531,7 +567,7 @@ export default {
|
|
},
|
|
},
|
|
//1.2 提交表单
|
|
//1.2 提交表单
|
|
addToServe() {
|
|
addToServe() {
|
|
-
|
|
|
|
|
|
+ //判断是否为外链
|
|
if (this.form.islink == false) {
|
|
if (this.form.islink == false) {
|
|
if (this.form.is_survey == 1) {
|
|
if (this.form.is_survey == 1) {
|
|
const hasEmptyInput = this.inputList.some(input => input.value === '');
|
|
const hasEmptyInput = this.inputList.some(input => input.value === '');
|
|
@@ -552,12 +588,6 @@ export default {
|
|
this.form.suvey_array = JSON.stringify(inputLists);
|
|
this.form.suvey_array = JSON.stringify(inputLists);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- // console.log('提交的数据:', this.inputList.map(input => input.value));
|
|
|
|
- // this.form.suvey_array
|
|
|
|
- // return false;
|
|
|
|
- //提交之前先判断是否为外链
|
|
|
|
- //如果使用了外链,清理掉除了外链以外的内容
|
|
|
|
if (this.form.islink == true) {
|
|
if (this.form.islink == true) {
|
|
this.form.islink = 1;
|
|
this.form.islink = 1;
|
|
this.cleatForm(1)
|
|
this.cleatForm(1)
|
|
@@ -568,6 +598,13 @@ export default {
|
|
if (this.form.level == "") {
|
|
if (this.form.level == "") {
|
|
this.form.level = 0;
|
|
this.form.level = 0;
|
|
}
|
|
}
|
|
|
|
+ //取出行政职能和行政区划数组的最后一个数字
|
|
|
|
+ this.form.department_id = this.form.department_arr_id[this.form.department_arr_id.length - 1];
|
|
|
|
+ this.form.city_id = this.form.city_arr_id[this.form.city_arr_id.length - 1];
|
|
|
|
+ //将department_id和city_id转换为字符串
|
|
|
|
+ this.form.department_arr_id = JSON.stringify(this.form.department_arr_id);
|
|
|
|
+ this.form.city_arr_id = JSON.stringify(this.form.city_arr_id);
|
|
|
|
+
|
|
//先进行验证
|
|
//先进行验证
|
|
this.$refs.form.validate(valid => {
|
|
this.$refs.form.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
@@ -633,6 +670,11 @@ export default {
|
|
this.form.status = "";
|
|
this.form.status = "";
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ //1.4更新详细地址
|
|
|
|
+ update_city_arr_id(value){
|
|
|
|
+ console.log("行政区划ID已更新:", value);
|
|
|
|
+ this.form.city_arr_id = value;
|
|
|
|
+ },
|
|
//提交表单 end ------------------------------------------------------------>
|
|
//提交表单 end ------------------------------------------------------------>
|
|
|
|
|
|
//2.跳转操作 start ------------------------------------------------------------>
|
|
//2.跳转操作 start ------------------------------------------------------------>
|
|
@@ -686,6 +728,11 @@ export default {
|
|
this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
|
|
this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
|
|
this.parentKey_2 += 1; // 触发级联选择器重新加载
|
|
this.parentKey_2 += 1; // 触发级联选择器重新加载
|
|
this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
|
|
this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
|
|
|
|
+ //回显行政区划
|
|
|
|
+ this.form.city_arr_id = JSON.parse(res.data.city_arr_id);
|
|
|
|
+ //回显行政职能
|
|
|
|
+ this.searchDepartmentKey += 1;
|
|
|
|
+ this.form.department_arr_id = JSON.parse(res.data.department_arr_id);
|
|
//回显其他数据
|
|
//回显其他数据
|
|
this.form.imgurl = res.data.imgurl;
|
|
this.form.imgurl = res.data.imgurl;
|
|
this.imgUrl = res.data.imgurl;
|
|
this.imgUrl = res.data.imgurl;
|
|
@@ -739,7 +786,6 @@ export default {
|
|
},
|
|
},
|
|
//1.3提交修改
|
|
//1.3提交修改
|
|
editToServe() {
|
|
editToServe() {
|
|
-
|
|
|
|
//不使用外联 验证投票逻辑
|
|
//不使用外联 验证投票逻辑
|
|
if (this.form.islink == false) {
|
|
if (this.form.islink == false) {
|
|
if (this.form.is_survey == 1) {
|
|
if (this.form.is_survey == 1) {
|
|
@@ -761,7 +807,6 @@ export default {
|
|
this.form.suvey_array = JSON.stringify(inputLists);
|
|
this.form.suvey_array = JSON.stringify(inputLists);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
console.log(this.form)
|
|
console.log(this.form)
|
|
if (this.form.islink == 1) {
|
|
if (this.form.islink == 1) {
|
|
this.cleatForm(1)
|
|
this.cleatForm(1)
|
|
@@ -770,6 +815,12 @@ export default {
|
|
if (this.form.level == "") {
|
|
if (this.form.level == "") {
|
|
this.form.level = 0;
|
|
this.form.level = 0;
|
|
}
|
|
}
|
|
|
|
+ //取出行政职能和行政区划数组的最后一个数字
|
|
|
|
+ this.form.department_id = this.form.department_arr_id[this.form.department_arr_id.length - 1];
|
|
|
|
+ this.form.city_id = this.form.city_arr_id[this.form.city_arr_id.length - 1];
|
|
|
|
+ //将department_id和city_id转换为字符串
|
|
|
|
+ this.form.department_arr_id = JSON.stringify(this.form.department_arr_id);
|
|
|
|
+ this.form.city_arr_id = JSON.stringify(this.form.city_arr_id);
|
|
//添加要修改的id
|
|
//添加要修改的id
|
|
this.form.id = this.editId;
|
|
this.form.id = this.editId;
|
|
//先进行验证
|
|
//先进行验证
|