|
|
@@ -13,6 +13,7 @@
|
|
|
ref="assetDialog"
|
|
|
title="上播内容"
|
|
|
size="xl fixed"
|
|
|
+ @closed="onClosed"
|
|
|
>
|
|
|
<c-transfer
|
|
|
class="l-flex__auto"
|
|
|
@@ -94,20 +95,24 @@ export default {
|
|
|
{ type: 'add', on: this.onAdd }
|
|
|
],
|
|
|
filters: [
|
|
|
- { key: 'name', type: 'search', placeholder: '名称' }
|
|
|
+ { key: 'name', type: 'search', placeholder: '名称' },
|
|
|
+ { type: 'refresh' }
|
|
|
],
|
|
|
cols: [
|
|
|
+ { type: 'refresh' },
|
|
|
{ prop: 'name', label: '名称', render: (data, h) => h('edit-input', {
|
|
|
props: {
|
|
|
value: `${data.name}`
|
|
|
},
|
|
|
on: { edit: val => this.onEditName(data, val) }
|
|
|
}), 'class-name': 'c-edit-column' },
|
|
|
+ { prop: 'createTime', label: '创建时间', width: 200 },
|
|
|
+ { prop: 'updateTime', label: '更新时间', width: 200 },
|
|
|
{ type: 'invoke', render: [
|
|
|
{ label: '上播内容', on: this.onEdit },
|
|
|
{ label: '关联设备', on: this.onViewDevices },
|
|
|
{ label: '删除', on: this.onDel }
|
|
|
- ], width: 240 }
|
|
|
+ ], width: 200 }
|
|
|
]
|
|
|
},
|
|
|
assetSchema: {
|
|
|
@@ -185,21 +190,15 @@ export default {
|
|
|
inputPlaceholder: '最多30个字符',
|
|
|
inputPattern: /^.{0,30}$/,
|
|
|
inputValidator: val => {
|
|
|
- console.log(val)
|
|
|
- if (val) {
|
|
|
- if (/^\s+|\s+$/.test(val)) {
|
|
|
- return '请勿输入首尾空格'
|
|
|
- }
|
|
|
- return true
|
|
|
- }
|
|
|
- return '请填写名称'
|
|
|
+ const name = val ? val.replace(/^\s+|\s+$/g, '') : val
|
|
|
+ return name ? true : '请填写名称'
|
|
|
},
|
|
|
inputErrorMessage: '最多30个字符',
|
|
|
confirmButtonText: '新增',
|
|
|
cancelButtonText: '取消',
|
|
|
beforeClose: (action, instance, done) => {
|
|
|
if (action === 'confirm') {
|
|
|
- this.onSave(instance.inputValue, done)
|
|
|
+ this.onSave(instance.inputValue.replace(/^\s+|\s+$/g, ''), done)
|
|
|
} else {
|
|
|
done()
|
|
|
}
|
|
|
@@ -232,12 +231,23 @@ export default {
|
|
|
updateDataset({
|
|
|
id: dataset.id,
|
|
|
name: newVal
|
|
|
- }).catch(() => {
|
|
|
- dataset.name = oldVal
|
|
|
- })
|
|
|
+ }).then(
|
|
|
+ () => {
|
|
|
+ this.$refs.table.pageTo(1)
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ dataset.name = oldVal
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ onClosed () {
|
|
|
+ if (this.$datasetChanged) {
|
|
|
+ this.$refs.table.pageTo(1)
|
|
|
+ }
|
|
|
},
|
|
|
onEdit ({ id }) {
|
|
|
this.$datasetId = id
|
|
|
+ this.$datasetChanged = false
|
|
|
this.$refs.assetDialog.show()
|
|
|
},
|
|
|
getAssetsByDataset () {
|
|
|
@@ -266,9 +276,12 @@ export default {
|
|
|
keyName,
|
|
|
adDuration: getAssetDuration(asset)
|
|
|
}
|
|
|
- }))
|
|
|
+ })).then(() => {
|
|
|
+ this.$datasetChanged = true
|
|
|
+ })
|
|
|
},
|
|
|
onAssetChanged () {
|
|
|
+ this.$datasetChanged = true
|
|
|
this.$refs.assetContentTable.pageTo()
|
|
|
},
|
|
|
onEditAssetDuration (asset, { newVal, oldVal }) {
|
|
|
@@ -277,9 +290,14 @@ export default {
|
|
|
}
|
|
|
if (newVal !== oldVal) {
|
|
|
asset.adDuration = Number(newVal)
|
|
|
- updateDatasetAssetDuration(asset.relationId, asset.adDuration).catch(() => {
|
|
|
- asset.adDuration = oldVal
|
|
|
- })
|
|
|
+ updateDatasetAssetDuration(asset.relationId, asset.adDuration).then(
|
|
|
+ () => {
|
|
|
+ this.$datasetChanged = true
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ asset.adDuration = oldVal
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
},
|
|
|
onAssetRowClick (row) {
|