|
@@ -10,76 +10,89 @@
|
|
|
:withHeader="false"
|
|
|
size="50%">
|
|
|
<div class="flex-align-center flex-between container" style="border-bottom:1px solid #f1f2f3">
|
|
|
- <div style="font-size:20px">模板</div>
|
|
|
+ <div style="font-size:20px">{{data.stagetempname}}</div>
|
|
|
<div>
|
|
|
- <el-button type="primary" @click="dialogStageVisible = false" size="small">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="saveStageData(dialogStageVisible = false)" size="small">确 定</el-button>
|
|
|
<!-- <el-button @click="dialogStageVisible = false" size="small">取 消</el-button> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="container">
|
|
|
- <div class="container">
|
|
|
- <div class="flex-align-stretch">
|
|
|
- <div v-for="(stage,index) in stageData.sa_projstagetempStages" :key="index" @click="(act_stageIndex = index,showEidtWork = 'hide',act_workIndex = null)">
|
|
|
- <div class="stage__panel" :class="act_stageIndex === index?'active__stage':''">
|
|
|
- <!-- <div>
|
|
|
- {{stage.stagename}}
|
|
|
- </div> -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="9">
|
|
|
+ <div>
|
|
|
+ <div class="flex-align-center flex-between normal-margin">
|
|
|
+ <p>项目阶段</p>
|
|
|
<div>
|
|
|
- <el-input
|
|
|
- style="width:100px"
|
|
|
- class="input-new-tag"
|
|
|
- v-if="act_stageIndex === index && inputVisible"
|
|
|
- v-model="stage.stagename"
|
|
|
- ref="editTagInput"
|
|
|
- size="small"
|
|
|
- @keyup.enter.native="handleInputConfirm"
|
|
|
- @blur="handleInputConfirm"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- <p v-else class="button-new-tag" size="small" @click="showEditInput">{{stage.stagename}}</p>
|
|
|
+ <el-button size="mini" type="default" @click="addStage">添加阶段</el-button>
|
|
|
+ <el-button size="mini" :disabled="stageData.sa_projstagetempStages.length === 1" type="default" @click="deleteStage">删除阶段</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="stage__panel">
|
|
|
- <div>
|
|
|
- <el-input
|
|
|
- style="width:100px"
|
|
|
- class="input-new-tag"
|
|
|
- v-if="inputVisible && !act_stageIndex"
|
|
|
- v-model="inputValue"
|
|
|
- ref="saveTagInput"
|
|
|
- size="small"
|
|
|
- @keyup.enter.native="handleInputConfirm"
|
|
|
- @blur="handleInputConfirm"
|
|
|
+ <div
|
|
|
+ v-for="(stage,index) in stageData.sa_projstagetempStages"
|
|
|
+ :key="index"
|
|
|
+ @click="(act_stageIndex = index,act_workIndex = null)"
|
|
|
+ @dragenter="dragenter($event, index,dragover,1000)"
|
|
|
+ @dragover="debounce($event, index)"
|
|
|
+ @dragstart="dragstart(index)"
|
|
|
+ draggable
|
|
|
>
|
|
|
- </el-input>
|
|
|
- <p v-else class="button-new-tag" size="small" @click="showInput">+ 新阶段</p>
|
|
|
+ <div class="stage__panel" :class="act_stageIndex === index?'active__stage':''">
|
|
|
+ <!-- <div>
|
|
|
+ {{stage.stagename}}
|
|
|
+ </div> -->
|
|
|
+ <div style="padding:0 10px;">
|
|
|
+ <el-input
|
|
|
+ class="input-new-tag"
|
|
|
+ v-if="act_stageIndex === index && inputVisible"
|
|
|
+ v-model="stage.stagename"
|
|
|
+ ref="editTagInput"
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="updateStage(stage)"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ <div v-else class="flex-align-center flex-between">
|
|
|
+ <p class="button-new-tag" size="small" @click="(inputVisible = false)">{{stage.stagename}}</p>
|
|
|
+ <i class="el-icon-edit" @click.stop="editStage(index)">编 辑</i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="work__panel"
|
|
|
- :class="act_workIndex === windex?'active__work':''"
|
|
|
- v-for="(work,windex) in stageData.sa_projstagetempStages[act_stageIndex].sa_projstagetempWorks"
|
|
|
- :key="windex"
|
|
|
- @click="(act_workIndex = windex,showEidtWork = 'show')">
|
|
|
- <div :class="act_workIndex === windex?showEidtWork==='hide'?'show':'hide':''">
|
|
|
- <!-- <p><b>{{work.workname}}</b></p> -->
|
|
|
- <el-divider content-position="left">{{work.workname}}</el-divider>
|
|
|
- <p>{{work.remarks}}</p>
|
|
|
- </div>
|
|
|
- <div class="work__panel__operation">
|
|
|
- <i class="el-icon-s-claim"></i> 
|
|
|
- <i class="el-icon-delete" @click="deleteWork(windex)"></i>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="15">
|
|
|
+ <div class="flex-align-center flex-between normal-margin">
|
|
|
+ <p>设置阶段任务</p>
|
|
|
+ <div>
|
|
|
+ <el-button size="mini" type="default" @click="addNewWork">添加工作</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div v-if="act_workIndex === windex" :class="showEidtWork" style="margin-top:20px">
|
|
|
- <el-input class="normal-margin" v-model="work.workname" size="small"></el-input>
|
|
|
- <el-input v-model="work.remarks" type="textarea" size="mini" :rows="3"></el-input>
|
|
|
+ <div style="height:calc(100vh - 141px);overflow-y:scroll">
|
|
|
+ <div class="work__panel"
|
|
|
+ :class="act_workIndex === windex?'active__work':''"
|
|
|
+ v-for="(work,windex) in stageData.sa_projstagetempStages[act_stageIndex].sa_projstagetempWorks"
|
|
|
+ :key="windex"
|
|
|
+ @click="(act_workIndex = windex)">
|
|
|
+ <div class="work__panel__operation">
|
|
|
+ <i class="el-icon-s-claim" @click="updateWork(work)"></i> 
|
|
|
+ <i class="el-icon-delete" @click="deleteWork(work)"></i>
|
|
|
+ </div>
|
|
|
+ <div style="margin-top:20px">
|
|
|
+ <el-form class="demo-form-inline" label-position="right" label-width="80px">
|
|
|
+ <el-form-item label="工作内容">
|
|
|
+ <el-input v-model="work.workname" type="textarea" size="mini" :rows="3"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="分值">
|
|
|
+ <el-input style="width:100px" class="normal-margin" v-model="work.score" size="small"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="work__panel_add" @click="addNewWork()">
|
|
|
- + 添加新工作内容
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <!-- <div class="work__panel_add" @click="addNewWork()">
|
|
|
+ + 添加新工作内容
|
|
|
+ </div> -->
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</div>
|
|
@@ -94,7 +107,6 @@ export default {
|
|
|
inputVisible:false,
|
|
|
act_stageIndex:0,
|
|
|
act_workIndex:null,
|
|
|
- showEidtWork:'hide',
|
|
|
stageData: {
|
|
|
"sa_projstagetempid": this.data.sa_projstagetempid,
|
|
|
"stagetempname": this.data.stagetempname,
|
|
@@ -107,42 +119,27 @@ export default {
|
|
|
"sa_projstagetemp_stageid": 0,
|
|
|
"stagename": "阶段一",
|
|
|
"remarks": "",
|
|
|
- "sequence": 1,
|
|
|
+ "sequence": 0,
|
|
|
"sa_projstagetempWorks": [
|
|
|
- {
|
|
|
- "workname": "工作一",
|
|
|
- "remarks": "本的 CSS 变形平行四边形其实是矩形的超集:它的各条边是两两平行的,但各个角则不一定都是直角。",
|
|
|
- "sequence": 1,
|
|
|
- "score": 1
|
|
|
- },
|
|
|
- {
|
|
|
- "workname": "工作二",
|
|
|
- "remarks": "yos23",
|
|
|
- "sequence": 1,
|
|
|
- "score": 1
|
|
|
+ {
|
|
|
+ "sa_projstagetemp_workid":0,
|
|
|
+ "workname": "工作一",
|
|
|
+ "remarks": "",
|
|
|
+ "sequence": 0,
|
|
|
+ "score": 1
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- {
|
|
|
- "sa_projstagetemp_stageid": 0,
|
|
|
- "stagename": "阶段二",
|
|
|
- "remarks": "",
|
|
|
- "sequence": 1,
|
|
|
- "sa_projstagetempWorks": [
|
|
|
- {
|
|
|
- "workname": "yos23",
|
|
|
- "remarks": "yos23",
|
|
|
- "sequence": 1,
|
|
|
- "score": 1
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+
|
|
|
]
|
|
|
},
|
|
|
- inputValue:''
|
|
|
+ inputValue:'',
|
|
|
+ dragIndex: '',
|
|
|
+ enterIndex: '',
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
+ // 查询阶段数据
|
|
|
async getStageData() {
|
|
|
const res = await this.$api.requested({
|
|
|
"id": "20221019085904",
|
|
@@ -150,63 +147,143 @@ export default {
|
|
|
"sa_projstagetempid":this.data.sa_projstagetempid
|
|
|
}
|
|
|
})
|
|
|
+ if (res.data.sa_projstagetempStages.length === 0) {
|
|
|
+ this.saveStageData()
|
|
|
+ } else {
|
|
|
+ res.data.sa_projstagetempStages.forEach((e,index) => {
|
|
|
+ e.sequence = index
|
|
|
+ });
|
|
|
+ this.stageData = Object.assign({},this.stageData,res.data)
|
|
|
+ }
|
|
|
},
|
|
|
onShow () {
|
|
|
this.dialogStageVisible = true
|
|
|
this.getStageData()
|
|
|
},
|
|
|
- editWork () {
|
|
|
- this.showEidtWork = 'show'
|
|
|
+
|
|
|
+ // 保存完整数据
|
|
|
+ async saveStageData () {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221020084204",
|
|
|
+ "content":this.stageData
|
|
|
+ })
|
|
|
+ this.stageData = Object.assign({},this.stageData,res.data)
|
|
|
+ },
|
|
|
+ // 显示编辑阶段输入框
|
|
|
+ editStage (index) {
|
|
|
+ this.act_stageIndex = index
|
|
|
+ this.inputVisible = true
|
|
|
+ },
|
|
|
+ // 新增阶段
|
|
|
+ async addStage() {
|
|
|
+ let obj = {
|
|
|
+ "sa_projstagetempid":this.data.sa_projstagetempid,
|
|
|
+ "sa_projstagetemp_stageid": 0,
|
|
|
+ "stagename": '新阶段',
|
|
|
+ "remarks": "",
|
|
|
+ "sequence": this.stageData.sa_projstagetempStages.length,
|
|
|
+ "sa_projstagetempWorks": []
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221019090104",
|
|
|
+ "content": obj
|
|
|
+ })
|
|
|
+ this.getStageData()
|
|
|
},
|
|
|
+ // 删除阶段
|
|
|
+ async deleteStage () {
|
|
|
+ let id = this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetemp_stageid
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id":"20221019090204",
|
|
|
+ "content": {
|
|
|
+ "sa_projstagetemp_stageids":[id]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.act_stageIndex = 0
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.getStageData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 更新阶段请求
|
|
|
+ async updateStage (stage) {
|
|
|
+ this.inputVisible = false
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221019090104",
|
|
|
+ "content": stage
|
|
|
+ })
|
|
|
+ this.stageData = Object.assign({},this.stageData,res.data)
|
|
|
+ },
|
|
|
+ // 新增工作内容
|
|
|
addNewWork () {
|
|
|
let stage = this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetempWorks
|
|
|
- stage.push({
|
|
|
+ let obj = {
|
|
|
"workname": "新工作",
|
|
|
"remarks": "新工作内容",
|
|
|
"sequence": 1,
|
|
|
- "score": 1
|
|
|
+ "score": 1,
|
|
|
+ "sa_projstagetemp_workid":0,
|
|
|
+ "sa_projstagetemp_stageid": this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetemp_stageid,
|
|
|
+ "sa_projstagetempid":this.data.sa_projstagetempid,
|
|
|
+ }
|
|
|
+ stage.push(obj)
|
|
|
+ this.updateWork(obj)
|
|
|
+ },
|
|
|
+ // 更新工作内容
|
|
|
+ async updateWork (work) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221019090504",
|
|
|
+ "content": work
|
|
|
+ })
|
|
|
+ this.stageData = Object.assign({},this.stageData,res.data)
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+
|
|
|
})
|
|
|
- this.act_workIndex = stage.length - 1
|
|
|
- this.showEidtWork = 'show'
|
|
|
},
|
|
|
- deleteWork (windex) {
|
|
|
- let stage = this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetempWorks
|
|
|
- stage = stage.filter((e,index)=>{
|
|
|
- if (index !== windex) {
|
|
|
- return e
|
|
|
+ // 删除工作内容
|
|
|
+ async deleteWork (work) {
|
|
|
+ console.log(work)
|
|
|
+ let id = work.sa_projstagetemp_workid
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id":"20221019090604",
|
|
|
+ "content": {
|
|
|
+ "sa_projstagetemp_workids":[id]
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
- this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetempWorks = stage
|
|
|
- console.log(stage)
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.getStageData()
|
|
|
+ })
|
|
|
},
|
|
|
- showInput() {
|
|
|
- this.act_stageIndex = null
|
|
|
- this.inputVisible = true;
|
|
|
- this.$nextTick(_ => {
|
|
|
- this.$refs.saveTagInput.$refs.input.focus();
|
|
|
- });
|
|
|
+
|
|
|
+ dragstart(index) {
|
|
|
+ this.dragIndex = index;
|
|
|
},
|
|
|
- showEditInput () {
|
|
|
- this.inputVisible = true;
|
|
|
- this.$nextTick(_ => {
|
|
|
- this.$refs.editTagInput.$refs.input.focus();
|
|
|
- });
|
|
|
+ dragenter(e, index) {
|
|
|
+ e.preventDefault();
|
|
|
+ // 避免源对象触发自身的dragenter事件
|
|
|
+ if (this.dragIndex !== index) {
|
|
|
+ const source = this.stageData.sa_projstagetempStages[this.dragIndex];
|
|
|
+ this.stageData.sa_projstagetempStages.splice(this.dragIndex, 1);
|
|
|
+ this.stageData.sa_projstagetempStages.splice(index, 0, source);
|
|
|
+ // 排序变化后目标对象的索引变成源对象的索引
|
|
|
+ this.dragIndex = index;
|
|
|
+ this.stageData.sa_projstagetempStages.forEach((e,idx)=>{
|
|
|
+ e.sequence = idx
|
|
|
+ })
|
|
|
+ this.saveStageData()
|
|
|
+ }
|
|
|
},
|
|
|
- handleInputConfirm() {
|
|
|
- let inputValue = this.inputValue;
|
|
|
- if (inputValue) {
|
|
|
- this.stageData.sa_projstagetempStages.push({
|
|
|
- "sa_projstagetemp_stageid": 0,
|
|
|
- "stagename": this.inputValue,
|
|
|
- "remarks": "yos",
|
|
|
- "sequence": 1,
|
|
|
- "sa_projstagetempWorks": []
|
|
|
- });
|
|
|
+ debounce (event,index,fn,delay) {
|
|
|
+ let timerid
|
|
|
+ return function () {
|
|
|
+ clearTimeout(timerid)
|
|
|
+ timerid = setTimeout(fn(event,index),delay)
|
|
|
}
|
|
|
- this.inputVisible = false;
|
|
|
- this.inputValue = '';
|
|
|
- }
|
|
|
+ },
|
|
|
+ dragover(e, index) {
|
|
|
+ e.preventDefault();
|
|
|
+ console.log('end')
|
|
|
+ },
|
|
|
+
|
|
|
},
|
|
|
create () {
|
|
|
|
|
@@ -220,26 +297,22 @@ export default {
|
|
|
.stage__panel{
|
|
|
height: 42px;
|
|
|
line-height: 42px;
|
|
|
- width:150px;
|
|
|
- transform: skewX(-45deg);
|
|
|
- margin-left:15px;
|
|
|
+ margin-bottom:10px;
|
|
|
text-align: center;
|
|
|
cursor: pointer;
|
|
|
background: #f1f2f3;
|
|
|
+
|
|
|
}
|
|
|
.active__stage {
|
|
|
background: #3874f6;
|
|
|
color:#fff
|
|
|
}
|
|
|
-.stage__panel > div {
|
|
|
- transform: skewX(45deg);
|
|
|
- }
|
|
|
.work__panel{
|
|
|
position: relative;
|
|
|
- width:400px;
|
|
|
- margin: 16px 0 0px 0;
|
|
|
+ /* width:400px; */
|
|
|
padding:10px;
|
|
|
- border:2px solid #fff;
|
|
|
+ margin-bottom:10px;
|
|
|
+ border:2px solid #f1f2f3;
|
|
|
font-size:14px;
|
|
|
border-radius: 4px;
|
|
|
cursor: pointer;
|
|
@@ -248,6 +321,7 @@ export default {
|
|
|
border:2px dashed #3874f6;
|
|
|
}
|
|
|
.active__work{
|
|
|
+ margin-bottom:10px;
|
|
|
border:2px dashed #3874f6;
|
|
|
}
|
|
|
.work__panel__operation{
|
|
@@ -256,6 +330,7 @@ export default {
|
|
|
right:0px;
|
|
|
top:0px;
|
|
|
padding:2px 10px;
|
|
|
+
|
|
|
background: #3874f6;
|
|
|
color:#fff;
|
|
|
z-index: 999;
|
|
@@ -269,14 +344,11 @@ export default {
|
|
|
.show{
|
|
|
display: block;
|
|
|
}
|
|
|
-.work__panel_add{
|
|
|
- width:400px;
|
|
|
- margin: 16px 0 0px 0;
|
|
|
- padding:10px;
|
|
|
- font-size:14px;
|
|
|
- color:#666;
|
|
|
- border-radius: 4px;
|
|
|
- cursor: pointer;
|
|
|
- border:2px dashed #ccc;
|
|
|
+.button-new-tag{
|
|
|
+ flex:1;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+.sort-move {
|
|
|
+ transition: transform 0.3s;
|
|
|
}
|
|
|
</style>
|