添加页面

This commit is contained in:
zhengw
2026-02-02 16:58:37 +08:00
parent bdee04ad67
commit 1c0e0b265d
38 changed files with 1575 additions and 10 deletions

View File

@@ -19,7 +19,14 @@
"pages/purchase/backOrder/backOrder", "pages/purchase/backOrder/backOrder",
"pages/base/supplier/supplier", "pages/base/supplier/supplier",
"pages/base/customer/customer", "pages/base/customer/customer",
"pages/base/account/account" "pages/base/account/account",
"pages/manage/department/department",
"pages/manage/groupDetail/groupDetail",
"pages/manage/group/group",
"pages/manage/my/my",
"pages/logs/loginLog/loginLog",
"pages/logs/operateLog/operateLog",
"pages/manage/staff/staff"
], ],
"window": { "window": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M790.211373 178.146353H512v0.054235H233.788627c-17.225313-0.027629-27.549449-5.868661-27.821649-2.825348v-25.049513c0-15.350616 12.497639-27.820626 27.821649-27.820625h612.06502c15.377222 0 27.821649-12.443403 27.821649-27.821649s-12.443403-27.821649-27.821649-27.821649H233.788627c-44.115754 0-79.972403 34.504862-82.900081 77.894068h-0.563842v728.919424c0 46.02422 37.438681 83.463923 83.463923 83.463924h556.422746c46.02422 0 83.463923-37.438681 83.463923-83.463924V247.726058c-0.001023-38.362726-37.439704-69.579705-83.463923-69.579705z m27.820625 695.52792c0 15.350616-12.497639 27.821649-27.821649 27.821649H233.788627c-15.322987 0-27.821649-12.471033-27.821649-27.821649V230.497675c8.676613 2.02717 17.907858 3.345188 27.821649 3.345188h278.211373v-0.054236H790.211373c17.007349 0 27.821649 9.155521 27.821649 13.937431v625.948215z" fill="#165dff"></path><path d="M607.624894 582.130244c26.737968-23.609721 43.969421-57.741076 43.969421-96.131431 0-70.992891-57.761542-128.726803-128.726803-128.726803S394.140709 415.005922 394.140709 485.998813c0 36.423561 15.347546 69.195965 39.738049 92.63991-66.166979 31.515784-112.334461 98.511641-112.334461 176.551018 0 15.377222 12.443403 27.821649 27.821649 27.821649s27.821649-12.443403 27.821649-27.821649c0-77.404927 62.978357-140.382261 140.355655-140.38226S657.897881 677.785837 657.897881 755.190765c0 15.377222 12.443403 27.821649 27.821649 27.821649s27.821649-12.443403 27.821649-27.821649c-0.001023-75.431993-43.298132-140.29835-105.916285-173.060521z m-84.757382-169.21596c40.319288 0 73.084529 32.79287 73.084529 73.084529 0 40.319288-32.766264 73.112158-73.084529 73.112158s-73.084529-32.79287-73.084529-73.112158c0-40.291658 32.765241-73.084529 73.084529-73.084529z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M219.428571 402.285714a109.714286 109.714286 0 1 0 219.428572 0 109.714286 109.714286 0 0 0-219.428572 0zM146.285714 773.193143c0-67.145143 34.816-129.243429 91.428572-162.816a178.468571 178.468571 0 0 1 182.857143 0C477.184 643.949714 512 737.28 512 804.571429H146.285714v-31.378286zM585.142857 658.285714h292.571429v73.142857H585.142857zM585.142857 512h292.571429v73.142857H585.142857zM585.142857 365.714286h292.571429v73.142857H585.142857z" fill="#165dff"></path><path d="M1024 0v1024H0V0h1024z m-73.142857 73.142857H73.142857v877.714286h877.714286V73.142857z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 880 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M924.153161 127.658059L512 0 99.846839 127.658059c-14.589492 3.647373-25.531612 18.236866-25.531612 32.826358L77.9626 656.527159v7.294747c0 3.647373 18.236866 87.536955 102.126447 167.779163 65.652716 62.005343 222.48976 142.247551 291.789849 175.073909 10.942119 3.647373 18.236866 10.942119 21.884238 10.942119l7.294747 3.647373c3.647373 3.647373 10.942119 3.647373 18.236865 0l10.94212-7.294746c40.121104-18.236866 240.726625-116.715939 317.32146-186.016029 83.889581-80.242208 102.126447-164.13179 102.126447-167.779162V160.484417c0-14.589492-10.942119-29.178985-25.531612-32.826358zM125.378451 652.879786l3.647373-477.805877L512 58.35797l382.974176 116.715939-3.647373 481.45325c0 7.294746-3.647373 18.236866-10.942119 32.826358-14.589492 29.178985-36.473731 62.005343-65.652716 91.184328l-7.294746 7.294746c-29.178985 29.178985-87.536955 65.652716-160.484417 105.77382-47.41585 25.531612-98.479074 51.063224-138.600178 69.300089l-14.589493-7.294746c-62.005343-29.178985-98.479074-51.063224-142.247551-76.594835-25.531612-14.589492-47.41585-29.178985-69.300089-40.121104-29.178985-18.236866-54.710597-36.473731-69.300089-51.063224l-7.294746-7.294746c-29.178985-29.178985-51.063224-58.35797-65.652716-91.184328" fill="#165dff"></path><path d="M512 255.316118c-80.242208 0-145.894924 65.652716-145.894924 145.894924 0 72.947462 51.063224 131.305432 116.715939 142.247551v229.784506h54.710597v-102.126447h91.184327v-54.710597h-91.184327v-76.594835c69.300089-14.589492 116.715939-72.947462 116.715939-142.247551C657.894924 320.968833 592.242208 255.316118 512 255.316118z m0 237.079252c-51.063224 0-91.184328-40.121104-91.184328-91.184328s40.121104-91.184328 91.184328-91.184328 91.184328 40.121104 91.184328 91.184328-40.121104 91.184328-91.184328 91.184328z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M861.44 1008.64H162.56A101.76 101.76 0 0 1 64 906.88V114.56A101.76 101.76 0 0 1 162.56 12.8h698.88a101.76 101.76 0 0 1 101.76 101.76v792.32a101.76 101.76 0 0 1-101.76 101.76zM162.56 88.32a26.24 26.24 0 0 0-26.24 26.24v792.32a25.6 25.6 0 0 0 26.24 25.6h698.88a25.6 25.6 0 0 0 26.24-25.6V114.56a26.24 26.24 0 0 0-26.24-26.24z" fill="#165dff"></path><path d="M750.08 275.84H262.4a38.4 38.4 0 0 1 0-76.16h487.68a38.4 38.4 0 0 1 0 76.16zM576 408.32H262.4a37.76 37.76 0 0 1-37.76-37.76 38.4 38.4 0 0 1 37.76-37.76H576a37.76 37.76 0 0 1 37.76 37.76 37.12 37.12 0 0 1-37.76 37.76zM407.68 533.76H262.4a32 32 0 0 1-32-32 32.64 32.64 0 0 1 32-32h145.28a32 32 0 0 1 32 32 32 32 0 0 1-32 32zM811.52 910.72a64 64 0 0 1-44.8-18.56l-115.84-115.84a148.48 148.48 0 0 1-76.8 7.04 150.4 150.4 0 0 1-115.84-203.52 22.4 22.4 0 0 1 17.28-14.72 25.6 25.6 0 0 1 23.04 6.4l58.88 58.88 37.76-37.76-58.88-58.88A24.96 24.96 0 0 1 529.28 512a25.6 25.6 0 0 1 15.36-17.92 151.04 151.04 0 0 1 203.52 115.2 154.24 154.24 0 0 1-7.04 78.08l115.84 115.84a64 64 0 0 1 0 89.6 64 64 0 0 1-45.44 18.56z m-151.68-174.08l7.68 9.6 120.96 120.96a30.08 30.08 0 0 0 42.88 0 30.72 30.72 0 0 0 0-42.88L712.32 704l-8.32-8.96 5.12-11.52a121.6 121.6 0 0 0 8.96-69.12 115.2 115.2 0 0 0-33.28-64 118.4 118.4 0 0 0-115.2-30.08L640 592.64l-82.56 85.12-72.96-72.96a118.4 118.4 0 0 0 94.72 145.92 121.6 121.6 0 0 0 69.12-8.96z m0 0" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1038 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64.875" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M76.778433 76.778433h776.41112v328.249368h77.209773v-345.071609A59.956192 59.956192 0 0 0 872.599832 0H59.956192A59.956192 59.956192 0 0 0 0 59.956192v898.048863a59.956192 59.956192 0 0 0 59.956192 59.956192H474.473463v-75.915754H76.778433z" fill="#165dff"></path><path d="M209.631003 256.647009h513.294018v81.091828H209.631003zM209.631003 472.748104h389.068239v81.091829H209.631003zM209.631003 684.535805h278.213984v81.091828H209.631003zM914.871104 774.685762a163.046335 163.046335 0 1 0-227.747262 0 180.731255 180.731255 0 0 0-122.069082 180.731256c0 68.582982 102.227464 68.582982 243.706824 68.582982h86.267902c59.956192 0 101.364785-3.450716 125.088458-27.605729a57.799495 57.799495 0 0 0 17.68492-43.133951 172.535805 172.535805 0 0 0-122.93176-178.574558zM733.277169 590.503791a94.894693 94.894693 0 0 1 67.288964-28.037068 92.306655 92.306655 0 1 1-67.288964 26.74305z m122.500422 364.913227h-46.584668a862.679023 862.679023 0 0 1-172.535804-10.352149c5.607414-99.639427 92.737995-121.206403 166.065712-121.206402 144.498736 0 164.771693 70.73968 166.497051 125.951137a480.943555 480.943555 0 0 1-113.442291 5.607414z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M332.8 281.6c0 121.6 102.4 224 224 224s224-102.4 224-224S678.4 57.6 556.8 57.6c-128 0-224 96-224 224m-281.6 512c0 96 83.2 179.2 179.2 179.2 96 0 179.2-83.2 179.2-179.2S332.8 614.4 230.4 614.4C134.4 614.4 51.2 691.2 51.2 793.6m665.6-32c0 70.4 57.6 128 128 128s128-57.6 128-128-57.6-128-128-128-128 57.6-128 128m121.6-160c89.6 0 160 70.4 160 160s-70.4 160-160 160-160-70.4-160-160c0-64 38.4-121.6 108.8-153.6l-70.4-134.4c-44.8 38.4-115.2 64-166.4 64-38.4 0-96-6.4-128-38.4l-70.4 128c57.6 32 89.6 102.4 89.6 166.4 0 115.2-96 211.2-211.2 211.2-115.2 0-211.2-96-211.2-211.2 0-115.2 96-211.2 211.2-211.2 25.6 0 51.2 6.4 76.8 12.8l76.8-128c-57.6-44.8-89.6-115.2-89.6-192 0-140.8 115.2-256 256-256s256 115.2 256 256c0 64-19.2 121.6-57.6 166.4L832 601.6h6.4m0 0z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -13,6 +13,8 @@ Component({
headerStyle: null, headerStyle: null,
contentStyle: null, contentStyle: null,
footerStyle: null, footerStyle: null,
showMoreBar: { type: Boolean, value: true },
showAll: { type: Boolean, value: false },
}, },
lifetimes: { lifetimes: {
attached() { attached() {
@@ -27,7 +29,7 @@ Component({
*/ */
data: { data: {
showMore: false, showMore: false,
showMoreBar: true, // showMoreBar: true,
}, },
/** /**
* 组件的方法列表 * 组件的方法列表

View File

@@ -6,14 +6,21 @@
<slot name="header" /> <slot name="header" />
</view> </view>
<view class="content" style="padding:16rpx 24rpx;{{contentStyle || ''}}"> <view class="content" style="padding:16rpx 24rpx;{{contentStyle || ''}}">
<view id="contentSlot" <block wx:if="{{showAll}}">
style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;"> <view id="contentSlot">
<slot name="content" /> <slot name="content" />
</view> </view>
<view wx:if="{{showMoreBar}}" class="show-more" catch:tap="showMoreTap"> </block>
<view>{{showMore ? '收起' : '显示更多' }}</view> <block wx:else>
<t-icon name="{{showMore ? 'chevron-up' : 'chevron-down' }}" /> <view id="contentSlot"
</view> style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;">
<slot name="content" />
</view>
<view wx:if="{{showMoreBar}}" class="show-more" catch:tap="showMoreTap">
<view>{{showMore ? '收起' : '显示更多' }}</view>
<t-icon name="{{showMore ? 'chevron-up' : 'chevron-down' }}" />
</view>
</block>
</view> </view>
<view class="footer" style="{{footerStyle||''}}"> <view class="footer" style="{{footerStyle||''}}">
<slot name="footer" /> <slot name="footer" />

View File

@@ -0,0 +1,15 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
},
"navigationBarTitleText": "登录日志"
}

View File

@@ -0,0 +1,143 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
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);
post('Log/loginList', temp).then((res: any) => {
const list = toArray(res.data?.list);
if (list.length == 0 && this.data.params.curr_page > 1) {
this.getList(this.data.params.curr_page - 1);
}
this.setData({
count: toNumber(res.data?.count),
list: list.map((el) => {
el.address = '';
if (el.detail) {
const obj = JSON.parse(el.detail);
const arr = ['province', 'city']
.map((key) => obj[key]) // 取出字段值
.filter(Boolean);
el.address = arr.length ? arr.join(',') : '';
}
return el;
}),
});
});
},
/**
* 生命周期函数--监听页面加载
*/
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() {},
});

View File

@@ -0,0 +1,31 @@
<page-plugin isAuth="{{authInfo['SF_ERP_LOG_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<search-popup placeholder="输入登录账号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.login_name}}" data-key="login_name">
<view slot="content">
<search-input label="登录IP" value="{{params.login_ip}}" data-key="login_ip"
bind:change="searchChange2" />
<date-picker-plugin title="登录开始日期" value="{{params.login_timeL}}" data-key="login_timeL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="登录结束日期" value="{{params.login_timeU}}" data-key="login_timeU"
bind:confirm="datePickerConfirm" />
</view>
</search-popup>
<count-plugin count="{{count}}">
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
</count-plugin>
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="log_id" showAll="{{true}}">
<view slot="header">{{ item.login_name }}</view>
<view slot="content">
<card-item-plugin label="登录IP" value="{{item.login_ip}}" />
<card-item-plugin label="登录时间" value="{{item.login_time}}" />
<card-item-plugin label="登录地址" value="{{item.address}}" />
<card-item-plugin label="浏览器" value="{{item.browser}}" />
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

@@ -0,0 +1,15 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
},
"navigationBarTitleText": "操作日志"
}

View File

@@ -0,0 +1,133 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
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);
post('Log/operateList', temp).then((res: any) => {
const list = toArray(res.data?.list);
if (list.length == 0 && this.data.params.curr_page > 1) {
this.getList(this.data.params.curr_page - 1);
}
this.setData({
count: toNumber(res.data?.count),
list: list,
});
});
},
/**
* 生命周期函数--监听页面加载
*/
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() {},
});

View File

@@ -0,0 +1,37 @@
<page-plugin isAuth="{{authInfo['SF_ERP_LOG_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<search-popup placeholder="输入操作账号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.login_name}}" data-key="login_name">
<view slot="content">
<search-input label="操作IP" value="{{params.client_ip}}" data-key="client_ip"
bind:change="searchChange2" />
<date-picker-plugin title="操作开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="操作结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
bind:confirm="datePickerConfirm" />
</view>
</search-popup>
<count-plugin count="{{count}}">
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
</count-plugin>
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="log_id" showAll="{{true}}">
<view slot="header">{{ item.menu_ch_name }}({{item.function_ch_name}})</view>
<view slot="content">
<card-item-plugin label="操作详情" value="{{item.content}}" />
<card-item-plugin label="操作账号">
<view slot="value">
{{item.login_name}}
<text wx:if="{{item.nick_name}}">({{item.nick_name}})</text>
</view>
</card-item-plugin>
<card-item-plugin label="操作IP" value="{{item.client_ip}}" />
<card-item-plugin label="操作时间" value="{{item.create_date}}" />
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
},
"navigationBarTitleText": "组织架构"
}

View File

@@ -0,0 +1,166 @@
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('Departments/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 });
});
},
onOrderDel(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
showModal({ content: `确认删除 ${item.name}?` }).then(() => {
post('Departments/del', { department_id: item.department_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() {},
});

View File

@@ -0,0 +1,32 @@
<page-plugin isAuth="{{authInfo['SF_ERP_DEPART_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 theme="card" custom-style="margin: 0">
<t-cell wx:for="{{ list }}" wx:key="department_id" title="{{item.name}}">
<t-button slot="right-icon" wx:if="{{authInfo['SF_ERP_DEPART_DEL']}}" size="extra-small"
theme="danger" bind: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>

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
},
"navigationBarTitleText": "岗位角色"
}

View 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() {},
});

View 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>

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,114 @@
import { loginStatus, post } from '@/utils/https';
import { getAuthInfo, toArray } from '@/utils/util';
Page({
/**
* 页面的初始数据
*/
data: {
list: [] as any[],
group_id: '',
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
post('Groups/getGrpRights', { group_id: this.data.group_id }).then((res: any) => {
const list = toArray(res.right_tree);
const rights = `${res.rights || ''}`.split(',');
this.data.list.length = 0;
toArray(list).forEach((menu) => {
const arr: any[] = [];
toArray(menu.children).forEach((menu2) => {
let flag = false;
toArray(menu2.children).forEach((fun) => {
fun.web_checked = rights.includes(`${fun.function_id}`);
if (fun.web_checked) {
flag = true;
}
});
if (flag) {
arr.push({
menu_ch_name: menu2.menu_ch_name,
menu_id: menu2.menu_id,
functions: toArray(menu2.children),
});
}
});
if (arr.length) {
this.data.list.push({
menu_ch_name: menu.menu_ch_name,
menu_id: menu.menu_id,
children: arr,
});
}
});
// console.log(this.data.list);
this.setData({ list: this.data.list });
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.data.group_id = `${options.group_id}`;
wx.setNavigationBarTitle({ title: `${decodeURIComponent(`${options.name}`)} 权限` });
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);
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,25 @@
<page-plugin isAuth="{{authInfo['SF_ERP_GROUP_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin" customStyle="padding-top: 0">
<empty-plugin wx:if="{{list.length == 0}}" />
<view wx:if="{{list.length}}" class="top">
<view class="header">
<view class="name">菜单名称</view>
<view class="name2">目录名称</view>
<view class="functions">权限点</view>
</view>
</view>
<view wx:for="{{list}}" wx:key="menu_id" class="content">
<view class="name">{{item.menu_ch_name}}</view>
<view style="display: flex;flex-direction: column;flex: 1;">
<view wx:for="{{item.children}}" wx:key="menu_id" wx:for-item="item2"
style="display: flex;flex: 1;">
<view class="name2" style="flex-shrink: 0;">{{item2.menu_ch_name}}</view>
<view style="display: flex;" class="functions">
<block wx:for="{{item2.functions}}" wx:key="function_id">
<view wx:if="{{item.web_checked}}">{{item.function_ch_name}}</view>
</block>
</view>
</view>
</view>
</view>
</page-plugin>

View File

@@ -0,0 +1,55 @@
.header,
.content {
display: flex;
font-size: 14px;
border-left: 1rpx solid #ddd;
border-right: 1rpx solid #ddd;
box-sizing: border-box;
}
.header {
border-top: 1rpx solid #ddd;
background: #f5f5f5;
font-weight: bold;
}
.top {
position: sticky;
top: 0;
z-index: 1;
padding-top: 24rpx;
background: #fff;
}
.content {
/* flex-direction: column; */
align-items: stretch;
}
.name,
.name2 {
width: 5.5em;
flex-shrink: 0;
border-bottom: 1rpx solid #ddd;
border-right: 1rpx solid #ddd;
min-width: 0;
display: flex;
align-items: center;
padding: 12rpx 0.5em;
word-break: break-all;
box-sizing: border-box;
}
.name2 {
width: 6.5em;
}
.functions {
border-bottom: 1rpx solid #ddd;
flex: 1;
display: flex;
column-gap: 0.5em;
row-gap: 12rpx;
flex-wrap: wrap;
padding: 0.5em;
}

View File

@@ -0,0 +1,4 @@
{
"usingComponents": { },
"navigationBarTitleText": "我的权限"
}

View File

@@ -0,0 +1,110 @@
import { loginStatus, post } from '@/utils/https';
import { getAuthInfo, toArray } from '@/utils/util';
Page({
/**
* 页面的初始数据
*/
data: {
list: [] as any[],
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
post('Groups/myAuth').then((res: any) => {
const list = toArray(res.right_tree);
const rights = `${res.rights || ''}`.split(',');
this.data.list.length = 0;
toArray(list).forEach((menu) => {
const arr: any[] = [];
toArray(menu.children).forEach((menu2) => {
let flag = false;
toArray(menu2.children).forEach((fun) => {
fun.web_checked = rights.includes(`${fun.function_id}`);
if (fun.web_checked) {
flag = true;
}
});
if (flag) {
arr.push({
menu_ch_name: menu2.menu_ch_name,
menu_id: menu2.menu_id,
functions: toArray(menu2.children),
});
}
});
if (arr.length) {
this.data.list.push({
menu_ch_name: menu.menu_ch_name,
menu_id: menu.menu_id,
children: arr,
});
}
});
// console.log(this.data.list);
this.setData({ list: this.data.list });
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(_options) {
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);
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,25 @@
<page-plugin isAuth="{{authInfo['SF_ERP_GROUP_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin" customStyle="padding-top: 0">
<empty-plugin wx:if="{{list.length == 0}}" />
<view wx:if="{{list.length}}" class="top">
<view class="header">
<view class="name">菜单名称</view>
<view class="name2">目录名称</view>
<view class="functions">权限点</view>
</view>
</view>
<view wx:for="{{list}}" wx:key="menu_id" class="content">
<view class="name">{{item.menu_ch_name}}</view>
<view style="display: flex;flex-direction: column;flex: 1;">
<view wx:for="{{item.children}}" wx:key="menu_id" wx:for-item="item2"
style="display: flex;flex: 1;">
<view class="name2" style="flex-shrink: 0;">{{item2.menu_ch_name}}</view>
<view style="display: flex;" class="functions">
<block wx:for="{{item2.functions}}" wx:key="function_id">
<view wx:if="{{item.web_checked}}">{{item.function_ch_name}}</view>
</block>
</view>
</view>
</view>
</view>
</page-plugin>

View File

@@ -0,0 +1,55 @@
.header,
.content {
display: flex;
font-size: 14px;
border-left: 1rpx solid #ddd;
border-right: 1rpx solid #ddd;
box-sizing: border-box;
}
.header {
border-top: 1rpx solid #ddd;
background: #f5f5f5;
font-weight: bold;
}
.top {
position: sticky;
top: 0;
z-index: 1;
padding-top: 24rpx;
background: #fff;
}
.content {
/* flex-direction: column; */
align-items: stretch;
}
.name,
.name2 {
width: 5.5em;
flex-shrink: 0;
border-bottom: 1rpx solid #ddd;
border-right: 1rpx solid #ddd;
min-width: 0;
display: flex;
align-items: center;
padding: 12rpx 0.5em;
word-break: break-all;
box-sizing: border-box;
}
.name2 {
width: 6.5em;
}
.functions {
border-bottom: 1rpx solid #ddd;
flex: 1;
display: flex;
column-gap: 0.5em;
row-gap: 12rpx;
flex-wrap: wrap;
padding: 0.5em;
}

View File

@@ -0,0 +1,15 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
},
"navigationBarTitleText": "员工管理"
}

View File

@@ -0,0 +1,223 @@
import { loginStatus, post } from '@/utils/https';
import {
cloneLite,
getAuthInfo,
getDataSet,
showModal,
sleep,
toArray,
toastSuccess,
toNumber,
} from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
orderStep: [] as any[],
sort: [
{ label: '部门', value: 'dep_name' },
{ label: '岗位', value: 'group_id' },
{ label: '状态', value: 'state' },
{ label: '创建日期', value: 'create_date' },
],
user_id: wx.getStorageSync('user_id'),
depOption: [] as any[],
groupsOption: [] as any[],
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
this.getOrderStep();
},
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);
},
onSearchState(e: any) {
const key = getDataSet(e).key;
if (key) {
this.data.params.state = key;
} else {
delete this.data.params.state;
}
this.setData({ params: this.data.params });
this.getList(1);
},
paginationChange(e: any) {
this.getList(e.detail.curr_page);
},
getOrderStep() {
post('Departments/list').then((res: any) => {
this.setData({
depOption: [
{ label: '全部', value: '' },
...toArray(res.data).map((el) => ({
label: el.name,
value: el.department_id,
})),
],
});
});
post('Groups/list').then((res: any) => {
this.setData({
groupsOption: [
{ label: '全部', value: '' },
...toArray(res.data).map((el) => ({
label: el.name,
value: el.group_id,
})),
],
});
});
},
getList(curr: number = 1) {
this.data.params.curr_page = curr;
this.setData({ params: this.data.params });
const temp = cloneLite(this.data.params);
post('Users/getStaff', 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({ count: toNumber(res.count), list: list });
});
},
onReinstatedStaff(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
showModal({ content: `确认复职 ${item.login_name}?` }).then(() => {
post('Users/reinstatedStaff', { staff_id: item.staff_id }).then(() => {
toastSuccess('复职成功');
sleep(() => {
this.getList();
}, 1000);
});
});
},
onFireStaff(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
showModal({ content: `确认解雇 ${item.login_name}?` }).then(() => {
post('Users/fireStaff', { staff_id: item.staff_id }).then(() => {
toastSuccess('解雇成功');
sleep(() => {
this.getList();
}, 1000);
});
});
},
onStaffState(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
showModal({ content: `确认${item.state == 1 ? '禁用' : '启用'} ${item.login_name}?` }).then(
() => {
post('Users/setStaffState', { staff_id: item.staff_id }).then(() => {
toastSuccess(`${item.state == 1 ? '禁用' : '启用'}成功`);
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() {},
});

View File

@@ -0,0 +1,65 @@
<page-plugin isAuth="{{authInfo['SF_ERP_STAFF_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<search-popup placeholder="输入员工账号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.login_name}}" data-key="login_name">
<view slot="content">
<search-input label="手机" value="{{params.user_phone}}" data-key="user_phone"
bind:change="searchChange2" />
<option-cell-plugin title="组织架构" value="{{params.department_id || ''}}"
bind:change="onOptionChange" mode="radio" options="{{depOption}}"
data-key="department_id" />
<option-cell-plugin title="组织架构" value="{{params.group_id || ''}}"
bind:change="onOptionChange" mode="radio" options="{{groupsOption}}" data-key="group_id" />
<!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
bind:confirm="datePickerConfirm" /> -->
</view>
</search-popup>
<count-plugin count="{{count}}">
<view slot="left">
<t-button size="small" theme="{{params.state == '-1' ? '': 'primary'}}" class="btn-left"
bind:tap="onSearchState" data-key="">在职员工</t-button>
<t-button size="small" theme="{{params.state == '-1' ? 'primary': ''}}" class="btn-right"
bind:tap="onSearchState" data-key="-1">离职员工</t-button>
</view>
<sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" />
</count-plugin>
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="staff_id" showAll="{{true}}">
<view slot="header"
style="display: flex;justify-content: space-between;align-items: center;width: 100%;">
<view style="word-break: break-all;">
{{ item.login_name }}
<text wx:if="{{item.nick_name}}">({{item.nick_name}})</text>
</view>
<view style="font-weight: normal;color: #999;flex-shrink: 0;display: flex;">
{{ item.state== 1 ? '正常' : '禁用'}}
</view>
</view>
<view slot="content">
<card-item-plugin label="手机" value="{{item.user_phone}}" />
<card-item-plugin label="部门" value="{{item.dep_name}}" />
<card-item-plugin label="岗位" value="{{item.group_name}}" />
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
</view>
<view slot="footer" class="card-plugin-footer">
<block wx:if="{{item.state == -1}}">
<t-button wx:if="{{authInfo['SF_ERP_STAFF_EDIT']}}" size="small" theme="primary"
bind:tap="onReinstatedStaff" data-index="{{index}}">复职</t-button>
</block>
<block wx:else>
<t-button wx:if="{{user_id != item.user_id && authInfo['SF_ERP_STAFF_FIRE']}}" size="small"
theme="danger" bind:tap="onFireStaff" data-index="{{index}}">解雇</t-button>
<t-button wx:if="{{authInfo['SF_ERP_STAFF_EDIT']}}" size="small"
theme="{{ item.state== 1 ? 'danger' : 'primary'}}" bind:tap="onStaffState"
data-index="{{index}}">{{ item.state== 1 ? '禁用' : '启用'}}</t-button>
</block>
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

@@ -0,0 +1,11 @@
button.btn-left,
button.btn-left::after {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
button.btn-right,
button.btn-right::after {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}

View File

@@ -116,4 +116,48 @@ export const menuConfig = [
}, },
], ],
}, },
{
title: '用户管理',
icon: 'usergroup',
iconColor: iconColor,
children: [
{
title: '组织架构',
url: '/pages/manage/department/department',
auth: 'SF_ERP_DEPART_VIEW',
},
{
title: '岗位角色',
url: '/pages/manage/group/group',
auth: 'SF_ERP_GROUP_VIEW',
},
{
title: '员工管理',
url: '/pages/manage/staff/staff',
auth: 'SF_ERP_STAFF_VIEW',
},
{
title: '我的权限',
url: '/pages/manage/my/my',
auth: 'SF_MY_RIGHT_VIEW',
},
],
},
{
title: '日志查看',
icon: 'catalog',
iconColor: iconColor,
children: [
{
title: '登录日志',
url: '/pages/logs/loginLog/loginLog',
auth: 'SF_ERP_LOG_VIEW',
},
{
title: '操作日志',
url: '/pages/logs/operateLog/operateLog',
auth: 'SF_ERP_LOG_VIEW',
},
],
},
]; ];