|
|
@@ -9,6 +9,7 @@
|
|
|
</template>
|
|
|
|
|
|
<template #slot-add-cp-btn>
|
|
|
+ <el-button type="primary" size="mini" @click="setInTurn()">排序值</el-button>
|
|
|
<el-button type="primary" size="mini" @click="replaceCpFn(0)">添加</el-button>
|
|
|
</template>
|
|
|
|
|
|
@@ -25,16 +26,18 @@
|
|
|
<span v-else>若干{{scope.row.smallUnit}}/{{ scope.row.bigUnit }}</span>
|
|
|
</template>
|
|
|
|
|
|
- <template #table-column-inTurn="{ scope }">
|
|
|
- <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
- <el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)" ></el-input>
|
|
|
- </template>
|
|
|
- <!-- 排序 -->
|
|
|
<template #table-header-inTurn>
|
|
|
<div class="set-sort">
|
|
|
<span>排序</span>
|
|
|
+ <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show" >
|
|
|
+ </el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="finishSort" type="primary" >完成</el-button >
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template #table-column-inTurn="{ scope }">
|
|
|
+ <span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
+ <el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn"></el-input>
|
|
|
+ </template>
|
|
|
|
|
|
<template #slot-cp-classStyle="{scope}">
|
|
|
<el-radio-group v-model="classStyle" @change="changeClassStyle" style="margin-right:20px;padding-top:6px;margin-left:20px;">
|
|
|
@@ -189,7 +192,8 @@ export default {
|
|
|
selects:{ids:[]},
|
|
|
selectedIds:[],
|
|
|
selectedClassName:'',
|
|
|
- selectedClassId:''
|
|
|
+ selectedClassId:'',
|
|
|
+ cpInfoList:[]
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
@@ -241,6 +245,13 @@ export default {
|
|
|
query.cpName = data.name
|
|
|
this.$router.push({ path: '/item/list', query });
|
|
|
},
|
|
|
+ setInTurn(){
|
|
|
+ this.$prompt('请输入数值', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', inputPattern: /^[0-9]\d*$/, inputErrorMessage: '请填写数值' }).then(({ value }) => {
|
|
|
+ this.cpInfoList.forEach((item,idx,arr) => {
|
|
|
+ arr[idx].inTurn = value
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
replaceCpFn(id){
|
|
|
this.replaceCpPop = true
|
|
|
this.currentCpId = id
|
|
|
@@ -386,6 +397,10 @@ export default {
|
|
|
['data-table'],
|
|
|
['slot-more-do-btn','slot-selected-class','flex1', 'pagination'],
|
|
|
])
|
|
|
+ .on('refresh', async (params, { next, render }) => {
|
|
|
+ let { list } = await next(params);
|
|
|
+ this.cpInfoList = list
|
|
|
+ })
|
|
|
.done();
|
|
|
app.refresh({ classStyle:this.classStyle,classId:this.currentCpClassId })
|
|
|
|
|
|
@@ -396,8 +411,17 @@ export default {
|
|
|
showSort(e) {
|
|
|
this.sort.status = true;
|
|
|
},
|
|
|
- hideSort(e) {
|
|
|
- this.sort.status = false;
|
|
|
+ finishSort(e) {
|
|
|
+ this.sort.status = false
|
|
|
+ const rankData = this.cpInfoList.map(ele => {
|
|
|
+ return { cpId: ele.id, inTurn:ele.inTurn}
|
|
|
+ })
|
|
|
+ JSON.stringify(rankData)
|
|
|
+ let params = JSON.parse(JSON.stringify(rankData))
|
|
|
+ this.$service.ptCp.batchSort(params).then(res=>{
|
|
|
+ this.app.refresh({ classStyle:this.classStyle,classId:this.currentCpClassId })
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ })
|
|
|
},
|
|
|
changeSort(d) {
|
|
|
},
|