-- 项目经理

This commit is contained in:
yuping
2022-12-03 00:22:07 +08:00
parent 7f647ced3d
commit 2926e18279
3 changed files with 236 additions and 202 deletions

View File

@@ -1,8 +1,8 @@
function formatNumber(n) { function formatNumber(n) {
n = n.toString(); n = n.toString();
return n[1] ? n : "0" + n; return n[1] ? n : "0" + n;
} }
function toDate(number, format) { function toDate(number, format) {
var formateArr = ["Y", "M", "D", "h", "m", "s"]; var formateArr = ["Y", "M", "D", "h", "m", "s"];
var returnArr = []; var returnArr = [];
@@ -25,6 +25,7 @@ function toDate(number, format) {
} }
return format; return format;
} }
function getWeek(date) { function getWeek(date) {
//date:'Y-M-D' //date:'Y-M-D'
let time = new Date(date).getDay() let time = new Date(date).getDay()
@@ -163,6 +164,19 @@ function autoComma(number) {
} }
} }
//节流
function throttle(fn, delay = 200) {
var timer = null;
return function () {
console.log('throttle')
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
};
}
//把token存到cookie //把token存到cookie
//name 字段名 value 字段值 perpetual 有效期 //name 字段名 value 字段值 perpetual 有效期
const setCookie = (name, value, perpetual) => { const setCookie = (name, value, perpetual) => {
@@ -201,7 +215,7 @@ function getCookie(name) {
//滚动加载信息 //滚动加载信息
const scrollLoad = (e) => { const scrollLoad = (e) => {
// console.log("滚动", e, b); // console.log("滚动", e, b);
const { target } = e; const {target} = e;
const scrllHeight = target.scrollHeight - target.scrollTop; const scrllHeight = target.scrollHeight - target.scrollTop;
const clientHeight = target.clientHeight; const clientHeight = target.clientHeight;
// console.log("scrllHeight", scrllHeight, clientHeight); // console.log("scrllHeight", scrllHeight, clientHeight);
@@ -422,6 +436,7 @@ const organizationalTree = []
const iframeUrl = "https://u-pre.boe.com/pc/iframe" const iframeUrl = "https://u-pre.boe.com/pc/iframe"
export { export {
throttle,
toDate, toDate,
getWeek, getWeek,
autoComma, autoComma,

View File

@@ -20,7 +20,7 @@
</template> </template>
<script> <script>
import {onMounted, reactive, toRefs, watch} from "vue"; import {onMounted, reactive, toRefs, watch} from "vue";
import {scrollLoad} from "@/api/method"; import {scrollLoad, throttle} from "@/api/method";
import * as api1 from "@/api/index1"; import * as api1 from "@/api/index1";
export default { export default {
@@ -46,8 +46,9 @@ export default {
loading: false, loading: false,
init: false init: false
}); });
const getMemberThrottle = throttle(getMember, 500)
watch(() => state.memberParam, getMember) watch(() => state.memberParam, getMemberThrottle)
watch(props, init) watch(props, init)
onMounted(() => { onMounted(() => {
@@ -57,15 +58,24 @@ export default {
function getMember() { function getMember() {
state.loading = true state.loading = true
state.options = []
getMemberData()
}
function getMemberData() {
api1.getMemberInfo(state.memberParam).then((res) => { api1.getMemberInfo(state.memberParam).then((res) => {
const list = res.data.data.rows.filter(e => !props.value?.includes(e.id + '')).map(e => ({ const list = res.data.data.rows.filter(e => !props.value?.includes(e.id + '')).map(e => ({
label: e.realName, label: e.realName,
value: e.id value: e.id
})); }));
state.options.push(...list) if (state.memberParam.pageNo === 1 && props.value) {
const arrManagerId = props.value.split(',')
const arrManager = props.name.split(',')
state.options = [...arrManager.map((e, i) => ({label: e, value: arrManagerId[i]})), ...list]
} else state.options.push(...list)
state.loading = false state.loading = false
}); });
} }
const memberScroll = (e) => { const memberScroll = (e) => {
@@ -82,17 +92,26 @@ export default {
}; };
function init() { function init() {
if (!props.value) { console.log('init--', props)
state.managerArray = []
return;
}
if (props.value !== state.managerArray.join(',')) { if (props.value !== state.managerArray.join(',')) {
if (props.value) {
const arrManager = props.name.split(',') const arrManager = props.name.split(',')
const arrManagerId = props.value.split(',') const arrManagerId = props.value.split(',')
state.managerArray = arrManagerId state.managerArray = arrManagerId
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]})) state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
} else {
state.managerArray = []
}
getMemberData()
return;
}
if (!props.value) {
if (!(state.options && state.options.length)) {
state.options = []
getMember() getMember()
} }
return;
}
} }
function change(e, l) { function change(e, l) {

View File

@@ -347,7 +347,7 @@
</div> </div>
</div> </div>
<div class="modalMain"> <div class="modalMain">
<router-link :to="`/projectadd?parentId=${projectInfo.parentId}&parentName=${projectInfo.parentName}`"> <router-link :to="`/projectadd?parentId=${projectInfo.parentId || ''}&parentName=${projectInfo.parentName || ''}`">
<div <div
class="taskbox" class="taskbox"
style=" style="