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

记工时-新建项目跳转

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