|
@@ -57,8 +57,7 @@ import {onLoad} from '@dcloudio/uni-app'
|
|
|
import {useAppStore} from "@/store";
|
|
|
import mainApi from "~api/user/project";
|
|
|
import {errorToast, successToast} from "@/utils/tools";
|
|
|
-import {deepClone, getArrValue, getObjValue} from "js-fast-way";
|
|
|
-import {getProjectContract} from "@/store/user";
|
|
|
+import {deepClone, getArrValue} from "js-fast-way";
|
|
|
|
|
|
//初始变量
|
|
|
const store = useAppStore()
|
|
@@ -66,6 +65,7 @@ const userInfo = ref(store.userInfo);
|
|
|
const projectInfo = ref({pid: '', cid: ''});
|
|
|
const projectId = ref('');
|
|
|
const contractId = ref('');
|
|
|
+const app = getApp()
|
|
|
|
|
|
//渲染完成
|
|
|
onLoad(() => {
|
|
@@ -123,7 +123,7 @@ const setProjectClick = async () => {
|
|
|
contractId: contractId.value,
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
- await getProjectContract()
|
|
|
+ await setProjectContractData()
|
|
|
uni.hideLoading();
|
|
|
successToast('设置成功')
|
|
|
setTimeout(() => {
|
|
@@ -136,21 +136,34 @@ const setProjectClick = async () => {
|
|
|
}
|
|
|
|
|
|
//仅本次生效
|
|
|
-const onlyEffectivelick = () => {
|
|
|
+const onlyEffectivelick = async () => {
|
|
|
const pid = projectId.value, cid = contractId.value
|
|
|
if (!pid || !cid) {
|
|
|
cancelPopup()
|
|
|
errorToast('请先选择项目和合同段')
|
|
|
return
|
|
|
}
|
|
|
- store.setProjectId(pid)
|
|
|
- store.setContractId(cid)
|
|
|
- store.setProjectInfo(projectData.value)
|
|
|
- store.setContractInfo(contractData.value)
|
|
|
+ uni.showLoading({title: '设置中...', mask: true});
|
|
|
+ await setProjectContractData()
|
|
|
+ uni.hideLoading();
|
|
|
successToast('设置成功')
|
|
|
setTimeout(() => {
|
|
|
uni.navigateBack()
|
|
|
- }, 1500)
|
|
|
+ }, 1200)
|
|
|
+}
|
|
|
+
|
|
|
+//设置项目合同信息
|
|
|
+const setProjectContractData = async () => {
|
|
|
+ const pid = store.projectId, cid = store.contractId
|
|
|
+ const pids = projectId.value, cids = contractId.value
|
|
|
+ if (pid !== pids || cid !== cids) {
|
|
|
+ store.setProjectId(pids)
|
|
|
+ store.setContractId(cids)
|
|
|
+ store.setProjectInfo(projectData.value)
|
|
|
+ store.setContractInfo(contractData.value)
|
|
|
+ app.socketSendMsg(`${pids},${cids}`)
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
|
|
|
//取消并关闭
|