|
|
@@ -7,12 +7,11 @@
|
|
|
background
|
|
|
>
|
|
|
<device-tree-single
|
|
|
- class="c-sibling-item"
|
|
|
- size="mini"
|
|
|
+ class="c-sibling-item c-sidebar auto-width u-font-size--sm"
|
|
|
@change="onChange"
|
|
|
/>
|
|
|
<schema-table
|
|
|
- v-if="device"
|
|
|
+ v-if="deviceId"
|
|
|
ref="table"
|
|
|
class="c-sibling-item far"
|
|
|
row-key="id"
|
|
|
@@ -170,49 +169,19 @@ import {
|
|
|
export default {
|
|
|
name: 'AdOrderTask',
|
|
|
data () {
|
|
|
- return {
|
|
|
- contentSchema: {
|
|
|
- list: this.getContentAssets,
|
|
|
- cols: [
|
|
|
- { prop: 'tagType', label: '文件', width: 100, align: 'center' },
|
|
|
- { prop: 'fileType', label: '', width: 80 },
|
|
|
- { prop: 'file', label: '', type: 'asset', on: this.onViewAsset },
|
|
|
- { prop: 'adDuration', label: '上播时长', align: 'center' },
|
|
|
- { type: 'invoke', render: [
|
|
|
- { label: '查看', allow: ({ file }) => !!file, on: this.onViewAsset }
|
|
|
- ] }
|
|
|
- ]
|
|
|
- },
|
|
|
- taskTimeTypeSelectSchema: {
|
|
|
- options: [
|
|
|
- { value: TimeType.SCREEN, label: '开机期间' },
|
|
|
- { value: TimeType.RANGE, label: '时段' },
|
|
|
- { value: TimeType.POINT, label: '时间点' }
|
|
|
- ]
|
|
|
- },
|
|
|
- device: null,
|
|
|
- taskDataFrom: TaskFromType.ASSET,
|
|
|
- taskData: null,
|
|
|
- taskDate: '',
|
|
|
- taskTime: {},
|
|
|
- taskCount: 100,
|
|
|
- taskDuration: 5
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- schema () {
|
|
|
- const canEdit = this.$store.getters.isOperator
|
|
|
- const canAudit = this.$store.getters.isGroupAdmin
|
|
|
+ const canEdit = this.$store.getters.isOperator
|
|
|
+ const canAudit = this.$store.getters.isGroupAdmin
|
|
|
|
|
|
- return {
|
|
|
+ return {
|
|
|
+ deviceId: '',
|
|
|
+ schema: {
|
|
|
buttons: canEdit
|
|
|
? [
|
|
|
{ type: 'add', label: '素材任务', on: this.onAddAssetTask },
|
|
|
{ type: 'add', label: '合同任务', on: this.onAddContractTask }
|
|
|
]
|
|
|
: null,
|
|
|
- condition: { deviceId: this.device.id },
|
|
|
- list: getTasks,
|
|
|
+ list: this.getTasks,
|
|
|
transform: this.transform,
|
|
|
cols: [
|
|
|
{ prop: 'type', type: 'refresh', width: 80 },
|
|
|
@@ -283,8 +252,35 @@ export default {
|
|
|
{ label: '删除', allow: ({ from }) => from !== TaskFromType.ORDER, on: this.onDel }
|
|
|
], width: 92 }
|
|
|
]
|
|
|
- }
|
|
|
- },
|
|
|
+ },
|
|
|
+ contentSchema: {
|
|
|
+ list: this.getContentAssets,
|
|
|
+ cols: [
|
|
|
+ { prop: 'tagType', label: '文件', width: 100, align: 'center' },
|
|
|
+ { prop: 'fileType', label: '', width: 80 },
|
|
|
+ { prop: 'file', label: '', type: 'asset', on: this.onViewAsset },
|
|
|
+ { prop: 'adDuration', label: '上播时长', align: 'center' },
|
|
|
+ { type: 'invoke', render: [
|
|
|
+ { label: '查看', allow: ({ file }) => !!file, on: this.onViewAsset }
|
|
|
+ ] }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ taskTimeTypeSelectSchema: {
|
|
|
+ options: [
|
|
|
+ { value: TimeType.SCREEN, label: '开机期间' },
|
|
|
+ { value: TimeType.RANGE, label: '时段' },
|
|
|
+ { value: TimeType.POINT, label: '时间点' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ taskDataFrom: TaskFromType.ASSET,
|
|
|
+ taskData: null,
|
|
|
+ taskDate: '',
|
|
|
+ taskTime: {},
|
|
|
+ taskCount: 100,
|
|
|
+ taskDuration: 5
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
taskDataInfo () {
|
|
|
if (this.taskData) {
|
|
|
switch (this.taskData.from) {
|
|
|
@@ -306,13 +302,24 @@ export default {
|
|
|
return !this.disableTask && this.taskData ? this.taskData.info.type === AssetType.VIDEO : this.disableTask
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ deviceId () {
|
|
|
+ this.$refs.table?.pageTo(1)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ onChange ({ id }) {
|
|
|
+ this.deviceId = id
|
|
|
+ },
|
|
|
+ getTasks (params) {
|
|
|
+ return getTasks({
|
|
|
+ deviceId: this.deviceId,
|
|
|
+ ...params
|
|
|
+ })
|
|
|
+ },
|
|
|
canEditDuration ({ allowed, from, fromInfo }) {
|
|
|
return allowed && from === TaskFromType.ASSET && fromInfo?.type === AssetType.IMAGE
|
|
|
},
|
|
|
- onChange (device) {
|
|
|
- this.device = device
|
|
|
- },
|
|
|
transform (task) {
|
|
|
const { id, from, fromId, fromInfo, startDate, startTime, endTime, day, duration, count, auditCount, enable } = task
|
|
|
const allowed = this.isValidTask(from, fromInfo)
|
|
|
@@ -514,7 +521,7 @@ export default {
|
|
|
return addTask({
|
|
|
...task,
|
|
|
auditCount: task.count,
|
|
|
- deviceIdList: [this.device.id],
|
|
|
+ deviceIdList: [this.deviceId],
|
|
|
enable: false
|
|
|
}).then(() => {
|
|
|
this.$refs.table.pageTo(1)
|