|
@@ -10,36 +10,31 @@
|
|
|
@close="onClose">
|
|
|
<div class="drawer__panel" >
|
|
|
<el-row :gutter="20" style="border-bottom:1px solid #f1f2f3">
|
|
|
- <el-form :model="form" :rules="rules" ref="form" label-width="110px" label-position="right" size="mini">
|
|
|
+ <el-form :model="stageData" :rules="rules" ref="form" label-width="110px" label-position="right" size="mini">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="项目模板名称" prop="stagetempname">
|
|
|
- <el-input v-model="form.stagetempname" placeholder="项目模板名称"></el-input>
|
|
|
+ <el-input v-model="stageData.stagetempname" placeholder="项目模板名称"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="项目类型">
|
|
|
- <el-select v-model="form.projecttype" style="width:100%">
|
|
|
+ <el-select v-model="stageData.projecttype" style="width:100%">
|
|
|
<el-option v-for="item in sys_options" :key="item.index" :value="item.value" :label="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-<!-- <el-col :span="24">
|
|
|
- <el-form-item label="备注" prop="remarks">
|
|
|
- <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>-->
|
|
|
<el-col :span="10">
|
|
|
<el-form-item>
|
|
|
<div style="display:flex">
|
|
|
- <el-checkbox :true-label="1" :false-label="0" v-model="form.isused" checked="checked">启用</el-checkbox>
|
|
|
+ <el-checkbox :true-label="1" :false-label="0" v-model="stageData.isused" checked="checked">启用</el-checkbox>
|
|
|
<!-- <el-checkbox :true-label="1" :false-label="0" v-model="form.locked">锁定</el-checkbox>-->
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
- <el-button size="mini" @click="onSet" v-show="setEvent" style="margin-top: 10px">设置项目阶段</el-button>
|
|
|
- <div class="container" v-show="set">
|
|
|
+ <!-- <el-button size="mini" @click="onSet" v-show="setEvent" style="margin-top: 10px">设置项目阶段</el-button> -->
|
|
|
+ <div class="container" style="font-size:14px;" >
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="9">
|
|
|
<div>
|
|
@@ -47,7 +42,7 @@
|
|
|
<p>项目阶段</p>
|
|
|
<div>
|
|
|
<el-button size="mini" type="default" @click="addStage">添加阶段</el-button>
|
|
|
- <el-button size="mini" type="default" @click="deleteStage">删除阶段</el-button>
|
|
|
+ <el-button size="mini" type="default" @click="deleteStage" :disabled="stageData.sa_projstagetempStages.length === 1">删除阶段</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
@@ -70,7 +65,6 @@
|
|
|
v-model="stage.stagename"
|
|
|
ref="editTagInput"
|
|
|
size="small"
|
|
|
- @keyup.enter.native="updateStage(stage)"
|
|
|
>
|
|
|
</el-input>
|
|
|
<div v-else class="flex-align-center flex-between" >
|
|
@@ -121,7 +115,7 @@
|
|
|
</div>
|
|
|
<div class="fixed__btn__panel">
|
|
|
<el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="onClose" class="normal-btn-width">确 定</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="saveStageData" class="normal-btn-width">确 定</el-button>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</div>
|
|
@@ -133,19 +127,9 @@ export default {
|
|
|
name: "add",
|
|
|
data(){
|
|
|
return {
|
|
|
- set:false,
|
|
|
- setEvent:true,
|
|
|
dialogFormVisible:false,
|
|
|
isordercheck:true,
|
|
|
isusedcheck:false,
|
|
|
- form:{
|
|
|
- "sa_projstagetempid": 0,
|
|
|
- "stagetempname":"",
|
|
|
- "remarks":"",
|
|
|
- "projecttype":"",
|
|
|
- "isused":1,
|
|
|
- "locked":0
|
|
|
- },
|
|
|
rules:{
|
|
|
stagetempname:[
|
|
|
{ required: true, message: '请输入模板名称', trigger: 'blur'},
|
|
@@ -158,7 +142,7 @@ export default {
|
|
|
act_stageIndex:0,
|
|
|
act_workIndex:null,
|
|
|
stageData: {
|
|
|
- "sa_projstagetempid": '',
|
|
|
+ "sa_projstagetempid": 0,
|
|
|
"stagetempname": '',
|
|
|
"remarks":'',
|
|
|
"projecttype": '',
|
|
@@ -228,31 +212,10 @@ export default {
|
|
|
this.onSubmit()
|
|
|
},
|
|
|
onClose(){
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$refs['form'].resetFields()
|
|
|
- this.$emit('onSuccess')
|
|
|
- this.set = false
|
|
|
- this.setEvent = true
|
|
|
- },
|
|
|
-
|
|
|
- // 查询阶段数据
|
|
|
- async getStageData(data) {
|
|
|
- const res = await this.$api.requested({
|
|
|
- "id": "20221019085904",
|
|
|
- "content": {
|
|
|
- "sa_projstagetempid":data.sa_projstagetempid
|
|
|
- }
|
|
|
- })
|
|
|
- console.log("查询阶段数据")
|
|
|
- console.log(res)
|
|
|
- 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)
|
|
|
- }
|
|
|
+ console.log(this.stageData)
|
|
|
+ // this.dialogFormVisible = false
|
|
|
+ // this.$refs['form'].resetFields()
|
|
|
+ // this.$emit('onSuccess')
|
|
|
},
|
|
|
|
|
|
// 保存完整数据
|
|
@@ -262,6 +225,9 @@ export default {
|
|
|
"content":this.stageData
|
|
|
})
|
|
|
this.stageData = Object.assign({},this.stageData,res.data)
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ })
|
|
|
},
|
|
|
// 显示编辑阶段输入框
|
|
|
editStage (index) {
|
|
@@ -270,43 +236,28 @@ export default {
|
|
|
},
|
|
|
// 新增阶段
|
|
|
async addStage(data) {
|
|
|
- data = this.form
|
|
|
- let obj = {
|
|
|
- "sa_projstagetempid":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(this.form)
|
|
|
+ this.stageData.sa_projstagetempStages.push(
|
|
|
+ {
|
|
|
+ "sa_projstagetemp_stageid": 0,
|
|
|
+ "stagename": "阶段一",
|
|
|
+ "remarks": "",
|
|
|
+ "sequence": 0,
|
|
|
+ "sa_projstagetempWorks": [
|
|
|
+ {
|
|
|
+ "sa_projstagetemp_workid":0,
|
|
|
+ "workname": "工作一",
|
|
|
+ "remarks": "",
|
|
|
+ "sequence": 0,
|
|
|
+ "score": 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ )
|
|
|
},
|
|
|
// 删除阶段
|
|
|
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)
|
|
|
+ this.stageData.sa_projstagetempStages.splice(this.act_stageIndex,1)
|
|
|
},
|
|
|
// 新增工作内容
|
|
|
addNewWork (data) {
|
|
@@ -318,36 +269,15 @@ export default {
|
|
|
"sequence": 1,
|
|
|
"score": 1,
|
|
|
"sa_projstagetemp_workid":0,
|
|
|
- "sa_projstagetemp_stageid": this.stageData.sa_projstagetempStages[this.act_stageIndex].sa_projstagetemp_stageid,
|
|
|
- "sa_projstagetempid":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.updateWork(obj)
|
|
|
},
|
|
|
// 删除工作内容
|
|
|
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.tool.showMessage(res,()=>{
|
|
|
- this.getStageData()
|
|
|
- })
|
|
|
+ this.act_workIndex = 0
|
|
|
+ this.stageData.sa_projstagetempStages[this.act_workIndex].splice(this.act_workIndex,1)
|
|
|
},
|
|
|
|
|
|
dragstart(index) {
|