123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- isdep: {
- type: Boolean,
- value: true
- },
- isusers: {
- type: Boolean,
- value: true
- },
- defaultMy: {
- type: Boolean,
- value: true
- },
- exclution: {
- type: Boolean,
- value: true
- },
- dimissionF: {
- type: Boolean
- }
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- data: {
- takeEffect: "", //生效筛选项
- result: {},
- isleave: 0,
- tabs: [{
- value: 0,
- name: "全部"
- }, {
- value: 1,
- name: "在职"
- }, {
- value: 2,
- name: "离职"
- }],
- searchValue: ""
- },
- methods: {
- searchChange({
- detail
- }) {
- if (detail.length == 0) return this.searchClear()
- let list = JSON.parse(JSON.stringify(this.data.users.copyList));
- this.setData({
- 'users.list': list.filter(v => v.name.includes(detail) || v.accountno.includes(detail))
- })
- },
- searchClear() {
- this.setData({
- 'users.list': JSON.parse(JSON.stringify(this.data.users.copyList))
- })
- },
- changLeave(e) {
- this.setData({
- isleave: e.currentTarget.dataset.value,
- 'result.isleave': e.currentTarget.dataset.value
- })
- },
- initDepAndUser() {
- this.setData({
- result: {},
- takeEffect: ""
- })
- return new Promise((resolve) => {
- _Http.basic({
- "id": 20230620102004,
- "content": {}
- }).then(res => {
- console.log("获取部门", res)
- if (this.data.isdep) this.setData({
- depGroud: [{
- label: "部门",
- list: res.data.dep,
- active: ""
- }]
- })
- if (this.data.isusers) {
- let active = ''
- if (this.data.defaultMy) {
- let user = res.data.hr.find(v => v.userid == wx.getStorageSync('userMsg').userid)
- if (user) {
- active = user.userid;
- resolve(user)
- this.setData({
- takeEffect: "user",
- result: user
- })
- }
- }
- this.setData({
- users: {
- label: "业务员",
- list: res.data.hr,
- copyList: res.data.hr,
- active
- }
- })
- }
- resolve({})
- })
- })
- },
- selectDep(e) {
- const {
- item,
- index
- } = e.currentTarget.dataset;
- let depGroud = this.data.depGroud.slice(0, index + 1);
- depGroud[index].active = item.departmentid;
- if (item.subdep.length) {
- item.subdep.unshift(JSON.parse(JSON.stringify(item)))
- item.subdep[0].depname = getApp().globalData.Language.getMapText('全部');
- item.subdep[0].subdep = [];
- depGroud.push({
- label: item.depname + getApp().globalData.Language.getMapText('下级部门'),
- list: item.subdep,
- active: item.departmentid
- })
- }
- item.name = item.depname
- item.isleave = this.data.isleave;
- this.setData({
- depGroud,
- takeEffect: "dep",
- result: item
- })
- },
- selectUser(e) {
- const {
- item
- } = e.currentTarget.dataset;
- this.setData({
- 'users.active': item.userid,
- takeEffect: "user",
- result: item
- })
- },
- }
- })
|