Commit da64e275 authored by 刘文虎's avatar 刘文虎

记工时-新建项目跳转

parent 770041c3
{
"name" : "account-book",
"name" : "扳手记账",
"appid" : "__UNI__EDB8C7C",
"description" : "",
"versionName" : "1.0.9",
......
......@@ -219,11 +219,6 @@ export default {
path: '/pages/card/payee-code',
name: '收款码'
},
{
image: this.baseUrl + 'jigongshi@3x.png',
path: '/pages/workpoint/project/index',
name: '记工时'
},
{
image: this.baseUrl + 'famingpian@3x.png',
path: '/pages/card/index',
......@@ -239,7 +234,12 @@ export default {
image: this.baseUrl + 'chaqianzhang@3x.png',
path: '/pages/bill/debit-note/debit-note',
name: '查欠账'
}
},
{
image: this.baseUrl + 'jigongshi@3x.png',
path: '/pages/workpoint/project/index',
name: '记工时'
},
];
},
paddingTop() {
......
......@@ -260,6 +260,7 @@ import BillingCategory from '../components/billing-category.vue';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
import { getMembers, getProject, getProjectList, update } from '@/api/workpoint/index.js';
import { getBillInfo, deleteBill } from '@/api/workpoint/project-bill.js';
import { updateProject } from '@/api/project/index.js';
import { formatCount } from '@/utils/common.js';
import { baseUrl, billBaseUrl } from '@/utils/config.js';
import {
......@@ -353,7 +354,7 @@ export default {
'background-color': '#f6f7fa',
'border-radius': '8rpx'
},
unitCustomStyle:{
unitCustomStyle: {
'font-size': '28rpx',
textAlign: 'right',
width: '76rpx',
......@@ -501,12 +502,13 @@ export default {
},
onShow() {
if (!this.recordId) {
this.initData();
console.log('------onShow-------');
this.initData('onshow');
}
},
methods: {
async initData() {
await this.getProjectList();
async initData(text) {
await this.getProjectList(text);
if (this.projectId) {
await this.getMembersOptions();
}
......@@ -567,7 +569,7 @@ export default {
console.log(e);
}
},
async getProjectList() {
async getProjectList(text) {
try {
let { data } = await getProjectList();
this.projectList = data;
......@@ -583,14 +585,13 @@ export default {
} else {
if (data[0]) {
this.projectId = data[0].id + '';
this.form.projectId = data[0].id + '';
this.form.projectName = data[0].name;
}
}
}
data.map((item, index) => {
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
this.form.projectId = item.id + '';
this.form.projectName = item.name;
}
});
} catch (e) {
......@@ -602,12 +603,15 @@ export default {
if (this.recordId) {
return false;
}
this.selectShow = true;
},
toAddProject() {
this.$u.route({
url: '/pages/workpoint/project/project-edit'
this.projectList.map((item, index) => {
if (item.id == this.projectId) {
this.defaultProject = [index];
}
});
console.log('open===defaultProject', this.defaultProject);
setTimeout(() => {
this.selectShow = true;
},1000);
},
selectConfirm(e) {
console.log(e);
......@@ -623,7 +627,46 @@ export default {
this.getMembersOptions();
}
this.$refs.uForm.validate();
console.log('confirm====defaultProject', this.defaultProject);
},
toAddProject() {
this.$u.route({
url: '/pages/mine/input/input',
type: 'navigateTo',
params: {
type: 'project-create'
}
});
uni.$once('input-sure-project-create', res => {
console.log(res);
this.updateProject({
name: res.content
});
});
},
updateProject(params) {
updateProject(params)
.then(res => {
let { data, code } = res;
console.log('------updateProject-------', data);
if (code === 0 && data) {
this.$refs.uToast.show({
title: '项目创建成功',
type: 'success',
duration: 1500,
callback: () => {
this.projectId = data;
this.initData();
}
});
this.projectId = data;
}
})
.catch(err => {
console.log(err);
});
},
handleChangeUnit(e) {
this.form.unit = e;
},
......@@ -645,7 +688,7 @@ export default {
this.normalNumberFocus = false;
}
},
onBlurNormalNumber(){
onBlurNormalNumber() {
this.normalNumberFocus = false;
},
overtimeTypeChange(item) {
......@@ -659,7 +702,7 @@ export default {
this.overNumberFocus = false;
}
},
onBlurOverNumber(){
onBlurOverNumber() {
this.overNumberFocus = false;
},
tabChange(item) {
......@@ -1088,6 +1131,7 @@ export default {
align-items: center;
justify-content: space-between;
font-size: 28rpx;
margin-top: 8rpx;
&-label {
color: $default-color;
display: flex;
......
import {
setBillType,
getBillType,
removeBillType,
setCustomId,
getCustomId,
removeCustomId,
} from "@/utils/common.js"
......@@ -16,10 +18,18 @@ const mutations = {
state.billType = data
setBillType(data)
},
REMOVE_BILL_TYPE: (state, data) => {
state.billType = null
removeBillType()
},
SAVE_CUSTOM_ID: (state, data) => {
state.customId = data
setCustomId(data)
},
REMOVE_CUSTOM_ID: (state, data) => {
state.customId = null
removeCustomId()
},
}
const actions = {
......@@ -29,12 +39,24 @@ const actions = {
},data) => {
commit("SAVE_BILL_TYPE", data)
},
Remove_bill_type:({
state,
commit
}) => {
commit("REMOVE_BILL_TYPE")
},
Save_custom_id:({
state,
commit
},data) => {
commit("SAVE_CUSTOM_ID", data)
},
Remove_custom_id:({
state,
commit
}) => {
commit("REMOVE_CUSTOM_ID")
},
}
export default {
......
......@@ -8,8 +8,6 @@ import {
removeCodeTimetamp,
removeRefreshToken,
removeTimetamp,
removeCustomId,
removeProjectId,
setTimetamp,
setChannel,
getChannel,
......@@ -248,8 +246,9 @@ const actions = {
removeTimetamp()
removeCodeTimetamp()
removeRefreshToken()
removeCustomId()
removeProjectId()
// dispatch("Remove_bill_type")
dispatch("Remove_custom_id")
dispatch("Remove_project_id")
},
// 获取图片域名
GetHost({
......
......@@ -14,6 +14,10 @@ const mutations = {
state.prevProjectId = data
setProjectId(data)
},
REMOVE_PROJECT_ID: (state, data) => {
state.prevProjectId = null
removeProjectId()
},
}
const actions = {
......@@ -23,7 +27,12 @@ const actions = {
},data) => {
commit("SAVE_PROJECT_ID", data||'')
},
Remove_project_id:({
state,
commit
}) => {
commit("REMOVE_PROJECT_ID")
},
}
export default {
......
......@@ -107,6 +107,9 @@ export function setBillType(data) {
export function getBillType() {
return uni.getStorageSync("BILLTYPE") || ''
}
export function removeBillType() {
uni.removeStorageSync("BILLTYPE")
}
export function setEyeFill(data) {
uni.setStorageSync("EYEFILL", data);
......@@ -136,7 +139,7 @@ export function getCustomId() {
}
export function removeCustomId() {
return uni.removeStorageSync("CUSTOM-ID")
uni.removeStorageSync("CUSTOM-ID")
}
export function setProjectId(data) {
......@@ -148,7 +151,7 @@ export function getProjectId() {
}
export function removeProjectId() {
return uni.removeStorageSync("PROJECT-ID")
uni.removeStorageSync("PROJECT-ID")
}
export function checkLoginAndVip(callback) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment