deploy
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import Message from "tdesign-miniprogram/message/index";
|
||||
import { getDict } from "../../api/dict";
|
||||
import { addFinance, getFinanceInfo, updateFinance } from "../../api/finance";
|
||||
import { getInfo } from "../../api/login";
|
||||
|
||||
// pages/add-affairs/add-affairs.ts
|
||||
const dayjs = require("dayjs");
|
||||
@ -9,6 +10,7 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
permissions: [],
|
||||
defaultTime: dayjs(dayjs().format("YYYY-MM-DD")).valueOf(),
|
||||
types: [],
|
||||
form: {
|
||||
@ -56,6 +58,23 @@ Page({
|
||||
[`form.date`]: e.detail.value,
|
||||
});
|
||||
},
|
||||
loadUserInfo() {
|
||||
const permissions = getApp().globalData.permissions;
|
||||
|
||||
if (permissions) {
|
||||
this.setData({
|
||||
permissions,
|
||||
});
|
||||
} else {
|
||||
const token = getApp().globalData.authToken;
|
||||
getInfo(token).then((resp: any) => {
|
||||
this.setData({
|
||||
permissions: resp.permissions,
|
||||
});
|
||||
getApp().globalData.permissions = resp.permissions;
|
||||
});
|
||||
}
|
||||
},
|
||||
getTypeLabel(dictValue: string) {
|
||||
// @ts-ignore
|
||||
return this.data.types.find((item: any) => item.value === dictValue)?.label;
|
||||
@ -117,6 +136,7 @@ Page({
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleSubmitFinance() {
|
||||
const { form } = this.data;
|
||||
const result = this.validate();
|
||||
@ -208,6 +228,7 @@ Page({
|
||||
this.getFinanceDetail(option.financeId);
|
||||
}
|
||||
this.getTypeOptions();
|
||||
this.loadUserInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@
|
||||
<t-message id="t-message" />
|
||||
<wxs module="times" src="../../utils/time.wxs" />
|
||||
<wxs module="dict" src="../../utils/dict.wxs" />
|
||||
<wxs module="utils" src="../../utils/utils.wxs" />
|
||||
<view class="add-affairs">
|
||||
<view class="add-affairs-form">
|
||||
<t-input label="事项" bind:change="onChange" data-field="event" value="{{form.event}}" align="right" placeholder="请输入事项"></t-input>
|
||||
@ -10,14 +11,13 @@
|
||||
<t-input label="对方账户" bind:change="onChange" data-field="oppositeCompany" value="{{form.oppositeCompany}}" align="right" placeholder="请输入对方账户"></t-input>
|
||||
<t-input label="金额" type="number" bind:change="onChange" data-field="amount" value="{{form.amount}}" align="right" placeholder="请输入金额"></t-input>
|
||||
</view>
|
||||
<view class="submit-button">
|
||||
<view wx:if="{{utils.hasPermission('finance:detail:edit', permissions)}}" class="submit-button">
|
||||
<t-button bind:tap="handleSubmitFinance" theme="primary" block>确认提交</t-button>
|
||||
</view>
|
||||
|
||||
<!-- 年月日 -->
|
||||
<t-date-time-picker title="选择日期" visible="{{dateVisible}}" mode="date" defaultValue="{{form.date || defaultTime}}" format="YYYY-MM-DD HH:mm:ss" bindchange="handleConfirmTime" bindcancel="hideTimePicker" />
|
||||
|
||||
|
||||
<t-picker visible="{{pickerVisible}}" value="{{form.type}}" data-key="type" title="选择类别" cancelBtn="取消" confirmBtn="确认" bindchange="onPickerChange" bindpick="onColumnChange" bindcancel="onPickerCancel">
|
||||
<t-picker-item options="{{types}}" />
|
||||
</t-picker>
|
||||
|
Reference in New Issue
Block a user