|
@@ -1,472 +1,242 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-button size="small" type="primary" @click="onShow">新 建</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="(drawer = true)">新 建</el-button>
|
|
|
<el-drawer
|
|
|
- title="新建工作任务"
|
|
|
- :visible.sync="drawer"
|
|
|
- size="45%"
|
|
|
- direction="rtl"
|
|
|
- append-to-body
|
|
|
- :show-close="false"
|
|
|
- @close="onClose">
|
|
|
- <div class="drawer__panel" style="margin-bottom: 0px;padding-bottom: 0px">
|
|
|
- <el-row>
|
|
|
- <el-form :model="form" :rules="rules" ref="formData" size="mini" label-position="right">
|
|
|
- <el-col :span="20">
|
|
|
- <el-form-item label="工作任务:" label-width="85px" prop="taskname">
|
|
|
- <el-input v-model="form.taskname" autocomplete="off" placeholder="输入工作任务"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item label="顺序:" label-width="80px">
|
|
|
- <el-input v-model="form.sequence" autocomplete="off" placeholder="输入顺序"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="关键任务:" label-width="85px">
|
|
|
- <el-radio v-model="form.important" label="1">是</el-radio>
|
|
|
- <el-radio v-model="form.important" label="0">否</el-radio>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item >
|
|
|
- <el-checkbox v-model="form.onparties" @change="onPartiesChange">关联客户对象</el-checkbox>
|
|
|
- <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectObject"></AssociateCustomerObject>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item >
|
|
|
- <el-checkbox v-model="form.onstage" style="font-size: 14px" @change="onOnstageChange">关联项目阶段</el-checkbox>
|
|
|
- <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectStage"></AssociatedProjectPhases>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
+ title="我是标题"
|
|
|
+ :visible.sync="drawer"
|
|
|
+ direction="rtl"
|
|
|
+ append-to-body
|
|
|
+ size="80%">
|
|
|
<div class="drawer__panel">
|
|
|
- <el-row>
|
|
|
- <el-form ref="form" size="mini" label-position="right">
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item label="评估项:" label-width="60px" >
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="2">
|
|
|
- <el-form-item style="float: right;width: 100%;">
|
|
|
- <el-button size="small" type="primary" plain style="width: 100%" @click="addOptions">添加</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" >
|
|
|
- <el-form-item style="float: right;width: 100%;text-align: center">
|
|
|
- <el-table
|
|
|
- :data="form.projtaskmag_options"
|
|
|
- @expand-change="expandChange"
|
|
|
- ref="refTable"
|
|
|
- style="width: 100%"
|
|
|
- @cell-click="cellClick">
|
|
|
- <el-table-column v-if="(form.onparties || form.onstage) && showChildTable" type="expand">
|
|
|
- <template slot-scope="prop">
|
|
|
- <el-table
|
|
|
- :data="associatedData"
|
|
|
- border
|
|
|
- style="width: 100%"
|
|
|
- :span-method="oldData.length > 0? arraySpanMethod:noop">
|
|
|
- <el-table-column
|
|
|
- v-if="form.onparties"
|
|
|
- prop="partiestype"
|
|
|
- label="客户对象"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="form.onstage"
|
|
|
- prop="stagename"
|
|
|
- label="项目阶段"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="score"
|
|
|
- label="分值">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.score" placeholder=""></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="optionname"
|
|
|
- label="任务内容"
|
|
|
- width="360">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input @change="inputChange(scope.$index)" v-model="scope.row.optionname" placeholder=""></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="remarks"
|
|
|
- label="描述"
|
|
|
- width="0">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.remarks" placeholder=""></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="score"
|
|
|
- width="160"
|
|
|
- label="独立项分值">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.score" placeholder="" ></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="operation"
|
|
|
- width="100"
|
|
|
- label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" size="mini" :disabled="form.projtaskmag_options.length === 1">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- <!-- <div class="drawer__panel">
|
|
|
- <el-row>
|
|
|
- <el-form ref="form" size="mini" label-position="right">
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item label="关联信息:" label-width="75px" >
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" >
|
|
|
- <el-form-item style="float: right;width: 100%;text-align: center">
|
|
|
- <el-table
|
|
|
- :data="associatedData"
|
|
|
- border
|
|
|
- style="width: 100%"
|
|
|
- :span-method="oldData.length > 0? arraySpanMethod:noop"
|
|
|
- @row-click="rowClick">
|
|
|
- <el-table-column
|
|
|
- v-if="form.onparties"
|
|
|
- prop="value"
|
|
|
- label="客户对象"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="form.onstage"
|
|
|
- prop="stagename"
|
|
|
- label="项目阶段"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="score"
|
|
|
- label="分值">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.score" placeholder=""></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </el-row>
|
|
|
- </div> -->
|
|
|
- <div class="fixed__btn__panel">
|
|
|
- <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
|
|
|
+ <el-input v-model="form.taskname"></el-input>
|
|
|
+ <div>
|
|
|
+ <el-checkbox v-model="form.onparties" :true-label="1" :false-label="0">关联客户对象</el-checkbox>
|
|
|
+ <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectObject"></AssociateCustomerObject>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-checkbox v-model="form.onstage" :true-label="1" :false-label="0" style="font-size: 14px">关联项目阶段</el-checkbox>
|
|
|
+ <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectStage"></AssociatedProjectPhases>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ v-if="show"
|
|
|
+ :data="form.projtaskmag_options"
|
|
|
+ style="width: 100%"
|
|
|
+ @row-click="rowClick"
|
|
|
+ :row-class-name="tableRowClassName"
|
|
|
+ border>
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="optionname"
|
|
|
+ label="任务内容"
|
|
|
+ width="360">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input @change="inputChange(scope.$index)" v-model="scope.row.optionname" placeholder=""></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="remarks"
|
|
|
+ label="描述"
|
|
|
+ width="0">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.remarks" placeholder=""></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="score"
|
|
|
+ width="160"
|
|
|
+ label="独立项分值">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.score" placeholder=""></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="operation"
|
|
|
+ width="100"
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="mini" :disabled="form.projtaskmag_options.length === 1">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div v-if="show">
|
|
|
+ <el-table
|
|
|
+ v-for="item in form.projtaskmag_options"
|
|
|
+ :key="item.index"
|
|
|
+ :data="item.projtaskmag_optionscore"
|
|
|
+ border
|
|
|
+ style="width: 100%">
|
|
|
+ <el-table-column
|
|
|
+ v-if="form.onparties"
|
|
|
+ prop="partiestype"
|
|
|
+ label="客户对象"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-if="form.onstage"
|
|
|
+ prop="stagename"
|
|
|
+ label="项目阶段"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="score"
|
|
|
+ label="分值">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.score" placeholder="" @change="onScoreChange(item.optionname)"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import AssociateCustomerObject from '@/HDrpManagement/projectTask/modules/AssociateCustomerObject.vue'
|
|
|
-import AssociatedProjectPhases from '@/HDrpManagement/projectTask/modules/AssociatedProjectStage.vue'
|
|
|
-export default {
|
|
|
- name: "add",
|
|
|
- components:{AssociateCustomerObject,AssociatedProjectPhases},
|
|
|
- data(){
|
|
|
- return {
|
|
|
- drawer:false,
|
|
|
- input:'',
|
|
|
- associatedData:[],
|
|
|
- form:{
|
|
|
- "sa_projtaskmagid": 0,
|
|
|
- "taskname": "",
|
|
|
- "sequence": 0,
|
|
|
- "important": '0',
|
|
|
- "onparties": false,
|
|
|
- "onstage": false,
|
|
|
- "projtaskmag_options": [
|
|
|
- {
|
|
|
- "sa_projtaskmag_optionsid": 0,
|
|
|
- "optionname": "",
|
|
|
- "remarks": "",
|
|
|
- "score": 0,
|
|
|
- "index":0,
|
|
|
- "projtaskmag_optionscore": [
|
|
|
+ import AssociateCustomerObject from '@/HDrpManagement/projectTask/modules/AssociateCustomerObject.vue'
|
|
|
+ import AssociatedProjectPhases from '@/HDrpManagement/projectTask/modules/AssociatedProjectStage.vue'
|
|
|
+ export default {
|
|
|
+ components:{
|
|
|
+ AssociateCustomerObject,
|
|
|
+ AssociatedProjectPhases
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ drawer:false,
|
|
|
+ show:true,
|
|
|
+ form:{
|
|
|
+ "sa_projtaskmagid": 0,
|
|
|
+ "taskname": "测试111",
|
|
|
+ "sequence": 0,
|
|
|
+ "important": 0,
|
|
|
+ "onparties": 1,
|
|
|
+ "onstage": 1,
|
|
|
+ "projtaskmag_options": [
|
|
|
+ {
|
|
|
+ "sa_projtaskmag_optionsid": 20,
|
|
|
+ "optionname": "测试1",
|
|
|
+ "remarks": "测试1",
|
|
|
+ "score": 0,
|
|
|
+ "projtaskmag_optionscore": [
|
|
|
+ {
|
|
|
+ "sa_projtaskmag_optionscoreid":13,
|
|
|
+ "partiestype": "设计院",
|
|
|
+ "sa_projstagemagid": 1,
|
|
|
+ "score": 10
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
{
|
|
|
- "sa_projtaskmag_optionscoreid":0,
|
|
|
- "partiestype": "",
|
|
|
- "sa_projstagemagid": "",
|
|
|
- "score": 0
|
|
|
+ "sa_projtaskmag_optionsid": 21,
|
|
|
+ "optionname": "测试2",
|
|
|
+ "remarks": "测试2",
|
|
|
+ "score": 0,
|
|
|
+ "projtaskmag_optionscore": [
|
|
|
+ {
|
|
|
+ "sa_projtaskmag_optionscoreid":15,
|
|
|
+ "partiestype": "业主",
|
|
|
+ "sa_projstagemagid": 1,
|
|
|
+ "score": 5
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
- ]
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- rules:{
|
|
|
- taskname: [
|
|
|
- { required: true, message: '请输入工作任务', trigger: 'blur' }
|
|
|
- ],
|
|
|
- },
|
|
|
- oldData:[],
|
|
|
- oldstage:[],
|
|
|
- expands:[],
|
|
|
- showChildTable:true,
|
|
|
- nowIndex:0
|
|
|
- }
|
|
|
- },
|
|
|
- methods:{
|
|
|
- onShow(){
|
|
|
- this.drawer = true
|
|
|
- },
|
|
|
- selectObject(val){
|
|
|
- val.length === 0?this.form.onparties = 0:""
|
|
|
- this.oldData = val
|
|
|
- if (this.oldstage.length > 0) {
|
|
|
- this.selectStage(this.oldstage)
|
|
|
- } else {
|
|
|
- this.associatedData = this.oldData.sort()
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ optionscore:[]
|
|
|
}
|
|
|
- this.refreChildTable()
|
|
|
},
|
|
|
- selectStage(val){
|
|
|
- val.length === 0?this.form.onstage = 0:""
|
|
|
- let arr = []
|
|
|
- this.oldstage = val
|
|
|
-
|
|
|
- if (this.oldData.length === 0) {
|
|
|
- this.associatedData = val.map(e=>{
|
|
|
- return {
|
|
|
- partiestype:'',
|
|
|
- stagename:e.stagename,
|
|
|
- sa_projstagemagid:e.sa_projstagemagid
|
|
|
- }
|
|
|
+ methods:{
|
|
|
+ selectObject (val) {
|
|
|
+ // this.form.projtaskmag_options = this.form.projtaskmag_options.forEach(e=>{
|
|
|
+ // e.projtaskmag_optionscore = val
|
|
|
+ // return e
|
|
|
+ // })
|
|
|
+ val.forEach(e=>{
|
|
|
+ this.form.projtaskmag_options.forEach(p=>{
|
|
|
+ p.projtaskmag_optionscore.push(e)
|
|
|
+ })
|
|
|
})
|
|
|
- } else {
|
|
|
- if (this.oldstage.length > 0) {
|
|
|
- this.oldData.forEach(e=>{
|
|
|
- val.forEach(vl=>{
|
|
|
- arr.push({
|
|
|
- partiestype:e.partiestype,
|
|
|
- stagename:vl.stagename,
|
|
|
- sa_projstagemagid:vl.sa_projstagemagid
|
|
|
- })
|
|
|
+ this.refreshTable()
|
|
|
+ console.log(this.form.projtaskmag_options)
|
|
|
+ },
|
|
|
+ selectStage (val) {
|
|
|
+ let old = this.form.projtaskmag_options[0].projtaskmag_optionscore
|
|
|
+ console.log(old)
|
|
|
+ let arr = []
|
|
|
+ old.forEach(e=>{
|
|
|
+ val.forEach(vl=>{
|
|
|
+ arr.push({
|
|
|
+ partiestype:e.partiestype,
|
|
|
+ stagename:vl.stagename,
|
|
|
+ sa_projstagemagid:vl.sa_projstagemagid,
|
|
|
+ score:0
|
|
|
})
|
|
|
})
|
|
|
- this.associatedData = arr.sort()
|
|
|
- } else {
|
|
|
- this.associatedData = this.oldData.sort()
|
|
|
- }
|
|
|
- }
|
|
|
- this.refreChildTable()
|
|
|
- },
|
|
|
- inputChange (index) {
|
|
|
- this.form.projtaskmag_options[index].projtaskmag_optionscore = this.associatedData
|
|
|
- this.$set(this.form.projtaskmag_options,index,this.form.projtaskmag_options[index])
|
|
|
- console.log(this.form.projtaskmag_options[index].projtaskmag_optionscore)
|
|
|
- },
|
|
|
- onPartiesChange (val) {
|
|
|
- this.$refs.onparties.drawer = val
|
|
|
- val?'':this.oldData = []
|
|
|
- val?'':this.associatedData = []
|
|
|
- val?'':this.associatedData = this.oldstage.map(e=>{
|
|
|
- return {
|
|
|
- partiestype:'',
|
|
|
- stagename:e.stagename,
|
|
|
- sa_projstagemagid:e.sa_projstagemagid
|
|
|
- }
|
|
|
- })
|
|
|
- this.refreChildTable()
|
|
|
- },
|
|
|
- onOnstageChange (val) {
|
|
|
- this.$refs.onstage.drawer = val
|
|
|
- val?'':this.associatedData = this.oldData.map(e=>{
|
|
|
- return {
|
|
|
- partiestype:e.partiestype,
|
|
|
- stagename:'',
|
|
|
- sa_projstagemagid:e.sa_projstagemagid
|
|
|
- }
|
|
|
- })
|
|
|
- this.refreChildTable()
|
|
|
- },
|
|
|
- onSubmit(){
|
|
|
- if (this.form.onstage){
|
|
|
- this.form.onstage = 1
|
|
|
- }else {
|
|
|
- this.form.onstage = 0
|
|
|
- }
|
|
|
- if (this.form.onparties){
|
|
|
- this.form.onparties = 1
|
|
|
- }else {
|
|
|
- this.form.onparties = 0
|
|
|
- }
|
|
|
- console.log(this.form.projtaskmag_options)
|
|
|
- this.form.stage
|
|
|
- /*this.$refs.formData.validate(async(valid)=>{
|
|
|
- if (!valid) return false
|
|
|
- const res = await this.$api.requested({
|
|
|
- "id": "20221128144204",
|
|
|
- "content": this.form
|
|
|
})
|
|
|
- this.tool.showMessage(res,()=>{
|
|
|
- this.drawer = false
|
|
|
- this.$refs.formData.resetFields()
|
|
|
- this.form = {
|
|
|
- "sa_projtaskmagid": 0,
|
|
|
- "taskname": "",
|
|
|
- "sequence": 0,
|
|
|
- "important": '0',
|
|
|
- "onparties": false,
|
|
|
- "onstage": false,
|
|
|
- "parties": [],
|
|
|
- "stage": [],
|
|
|
- "projtaskmag_options": [
|
|
|
- {
|
|
|
- "sa_projtaskmag_optionsid": 0,
|
|
|
- "optionname": "",
|
|
|
- "remarks": "",
|
|
|
- "score": "",
|
|
|
- "projtaskmag_optionscore": [
|
|
|
- {
|
|
|
- "sa_projtaskmag_optionscoreid":0,
|
|
|
- "partiestype": "",
|
|
|
- "sa_projstagemagid": '',
|
|
|
- "score": ''
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- ]
|
|
|
- }
|
|
|
- this.$emit("onSuccess")
|
|
|
+ this.form.projtaskmag_options = this.form.projtaskmag_options.map(e=>{
|
|
|
+ e.projtaskmag_optionscore = arr.sort()
|
|
|
+ return e
|
|
|
})
|
|
|
- })*/
|
|
|
- },
|
|
|
- addOptions(){
|
|
|
- console.log(this.form.projtaskmag_options)
|
|
|
- this.form.projtaskmag_options.push({
|
|
|
- "sa_projtaskmag_optionsid": 0,
|
|
|
- "optionname": "",
|
|
|
- "remarks": "",
|
|
|
- "score": 0,
|
|
|
- "index":this.form.projtaskmag_options.length,
|
|
|
- "projtaskmag_optionscore": this.associatedData
|
|
|
- })
|
|
|
- },
|
|
|
- onClose(){
|
|
|
- this.$refs.formData.resetFields()
|
|
|
- this.form = {
|
|
|
- "sa_projtaskmagid": 0,
|
|
|
- "taskname": "",
|
|
|
- "sequence": 0,
|
|
|
- "important": '0',
|
|
|
- "onparties": false,
|
|
|
- "onstage": false,
|
|
|
- "parties": [],
|
|
|
- "stage": [],
|
|
|
- "projtaskmag_options": [
|
|
|
- {
|
|
|
- "sa_projtaskmag_optionsid": 0,
|
|
|
- "optionname": "",
|
|
|
- "remarks": "",
|
|
|
- "score": "",
|
|
|
- "projtaskmag_optionscore": [
|
|
|
- {
|
|
|
- "sa_projtaskmag_optionscoreid":0,
|
|
|
- "partiestype": "",
|
|
|
- "sa_projstagemagid": '',
|
|
|
- "score": ''
|
|
|
+ this.refreshTable()
|
|
|
+ },
|
|
|
+ rowClick (row, column, event) {
|
|
|
+ console.log(row, column, event)
|
|
|
+ this.optionscore = row.projtaskmag_optionscore
|
|
|
+ },
|
|
|
+ onScoreChange (row) {
|
|
|
+ console.log(row)
|
|
|
+ },
|
|
|
+ arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
|
|
|
+ let mergeLength = 1;//需要进行横纵合并的列
|
|
|
+ if (columnIndex < mergeLength) {
|
|
|
+ let finArray = [1,1];
|
|
|
+ // 处理行数据
|
|
|
+ let cgname = Object.keys(row)[columnIndex]
|
|
|
+ // let cgname = 'value'
|
|
|
+ if(rowIndex === 0 || row[cgname] !== this.optionscore[rowIndex-1][cgname]){
|
|
|
+ let rowspan = 1;
|
|
|
+ //计算需要进行合并操作的行
|
|
|
+ for(let i=0; i<this.optionscore.length-1; i++){
|
|
|
+ // 只合并连续的
|
|
|
+ if(this.optionscore[i][cgname] === row[cgname] && this.optionscore[i+1][cgname] === row[cgname]){
|
|
|
+ rowspan ++;
|
|
|
}
|
|
|
- ]
|
|
|
- },
|
|
|
- ]
|
|
|
- }
|
|
|
- },
|
|
|
- arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
|
|
|
- let mergeLength = 1;//需要进行横纵合并的列
|
|
|
- if (columnIndex < mergeLength) {
|
|
|
- let finArray = [1,1];
|
|
|
- // 处理行数据
|
|
|
- let cgname = Object.keys(row)[columnIndex]
|
|
|
- console.log(cgname,'---')
|
|
|
- // let cgname = 'value'
|
|
|
- if(rowIndex === 0 || row[cgname] !== this.associatedData[rowIndex-1][cgname]){
|
|
|
- let rowspan = 1;
|
|
|
- //计算需要进行合并操作的行
|
|
|
- for(let i=0; i<this.associatedData.length-1; i++){
|
|
|
- // 只合并连续的
|
|
|
- if(this.associatedData[i][cgname] === row[cgname] && this.associatedData[i+1][cgname] === row[cgname]){
|
|
|
- rowspan ++;
|
|
|
}
|
|
|
+ finArray[0] = rowspan;
|
|
|
+ }else {
|
|
|
+ finArray[0] = 0;
|
|
|
}
|
|
|
- finArray[0] = rowspan;
|
|
|
- }else {
|
|
|
- finArray[0] = 0;
|
|
|
- }
|
|
|
|
|
|
- // 处理列数据
|
|
|
- let colkeys = Object.keys(row);
|
|
|
- let cgvalue = Object.values(row)[columnIndex]
|
|
|
- if(columnIndex ===0 || row[colkeys[columnIndex-1]] !== row[colkeys[columnIndex]]){
|
|
|
- let colspan = 1;
|
|
|
- //计算需要进行合并操作的列
|
|
|
- for(let i=columnIndex; i<mergeLength; i++) {
|
|
|
- // 只合并连续的
|
|
|
- if (row[colkeys[i]]===cgvalue && row[colkeys[i+1]]===cgvalue && i+1<mergeLength) {
|
|
|
- colspan ++;
|
|
|
+ // 处理列数据
|
|
|
+ let colkeys = Object.keys(row);
|
|
|
+ let cgvalue = Object.values(row)[columnIndex]
|
|
|
+ if(columnIndex ===0 || row[colkeys[columnIndex-1]] !== row[colkeys[columnIndex]]){
|
|
|
+ let colspan = 1;
|
|
|
+ //计算需要进行合并操作的列
|
|
|
+ for(let i=columnIndex; i<mergeLength; i++) {
|
|
|
+ // 只合并连续的
|
|
|
+ if (row[colkeys[i]]===cgvalue && row[colkeys[i+1]]===cgvalue && i+1<mergeLength) {
|
|
|
+ colspan ++;
|
|
|
+ }
|
|
|
}
|
|
|
+ finArray[1] = colspan;
|
|
|
+ } else {
|
|
|
+ finArray[1] = 0;
|
|
|
}
|
|
|
- finArray[1] = colspan;
|
|
|
- } else {
|
|
|
- finArray[1] = 0;
|
|
|
- }
|
|
|
- return finArray
|
|
|
- }
|
|
|
- },
|
|
|
- noop(){},
|
|
|
- expandChange (row, expandedRows) {
|
|
|
- var that = this
|
|
|
-
|
|
|
- that.nowIndex = row.index
|
|
|
-
|
|
|
- that.associatedData = that.form.projtaskmag_options[row.index].projtaskmag_optionscore
|
|
|
-
|
|
|
- if (expandedRows.length>1) {
|
|
|
- that.expands = []
|
|
|
- if (row) {
|
|
|
- that.expands.push(row);
|
|
|
+ return finArray
|
|
|
}
|
|
|
- this.$refs.refTable.toggleRowExpansion(expandedRows[0]);
|
|
|
- } else {
|
|
|
- that.expands = [];
|
|
|
+ },
|
|
|
+ refreshTable() {
|
|
|
+ this.show = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.show = true
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ tableRowClassName({row,rowIndex}) {
|
|
|
+ row.index = rowIndex
|
|
|
}
|
|
|
- },
|
|
|
- refreChildTable () {
|
|
|
- this.showChildTable = false
|
|
|
- setTimeout(() => {
|
|
|
- this.showChildTable = true
|
|
|
- }, 100);
|
|
|
- },
|
|
|
- cellClick (row, column, cell, event) {
|
|
|
- console.log(row, column, cell, event)
|
|
|
}
|
|
|
- },
|
|
|
- mounted() {
|
|
|
}
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+</script>
|