feat 可以取消编辑
All checks were successful
Build image / build (push) Successful in 21s

This commit is contained in:
timerzz 2024-05-15 18:07:24 +08:00
parent b436853001
commit 4cb2da49d8
2 changed files with 16 additions and 4 deletions

5
src/api/spider.js Normal file
View File

@ -0,0 +1,5 @@
import {mande} from "mande";
const spider = mande('/api/v1/spider')
export const GetSpiderCfg = ()=> spider.get("cfg")

View File

@ -12,7 +12,7 @@
</div>
<div class="h-full border-0 border-t-1 border-solid border-gray-300 pt-4">
<a-spin :spinning="loading" :indicator="indicator">
<a-table :dataSource="data.list" :columns="columns" :pagination="false" @change="tableChange">
<a-table :dataSource="data.list" :columns="columns" :custom-row="customRow" :pagination="false" @change="tableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'name'">
<a v-if="record.name !== '' " :href="record.link" target="_blank">{{record.name}}</a>
@ -30,7 +30,7 @@
</template>
<template v-else-if="column.key === 'freight'">
<div class="flex space-x-4">
<a-input-number v-if="editData.edit && editData.param==='freight' && editData.data.pid === record.pid" v-model:value="editData.data.freight" @pressEnter="doUpdate"></a-input-number>
<a-input-number @click.stop v-if="editData.edit && editData.param==='freight' && editData.data.pid === record.pid" v-model:value="editData.data.freight" @pressEnter="doUpdate"></a-input-number>
<span v-else @dblclick="onEdit(record, 'freight')">{{record.freight}}</span>
<SaveOutlined class="cursor-pointer" v-if="editData.edit && editData.param==='freight' && editData.data.pid === record.pid" v-model:value="editData.data.freight" @click="doUpdate"/>
<!-- <FormOutlined v-else class="cursor-pointer" @click="onEdit(record, 'freight')"/>-->
@ -38,7 +38,7 @@
</template>
<template v-else-if="column.key === 'dwPrice'">
<div class="flex space-x-4">
<a-input-number v-if="editData.edit && editData.param==='dwPrice' && editData.data.pid === record.pid" v-model:value="editData.data.dwPrice" @pressEnter="doUpdate"></a-input-number>
<a-input-number @click.stop v-if="editData.edit && editData.param==='dwPrice' && editData.data.pid === record.pid" v-model:value="editData.data.dwPrice" @pressEnter="doUpdate"></a-input-number>
<span v-else @dblclick="onEdit(record, 'dwPrice')">{{record.dwPrice}}</span>
<SaveOutlined class="cursor-pointer" v-if="editData.edit && editData.param==='dwPrice' && editData.data.pid === record.pid" v-model:value="editData.data.dwPrice" @click="doUpdate"/>
<!-- <FormOutlined v-else class="cursor-pointer" @click="onEdit(record, 'dwPrice')"/>-->
@ -66,7 +66,6 @@
<template #content>
<a-button type="text" block @click="onEdit(record, 'modal')">编辑</a-button>
<a-button type="text" block @click="onWatch(record.pid, record.name)">一键蹲货</a-button>
</template>
<SettingOutlined class="cursor-pointer" />
</a-popover>
@ -295,6 +294,14 @@ const loadSpiderCfg = ()=>{
message.error("获取spider配置失败")
})
}
const customRow=(record, index)=>{
return {
onClick: (event) => {
editData.edit = false
}, //
}
}
</script>