-
+
-
-
-
-
-
-
-
-
-
- *计划状态:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 附件:
-
-
-
- 点击上传
-
-
-
-
-
-
-
-
-
-
-
-
- 责任科室:
-
-
-
- 部门
-
-
-
-
-
-
-
-
-
-
-
-
全选
-
-
-
- {{dept.name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 组别:{{item.name=mission_plan_groups_name[index]}}
-
-
-
{return getSelectedgroupValue(e,item)}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -349,12 +100,10 @@
import {
Message
} from 'element-ui'
- import {
- getparameteritem
- } from "@/api/system/dictionary.js";
import {
save,
- get,del
+ get,
+ del
} from "@/api/task/plan.js";
import {
listdept
@@ -364,426 +113,209 @@
} from "@/api/common.js"
import {
getToken
- } from '@/utils/auth'
-import elSelectTree from '@/components/selectTree'
+ } from '@/utils/auth'
+ import {
+ contactUser,
+ sortDepartment
+ } from '../js/index.js'
export default {
- components: {
- elSelectTree
+ components: {
+
},
data() {
return {
isShow: false,
type: 'add',
- id: '',
- plan_type:1,
- department_id:'',
+ id: '',
+ department_id: '',
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
pictureList: [],
deptOptions: [],
- checkAll: false,
- isIndeterminate: true,
- checkAllMonth: false,
- isIndeterminateMonth: true,
- userdata: [],
- userdatabefore:[],
- valueMultiple:[],
- valueArr:[],
- filterMethod(query, item) {
- return item.name.indexOf(query) > -1;
- },
- planTypeList: [],
- statusList:[{
- id:0,
- value:'未完成'
- },{
- id:1,
- value:'未开展'
- },{
- id:2,
- value:'开展中'
- },{
- id:3,
- value:'已完成'
- }],
- form: {
- menu:'',
- level:'',
- out_line_content:'',
- name: '',
- year:'',
- status:1,
-
-
-
- // end_date: '',
- // count:'',
- lefts:'',
- name7: 2,
- // months_list:[],
- file_ids: '',
+ userdata: [],
+ userOptions: [],
+ checkAllMonth: false,
+ isIndeterminateMonth: true,
+ form: {
+ lefts: '',
+ rights: '',
+ name: '',
content: '',
- accept_admin_ids: [],
- accept_department_ids: [],
- mission_plan_groups: [],
- plan_type:'',
- type: '',
- start_date: [],
- },
- monthsArr:['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
- table:[{
- label: "月份",
- prop: 'month',
- width: 220,
- align:'center',
- customFn:(row)=>{
- return(
- {
- this.monthsArr.map(item=>{
- return(
- )
- })
- }
- row.list.push({'content':''}),
- }
- }>新增内容
- )
- }
- },{
- label: "内容",
- prop: 'list',
- align:'left',
- customFn:(row)=>{
- return(
- {
- row.list.map((item,index)=>{
- return(
{index+1}、{item.content}
- row.list.splice(index,1),
- }
- } >删除
-
)
- })
- }
-
-
)
- }
- }],
- mission_plan_groups_list: [{
- name: '',
- type: 1,
- link_id: []
- }],
- mission_plan_groups_name: ['一组', '二组', '三组', '四组', '五组', '六组', '七组', '八组', '九组', '十组'],
-
+ file_ids: '',
+ start_date: [],
+ main_department_id: '',
+ main_admin_id: '',
+ menu: '',
+ level: '',
+ menu_id: '',
+ level_id: '',
+ out_line_id: '',
+ out_line_content: '',
+ year: '',
+ status: 2,
+ },
+ monthsArr: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
rules: {
name: [{
required: true,
message: '请输入计划名称'
- }],
- status: [{
- required: true,
- message: '请选择计划状态'
- }],
- year: [{
- required: true,
- message: '请选择计划年份'
}],
start_date: [{
required: true,
- message: '请选择开始时间'
- }],
- // end_date: [{
- // required: true,
- // message: '请选择结束时间'
- // }],
- // type: [{
- // required: true,
- // message: '请选择任务类型'
- // }]
+ message: '请选择月份'
+ }],
+ main_admin_id: [{
+ required: true,
+ message: '请选择责任人'
+ }]
}
}
},
created() {
- this.uploadOther.token = getToken();
- this.getPlanList()
+ this.uploadOther.token = getToken();
this.loadDeptOptions()
this.loadUser()
},
- methods: {
- async getPlanList(){
- const res = await getparameteritem('planType')
- this.planTypeList = res.detail
- },
- setMenuLevel(menu,level,outLineId,out_line_content,content){
- this.form.menu = menu?menu:''
- this.form.level = level?level:''
- this.form.out_line_id = outLineId?outLineId:''
- this.form.out_line_content = out_line_content?out_line_content:''
- this.form.content = content?content:''
- },
- changeType(e){
- console.log("e",e)
- if(e){
- this.form.type = e
- }else{
- this.form.type=[]
- }
+ methods: {
+ setMenuLevel(row) {
+ this.form.menu = row.menu ? row.menu : ''
+ this.form.level = row.level ? row.level : ''
+ this.form.menu_id = row.menu_id ? row.menu_id : ''
+ this.form.level_id = row.level_id ? row.level_id : ''
+ this.form.out_line_id = row.id ? row.id : ''
+ this.form.out_line_content = row.out_line_content ? row.out_line_content : ''
+ this.form.name = row.content ? row.content : '',
+ this.form.content = row.flow ? row.flow : '',
+ this.form.year = row.year ? row.year : new Date().getFullYear()
},
- changeName7(e) {
+ // 选择科室
+ changeDeptOptions(e) {
+ console.log("e",this.userdata)
if (e) {
- this.form.accept_department_ids = []
- this.form.accept_admin_ids = []
- this.form.mission_plan_groups = []
- this.mission_plan_groups_list = []
- this.valueArr = []
- this.valueMultiple = []
- this.$forceUpdate()
+ this.form.main_admin_id = ''
+ this.userdata.map(item => {
+ if (item.department_id === e) {
+ this.userOptions = item.children
+ this.form.main_admin_id = item.manager_id
+ console.log("item.manager_id",item.manager_id)
+ }
+ })
}
- },
- // 选择科室
- loadDeptOptions() {
- listdept().
- then((res) => {
- for (var m of res) {
- m.checked = false;
- }
- this.deptOptions = res;
- }).catch(error => {
- console.log(error)
- reject(error)
- })
- },
+ },
+ loadDeptOptions() {
+ listdept().
+ then((res) => {
+ for (var m of res) {
+ m.checked = false;
+ }
+ this.deptOptions = res;
+ }).catch(error => {
+ console.log(error)
+ reject(error)
+ })
+ },
loadUser() {
listCommonuser({
page_size: 999,
}).
- then((res) => {
- // this.userdata = res.data ? res.data.reverse() : [];
- let data = res.data ? res.data.reverse() : [];
- this.userdatabefore = res.data ? res.data : [];
- let contactData = this.contactUser(data)
- this.userdata = this.sortDepartment(contactData,'department_id')
- console.log("this.userdata",this.userdata)
+ then((res) => {
+ let data = res.data ? res.data.reverse() : [];
+ let contactData = contactUser(data)
+ this.userdata = sortDepartment(contactData, 'department_id')
}).catch(error => {
console.log(error)
})
- },
- getSelectedValue (value) {
- console.log('选中的结果值', value)
-
- if(value.length>0){
- this.form.accept_admin_ids = []
- value.map(item=>{
- this.form.accept_admin_ids.push(item.id)
- })
- }else{
- this.form.accept_admin_ids = []
- }
- },
- getSelectedgroupValue (value,item) {
- console.log('选中的结果值', value,item)
- if(value.length>0){
- item.link_id = []
- value.map(item1=>{
- item.link_id.push(item1.id)
- })
- }else{
- item.link_id = []
- }
- },
- contactUser(arr) {
- let tempArr = [],
- newArr = []
- for (let i = 0; i < arr.length; i++) {
- if (tempArr.indexOf(arr[i].department_id) === -1) {
- newArr.push({
- department_id: arr[i].department_id,
- name: arr[i]['department']['name'],
- children: [arr[i]]
- })
- tempArr.push(arr[i].department_id);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].department_id == arr[i].department_id) {
- newArr[j].children.push(arr[i])
- }
- }
- }
- }
- return newArr
- },
- sortDepartment(arr,key){
- return arr.sort(function(a,b){
- var x = a[key]
- var y = b[key]
- return ((x
y)?1:0)
- })
- },
- handleCheckAllChange(val) {
- let options = [];
- for (var m of this.deptOptions) {
- options.push(m.id);
- }
- this.form.accept_department_ids = val ? options : [];
- this.isIndeterminate = false;
- },
- handleCheckedDeptSingleChange(v) {
- //如果出现取消的操作 就要执行删除
- console.log(v);
- var that = this;
- if (this.form.accept_department_ids)
- that.delDeptItem();
-
- },
- //删除操作
- delDeptItem() {
- for (var m of this.deptOptions) {
- if (this.form.accept_department_ids.indexOf(m.id) == -1) {
- var d = this.form.accept_department_ids.filter(function(t) {
- return t.department_id == m.id;
- })
-
- if (d.length != 0) {
- delDep(d[0].id).then(response => {}).catch(error => {
- console.log(error)
- })
- }
-
- }
- }
- },
- handleCheckedDeptChange(value) {
- let checkedCount = value.length;
- this.checkAll = checkedCount === this.deptOptions.length;
- this.isIndeterminate = checkedCount > 0 && checkedCount < this.deptOptions.length;
- },
- handleCheckAllChangeMonth(val) {
- let options = [];
- for (var m of this.monthsArr) {
- options.push(m);
- }
- this.form.start_date = val ? options : [];
- this.isIndeterminateMonth = false;
- },
- handleCheckedDeptSingleChangeMonth(v) {
- //如果出现取消的操作 就要执行删除
- console.log(v);
- var that = this;
- if (this.form.start_date)
- that.delDeptItemMonth();
-
- },
- //删除操作
- delDeptItemMonth() {
- for (var m of this.monthsArr) {
- if (this.form.start_date.indexOf(m) == -1) {
- var d = this.form.start_date.filter(function(t) {
- return t == m;
- })
-
- if (d.length != 0) {
- delDep(d[0].id).then(response => {}).catch(error => {
- console.log(error)
- })
- }
-
- }
- }
- },
- handleCheckedDeptChangeMonth(value) {
- let checkedCount = value.length;
- this.checkAllMonth = checkedCount === this.monthsArr.length;
- this.isIndeterminateMonth = checkedCount > 0 && checkedCount < this.monthsArr.length;
},
- async getDetail() {
- const res = await get(this.id)
- this.form = {
- menu:res?.menu,
- level:res?.level,
- out_line_content:res?.out_line_content,
- name: res?.name,
- year:res.year?res.year:new Date().getFullYear(),
- status:res.status?res.status:1,
-
- // end_date: res?.end_date,
-
- lefts:'',
- name7: res.accept_department.length > 0 ? 2 : (res.accept_admin.length > 0 ? 1 : (res
- .groups.length > 0 ? 3 : 2)),
- // months_list:[],
+ handleCheckAllChangeMonth(val) {
+ let options = [];
+ for (var m of this.monthsArr) {
+ options.push(m);
+ }
+ this.form.start_date = val ? options : [];
+ this.isIndeterminateMonth = false;
+ },
+ handleCheckedDeptSingleChangeMonth(v) {
+ //如果出现取消的操作 就要执行删除
+ console.log(v);
+ var that = this;
+ if (this.form.start_date)
+ that.delDeptItemMonth();
+
+ },
+ //删除操作
+ delDeptItemMonth() {
+ for (var m of this.monthsArr) {
+ if (this.form.start_date.indexOf(m) == -1) {
+ var d = this.form.start_date.filter(function(t) {
+ return t == m;
+ })
+
+ if (d.length != 0) {
+ delDep(d[0].id).then(response => {}).catch(error => {
+ console.log(error)
+ })
+ }
+
+ }
+ }
+ },
+ handleCheckedDeptChangeMonth(value) {
+ let checkedCount = value.length;
+ this.checkAllMonth = checkedCount === this.monthsArr.length;
+ this.isIndeterminateMonth = checkedCount > 0 && checkedCount < this.monthsArr.length;
+ },
+ handleRemove(file, fileList) {
+ this.pictureList = fileList
+ },
+ handlesuccess(response, file, fileList) {
+ this.pictureList = fileList
+ },
+ async getDetail() {
+ const res = await get(this.id)
+ let that = this
+ this.form = {
+ lefts: '',
+ rights: '',
+ menu: res?.menu,
+ level: res?.level,
+ menu_id: res?.menu_id,
+ level_id: res?.level_id,
+ out_line_id: res?.out_line_id,
+ out_line_content: res?.out_line_content,
+ name: res?.name,
+ year: res.year ? res.year : new Date().getFullYear(),
+ status: res.status ? res.status : 2,
file_ids: res?.file_ids,
content: res?.content,
- accept_admin_ids: res?.accept_admin_ids,
- accept_department_ids: res?.accept_department_ids,
-
- plan_type:res?.plan_type,
- type: res?.type,
- start_date: res.start_date?res.start_date:[],
- }
- this.valueMultiple=[]
- this.valueArr=[]
- this.userdatabefore.map(item=>{
- res.accept_admin_ids.map(item1=>{
- if(item.id==item1){
- this.valueMultiple.push(item)
- }
- })
- })
- this.valueArr = res.accept_admin_ids
- console.log("this.valueMultiple",this.valueMultiple)
- this.$forceUpdate()
- this.mission_plan_groups_list = []
- let group_list = this.contactGroup(res.groups)
-
- for (var g of group_list) {
- let admin_arr = {}
- admin_arr = {
- name: g.name,
- type: 1,
- link_id: [],
- link_id_dep:[],
- valueArr:[],
- valueMultiple:[]
- }
- if(g.admin_details.length>0){
- for(var a of g.admin_details){
- admin_arr.link_id.push(a.id)
- admin_arr.valueArr.push(a.id)
- admin_arr.valueMultiple.push(a)
- }
- }
- if(g.dep_details.length>0){
- for(var d of g.dep_details){
- admin_arr.link_id_dep.push(d.id)
- }
- }
- this.mission_plan_groups_list.push(admin_arr)
- // else{
- // this.mission_plan_groups_list.push({
- // name: g.name,
- // type: g.type,
- // link_id: g.link_id
- // })
- // }
- }
-
+ start_date: res.start_date ? res.start_date : [],
+ main_department_id: res?.main_department_id,
+ main_admin_id: res?.main_admin_id
+ }
for (var f of res.files) {
this.pictureList.push({
id: f.id,
url: f.url,
name: f.original_name
})
+ }
+ // 责任部门 责任人
+ if(res.main_department_id){
+ this.userdata.map(item=>{
+ if(item.department_id==res.main_department_id){
+ this.userOptions = item.children
+ setTimeout(function(){
+ that.form.main_admin_id = res?.main_admin_id
+ console.log("this.form.main_admin_id",that.form.main_admin_id)
+ },1000)
+ }
+ })
}
- },
- clickSubmit(){
- this.$refs.dialog.submit()
+ },
+ clickSubmit() {
+ this.$refs.dialog.submit()
},
submit() {
let _files = []
@@ -798,45 +330,10 @@ import elSelectTree from '@/components/selectTree'
this.form.file_ids = _files
} else {
this.form.file_ids = []
- }
-
- if (this.form.name7 == 3) {
- if (this.mission_plan_groups_list.length == 0) {
- Message({
- type: 'warning',
- message: `请新增组别`
- })
- return
- }
- let arr = []
- for (var k of this.mission_plan_groups_list) {
- if (k.link_id.length == 0&&k.link_id_dep.length == 0) {
- Message({
- type: 'warning',
- message: `请选择${k.name}成员`
- })
- return
- }else{
- if(k.link_id_dep.length > 0 ){
- arr.push({
- name:k.name,
- type:2,
- link_id:k.link_id_dep
- })
- }else{
-
- }
- arr.push(k)
- }
- }
- console.log("this.mission_plan_groups_list",arr,this.mission_plan_groups_list)
- // return
- this.form.mission_plan_groups = arr
-
- }
- // this.$refs.dialog.submit()
- // return
- console.log("form",this.form)
+ }
+ // this.$refs.dialog.submit()
+ // return
+ console.log("form", this.form)
// return
if (this.type === 'add') {
save({
@@ -865,62 +362,19 @@ import elSelectTree from '@/components/selectTree'
})
}
},
- handleRemove(file, fileList) {
- this.pictureList = fileList
- },
- handlesuccess(response, file, fileList) {
- this.pictureList = fileList
- },
- deleteList() {
- var that = this;
- if (this.id) {
- del(this.id).then(response => {
- this.$Message.success('操作成功');
- this.isShow = false
- this.$emit('refresh')
- }).catch(error => {
- console.log(error)
- reject(error)
- })
- }
- },
- contactGroup(arr) {
- let tempArr = [],
- newArr = []
- for (let i = 0; i < arr.length; i++) {
- if (tempArr.indexOf(arr[i].name) === -1) {
- if(arr[i].type===1){
- newArr.push({
- type: arr[i].type,
- name: arr[i]['name'],
- admin_details: arr[i].details,
- dep_details: []
- })
- }else{
- newArr.push({
- type: arr[i].type,
- name: arr[i]['name'],
- admin_details:[],
- dep_details: arr[i].details
- })
- }
-
- tempArr.push(arr[i].name);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].name == arr[i].name) {
- if(arr[i].type===1){
- newArr[j].admin_details.push(...arr[i].details)
- }else{
- newArr[j].dep_details.push(
- ...arr[i].details
- )
- }
- }
- }
- }
- }
- return newArr
+
+ deleteList() {
+ var that = this;
+ if (this.id) {
+ del(this.id).then(response => {
+ this.$Message.success('操作成功');
+ this.isShow = false
+ this.$emit('refresh')
+ }).catch(error => {
+ console.log(error)
+ reject(error)
+ })
+ }
},
},
watch: {
@@ -928,33 +382,18 @@ import elSelectTree from '@/components/selectTree'
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
- }
- if(this.type==='add'){
- var date = new Date()
- this.form.year = date.getFullYear()+''
+ }
+ if (this.type === 'add') {
+ var date = new Date()
+ this.form.year = date.getFullYear() + ''
}
} else {
- this.id = ''
- this.plan_type = 1
- this.pictureList = []
- this.mission_plan_groups_list = [{
- name: '',
- type: 1,
- link_id: []
- }]
- this.valueMultiple = []
- this.valueArr = []
- this.checkAll = false
- this.isIndeterminate = true
- this.checkAllMonth = false
+ this.id = ''
+ this.pictureList = []
+ this.checkAllMonth = false
this.isIndeterminateMonth = true
this.$refs['dialog'].reset()
}
- },
- plan_type(newval){
- if(newval){
- this.form.plan_type=newval
- }
}
}
@@ -964,23 +403,26 @@ import elSelectTree from '@/components/selectTree'