code styles

This commit is contained in:
devezhao 2021-12-26 12:44:36 +08:00
parent cb7d7f0106
commit 81a9f097c2
6 changed files with 14 additions and 14 deletions

View file

@ -61,12 +61,12 @@ function _useAssetsHex(file) {
if (!hex) {
try {
hex = revHash(fs.readFileSync(`${WEB_ROOT}${file}`))
} catch (err0) {
} catch (err) {
try {
hex = revHash(fs.readFileSync(`${RBV_ROOT}${file}`))
} catch (err) {
} catch (err1) {
if (file.includes('frontjs-sdk.js')) console.log('No `@rbv` exists :', file)
else console.log('Cannot #revHash :', file, err)
else console.log('Cannot #revHash :', file, err1)
// Use date
const d = new Date()
@ -99,7 +99,7 @@ function compileHtml(m) {
if (file.includes('.development.js')) file = file.replace('.development.js', '.production.min.js')
return '<script th:src="@{' + file + '}"></script>'
} else {
file += '?v=' + _useAssetsHex(file.split('?')[0], m)
file += '?v=' + _useAssetsHex(file.split('?')[0])
return '<script th:src="@{' + file + '}"></script>'
}
})
@ -118,7 +118,7 @@ function compileHtml(m) {
console.log('Using lib :', file)
return '<link rel="stylesheet" type="text/css" th:href="@{' + file + '}" />'
} else {
file += '?v=' + _useAssetsHex(file.split('?')[0], m)
file += '?v=' + _useAssetsHex(file.split('?')[0])
return '<link rel="stylesheet" type="text/css" th:href="@{' + file + '}" />'
}
})

View file

@ -459,7 +459,7 @@ public class PrivilegesManager {
/**
* @param user
* @returny
* @return
*/
private Boolean userAllow(ID user) {
if (UserHelper.isAdmin(user)) return Boolean.TRUE;

View file

@ -491,7 +491,7 @@ class ModelConf extends React.Component {
_prev = () => this.props.$$$parent.setState({ stepNo: 4, modelProps: this._buildProps() })
_next = () => {
const ps = this._buildProps(true)
const ps = this._buildProps()
this.props.$$$parent.setState({ stepNo: 10, modelProps: ps }, () => this.props.$$$parent.install())
}
}

View file

@ -28,7 +28,7 @@ $(document).ready(function () {
$(res.data).each(function () {
validFields[this.fieldName] = this
if (configFields.includes(this.fieldName) === false) render_unset(this, '.field-list')
if (configFields.includes(this.fieldName) === false) render_unset(this)
// Adv control
const $control = $(`<tr data-field="${this.fieldName}">${template}</tr>`).appendTo($advControls)
@ -41,7 +41,7 @@ $(document).ready(function () {
$(wpc.formConfig.elements).each(function () {
const field = validFields[this.field]
if (this.field === DIVIDER_LINE) {
render_item({ fieldName: this.field, fieldLabel: this.label || '', colspan: 4 }, '.form-preview')
render_item({ fieldName: this.field, fieldLabel: this.label || '', colspan: 4 })
} else if (!field) {
const $item = $(`<div class="dd-item"><div class="dd-handle J_field J_missed"><span class="text-danger">[${this.field.toUpperCase()}] ${$L('字段已删除')}</span></div></div>`).appendTo(
'.form-preview'
@ -51,7 +51,7 @@ $(document).ready(function () {
$item.remove()
})
} else {
render_item({ ...field, isFull: this.isFull || false, colspan: this.colspan, tip: this.tip || null }, '.form-preview')
render_item({ ...field, isFull: this.isFull || false, colspan: this.colspan, tip: this.tip || null })
AdvControl.set(this)
}
})
@ -67,7 +67,7 @@ $(document).ready(function () {
$('.J_add-divider').click(function () {
$('.nav-tabs-classic a[href="#form-design"]').tab('show')
render_item({ fieldName: DIVIDER_LINE, fieldLabel: '', colspan: 4 }, '.form-preview')
render_item({ fieldName: DIVIDER_LINE, fieldLabel: '', colspan: 4 })
})
// @see field-new.html
@ -372,7 +372,7 @@ const add2Layout = function (fieldName) {
$.get(`../list-field?entity=${wpc.entityName}`, function (res) {
$(res.data).each(function () {
if (this.fieldName === fieldName) {
render_item({ ...this, tip: this.tip || null }, '.form-preview')
render_item({ ...this, tip: this.tip || null })
return false
}
})

View file

@ -46,7 +46,7 @@ class AdvFilter extends React.Component {
<button className="btn btn-primary" type="button" onClick={() => this.confirm()}>
{$L('确定')}
</button>
<button className="btn btn-secondary" type="button" onClick={() => this.hide(true)}>
<button className="btn btn-secondary" type="button" onClick={() => this.hide()}>
{$L('取消')}
</button>
</div>

View file

@ -499,7 +499,7 @@ const CellRenders = {
* @param {*} k key of React (contains fieldName)
*/
renderSimple(v, s, k) {
if (typeof v === 'string' && v.length > 300) v = v.sub(0, 300)
if (typeof v === 'string' && v.length > 300) v = v.substr(0, 300)
else if (k.endsWith('.approvalId') && !v) v = $L('未提交')
else if (k.endsWith('.approvalState') && !v) v = $L('草稿')