|
|
@@ -4,43 +4,63 @@
|
|
|
<div slot="header" class="search-section">
|
|
|
<div class="search-row">
|
|
|
<el-form :model="searchForm" label-width="90px" inline>
|
|
|
- <el-form-item label="所属银行:" required>
|
|
|
- <el-select v-model="searchForm.bank" placeholder="请选择" style="width: 160px" disabled>
|
|
|
- <el-option label="汇丰银行" value="hsbc" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="客群编号:">
|
|
|
<el-input v-model="searchForm.id" placeholder="请输入" clearable style="width: 180px" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客群名称:">
|
|
|
<el-input v-model="searchForm.name" placeholder="请输入" clearable style="width: 180px" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="类型:">
|
|
|
+ <el-select v-model="searchForm.type" placeholder="全部" clearable style="width: 160px">
|
|
|
+ <el-option label="规则组圈选" value="rule_group" />
|
|
|
+ <el-option label="指定客户号" value="name_list" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="action-row">
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="handleCreate">新增任务</el-button>
|
|
|
- <el-button type="primary" icon="el-icon-plus" plain @click="handleCopy">复制任务</el-button>
|
|
|
+ <el-dropdown trigger="click" @command="handleCreateByType">
|
|
|
+ <el-button type="primary" icon="el-icon-plus">
|
|
|
+ 新增任务<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="rule_group">规则组圈选</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="name_list">指定客户号</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<el-table
|
|
|
:data="pagedData"
|
|
|
- stripe border highlight-current-row
|
|
|
+ stripe border
|
|
|
style="width: 100%"
|
|
|
- @current-change="onRowSelect"
|
|
|
>
|
|
|
<el-table-column prop="id" label="客群编号" width="160" />
|
|
|
<el-table-column prop="name" label="客群名称" min-width="160" show-overflow-tooltip />
|
|
|
+ <el-table-column label="类型" width="120" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="scope.row.type === 'rule_group' ? '' : 'warning'" size="small">
|
|
|
+ {{ typeLabel(scope.row.type) }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="状态" width="100" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag :type="statusTagType(scope.row.status)" size="small">
|
|
|
- {{ statusLabel(scope.row.status) }}
|
|
|
+ <el-tag :type="statusTagType(scope.row)" size="small">
|
|
|
+ {{ statusLabel(scope.row) }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="人数" width="80" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.type === 'name_list'">{{ (scope.row.members || []).length }}</span>
|
|
|
+ <span v-else class="muted">-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="creator" label="创建人" width="100" />
|
|
|
<el-table-column label="审核人" width="100">
|
|
|
<template slot-scope="scope">{{ scope.row.reviewer || '-' }}</template>
|
|
|
@@ -48,37 +68,76 @@
|
|
|
<el-table-column prop="createdAt" label="任务创建时间" width="170" />
|
|
|
<el-table-column label="任务开始/结束日期" width="190" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.startDate }} / {{ scope.row.endDate }}
|
|
|
+ <span v-if="scope.row.type === 'rule_group'">
|
|
|
+ {{ scope.row.startDate }} / {{ scope.row.endDate }}
|
|
|
+ </span>
|
|
|
+ <span v-else class="muted">-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="updatedAt" label="更新时间" width="170" />
|
|
|
- <el-table-column label="操作" width="180" fixed="right" align="center">
|
|
|
+ <el-table-column label="操作" width="280" fixed="right" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- v-if="canDo(scope.row, 'edit')"
|
|
|
- type="primary" circle size="mini" icon="el-icon-edit" title="编辑"
|
|
|
- @click.stop="handleEdit(scope.row)"
|
|
|
- />
|
|
|
- <el-button
|
|
|
- v-if="canDo(scope.row, 'run')"
|
|
|
- type="success" circle size="mini" icon="el-icon-video-play" title="运行"
|
|
|
- @click.stop="handleRun(scope.row)"
|
|
|
- />
|
|
|
- <el-button
|
|
|
- v-if="canDo(scope.row, 'publish')"
|
|
|
- type="success" circle size="mini" icon="el-icon-upload2" title="上线"
|
|
|
- @click.stop="handlePublish(scope.row)"
|
|
|
- />
|
|
|
- <el-button
|
|
|
- v-if="canDo(scope.row, 'stop')"
|
|
|
- type="warning" circle size="mini" icon="el-icon-close" title="停止"
|
|
|
- @click.stop="handleStop(scope.row)"
|
|
|
- />
|
|
|
- <el-button
|
|
|
- v-if="canDo(scope.row, 'detail')"
|
|
|
- type="info" circle size="mini" icon="el-icon-view" title="详情"
|
|
|
- @click.stop="handleDetail(scope.row)"
|
|
|
- />
|
|
|
+ <!-- 规则组圈选 -->
|
|
|
+ <template v-if="scope.row.type === 'rule_group'">
|
|
|
+ <el-button
|
|
|
+ v-if="canDoTask(scope.row, 'edit')"
|
|
|
+ type="primary" circle size="mini" icon="el-icon-edit" title="编辑"
|
|
|
+ @click.stop="handleEditTask(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="canDoTask(scope.row, 'run')"
|
|
|
+ type="success" circle size="mini" icon="el-icon-video-play" title="运行"
|
|
|
+ @click.stop="handleRun(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="canDoTask(scope.row, 'publish')"
|
|
|
+ type="success" circle size="mini" icon="el-icon-upload2" title="上线"
|
|
|
+ @click.stop="handlePublish(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="canDoTask(scope.row, 'stop')"
|
|
|
+ type="warning" circle size="mini" icon="el-icon-close" title="停止"
|
|
|
+ @click.stop="handleStop(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="canDoTask(scope.row, 'detail')"
|
|
|
+ type="info" circle size="mini" icon="el-icon-view" title="详情"
|
|
|
+ @click.stop="handleDetail(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ type="primary" plain circle size="mini" icon="el-icon-document-copy" title="复制"
|
|
|
+ @click.stop="handleCopy(scope.row)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <!-- 指定客户号 -->
|
|
|
+ <template v-else>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 'draft'"
|
|
|
+ type="success" circle size="mini" icon="el-icon-check" title="启用"
|
|
|
+ @click.stop="handleActivate(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 'stopped'"
|
|
|
+ type="primary" circle size="mini" icon="el-icon-edit" title="编辑"
|
|
|
+ @click.stop="handleEditNameList(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 'stopped'"
|
|
|
+ type="primary" plain circle size="mini" icon="el-icon-user" title="人员调整"
|
|
|
+ @click.stop="openAdjust(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 'stopped'"
|
|
|
+ type="primary" plain circle size="mini" icon="el-icon-upload2" title="上传调整文件"
|
|
|
+ @click.stop="openUpload(scope.row)"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 'stopped'"
|
|
|
+ type="warning" circle size="mini" icon="el-icon-close" title="停止"
|
|
|
+ @click.stop="handleStopNameList(scope.row)"
|
|
|
+ />
|
|
|
+ <span v-if="scope.row.status === 'stopped'" class="muted">无可执行操作</span>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -94,24 +153,48 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
+
|
|
|
+ <adjust-member-dialog
|
|
|
+ :visible.sync="adjustVisible"
|
|
|
+ :default-list-id="adjustListId"
|
|
|
+ />
|
|
|
+ <upload-adjust-dialog
|
|
|
+ :visible.sync="uploadVisible"
|
|
|
+ :default-list-id="adjustListId"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import crowdTaskStore from '@/store/crowdTaskStore'
|
|
|
+import crowdNameListStore from '@/store/crowdNameListStore'
|
|
|
+import AdjustMemberDialog from '@/components/crowdNameList/AdjustMemberDialog.vue'
|
|
|
+import UploadAdjustDialog from '@/components/crowdNameList/UploadAdjustDialog.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'CrowdTaskList',
|
|
|
+ components: { AdjustMemberDialog, UploadAdjustDialog },
|
|
|
data() {
|
|
|
return {
|
|
|
- searchForm: { bank: 'hsbc', id: '', name: '' },
|
|
|
+ searchForm: { id: '', name: '', type: '' },
|
|
|
page: { current: 1, size: 10 },
|
|
|
- selectedRow: null
|
|
|
+ adjustVisible: false,
|
|
|
+ adjustListId: '',
|
|
|
+ uploadVisible: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
filteredData() {
|
|
|
- return crowdTaskStore.query({ id: this.searchForm.id, name: this.searchForm.name })
|
|
|
+ const { id, name, type } = this.searchForm
|
|
|
+ const tasks = type === 'name_list'
|
|
|
+ ? []
|
|
|
+ : crowdTaskStore.query({ id, name }).map((r) => ({ ...r, type: 'rule_group' }))
|
|
|
+ const lists = type === 'rule_group'
|
|
|
+ ? []
|
|
|
+ : crowdNameListStore.query({ id, name }).map((r) => ({ ...r, type: 'name_list' }))
|
|
|
+ const merged = [...tasks, ...lists]
|
|
|
+ merged.sort((a, b) => (b.updatedAt || '').localeCompare(a.updatedAt || ''))
|
|
|
+ return merged
|
|
|
},
|
|
|
pagedData() {
|
|
|
const start = (this.page.current - 1) * this.page.size
|
|
|
@@ -119,44 +202,58 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- statusLabel(s) {
|
|
|
- return { draft: '新建', verifying: '校验', online: '上线', stopped: '已停止' }[s] || s
|
|
|
+ typeLabel(t) {
|
|
|
+ return t === 'rule_group' ? '规则组圈选' : '指定客户号'
|
|
|
},
|
|
|
- statusTagType(s) {
|
|
|
- return { draft: 'info', verifying: 'warning', online: 'success', stopped: 'danger' }[s] || ''
|
|
|
+ statusLabel(row) {
|
|
|
+ if (row.type === 'name_list') {
|
|
|
+ return { draft: '新建', active: '已生效', stopped: '已停止' }[row.status] || row.status
|
|
|
+ }
|
|
|
+ return { draft: '新建', verifying: '校验', online: '上线', stopped: '已停止' }[row.status] || row.status
|
|
|
},
|
|
|
- canDo(row, action) {
|
|
|
- return crowdTaskStore.allowedActions(row).includes(action)
|
|
|
+ statusTagType(row) {
|
|
|
+ if (row.type === 'name_list') {
|
|
|
+ return { draft: 'info', active: 'success', stopped: 'danger' }[row.status] || ''
|
|
|
+ }
|
|
|
+ return { draft: 'info', verifying: 'warning', online: 'success', stopped: 'danger' }[row.status] || ''
|
|
|
},
|
|
|
- onRowSelect(row) {
|
|
|
- this.selectedRow = row
|
|
|
+ canDoTask(row, action) {
|
|
|
+ return crowdTaskStore.allowedActions(row).includes(action)
|
|
|
},
|
|
|
handleSearch() {
|
|
|
this.page.current = 1
|
|
|
},
|
|
|
- handleCreate() {
|
|
|
- this.$router.push('/customization/hsbc/crowd-tasks/add')
|
|
|
- },
|
|
|
- handleCopy() {
|
|
|
- if (!this.selectedRow) {
|
|
|
- this.$message.warning('请先在列表中选择一条任务再点击复制')
|
|
|
- return
|
|
|
+ handleCreateByType(type) {
|
|
|
+ if (type === 'rule_group') {
|
|
|
+ this.$router.push('/customization/hsbc/crowd-tasks/add')
|
|
|
+ } else {
|
|
|
+ this.$router.push('/customization/hsbc/crowd-name-lists/add')
|
|
|
}
|
|
|
+ },
|
|
|
+ handleCopy(row) {
|
|
|
this.$confirm(
|
|
|
- `确定要复制任务「${this.selectedRow.name}」吗?将生成一条状态为「新建」的副本。`,
|
|
|
+ `确定要复制任务「${row.name}」吗?将生成一条状态为「新建」的副本。`,
|
|
|
'复制任务',
|
|
|
{ confirmButtonText: '复制', cancelButtonText: '取消', type: 'info' }
|
|
|
).then(() => {
|
|
|
- const copy = crowdTaskStore.copyFrom(this.selectedRow.id)
|
|
|
- if (copy) {
|
|
|
- this.$message.success(`已复制为 ${copy.id}`)
|
|
|
- this.selectedRow = null
|
|
|
- }
|
|
|
+ const copy = crowdTaskStore.copyFrom(row.id)
|
|
|
+ if (copy) this.$message.success(`已复制为 ${copy.id}`)
|
|
|
}).catch(() => {})
|
|
|
},
|
|
|
- handleEdit(row) {
|
|
|
+ openAdjust(row) {
|
|
|
+ this.adjustListId = row.id
|
|
|
+ this.adjustVisible = true
|
|
|
+ },
|
|
|
+ openUpload(row) {
|
|
|
+ this.adjustListId = row.id
|
|
|
+ this.uploadVisible = true
|
|
|
+ },
|
|
|
+ handleEditTask(row) {
|
|
|
this.$router.push(`/customization/hsbc/crowd-tasks/edit/${row.id}`)
|
|
|
},
|
|
|
+ handleEditNameList(row) {
|
|
|
+ this.$router.push(`/customization/hsbc/crowd-name-lists/edit/${row.id}`)
|
|
|
+ },
|
|
|
handleDetail(row) {
|
|
|
this.$router.push(`/customization/hsbc/crowd-tasks/view/${row.id}`)
|
|
|
},
|
|
|
@@ -189,6 +286,22 @@ export default {
|
|
|
crowdTaskStore.stop(row.id)
|
|
|
this.$message.success('已停止')
|
|
|
}).catch(() => {})
|
|
|
+ },
|
|
|
+ handleActivate(row) {
|
|
|
+ this.$confirm(`启用名单「${row.name}」需通过审核后生效,确认提交?`, '启用', {
|
|
|
+ confirmButtonText: '提交', cancelButtonText: '取消', type: 'info'
|
|
|
+ }).then(() => {
|
|
|
+ crowdNameListStore.activate(row.id)
|
|
|
+ this.$message.success('已生效(demo 默认通过审核)')
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ handleStopNameList(row) {
|
|
|
+ this.$confirm(`停止后名单不可再调整,确认停止「${row.name}」?`, '停止', {
|
|
|
+ confirmButtonText: '停止', cancelButtonText: '取消', type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ crowdNameListStore.stop(row.id)
|
|
|
+ this.$message.success('已停止')
|
|
|
+ }).catch(() => {})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -203,6 +316,8 @@ export default {
|
|
|
|
|
|
.action-row { margin-top: 8px; display: flex; gap: 8px; }
|
|
|
|
|
|
+.muted { color: #c0c4cc; font-size: 12px; }
|
|
|
+
|
|
|
.pagination-section {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|