|
@@ -13,13 +13,13 @@
|
|
|
|
|
|
<el-form-item label="发布范围:" prop="city_arr_id" class="custom-align-right">
|
|
|
<el-cascader :key="cascaderKey" v-model="form.city_arr_id" placeholder="请选择发布范围" :props="cityData"
|
|
|
- filterable clearable></el-cascader>
|
|
|
+ filterable clearable @change="changeData"></el-cascader>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="行政职能:" prop="department_arr_id" class="custom-align-right">
|
|
|
<el-cascader :key="searchDepartmentKey" v-model="form.department_arr_id" placeholder="请选择行政职能"
|
|
|
- popper-class="my_cascader" :props="searchDepartmentData" filterable clearable></el-cascader>
|
|
|
+ popper-class="my_cascader" :props="searchDepartmentData" filterable clearable
|
|
|
+ @change="changeData"></el-cascader>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
<el-form-item label="行政人员:" prop="re_user_ids" class="custom-align-right">
|
|
|
<el-select v-model="form.re_user_ids" placeholder="请选择行政人员" multiple filterable clearable
|
|
|
@visible-change="getDUser">
|
|
@@ -148,6 +148,7 @@ export default {
|
|
|
searchCascaderKey: 0, //列表缓存key
|
|
|
website_id: 2,
|
|
|
file: '',
|
|
|
+ re_user_ids: [],
|
|
|
userType: 1, //用户类型 1:普通用户,
|
|
|
pickerOptions: {
|
|
|
selectableRange: '1900-01-01 to 2100-12-31', // 允许选择的日期范围
|
|
@@ -155,7 +156,7 @@ export default {
|
|
|
// return time.getTime() < Date.now() - 86400000; // 禁用今天之前的日期
|
|
|
// },
|
|
|
},
|
|
|
-
|
|
|
+ searchDepartmentKey: 0, //列表缓存key
|
|
|
//提交表单
|
|
|
form: {
|
|
|
//1.1使用了外链
|
|
@@ -180,7 +181,7 @@ export default {
|
|
|
city_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
department_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
re_user_ids: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
-
|
|
|
+ start: [{ required: true, trigger: 'blur', validator: validateNull }],
|
|
|
level: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
content: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
address: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
@@ -319,9 +320,13 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeData() {
|
|
|
+ this.form.re_user_ids = [];
|
|
|
+ this.getDUser();
|
|
|
+ },
|
|
|
//获取行政人员
|
|
|
getDUser() {
|
|
|
- this.$forceUpdate();
|
|
|
+ // this.form.re_user_ids = [];
|
|
|
let department_id = this.form.department_arr_id;
|
|
|
let city_id = this.form.city_arr_id;
|
|
|
if (department_id.length == 0) {
|
|
@@ -338,24 +343,7 @@ export default {
|
|
|
'department_id': department_id,
|
|
|
'city_id': city_id,
|
|
|
}
|
|
|
- //如果是编辑,就返回数据
|
|
|
- // if (this.$route.query.id != undefined) {
|
|
|
- // let ids = Array.isArray(this.form.re_user_ids) ? this.form.re_user_ids : JSON.parse(this.form.re_user_ids)
|
|
|
- // if (ids.length > 0) {
|
|
|
- // parames = {
|
|
|
- // 'ids': ids,
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // this.$message({
|
|
|
- // type: 'info',
|
|
|
- // message: '用户数据为空'
|
|
|
- // });
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
- // }
|
|
|
this.$store.dispatch('news/getDUser', parames).then(res => {
|
|
|
- // this.form.re_user_ids = res.data;
|
|
|
this.re_user_ids = res.data;
|
|
|
this.$forceUpdate();
|
|
|
}).catch(() => {
|
|
@@ -572,6 +560,7 @@ export default {
|
|
|
this.form.want = res.data.want;
|
|
|
this.form.start = res.data.start ? new Date(res.data.start) : null; // 处理时间格式
|
|
|
this.form.re_user_ids = Array.isArray(res.data.re_user_ids) ? res.data.re_user_ids : JSON.parse(res.data.re_user_ids);
|
|
|
+ this.getDUser();
|
|
|
})
|
|
|
},
|
|
|
async loadCascaderPath(path) {
|
|
@@ -608,48 +597,49 @@ export default {
|
|
|
//添加要修改的id
|
|
|
this.form.id = this.editId;
|
|
|
//先进行验证
|
|
|
-
|
|
|
this.$refs.form.validate(valid => {
|
|
|
-
|
|
|
if (valid) {
|
|
|
- if (this.form.start) {
|
|
|
- this.form.start = formatLocalDate(this.form.start);
|
|
|
+ // 拷贝对象form,处理另外的,并提交
|
|
|
+ const formData = { ...this.form };
|
|
|
+ if (formData.start) {
|
|
|
+ formData.start = formatLocalDate(formData.start);
|
|
|
}
|
|
|
- if (this.form.department_arr_id.length == 0) {
|
|
|
- this.form.department_id = 0;
|
|
|
+ if (formData.department_arr_id.length == 0) {
|
|
|
+ formData.department_id = 0;
|
|
|
}
|
|
|
- if (this.form.city_arr_id.length == 0) {
|
|
|
- this.form.city_id = 0;
|
|
|
+ if (formData.city_arr_id.length == 0) {
|
|
|
+ formData.city_id = 0;
|
|
|
}
|
|
|
- console.log(typeof this.form.city_arr_id, '---=-==-=')
|
|
|
- if (typeof this.form.city_arr_id == 'object') {
|
|
|
- this.form.city_id = this.form.city_arr_id.at(-1) || 0;
|
|
|
- this.form.city_arr_id = JSON.stringify(this.form.city_arr_id);
|
|
|
+ console.log(typeof formData.city_arr_id, '---=-==-=')
|
|
|
+ if (typeof formData.city_arr_id == 'object') {
|
|
|
+ formData.city_id = formData.city_arr_id.at(-1) || 0;
|
|
|
+ formData.city_arr_id = JSON.stringify(formData.city_arr_id);
|
|
|
}
|
|
|
- if (typeof this.form.department_arr_id == 'object') {
|
|
|
- this.form.department_id = this.form.department_arr_id.at(-1) || 0;
|
|
|
- this.form.department_arr_id = JSON.stringify(this.form.department_arr_id);
|
|
|
+ if (typeof formData.department_arr_id == 'object') {
|
|
|
+ formData.department_id = formData.department_arr_id.at(-1) || 0;
|
|
|
+ formData.department_arr_id = JSON.stringify(formData.department_arr_id);
|
|
|
}
|
|
|
//re_user_ids
|
|
|
- if (typeof this.form.re_user_ids == 'object') {
|
|
|
- this.form.re_user_ids = JSON.stringify(this.form.re_user_ids);
|
|
|
+ if (typeof formData.re_user_ids == 'object') {
|
|
|
+ formData.re_user_ids = JSON.stringify(formData.re_user_ids);
|
|
|
}
|
|
|
|
|
|
- delete this.form.cat_arr_id;
|
|
|
- delete this.form.time;
|
|
|
- delete this.form.catid;
|
|
|
- this.form.file = this.file;
|
|
|
- console.log(this.form, 'this.form-----------------')
|
|
|
+ delete formData.cat_arr_id;
|
|
|
+ delete formData.time;
|
|
|
+ delete formData.catid;
|
|
|
+ formData.file = this.file;
|
|
|
+ console.log(formData, 'formData-----------------')
|
|
|
|
|
|
if (this.userType == 10000) {
|
|
|
- this.form.status = 2
|
|
|
+ formData.status = 2
|
|
|
} else {
|
|
|
- this.form.status = 1
|
|
|
+ formData.status = 1
|
|
|
}
|
|
|
|
|
|
- this.$store.dispatch('news/updateComplaint', this.form).then(res => {
|
|
|
+ this.$store.dispatch('news/updateComplaint', formData).then(res => {
|
|
|
if (res.code != 200) {
|
|
|
this.$message.error("修改失败,请稍后再试!");
|
|
|
+ this.getMainData();
|
|
|
} else {
|
|
|
//汇报结果
|
|
|
this.$message({
|
|
@@ -683,19 +673,19 @@ export default {
|
|
|
|
|
|
},
|
|
|
watch: {
|
|
|
- //监听发布范围和行政职能的变化,获取行政人员
|
|
|
- 'form.city_arr_id': function (newVal, oldVal) {
|
|
|
- console.log(newVal, oldVal, 'newVal, oldVal')
|
|
|
- if (newVal.length > 0) {
|
|
|
- this.getDUser();
|
|
|
- }
|
|
|
- },
|
|
|
- 'form.department_arr_id': function (newVal, oldVal) {
|
|
|
- console.log(newVal, oldVal, 'newVal, oldVal')
|
|
|
- if (newVal.length > 0) {
|
|
|
- this.getDUser();
|
|
|
- }
|
|
|
- },
|
|
|
+ //监听发布范围和行政职能的变化,获取行政人员 ,
|
|
|
+ // 'form.city_arr_id': function (newVal, oldVal) {
|
|
|
+ // console.log(newVal, oldVal, 'newVal, oldVal', '到这里了-0---------1------------------')
|
|
|
+ // if (newVal.length > 0) {
|
|
|
+ // this.getDUser();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 'form.department_arr_id': function (newVal, oldVal) {
|
|
|
+ // console.log(newVal, oldVal, 'newVal, oldVal', '到这里了-0----------2-----------------')
|
|
|
+ // if (newVal.length > 0) {
|
|
|
+ // this.getDUser();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
'$route'(to, from) {
|
|
|
console.log(from, '---------------------------------------');
|
|
|
// 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
|
|
@@ -712,7 +702,8 @@ export default {
|
|
|
this.editStatus = true;
|
|
|
this.tableDivTitle = "编辑投诉举报";
|
|
|
console.log("编辑投诉举报")
|
|
|
- this.getMainData();
|
|
|
+ this.getMainData()
|
|
|
+
|
|
|
} else {
|
|
|
this.editStatus = false;
|
|
|
console.log("添加投诉举报!")
|
|
@@ -724,6 +715,7 @@ export default {
|
|
|
}
|
|
|
this.fetchWebsiteOptions();
|
|
|
this.getUserInfo();
|
|
|
+ console.log(this.isInitialized, '到了这里--------------')
|
|
|
// this.getDUser();
|
|
|
//复制内容到富文本 start ------------------------------------------------------------>
|
|
|
//复制富文本 end ------------------------------------------------------------>
|