|  | @@ -0,0 +1,254 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +    <div class="container">
 | 
	
		
			
				|  |  | +        <!-- 搜索框 -->
 | 
	
		
			
				|  |  | +        <el-input v-model="search" placeholder="输入关键字" :maxlength="20" />
 | 
	
		
			
				|  |  | +        <el-button class="searchButton" @Click="tableData()" type="primary">搜索</el-button>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <el-table :data="tableData()" class="table-container" :border="true">
 | 
	
		
			
				|  |  | +        <el-table-column prop="id" label="任务ID" align="center" />
 | 
	
		
			
				|  |  | +        <el-table-column prop="ty" label="任务类型" align="center" />
 | 
	
		
			
				|  |  | +        <el-table-column prop="rvl" label="完成值" align="center" value="0" />
 | 
	
		
			
				|  |  | +        <el-table-column prop="tia" label="领取状态" align="center" />
 | 
	
		
			
				|  |  | +        <el-table-column label="操作" width="500" align="center">
 | 
	
		
			
				|  |  | +            <template #default="scope">
 | 
	
		
			
				|  |  | +                <el-button @click="editTask(scope.row,0)" type="Edit" :icon="Edit">未完成</el-button>
 | 
	
		
			
				|  |  | +                <el-button @click="editTask(scope.row,1)" type="Edit" :icon="Edit">完成未领奖</el-button>
 | 
	
		
			
				|  |  | +                <el-button @click="editTask(scope.row,2)" type="Edit" :icon="Edit">完成已领奖</el-button>
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +        </el-table-column>
 | 
	
		
			
				|  |  | +    </el-table>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <el-pagination style="margin: auto;" class="pagination-container" background layout="prev, pager, next ,total,sizes"
 | 
	
		
			
				|  |  | +        :total="state.total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 模态框 -->
 | 
	
		
			
				|  |  | +    <el-dialog :title="dialogTitle" v-model="showModal" @close="closeModal" width="350px">
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <el-form-item label="引导组">
 | 
	
		
			
				|  |  | +            <el-input v-model="itemId" placeholder="输入道具ID" :maxlength="10"
 | 
	
		
			
				|  |  | +                style="width: 200px;position: relative; left: 41.219px;" />
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item label="引导ID">
 | 
	
		
			
				|  |  | +            <el-input v-model="itemNum" placeholder="请输入道具数量" :maxlength="5"
 | 
	
		
			
				|  |  | +                style="width: 200px;position: relative; left: 28px;" />
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <span slot="footer" class="dialog-footer" style="position: absolute; right: 20px; bottom: 10px;">
 | 
	
		
			
				|  |  | +            <el-button type="primary" @click="saveItem">保存</el-button>
 | 
	
		
			
				|  |  | +            <el-button @click="closeModal">关闭</el-button>
 | 
	
		
			
				|  |  | +        </span>
 | 
	
		
			
				|  |  | +    </el-dialog>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +<script lang="ts" setup>
 | 
	
		
			
				|  |  | +import { id } from 'element-plus/es/locale';
 | 
	
		
			
				|  |  | +import { ElMessageBox, ElMessage } from 'element-plus';
 | 
	
		
			
				|  |  | +import { reactive, ref, toRefs, defineComponent } from 'vue'
 | 
	
		
			
				|  |  | +import { Edit, Check, Close, Delete } from '@element-plus/icons-vue'
 | 
	
		
			
				|  |  | +import playerApi from '@/api/player'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const props = defineProps({
 | 
	
		
			
				|  |  | +    tasks: Array,
 | 
	
		
			
				|  |  | +    ruleForm: Object,
 | 
	
		
			
				|  |  | +    callback: {
 | 
	
		
			
				|  |  | +        type: Function,
 | 
	
		
			
				|  |  | +        required: true
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +let dialogTitle = ref<string>('');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const showModal = ref<Boolean>(false);
 | 
	
		
			
				|  |  | +const itemId = ref("");
 | 
	
		
			
				|  |  | +const itemNum = ref<Number>(1);
 | 
	
		
			
				|  |  | +const search = ref("");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const state = reactive({
 | 
	
		
			
				|  |  | +    page: 1,
 | 
	
		
			
				|  |  | +    limit: 10,
 | 
	
		
			
				|  |  | +    total: props.tasks.length
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const tableData = () => {
 | 
	
		
			
				|  |  | +    let tasks: any = [];
 | 
	
		
			
				|  |  | +    if (search.value == "") {
 | 
	
		
			
				|  |  | +        state.total = props.tasks.length;
 | 
	
		
			
				|  |  | +        tasks = props.tasks;
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +        const regex = new RegExp(search.value, 'i');
 | 
	
		
			
				|  |  | +        tasks = props.tasks.filter(
 | 
	
		
			
				|  |  | +            (task: { id: string}, index) => {
 | 
	
		
			
				|  |  | +                return regex.test(task.id);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +        state.total = tasks.length;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return tasks.filter(
 | 
	
		
			
				|  |  | +        (item, index) =>
 | 
	
		
			
				|  |  | +            index < state.page * state.limit &&
 | 
	
		
			
				|  |  | +            index >= state.limit * (state.page - 1)
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 分页
 | 
	
		
			
				|  |  | +// 删除引导
 | 
	
		
			
				|  |  | +const editTask = (row: any,state1) => {
 | 
	
		
			
				|  |  | +    ElMessageBox.confirm('确定要修改引导吗?', '提示', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消'
 | 
	
		
			
				|  |  | +    }).then(() => {
 | 
	
		
			
				|  |  | +        let data = {
 | 
	
		
			
				|  |  | +            playerId: props.ruleForm.id,
 | 
	
		
			
				|  |  | +            taskIds: row.id,
 | 
	
		
			
				|  |  | +            state: state1,
 | 
	
		
			
				|  |  | +            srvId: props.ruleForm.gId
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        console.log(data);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        let resp = playerApi.editTaskState(data);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        ElMessage({
 | 
	
		
			
				|  |  | +            message: "修改成功",
 | 
	
		
			
				|  |  | +            type: 'info',
 | 
	
		
			
				|  |  | +            duration: 3000
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        // let index = props.tasks.indexOf(row);
 | 
	
		
			
				|  |  | +        // props.tasks.splice(index, 1);
 | 
	
		
			
				|  |  | +    }).catch(() => { });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const addItem = () => {
 | 
	
		
			
				|  |  | +    dialogTitle.value = "添加道具";
 | 
	
		
			
				|  |  | +    showModal.value = true;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const closeModal = () => {
 | 
	
		
			
				|  |  | +    itemId.value = null;
 | 
	
		
			
				|  |  | +    itemNum.value = 1;
 | 
	
		
			
				|  |  | +    showModal.value = false;
 | 
	
		
			
				|  |  | +    dialogTitle.value = "添加图纸";
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 保存
 | 
	
		
			
				|  |  | +const saveItem = () => {
 | 
	
		
			
				|  |  | +    let data = {
 | 
	
		
			
				|  |  | +        playerId: props.ruleForm.id,
 | 
	
		
			
				|  |  | +        itemId: itemId.value,
 | 
	
		
			
				|  |  | +        itemNum: itemNum.value,
 | 
	
		
			
				|  |  | +        srvId: props.ruleForm.gId
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // playerApi.addPlayerItem(data).then((resp) => {
 | 
	
		
			
				|  |  | +    //     let data = resp.data.result;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    //     if (data === '道具添加失败' || data === '已拥有该道具') {
 | 
	
		
			
				|  |  | +    //         ElMessage({
 | 
	
		
			
				|  |  | +    //             message: data,
 | 
	
		
			
				|  |  | +    //             type: 'error',
 | 
	
		
			
				|  |  | +    //             duration: 3000
 | 
	
		
			
				|  |  | +    //         });
 | 
	
		
			
				|  |  | +    //     } else {
 | 
	
		
			
				|  |  | +    //         props.callback(data)
 | 
	
		
			
				|  |  | +    //     }
 | 
	
		
			
				|  |  | +    // });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    showModal.value = false;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const handleCurrentChange = (e) => {
 | 
	
		
			
				|  |  | +    state.page = e;
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const handleSizeChange = (e) => {
 | 
	
		
			
				|  |  | +    state.limit = e;
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 道具修改
 | 
	
		
			
				|  |  | +const handlEditClick = (row: any) => {
 | 
	
		
			
				|  |  | +    row.editing = true;
 | 
	
		
			
				|  |  | +    row.tempCount = row.count;
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const handleSaveClick = (row: any) => {
 | 
	
		
			
				|  |  | +    // row.editing = false;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    ElMessageBox.confirm('确定要修改道具数量吗?', '提示', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消'
 | 
	
		
			
				|  |  | +    }).then(() => {
 | 
	
		
			
				|  |  | +        row.editing = false;
 | 
	
		
			
				|  |  | +        let data = {
 | 
	
		
			
				|  |  | +            playerId: props.ruleForm.id,
 | 
	
		
			
				|  |  | +            itemId: row.id,
 | 
	
		
			
				|  |  | +            itemNum: row.tempCount,
 | 
	
		
			
				|  |  | +            srvId: props.ruleForm.gId
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        let resp = playerApi.editPlayerItem(data);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        row.count = row.tempCount;
 | 
	
		
			
				|  |  | +        ElMessage({
 | 
	
		
			
				|  |  | +            message: "修改成功",
 | 
	
		
			
				|  |  | +            type: 'info',
 | 
	
		
			
				|  |  | +            duration: 3000
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }).catch(() => { });
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const handleCancelClick = (row: any) => {
 | 
	
		
			
				|  |  | +    row.editing = false;
 | 
	
		
			
				|  |  | +    row.tempCount = row.count;
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style>
 | 
	
		
			
				|  |  | +.con {
 | 
	
		
			
				|  |  | +    display: flex;
 | 
	
		
			
				|  |  | +    align-items: center;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.input-container {
 | 
	
		
			
				|  |  | +    align-items: center;
 | 
	
		
			
				|  |  | +    width: 250px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.searchButton {
 | 
	
		
			
				|  |  | +    margin-right: 10px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.button-container {
 | 
	
		
			
				|  |  | +    position: relative;
 | 
	
		
			
				|  |  | +    left: 1%;
 | 
	
		
			
				|  |  | +    transform: translateY(-8%);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.container {
 | 
	
		
			
				|  |  | +    display: flex;
 | 
	
		
			
				|  |  | +    align-items: center;
 | 
	
		
			
				|  |  | +    width: 200px;
 | 
	
		
			
				|  |  | +    margin-bottom: 20px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.edit-button {
 | 
	
		
			
				|  |  | +    position: absolute;
 | 
	
		
			
				|  |  | +    top: 50%;
 | 
	
		
			
				|  |  | +    left: 400px;
 | 
	
		
			
				|  |  | +    transform: translateY(-50%);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.table-container {
 | 
	
		
			
				|  |  | +    display: grid;
 | 
	
		
			
				|  |  | +    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.pagination-container {
 | 
	
		
			
				|  |  | +    display: flex;
 | 
	
		
			
				|  |  | +    justify-content: center;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |