235 lines
8.8 KiB
PHP
235 lines
8.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2021年9月15日
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
|
|
use app\widgets\PickFile;
|
|
use app\assets\UeditorAsset;
|
|
use app\components\EncryptHelper;
|
|
|
|
UeditorAsset::register($this);
|
|
$this->title = $model->isNewRecord ? '添加球车型号' : '编辑球车型号';
|
|
$this->params['breadcrumbs'][] = ['label' => '型号列表', 'url' => [\Yii::$app->urlManager->createUrl(["admin/ball/mark"])]];
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
?>
|
|
<style>
|
|
.layui-input-block {
|
|
margin-left: 160px;
|
|
}
|
|
|
|
.layui-form-label {
|
|
width: 120px;
|
|
}
|
|
|
|
</style>
|
|
<div class="layui-fluid">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header"><?= $this->title ?></div>
|
|
<div class="layui-card-body">
|
|
<div class="layui-form">
|
|
<div class="layui-row">
|
|
<div class="layui-col-md6">
|
|
<div class="grid-demo grid-demo-bg1">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label required">型号名称</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" name="name" placeholder="请输入型号" autocomplete="off"
|
|
class="layui-input"
|
|
value="<?= $model->name ? $model->name : '' ?>"
|
|
lay-verify="required">
|
|
</div>
|
|
<div class="layui-form-mid layui-word-aux"></div>
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item input-static">
|
|
<label class="layui-form-label">状态</label>
|
|
<div class="layui-input-block">
|
|
<input type="radio" name="status" value="1"
|
|
title="启用" <?= $model->isNewRecord || $model->status == 1 ? 'checked' : '' ?>>
|
|
<input type="radio" name="status" value="0"
|
|
title="停用" <?= !$model->isNewRecord && $model->status == 0 ? 'checked' : '' ?>>
|
|
</div>
|
|
<div class="layui-form-mid layui-word-aux"></div>
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label required">内容</label>
|
|
<div class="layui-input-block">
|
|
<textarea id="editor" style="width: 100%"
|
|
name="desc"
|
|
rows="30"><?= $model->desc ? $model->desc : "" ?></textarea>
|
|
</div>
|
|
<div class="layui-form-mid layui-word-aux"></div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<div class="layui-input-block">
|
|
<div class="">
|
|
<button class="layui-btn" lay-submit="" lay-filter="layui-form-submit">保存
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
<?php $this->beginBlock('js_script_wrap') ?>
|
|
layui.config({
|
|
base: '/statics/layuiadmin/' //静态资源所在路径
|
|
}).extend({
|
|
index: 'lib/index' //主入口模块
|
|
}).use(['index', 'user', 'tree', 'laydate', 'form'], function () {
|
|
var $ = layui.$
|
|
, setter = layui.setter
|
|
, tree = layui.tree
|
|
, admin = layui.admin
|
|
, laydate = layui.laydate
|
|
, form = layui.form
|
|
, router = layui.router()
|
|
, search = router.search;
|
|
|
|
|
|
//自定义格式
|
|
laydate.render({
|
|
elem: '#coache_begin_time'
|
|
, format: 'yyyy-MM-dd'
|
|
});
|
|
|
|
form.render();
|
|
|
|
//提交
|
|
var submitLock = false;
|
|
form.on('submit(layui-form-submit)', function (obj) {
|
|
if (submitLock) {
|
|
return false;
|
|
}
|
|
submitLock = true;
|
|
//请求登入接口
|
|
//console.log(obj)
|
|
var url = '<?= \Yii::$app->urlManager->createUrl(["/admin/ball/mark-edit", 'id' => $model->id ? $model->id : 0]) ?>';
|
|
var returnUrl = "<?= $return_url ?>";
|
|
var data = obj.field;
|
|
data.content = UE.getEditor('editor').getContent();
|
|
data._csrf = _csrf;
|
|
console.log(data)
|
|
$.ajax(url, {
|
|
type: "POST",
|
|
dataType: "json",
|
|
data: data,
|
|
timeout: 10000,
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
layer.msg(res.msg, {
|
|
offset: '15px'
|
|
, icon: 1
|
|
, time: 1000
|
|
}, function () {
|
|
if (returnUrl) {
|
|
location.href = returnUrl;
|
|
} else {
|
|
location.reload();
|
|
}
|
|
});
|
|
} else {
|
|
layer.msg(res.msg, {
|
|
offset: '15px'
|
|
, icon: 2
|
|
, time: 1000
|
|
}, function () {
|
|
});
|
|
}
|
|
},
|
|
error: function (xhr, type, err) {
|
|
layer.msg(xhr.responseText, {
|
|
offset: '15px'
|
|
, icon: 2
|
|
, time: 1000
|
|
}, function () {
|
|
});
|
|
},
|
|
complete: function () {
|
|
submitLock = false;
|
|
}
|
|
})
|
|
});
|
|
|
|
var ue = UE.getEditor('editor', {
|
|
serverUrl: "<?= \Yii::$app->urlManager->createUrl(['file/upload']) ?>",
|
|
toolbars: [
|
|
[
|
|
'anchor', //锚点
|
|
'undo', //撤销
|
|
'redo', //重做
|
|
'bold', //加粗
|
|
'indent', //首行缩进
|
|
'italic', //斜体
|
|
'underline', //下划线
|
|
'strikethrough', //删除线
|
|
'subscript', //下标
|
|
'fontborder', //字符边框
|
|
'superscript', //上标
|
|
'formatmatch', //格式刷
|
|
'source', //源代码
|
|
'blockquote', //引用
|
|
'pasteplain', //纯文本粘贴模式
|
|
'selectall', //全选
|
|
'preview', //预览
|
|
'horizontal', //分隔线
|
|
'removeformat', //清除格式
|
|
'time', //时间
|
|
'date', //日期
|
|
'unlink', //取消链接
|
|
'cleardoc', //清空文档
|
|
'insertcode', //代码语言
|
|
'fontfamily', //字体
|
|
'fontsize', //字号
|
|
'paragraph', //段落格式
|
|
'link', //超链接
|
|
'spechars', //特殊字符
|
|
'help', //文章
|
|
'justifyleft', //居左对齐
|
|
'justifyright', //居右对齐
|
|
'justifycenter', //居中对齐
|
|
'justifyjustify', //两端对齐
|
|
'forecolor', //字体颜色
|
|
'insertorderedlist', //有序列表
|
|
'insertunorderedlist', //无序列表
|
|
'fullscreen', //全屏
|
|
'rowspacingtop', //段前距
|
|
'rowspacingbottom', //段后距
|
|
'lineheight', //行间距
|
|
'customstyle', //自定义标题
|
|
'autotypeset', //自动排版
|
|
'drafts', // 从草稿箱加载
|
|
]
|
|
]
|
|
});
|
|
});
|
|
<?php $this->endBlock(); ?>
|
|
</script>
|
|
<?php $this->registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|