mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 05:46:45 +08:00
-- 项目经理
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
|
||||
function formatNumber(n) {
|
||||
n = n.toString();
|
||||
return n[1] ? n : "0" + n;
|
||||
}
|
||||
|
||||
function toDate(number, format) {
|
||||
var formateArr = ["Y", "M", "D", "h", "m", "s"];
|
||||
var returnArr = [];
|
||||
@@ -25,6 +25,7 @@ function toDate(number, format) {
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
function getWeek(date) {
|
||||
//date:'Y-M-D'
|
||||
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
|
||||
//name 字段名 value 字段值 perpetual 有效期
|
||||
const setCookie = (name, value, perpetual) => {
|
||||
@@ -201,7 +215,7 @@ function getCookie(name) {
|
||||
//滚动加载信息
|
||||
const scrollLoad = (e) => {
|
||||
// console.log("滚动", e, b);
|
||||
const { target } = e;
|
||||
const {target} = e;
|
||||
const scrllHeight = target.scrollHeight - target.scrollTop;
|
||||
const clientHeight = target.clientHeight;
|
||||
// console.log("scrllHeight", scrllHeight, clientHeight);
|
||||
@@ -422,6 +436,7 @@ const organizationalTree = []
|
||||
|
||||
const iframeUrl = "https://u-pre.boe.com/pc/iframe"
|
||||
export {
|
||||
throttle,
|
||||
toDate,
|
||||
getWeek,
|
||||
autoComma,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import {onMounted, reactive, toRefs, watch} from "vue";
|
||||
import {scrollLoad} from "@/api/method";
|
||||
import {scrollLoad, throttle} from "@/api/method";
|
||||
import * as api1 from "@/api/index1";
|
||||
|
||||
export default {
|
||||
@@ -46,8 +46,9 @@ export default {
|
||||
loading: false,
|
||||
init: false
|
||||
});
|
||||
const getMemberThrottle = throttle(getMember, 500)
|
||||
|
||||
watch(() => state.memberParam, getMember)
|
||||
watch(() => state.memberParam, getMemberThrottle)
|
||||
watch(props, init)
|
||||
|
||||
onMounted(() => {
|
||||
@@ -57,15 +58,24 @@ export default {
|
||||
|
||||
function getMember() {
|
||||
state.loading = true
|
||||
state.options = []
|
||||
getMemberData()
|
||||
}
|
||||
|
||||
|
||||
function getMemberData() {
|
||||
api1.getMemberInfo(state.memberParam).then((res) => {
|
||||
const list = res.data.data.rows.filter(e => !props.value?.includes(e.id + '')).map(e => ({
|
||||
label: e.realName,
|
||||
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
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const memberScroll = (e) => {
|
||||
@@ -82,17 +92,26 @@ export default {
|
||||
};
|
||||
|
||||
function init() {
|
||||
if (!props.value) {
|
||||
state.managerArray = []
|
||||
return;
|
||||
}
|
||||
console.log('init--', props)
|
||||
if (props.value !== state.managerArray.join(',')) {
|
||||
if (props.value) {
|
||||
const arrManager = props.name.split(',')
|
||||
const arrManagerId = props.value.split(',')
|
||||
state.managerArray = arrManagerId
|
||||
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()
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function change(e, l) {
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modalMain">
|
||||
<router-link :to="`/projectadd?parentId=${projectInfo.parentId}&parentName=${projectInfo.parentName}`">
|
||||
<router-link :to="`/projectadd?parentId=${projectInfo.parentId || ''}&parentName=${projectInfo.parentName || ''}`">
|
||||
<div
|
||||
class="taskbox"
|
||||
style="
|
||||
|
||||
Reference in New Issue
Block a user