添加页面
This commit is contained in:
7
miniprogram/pages/manage/group/group.json
Normal file
7
miniprogram/pages/manage/group/group.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
|
||||
},
|
||||
"navigationBarTitleText": "岗位角色"
|
||||
}
|
||||
175
miniprogram/pages/manage/group/group.ts
Normal file
175
miniprogram/pages/manage/group/group.ts
Normal file
@@ -0,0 +1,175 @@
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import {
|
||||
cloneLite,
|
||||
getAuthInfo,
|
||||
getDataSet,
|
||||
showModal,
|
||||
sleep,
|
||||
toArray,
|
||||
toastSuccess,
|
||||
} from '@/utils/util';
|
||||
|
||||
const defaultParams = { curr_page: 1, page_count: 20, head_type: 1 };
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
params: cloneLite(defaultParams) as any,
|
||||
list: [] as any[],
|
||||
states: [
|
||||
{ value: '', label: '全部' },
|
||||
{ value: '1', label: '未审核' },
|
||||
{ value: '2', label: '已审核' },
|
||||
],
|
||||
sort: [{ label: '创建日期', value: 'create_date' }],
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.setData({ authInfo: getAuthInfo() });
|
||||
this.getList();
|
||||
},
|
||||
searchChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
this.data.params[key] = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
searchChange2(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
const val = `${e.detail.value || ''}`.trim();
|
||||
if (val) {
|
||||
this.data.params[key] = val;
|
||||
} else {
|
||||
delete this.data.params[key];
|
||||
}
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
onOptionChange(e: any) {
|
||||
const key = getDataSet(e).key;
|
||||
this.data.params[key] = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
datePickerConfirm(e: any) {
|
||||
const data = getDataSet(e);
|
||||
this.data.params[data.key] = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
searchOk() {
|
||||
this.getList(1);
|
||||
},
|
||||
searchReset() {
|
||||
this.data.params = cloneLite(defaultParams);
|
||||
this.getList(1);
|
||||
},
|
||||
onSort(e: any) {
|
||||
this.data.params.order = e.detail.value;
|
||||
this.setData({ params: this.data.params });
|
||||
this.getList(1);
|
||||
},
|
||||
paginationChange(e: any) {
|
||||
this.getList(e.detail.curr_page);
|
||||
},
|
||||
getList(curr: number = 1) {
|
||||
this.data.params.curr_page = curr;
|
||||
this.setData({ params: this.data.params });
|
||||
const temp = cloneLite(this.data.params);
|
||||
if (temp.order_step && temp.order_step.length) {
|
||||
temp.order_step = temp.order_step.join(',');
|
||||
} else {
|
||||
delete temp.order_step;
|
||||
}
|
||||
|
||||
if (temp.process_state && temp.process_state.length) {
|
||||
temp.process_state = temp.process_state.join(',');
|
||||
} else {
|
||||
delete temp.process_state;
|
||||
}
|
||||
|
||||
post('Groups/list', temp).then((res: any) => {
|
||||
const list = toArray(res.data);
|
||||
if (list.length == 0 && this.data.params.curr_page > 1) {
|
||||
this.getList(this.data.params.curr_page - 1);
|
||||
}
|
||||
this.setData({ list: list });
|
||||
});
|
||||
},
|
||||
onGroupTap(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
wx.navigateTo({
|
||||
url: `/pages/manage/groupDetail/groupDetail?group_id=${
|
||||
item.group_id
|
||||
}&name=${encodeURIComponent(item.name)}`,
|
||||
});
|
||||
},
|
||||
onOrderDel(e: any) {
|
||||
const data = getDataSet(e);
|
||||
const index = data.index;
|
||||
const item = this.data.list[index];
|
||||
showModal({ content: `确认删除 ${item.name}?` }).then(() => {
|
||||
post('Groups/del', { group_id: item.group_id }).then(() => {
|
||||
toastSuccess('删除成功');
|
||||
sleep(() => {
|
||||
this.getList();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(_options) {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.setData({ loading: true });
|
||||
loginStatus()
|
||||
.then(() => {
|
||||
this.setData({ isLogin: true, loading: false });
|
||||
this.init();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({ isLogin: false, loading: false });
|
||||
console.log('调用登录状态请求失败', err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {},
|
||||
});
|
||||
33
miniprogram/pages/manage/group/group.wxml
Normal file
33
miniprogram/pages/manage/group/group.wxml
Normal file
@@ -0,0 +1,33 @@
|
||||
<page-plugin isAuth="{{authInfo['SF_ERP_GROUP_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
|
||||
bind:handleLogin="handleLogin">
|
||||
<!-- <search-popup placeholder="输入单据编号" bind:change="searchChange" bind:ok="searchOk"
|
||||
bind:reset="searchReset" value="{{params.bill_no}}" data-key="bill_no">
|
||||
<view slot="content">
|
||||
<search-input label="销售单号" value="{{params.rel_bill_no}}" data-key="rel_bill_no"
|
||||
bind:change="searchChange2" />
|
||||
<search-input label="收入账户" value="{{params.account_name}}" data-key="account_name"
|
||||
bind:change="searchChange2" />
|
||||
<search-input label="往来单位" value="{{params.crm_name}}" data-key="crm_name"
|
||||
bind:change="searchChange2" />
|
||||
|
||||
<option-cell-plugin title="单据状态" value="{{params.state || ''}}" bind:change="onOptionChange"
|
||||
mode="radio" options="{{states}}" data-key="state" />
|
||||
|
||||
<date-picker-plugin title="单据开始日期" value="{{params.bill_dateL}}" data-key="bill_dateL"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
<date-picker-plugin title="单据结束日期" value="{{params.bill_dateU}}" data-key="bill_dateU"
|
||||
bind:confirm="datePickerConfirm" />
|
||||
</view>
|
||||
</search-popup> -->
|
||||
|
||||
<empty-plugin wx:if="{{list.length == 0}}" />
|
||||
<t-cell-group custom-style="margin: 0">
|
||||
<t-cell wx:for="{{ list }}" wx:key="department_id" title="{{item.name}}" hover arrow
|
||||
data-index="{{index}}" bind:tap="onGroupTap">
|
||||
<t-button slot="note" wx:if="{{authInfo['SF_ERP_GROUP_DEL']}}" size="extra-small"
|
||||
theme="danger" catch:tap="onOrderDel" data-index="{{index}}">删除</t-button>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<!-- <pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
|
||||
total="{{count}}" bind:change="paginationChange" /> -->
|
||||
</page-plugin>
|
||||
0
miniprogram/pages/manage/group/group.wxss
Normal file
0
miniprogram/pages/manage/group/group.wxss
Normal file
Reference in New Issue
Block a user