|
@@ -0,0 +1,131 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-input style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="clearSearchValue" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
|
|
|
+ </el-input>
|
|
|
+ <add class="inline-16" @addSuccess="addSuccess"></add>
|
|
|
+ <tableDetail style="margin-top: 10px" :layout="tablecols" :data="list" :opwidth="200" :custom="true">
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
+ <div v-if="scope.column.columnname === 'isdefault'" :style="{color:scope.column.data[scope.column.columnname]?tool.getStatusColor('是',true):tool.getStatusColor('否',true)}">
|
|
|
+ {{scope.column.data[scope.column.columnname]?'是':'否'}}
|
|
|
+ </div>
|
|
|
+ <div v-else>{{scope.column.data[scope.column.columnname]||scope.column.columnname ==='operation'?scope.column.data[scope.column.columnname] : '--'}}</div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:opreation="scope">
|
|
|
+ <el-button size="mini" type="text" @click="setDefault(scope.data)" :disabled="scope.data.isdefault" class="inline-16">{{$t(`设为默认`)}}</el-button>
|
|
|
+ <edit :data="scope.data" @editSuccess="listData" class="inline-16"></edit>
|
|
|
+ <el-button size="mini" type="text" class="inline-16" @click="onDel(scope.data)">{{$t(`删除`)}}</el-button>
|
|
|
+ </template>
|
|
|
+ </tableDetail>
|
|
|
+ <div class="container normal-panel" style="text-align:right">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
+ :page-size="100"
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import add from './add'
|
|
|
+import edit from './edit'
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ components:{add,edit},
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ param:{
|
|
|
+ "content": {
|
|
|
+ "sa_competitorid": this.$route.query.id,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "id": 2025031809222102,
|
|
|
+ },
|
|
|
+ tablecols:[],
|
|
|
+ list:[],
|
|
|
+ currentPage:0,
|
|
|
+ total:0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async listData(){
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.list = res.data
|
|
|
+ this.total = res.total
|
|
|
+ this.currentPage = res.pageNumber
|
|
|
+ },
|
|
|
+ async setDefault(data){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "content": {
|
|
|
+ "sa_competitor_advid": data.sa_competitor_advid
|
|
|
+ },
|
|
|
+ "id": 2025031809224302,
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.$emit('delSuccess')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onDel(data){
|
|
|
+ this.$confirm('确定删除此优势劣势信息吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "content": {
|
|
|
+ "sa_competitor_advid": data.sa_competitor_advid
|
|
|
+ },
|
|
|
+ "id": 2025031809214002,
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.$emit('delSuccess')
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addSuccess(){
|
|
|
+ this.listData()
|
|
|
+ this.$emit('success')
|
|
|
+ },
|
|
|
+ clearSearchValue () {
|
|
|
+ this.$store.dispatch('clearSearchValue')
|
|
|
+ this.listData(this.param.content.pageNumber = 1)
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
+ this.param.content.pageSize = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
+ this.param.content.pageNumber = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).advantAndDisadvantTable.tablecols
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|