This commit is contained in:
yuping
2023-02-19 16:00:54 +08:00
parent 0382af8507
commit ecacb0c980

View File

@@ -98,33 +98,19 @@
<div class="inname">项目时间</div> <div class="inname">项目时间</div>
</div> </div>
<div v-if="projectInfo.projectId" class="in"> <div class="in">
<a-range-picker <a-range-picker
separator="至" separator="至"
:show-time="{ format: 'HH:mm' }" :show-time="{ format: 'HH:mm' }"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间2', ' 结束时间2']"
:disabled-date="disabledDate1" :disabledDate="disabledDate"
v-model:value="projectInfo.rangeTime" v-model:value="projectInfo.rangeTime"
@calendarChange="calendarChange"
style="width: 100%; height: 40px; border-radius: 5px" style="width: 100%; height: 40px; border-radius: 5px"
:allowClear="false" :allowClear="false"
valueFormat="YYYY-MM-DD HH:mm" valueFormat="YYYY-MM-DD HH:mm"
@change="timeChange" @change="timeChange"
@ok="clickOk" :disabled="!!viewDetail"
@openChange="panelOpen"
:disabled="viewDetail ? true : false"
/>
</div>
<div v-else class="in">
<a-range-picker
separator="至"
:show-time="{ format: 'HH:mm' }"
:placeholder="[' 开始时间', ' 结束时间']"
v-model:value="projectInfo.rangeTime"
style="width: 100%; height: 40px; border-radius: 5px"
valueFormat="YYYY-MM-DD HH:mm"
@change="timeChange"
:disabled="viewDetail ? true : false"
/> />
</div> </div>
</div> </div>
@@ -330,13 +316,14 @@ export default {
const routers = useRoute(); const routers = useRoute();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
datePartial: 'start',
loading: false, loading: false,
currentPage: 1, //当前页 currentPage: 1, //当前页
tableDataTotal: -1, //模版列表总数 tableDataTotal: -1, //模版列表总数
pageSize: 10, //每页10条数据 pageSize: 10, //每页10条数据
totalPages: 0, //总页数 totalPages: 0, //总页数
viewDetail: null, viewDetail: null,
projectInfo: {}, projectInfo: {id: ''},
projectPic: [], projectPic: [],
memberParam: { memberParam: {
pageNo: 1, pageNo: 1,
@@ -397,13 +384,6 @@ export default {
state.projectInfo.endTime, state.projectInfo.endTime,
]; ];
state.projectInfo.rangeTime1 = [
state.projectInfo.beginTime,
state.projectInfo.endTime,
];
state.projectInfo.edits = true;
state.courseSyncFlag = !!state.projectInfo.courseSyncFlag; state.courseSyncFlag = !!state.projectInfo.courseSyncFlag;
if (Number(state.projectInfo.status) === -5) { if (Number(state.projectInfo.status) === -5) {
let obj = { let obj = {
@@ -546,44 +526,24 @@ export default {
state.projectInfo.sourceBelongFullName = orgName; state.projectInfo.sourceBelongFullName = orgName;
} }
const clickOk = (e) => {
state.clickNum = state.clickNum + 1
if (state.clickNum == 2) {
state.clickNum = 0
state.changeCondition = false;
} else {
state.changeCondition = true;
}
console.log(e)
}
const panelOpen = (e) => {
console.log(e)
if (!e) {
state.clickNum = 0
state.changeCondition = false;
}
}
const disabledDate1 = (current) => {
if (state.changeCondition) {
return current && current < moment(state.projectInfo.rangeTime[0]).endOf("YYYY-MM-DD HH:mm:ss");
} else {
return current && current > moment(state.projectInfo.rangeTime1[0]).endOf("YYYY-MM-DD HH:mm:ss")
}
};
const disabledDate = (current) => { const disabledDate = (current) => {
return current && current < dayjs().startOf("day"); //编辑的时候 开始实际只能选当前时间之前的时间
if (state.projectInfo.projectId && state.datePartial === 'start') {
return current && current > dayjs(state.projectInfo?.rangeTime[0]).endOf("YYYY-MM-DD HH:mm");
}
return current && current < dayjs().endOf('day');
}; };
function calendarChange(date, dateStr, partial) {
state.datePartial = partial
}
return { return {
...toRefs(state), ...toRefs(state),
disabledDate, disabledDate,
disabledDate1,
clickOk,
panelOpen,
managerChange, managerChange,
calendarChange,
timeChange, timeChange,
classificationChange, classificationChange,
classificationChange5, classificationChange5,