|
|
@ -11,19 +11,27 @@ |
|
|
|
</v-tooltip> |
|
|
|
</v-tooltip> |
|
|
|
<div v-else-if="urls" v-html="urls" /> |
|
|
|
<div v-else-if="urls" v-html="urls" /> |
|
|
|
<div v-else> |
|
|
|
<div v-else> |
|
|
|
{{ row[column.title] }} |
|
|
|
{{ result }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
import dayjs from 'dayjs' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'FormulaCell', |
|
|
|
name: 'FormulaCell', |
|
|
|
props: { column: Object, row: Object }, |
|
|
|
props: { column: Object, row: Object, client: String }, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
|
|
|
|
result() { |
|
|
|
|
|
|
|
if (this.client === 'pg') { |
|
|
|
|
|
|
|
return this.handleTZ(this.row[this.column.title]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.row[this.column.title] |
|
|
|
|
|
|
|
}, |
|
|
|
urls() { |
|
|
|
urls() { |
|
|
|
if (!this.row[this.column.title]) { return } |
|
|
|
if (!this.row[this.column.title]) { return } |
|
|
|
|
|
|
|
|
|
|
|
const rawText = this.row[this.column.title].toString() |
|
|
|
const rawText = this.result.toString() |
|
|
|
let found = false |
|
|
|
let found = false |
|
|
|
const out = rawText.replace(/URI::\((.*?)\)/g, (_, url) => { |
|
|
|
const out = rawText.replace(/URI::\((.*?)\)/g, (_, url) => { |
|
|
|
found = true |
|
|
|
found = true |
|
|
@ -36,6 +44,15 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
return found && out |
|
|
|
return found && out |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
// handle date returned from PostgreSQL |
|
|
|
|
|
|
|
handleTZ(val) { |
|
|
|
|
|
|
|
if (!val) { return } |
|
|
|
|
|
|
|
return val.replace(/((?:-?(?:[1-9][0-9]*)?[0-9]{4})-(?:1[0-2]|0[1-9])-(?:3[01]|0[1-9]|[12][0-9])T(?:2[0-3]|[01][0-9]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\.[0-9]+)?(?:Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9]))/g, (i, v) => { |
|
|
|
|
|
|
|
return dayjs(v).format('YYYY-MM-DD HH:mm') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|