甘特图新增功能id的处理
This commit is contained in:
parent
e6d68d55d8
commit
fb4cc47beb
@ -85,6 +85,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
// 父级传过来的参数
|
||||||
|
window.addEventListener('message', function(e) {
|
||||||
|
console.log(e.data, '父级页面传来的数据')
|
||||||
|
localStorage.setItem('id',e.data)
|
||||||
|
})
|
||||||
//页面加载就绪
|
//页面加载就绪
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
console.log("window.onload");
|
console.log("window.onload");
|
||||||
@ -164,15 +169,15 @@
|
|||||||
// },
|
// },
|
||||||
// ],
|
// ],
|
||||||
};
|
};
|
||||||
console.log("参数传进去了吗", data.PredecessorLink);
|
// console.log("参数传进去了吗", data.PredecessorLink);
|
||||||
if (dataArr[i].children.length > 0) {
|
if (dataArr[i].children.length > 0) {
|
||||||
let threeData = dataArr[i].children;
|
let threeData = dataArr[i].children;
|
||||||
let threeNum = 0;
|
let threeNum = 0;
|
||||||
for (let j = 0; j < dataArr[i].children.length; j++) {
|
for (let j = 0; j < dataArr[i].children.length; j++) {
|
||||||
console.log(
|
// console.log(
|
||||||
"有关联的前置任务嘛",
|
// "有关联的前置任务嘛",
|
||||||
dataArr[i].children[j].predecessorIds
|
// dataArr[i].children[j].predecessorIds
|
||||||
);
|
// );
|
||||||
number++;
|
number++;
|
||||||
let children = {
|
let children = {
|
||||||
id: dataArr[i].children[j].id,
|
id: dataArr[i].children[j].id,
|
||||||
@ -529,7 +534,6 @@
|
|||||||
|
|
||||||
//右侧 拖拽
|
//右侧 拖拽
|
||||||
var itemdragcomplete = (e) => {
|
var itemdragcomplete = (e) => {
|
||||||
// console.log('=====拖拽回调',e)
|
|
||||||
let requestData = {
|
let requestData = {
|
||||||
id: e.item.id,
|
id: e.item.id,
|
||||||
projectSn: projectSn,
|
projectSn: projectSn,
|
||||||
@ -632,10 +636,11 @@
|
|||||||
position:absolute;
|
position:absolute;
|
||||||
top: 20%;
|
top: 20%;
|
||||||
left: 30%;
|
left: 30%;
|
||||||
z-index: 9999;
|
z-index: 999;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
.addbox{
|
.addbox{
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
@ -650,6 +655,7 @@
|
|||||||
width:80px;
|
width:80px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
margin-left: 80px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -97,6 +97,7 @@ mini.extend(GanttMenu, mini.Menu, {
|
|||||||
console.log("点击新增执行",e);
|
console.log("点击新增执行",e);
|
||||||
var gantt = this.owner;
|
var gantt = this.owner;
|
||||||
var targetTask = gantt.getSelected();
|
var targetTask = gantt.getSelected();
|
||||||
|
console.log('新增选中的',targetTask)
|
||||||
var task = gantt.newTask()
|
var task = gantt.newTask()
|
||||||
let url = window.parent.document.getElementById("iframe").contentWindow.location.search;
|
let url = window.parent.document.getElementById("iframe").contentWindow.location.search;
|
||||||
var parameter = url.split("="); //所有参数
|
var parameter = url.split("="); //所有参数
|
||||||
@ -104,13 +105,13 @@ mini.extend(GanttMenu, mini.Menu, {
|
|||||||
var projectSn = parameter[2].split("&")[0]; //projectSn
|
var projectSn = parameter[2].split("&")[0]; //projectSn
|
||||||
// var createUserId = store.state.userInfo.userId
|
// var createUserId = store.state.userInfo.userId
|
||||||
//加到选中任务之后
|
//加到选中任务之后
|
||||||
// gantt.addTask(task, "after", targetTask);
|
|
||||||
document.getElementById('addDiv').style.display = 'block';
|
document.getElementById('addDiv').style.display = 'block';
|
||||||
console.log('vvvvv',document.getElementById('addDiv'))
|
|
||||||
document.getElementById('cancel').onclick=function(){
|
document.getElementById('cancel').onclick=function(){
|
||||||
document.getElementById('addDiv').style.display = 'none';
|
document.getElementById('addDiv').style.display = 'none';
|
||||||
}
|
}
|
||||||
document.getElementById('submit').onclick=function(){
|
document.getElementById('submit').onclick=function(){
|
||||||
|
let userid = localStorage.getItem('id')
|
||||||
let data = {}
|
let data = {}
|
||||||
data.taskName = document.getElementById("taskName").value;
|
data.taskName = document.getElementById("taskName").value;
|
||||||
data.duration = document.getElementById("duration").value;
|
data.duration = document.getElementById("duration").value;
|
||||||
@ -121,20 +122,21 @@ mini.extend(GanttMenu, mini.Menu, {
|
|||||||
data.actualStartDate = document.getElementById("actualStartDate").value;
|
data.actualStartDate = document.getElementById("actualStartDate").value;
|
||||||
data.actualFinishDate = document.getElementById("actualFinishDate").value;
|
data.actualFinishDate = document.getElementById("actualFinishDate").value;
|
||||||
data.remark = document.getElementById("remark").value;
|
data.remark = document.getElementById("remark").value;
|
||||||
console.log('data',data)
|
console.log('新增的参数',data)
|
||||||
// document.getElementById('addDiv').style.display = 'none';
|
if(typeof(targetTask) != "undefined") {
|
||||||
// if (!targetTask) {
|
data.parentId = e.targetTask.id
|
||||||
// data.parentId = e.task.id
|
}
|
||||||
// }
|
|
||||||
data.projectSn = projectSn
|
data.projectSn = projectSn
|
||||||
data.createUserId = '4'
|
data.createUserId = userid
|
||||||
console.log('data',data)
|
|
||||||
axios
|
axios
|
||||||
.post(requestUrl + "xmgl/progressTask/addProgressTask", data)
|
.post(requestUrl + "xmgl/progressTask/addProgressTask", data)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('====新增',res)
|
document.getElementById('addDiv').style.display = 'none';
|
||||||
alert('新增成功!')
|
console.log('res',res)
|
||||||
document.getElementById('addDiv').style.display = 'none';
|
if(res.data.code == 200){
|
||||||
|
alert('新增成功!')
|
||||||
|
// gantt.loadTasks();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
</gantt-elastic> -->
|
</gantt-elastic> -->
|
||||||
<!-- <gantt-header slot="header"></gantt-header>
|
<!-- <gantt-header slot="header"></gantt-header>
|
||||||
<gantt-footer slot="footer"></gantt-footer> -->
|
<gantt-footer slot="footer"></gantt-footer> -->
|
||||||
<iframe :src="'doc/ExtGantt/Ext甘特图.html?url='+baseURL+'&projectSn='+projectSn+'&token='+$store.state.userInfo.token" id="iframe" class="Extgantt" > </iframe>
|
<iframe @load="load" :src="'doc/ExtGantt/Ext甘特图.html?url='+baseURL+'&projectSn='+projectSn+'&token='+$store.state.userInfo.token" id="iframe" class="Extgantt" > </iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -25,6 +25,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
baseURL:'',
|
baseURL:'',
|
||||||
projectSn:'',
|
projectSn:'',
|
||||||
|
userId:"",
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
id: 99,
|
id: 99,
|
||||||
@ -265,7 +266,14 @@ export default {
|
|||||||
created(){
|
created(){
|
||||||
this.baseURL = this.$http.defaults.baseURL;
|
this.baseURL = this.$http.defaults.baseURL;
|
||||||
this.projectSn = this.$store.state.projectSn;
|
this.projectSn = this.$store.state.projectSn;
|
||||||
|
this.userId = this.$store.state.userInfo.userId
|
||||||
},
|
},
|
||||||
|
methods:{
|
||||||
|
load() {
|
||||||
|
var idom = document.getElementById('iframe').contentWindow;
|
||||||
|
idom.postMessage(this.userId)
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user