KunWeb/web/admin/develop/code_create.html
2025-06-26 07:08:49 +08:00

770 lines
40 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
<style>
div.table {
border-left: none;
}
.table>ul>li {
border: 1px solid #dddddd;
border-radius: 0.2em;
margin-bottom: 0.5em;
transition: all .8s;
width: 100%;
}
.subinp {
display: flex;
flex-wrap: wrap;
}
.subinp>div {
margin: 0 2em 0.5em 0;
}
</style>
</head>
<body>
<div class="container">
<div style="display:flex;position:fixed;top:0.5em;right:1em;z-index:1;">
<div>
<ciy-switch com="owpc" y="覆盖" n="查验"></ciy-switch>
</div>
<div>
<button class="btn" type="button" onclick="savepc(this);">写入文件</button>
</div>
<div>
<button class="btn" type="button" onclick="save(this);" id="id_submit">保存设置(Ctrl+S)</button>
</div>
</div>
<form>
<div>
<div class="ciy-form">
<label>页面名称</label>
<div><input type="text" name="_bcod_titname" style="width:20em;" />
</div>
</div>
<!-- <div class="ciy-form">
<label>主库</label>
<div><input type="text" name="_bcod_maindb" style="width:20em;" />
</div>
</div> -->
<div class="ciy-form">
<label>认证函数</label>
<div><input type="text" name="_bcod_verifyfunc" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>ud路径</label>
<div><input type="text" name="_bcod_uploadpat" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>列表选项卡</label>
<div><input type="text" name="_bcod_liiddict" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>更新选项卡</label>
<div><input type="text" name="_bcod_uptabcard" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>查看选项卡</label>
<div><input type="text" name="_bcod_viewtabcard" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>字典表</label>
<div><input type="text" name="_bcod_tabdict" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>SaaS代码</label>
<div><input type="text" name="_bcod_saascode" style="width:20em;" />
</div>
</div>
<!-- <div class="ciy-form">
<label>查重字段</label>
<div><input type="text" name="_bcod_uniquedata" style="width:20em;" />
</div>
</div> -->
<!-- <div class="ciy-form">
<label>功能开关</label>
<div>
<ciy-checkbox com="_bcod_chk" />
</div>
</div> -->
<div class="ciy-form">
<label>下拉排序</label>
<div><input type="text" name="_bcod_select_order" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>列表上按钮</label>
<div><input type="text" name="_bcod_btntop_newline" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>批量改按钮</label>
<div><input type="text" name="_bcod_btntop_multibtn" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>列表内按钮</label>
<div><input type="text" name="_bcod_btnlist_line" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>PC保存路径</label>
<div><input type="text" name="_bcod_savepc" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>PC前端语言</label>
<div>
<ciy-radio com="_bcod_htmllang"></ciy-radio>
</div>
</div>
<div class="ciy-form">
<label>后端语言</label>
<div>
<ciy-radio com="_bcod_proglang"></ciy-radio>
</div>
</div>
<div class="ciy-form">
<label>PC模版</label>
<div>
<ciy-radio com="_bcod_pctemplate"></ciy-radio>
</div>
</div>
<div class="ciy-form">
<label>MB模版</label>
<div>
<ciy-radio com="_bcod_mbtemplate"></ciy-radio>
</div>
</div>
<div class="ciy-form">
<label>生成源码</label>
<div>
<button class="btn btn-default" type="button" onclick="createhtml(this);">PC前端(原生JS)</button>
<button class="btn btn-default" type="button" onclick="createhtml(this);">PC前端(Vue3)</button>
|
<button class="btn btn-default" type="button" onclick="creatembvue3(this);">MB前端(Vue3)</button>
|
<button class="btn btn-default" type="button" onclick="createphp(this);">后端(PHP)</button>
<button class="btn btn-default" type="button" onclick="createphp(this);">后端(Golang)</button>
<button class="btn btn-default" type="button" onclick="createphp(this);">后端(Python)</button>
</div>
</div>
</div>
<div class="table">
<div class="loading col-24">Loading...</div>
<ul class="list row"></ul>
</div>
<div class="showtip">
列表内按钮 逗号分隔,支持下拉 XXX,YYY,ZZZ|xxx|-yyy|zzz<br />
批量改按钮 逗号分隔支持ASD前缀D 删除专用A ciy_select_act单行写法S 函数写法。勾选批量审核,自动增加审核/驳回按钮<br />
</div>
</form>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
<script type="text/javascript" src="/jscss/ciytable.js"></script>
<script type="text/javascript" src="../common.js"></script>
<script type="text/javascript">
'use strict';
var table;
var Glob = { sets: {} };
ciyfn.pageload(function () {
var cols = '12,8,16,6,18,t5,1,2,3,4,5,7,9,10,11,13,14,15,17,19,20,21,22,23'.split(',');
var isview = false; //临时措施isview为false集体置true
table = new ciyclass.cardtable({
dom: '.table'
, url: 'init'
, fn_done: function (json, post) {
var cc = json.code_create || {};
cc.bcod = cc.bcod || {};
document.title = '☯' + cc.bcod.titname + ' 【低代码生成】';
if (!cc.bcod.verifyfunc)
cc.bcod.verifyfunc = ciyfn.getstorage('_ccode_verifyfunc', 'verifyfast');
if (!cc.bcod.tabdict)
cc.bcod.tabdict = ciyfn.getstorage('_ccode_tabdict', 'zc_cata');
if (!cc.bcod.htmllang)
cc.bcod.htmllang = ciyfn.getstorage('_ccode_htmllang', 'js');
if (!cc.bcod.proglang)
cc.bcod.proglang = ciyfn.getstorage('_ccode_proglang', 'php');
if (!cc.bcod.saascode)
cc.bcod.saascode = ciyfn.getstorage('_ccode_saascode', '');
if (!cc.bcod.savepc)
cc.bcod.savepc = ciyfn.getstorage('_ccode_savepc', 'd:\\') + cc.bcod.tabname.substring(cc.bcod.tabname.indexOf('_') + 1);
$5('[name=_bcod_verifyfunc]').val(cc.bcod.verifyfunc);
$5('[name=_bcod_titname]').val(cc.bcod.titname);
$5('[name=_bcod_select_order]').val(cc.bcod.selectorder);
$5('[name=_bcod_btntop_newline]').val(cc.bcod.newline);
$5('[name=_bcod_btntop_multibtn]').val(cc.bcod.multibtn);
$5('[name=_bcod_uploadpat]').val(cc.bcod.uploadpat);
$5('[name=_bcod_liiddict]').val(cc.bcod.liiddict);
$5('[name=_bcod_uptabcard]').val(cc.bcod.uptabcard);
$5('[name=_bcod_viewtabcard]').val(cc.bcod.viewtabcard);
$5('[name=_bcod_tabdict]').val(cc.bcod.tabdict);
$5('[name=_bcod_saascode]').val(cc.bcod.saascode);
ciycmp({ dom: '[com=owpc]' });
// ciycmp({
// dom: '[com=_bcod_chk]', value: cc.bcod.bcod_chk, range: [
// //如果有固定的几个字段,则开启审核
// //如果有流程字段,则开启流程
// //如果有列表屏蔽的字段,则开启加载更新
// { id: 'in', name: '导入功能' } //导入+更新
// , { id: 'out', name: '导出功能' } //导出
// , { id: 'pcnoadd', name: 'PC不可添加' }
// ]
// });
$5('[name=_bcod_btnlist_line]').val(cc.bcod.btnlist_line);
$5('[name=_bcod_savepc]').val(cc.bcod.savepc);
ciycmp({ dom: '[com=_bcod_htmllang]', value: cc.bcod.htmllang, range: [{ id: 'js', name: '原生JS' }, { id: 'vue3', name: 'Vue3' }, { id: 'react18', name: 'ReactV18' }] });
ciycmp({ dom: '[com=_bcod_proglang]', value: cc.bcod.proglang, range: [{ id: 'php', name: 'PHP' }, { id: 'golang', name: 'Golang' }, { id: 'python', name: 'Python' }] });
ciycmp({ dom: '[com=_bcod_pctemplate]', value: cc.bcod.pctemplate, range: [{ id: 'sigpage', name: '单页版' }, { id: 'threepage', name: '独立三页' }, { id: 'treepage', name: '多级树形' }, { id: 'editpage', name: '列表编辑' }] });
ciycmp({ dom: '[com=_bcod_mbtemplate]', value: cc.bcod.mbtemplate, range: [{ id: 'sigpage', name: '单页版' }, { id: 'threepage', name: '独立三页' }] });
//计算所有的set给到subset
for (var ss in Glob.sets) {
ciycmp({
dom: '[com=bchk_' + ss + ']', range: [
{ id: 'bviw', name: '查看' }
, { id: 'bdup', name: '查重' }
, { id: 'bimp', name: '必填' }
, { id: 'breq', name: '外引' }
, { id: 'bqry', name: '查询' }
, { id: 'bsrt', name: '排序' }
, { id: 'bmin', name: '导入' }
, { id: 'bout', name: '导出' }
]
});
var colrange = [];
colrange.push({ id: '', name: '请选择' });
for (var x in cols) {
colrange.push({ id: cols[x], name: cols[x] });
}
ciycmp({
dom: '[com=subset_colview_' + ss + ']', range: colrange, minwidth: '3em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
ciycmp({
dom: '[com=subset_coledit_' + ss + ']', range: colrange, minwidth: '3em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '更新' });
colrange.push({ id: 'no', name: '不更新' });
colrange.push({ id: 'view', name: '只显示' });
colrange.push({ id: 'fow', name: '跟随' });
colrange.push({ id: 'now', name: '时间戳' });
colrange.push({ id: 'me', name: '本用户' });
colrange.push({ id: 'ip', name: '客户IP' });
colrange.push({ id: 'saas', name: 'SaaS' });
ciycmp({
dom: '[com=subset_noup_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '多选框' });
colrange.push({ id: 'selmulti', name: '下拉多选' });
ciycmp({
dom: '[com=subset_catstype_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '文本框' });
colrange.push({ id: 'txtarea', name: '多行框' });
colrange.push({ id: 'txtjson', name: 'JSON框' });
ciycmp({
dom: '[com=subset_txtedit_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '文本框' });
colrange.push({ id: 'select', name: '下拉' });
colrange.push({ id: 'window', name: '窗选' });
ciycmp({
dom: '[com=subset_dbquery_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '下拉' });
colrange.push({ id: 'window', name: '窗选' });
ciycmp({
dom: '[com=subset_dbedit_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '一次性' });
colrange.push({ id: 'rel', name: '增量' });
ciycmp({
dom: '[com=subset_listload_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '加载' });
colrange.push({ id: 'no', name: '不加载' });
ciycmp({
dom: '[com=subset_nocmn_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '下拉框' });
colrange.push({ id: 'radio', name: '单选框' });
ciycmp({
dom: '[com=subset_catacmp_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '区间框' });
colrange.push({ id: 'month', name: '月框' });
colrange.push({ id: 'day', name: '日框' });
ciycmp({
dom: '[com=subset_datequery_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
colrange = [];
colrange.push({ id: '', name: '下拉框' });
colrange.push({ id: 'radio', name: '单选框' });
ciycmp({
dom: '[com=subset_cabquery_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
return;
chgset(e.dom);
}
});
Glob.sets[ss].tset = {};
var othsp = [];
for (var spk in Glob.sets[ss].sp) {
var subdom = $5('[com=subset_' + spk + '_' + ss + ']');
if (subdom.length == 0)
subdom = $5('[name=subset_' + spk + '_' + ss + ']');
if (subdom.length == 1) {
subdom.val(Glob.sets[ss].sp[spk]);
Glob.sets[ss].tset[spk] = Glob.sets[ss].sp[spk];
} else {
othsp.push(spk + '=' + Glob.sets[ss].sp[spk]);
}
}
if (othsp.length > 0) {
$5('[name=subset_oth_' + ss + ']').val(othsp.join('|'));
Glob.sets[ss].tset['oth'] = othsp.join('|');
}
if (!isview)
$5('[name=bviw_' + ss + ']').attr('checked', 'true');
}
console.log(isview);
}
, fn_lihtml: function (data, i) {
var html = '';
var colcomment = calcolcomment(data);
var col = {};
if (table.json.code_create) {
col = table.json.code_create.col[data.COLUMN_NAME] || { bchk: 'init' };
}
var spset = ciyfn.getstrparam((col.set || ''), '|');
html += '<li data-id="' + i + '" noselect><div style="display:flex;">';
html += '<div style="width:33em;">';
var chkvalue = col.bchk;
if (chkvalue == 'init') {
if (data.COLUMN_NAME == 'id'
|| data.COLUMN_NAME == 'lat') {
chkvalue = ',bout';
}
else if (data.COLUMN_NAME.substring(0, 4) == 'saas' && data.COLUMN_NAME.substring(5) == 'id') {
chkvalue = '';
}
else if (data.COLUMN_NAME == 'ip'
|| data.COLUMN_NAME == 'auditstatus'
|| data.COLUMN_NAME == 'audittimes'
|| data.COLUMN_NAME == 'audituser'
|| data.COLUMN_NAME == 'auditmsg'
|| data.COLUMN_NAME == 'matterstatus'
|| data.COLUMN_NAME == 'matternextuser'
|| data.COLUMN_NAME == 'mattertimes'
|| data.COLUMN_NAME == 'uptimes'
|| data.COLUMN_NAME == 'addtimes') {
chkvalue = ',bviw,bout';
} else {
chkvalue = ',bviw,bmin,bout';
}
if (data.COLUMN_NAME == 'name') {
chkvalue += ',bqry,bimp';
}
if (colcomment.cate == 'DOWN' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1' || colcomment.cate == 'AV') {
chkvalue = chkvalue.replace(',bmin', '');
}
if (data.DATA_TYPE == 'text' || data.DATA_TYPE == 'mediumtext') {
chkvalue = chkvalue.replace(',bmin', '').replace(',bout', '');
}
if (colcomment.cate == 'BR' || colcomment.cate == 'MD') {
if(!colcomment.show)
spset.nocmn = 'no';
}
if (data.COLUMN_NAME == 'auditstatus'
|| data.COLUMN_NAME == 'audittimes'
|| data.COLUMN_NAME == 'audituser'
|| data.COLUMN_NAME == 'auditmsg'
|| data.COLUMN_NAME == 'matterstatus'
|| data.COLUMN_NAME == 'matternextuser'
|| data.COLUMN_NAME == 'mattertimes'
|| data.COLUMN_NAME == 'id'
|| data.COLUMN_NAME == 'ip') {
spset.noup = 'no';
}
if (data.COLUMN_NAME.substring(0, 4) == 'saas' && data.COLUMN_NAME.substring(5) == 'id') {
spset.noup = 'saas';
}
if (data.COLUMN_NAME == 'lat') {
spset.noup = 'fow';
}
if (data.COLUMN_NAME == 'uptimes' || data.COLUMN_NAME == 'addtimes') {
spset.noup = 'now';
}
if (data.COLUMN_NAME == 'inputuser' || data.COLUMN_NAME == 'vuser') {
spset.noup = 'me';
}
if (colcomment.cate == 'MSK')
spset.msk = '****##';
if (colcomment.cate == 'DOWN')
spset.ftype = 'jpg,png,pdf,zip,rar,docx,xlsx,pptx';
if (colcomment.cate == 'AV')
spset.ftype = 'mp3,mp4,wav,ogg';
if (colcomment.cate == 'IMG' || colcomment.cate == 'IMG1')
spset.ftype = 'jpg,png';
if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG')
spset.num = 3;
if (colcomment.dicttype == 'dictdb' && (colcomment.cate == 'DB' || colcomment.cate == 'CATU'))
spset.listload = 'rel';
}
html += '<ciy-checkbox com="bchk_' + i + '" value=' + chkvalue + '></ciy-checkbox>';
html += '</div>';
html += '<div style="width:6em;"><code>' + data.DATA_TYPE + '</code></div>';
html += '<div style="width:12em;"><kbd>' + data.COLUMN_NAME + '</kbd></div>';
html += '<div style="flex:1;font-size:0.9em;">' + data.COLUMN_COMMENT + '</div>';
html += '</div>';
html += '<div style="margin:0.5em;">';
html += '<input name="col_' + i + '" value="' + data.COLUMN_NAME + '" type="hidden" />';
html += '<input name="show_' + i + '" value="' + (colcomment.show?1:2) + '" type="hidden" />';
html += '<input name="name_' + i + '" value="' + colcomment.name + '" type="hidden" />';
html += '<input name="cate_' + i + '" value="' + colcomment.cate + '" type="hidden" />';
html += '<input name="type_' + i + '" value="' + data.DATA_TYPE + '" type="hidden" />';
html += '<input name="align_' + i + '" value="' + colcomment.align + '" type="hidden" />';
html += '<input name="data_' + i + '" value="' + colcomment.data + '" type="hidden" />';
html += '<div class="subinp">';
html += '<div title="24等分默认24。常见6/8/12/16。t5是5等分">查看栅格 <ciy-select com="subset_colview_' + i + '"></ciy-select></div>';
html += '<div title="24等分默认24。常见6/8/12/16。t5是5等分">编辑栅格 <ciy-select com="subset_coledit_' + i + '"></ciy-select></div>';
html += '<div title="更新语句不更新填no。">编辑否 <ciy-select com="subset_noup_' + i + '"></ciy-select></div>';
if (colcomment.cate == 'CATU' || colcomment.cate == 'DB' || colcomment.cate == 'CATS' || colcomment.cate == 'CATM') {
html += '<div title="">查询组件 <ciy-select com="subset_dbquery_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'DATE') {
html += '<div title="">查询组件 <ciy-select com="subset_datequery_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'BOOL' || colcomment.cate == 'CATA') {
html += '<div title="">查询组件 <ciy-select com="subset_cabquery_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'CATU' || colcomment.cate == 'DB') {
html += '<div title="">编辑组件 <ciy-select com="subset_dbedit_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'CATS' || colcomment.cate == 'TBIN') {
html += '<div title="">编辑组件 <ciy-select com="subset_catstype_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'CATA' || colcomment.cate == 'TINT') {
html += '<div title="">编辑组件 <ciy-select com="subset_catacmp_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'CATM') {
html += '<div title="多级下拉设置upid根值">upid根 <input oninput="chgset(this)" name="subset_cas_' + i + '" type="text" style="width:6em;" /></div>';
}
if (colcomment.dicttype == 'dictdb') {
html += '<div title="列表加载方式">列表加载 <ciy-select com="subset_listload_' + i + '"></ciy-select></div>';
}
if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG') {
html += '<div title="设置上传最大数量">上传数 <input oninput="chgset(this)" name="subset_num_' + i + '" type="text" style="width:3em;" /></div>';
}
if (colcomment.cate == 'MD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') {
if (colcomment.cate != 'MD') {
html += '<div title="组件的宽高带单位如100px">宽高 <input oninput="chgset(this)" name="subset_fwh_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="设置可上传文档扩展名">扩展名 <input oninput="chgset(this)" name="subset_ftype_' + i + '" type="text" style="width:6em;" /></div>';
}
html += '<div title="文件上传尺寸限制单位bytes">大小 <input oninput="chgset(this)" name="subset_flimit_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="图片水印文字">水印 <input oninput="chgset(this)" name="subset_fwater_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="上传图片的最大宽度,填纯数字。像素">图片宽 <input oninput="chgset(this)" name="subset_fimgw_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="上传图片的最大高度,填纯数字。像素">图片高 <input oninput="chgset(this)" name="subset_fimgh_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="上传图片jpg压缩质量0-1">jpg压缩 <input oninput="chgset(this)" name="subset_fzip_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="哪些类型图片可被压缩默认jpg,png">压缩范围 <input oninput="chgset(this)" name="subset_fzext_' + i + '" type="text" style="width:6em;" /></div>';
//html += '<div title="设置本地保存路径">savepath <input oninput="chgset(this)" name="subset_savepath_' + i + '" type="text" style="width:10em;" /></div>';
}
if (colcomment.cate == 'BR' || colcomment.cate == 'MD') {
html += '<div title="列表是否加载">列加载 <ciy-select com="subset_nocmn_' + i + '"></ciy-select></div>';
html += '<div title="设置高度只填数字单位px">高度 <input oninput="chgset(this)" name="subset_height_' + i + '" type="text" style="width:4em;" /></div>';
}
if (colcomment.cate == 'MSK') {
html += '<div title="设置字符隐藏蒙版,#或*">蒙版 <input oninput="chgset(this)" name="subset_msk_' + i + '" type="text" style="width:6em;" /></div>';
}
if (colcomment.cate == '' && (data.DATA_TYPE == 'varchar' || data.DATA_TYPE == 'text' || data.DATA_TYPE == 'mediumtext')) {
html += '<div title="">编辑组件 <ciy-select com="subset_txtedit_' + i + '"></ciy-select></div>';
html += '<div title="设置最小高度">高度 <input oninput="chgset(this)" name="subset_height_' + i + '" type="text" style="width:4em;" /></div>';
}
html += '</div>';
html += '<input disabled type="text" name="set_' + i + '" value="' + ciyfn.setstrparam(spset) + '" style="width:100%;background: #f7f8f8!important;border: none;" />';
html += '</div>';
html += '</li>';
Glob.sets[i] = { sp: spset, comment: colcomment, data: data };
return html;
}
});
table.callpage(1);
window.addEventListener('keydown', function (e) {
if (e.ctrlKey && e.keyCode == 83) {//Ctrl+S
e.preventDefault();
save(document.getElementById("id_submit"));
}
});
});
function splitdict(data) {
var datas = data.split('|');
if (datas[0].substring(0, 4) == 'ciy_')
return ['dictciy', datas[0]];
var ind = data.indexOf('_');
if (ind === -1 || ind > 4)
return ['dictcata', datas[0]];
if (data.indexOf('.') !== -1)
return ['dictstr', datas[0]];
return ['dictdb', datas[0]];
}
function chgset(dom) {
var val = $5(dom).val();
var name = $5(dom).attr('name') || $5(dom).attr('com');
var names = name.split('_');
var kp = names[1];
var stid = names[2];
if (val)
Glob.sets[stid].tset[kp] = val;
else if (Glob.sets[stid].tset)
delete Glob.sets[stid].tset[kp];
var setstr = '';
for (var tsk in Glob.sets[stid].tset) {
if (tsk == 'oth')
setstr += '|' + Glob.sets[stid].tset[tsk];
else
setstr += '|' + tsk + '=' + Glob.sets[stid].tset[tsk];
}
$5('[name=set_' + stid + ']').val(setstr.substr(1));
}
function calcolcomment(col) {
var colname = col.COLUMN_COMMENT;
var ret = { show: true };
if (!colname) {
ret.name = col.COLUMN_NAME;
ret.align = 'l';
ret.show = false;
return ret;
}
if (colname[0] == '#')
colname = colname.substr(1);
else if (colname[0] == ',') {
ret.show = false;
colname = colname.substr(1);
}
var ind = colname.indexOf(' //');
if (ind > 0)
colname = colname.substr(0, ind).trim();
var ind = colname.indexOf(',');
if (ind > 0) {
ret.name = colname.substr(0, ind);
colname = colname.substr(ind + 1);
} else {
ret.name = colname;
colname = '';
}
ret.align = 'l';
if (ret.name.substr(-1, 1) == '|') {
if (ret.name.substr(0, 1) == '|') {
ret.name = ret.name.substr(1, ret.name.length - 2);
ret.align = 'c';
} else {
ret.name = ret.name.substr(0, ret.name.length - 1);
ret.align = 'r';
}
}
ret.name = ret.name.trim();
ret.data = '';
var ind = colname.indexOf(',');
if (ind > 0) {
ret.cate = colname.substr(0, ind);
ret.data = colname.substr(ind + 1);
} else {
ret.cate = colname;
}
ret.cate = ret.cate.trim();
if (ret.cate == 'DB' || ret.cate == 'CATU' || ret.cate == 'CATS' || ret.cate == 'CATM') {
[ret.dicttype, ret.dictname] = splitdict(ret.data);
}
return ret;
}
function save(dom) {
var postparam = checkformdata(dom);
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('save', postparam, function (json) {
ciyfn.setstorage('_ccode_verifyfunc', postparam._bcod_verifyfunc);
ciyfn.setstorage('_ccode_tabdict', postparam._bcod_tabdict);
ciyfn.setstorage('_ccode_htmllang', postparam._bcod_htmllang);
ciyfn.setstorage('_ccode_proglang', postparam._bcod_proglang);
ciyfn.setstorage('_ccode_savepc', postparam._bcod_savepc.substring(0, postparam._bcod_savepc.lastIndexOf('\\') + 1)); //记忆一部分,默认一部分+表名
ciyfn.toast('保存成功');
});
}
function createhtml(dom) {
var postparam = checkformdata(dom);
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('createhtml', postparam, function (json) {
ciyfn.alert({
title: 'HTML代码'
, width: 'max'
, height: 'max'
, content: '<textarea spellcheck="false" style="white-space: nowrap;width:100%;height:calc(100% - 1em);"></textarea>'
, fn_showed: function (doc, dom) {
$5('textarea', dom).val(json.source);
}
, nobutton: true
});
});
}
function createphp(dom) {
var postparam = checkformdata(dom);
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('createphp', postparam, function (json) {
ciyfn.alert({
title: '后端代码'
, width: 'max'
, height: 'max'
, content: '<textarea spellcheck="false" style="white-space: nowrap;width:100%;height:calc(100% - 1em);"></textarea>'
, fn_showed: function (doc, dom) {
$5('textarea', dom).val(json.source);
}
, nobutton: true
});
});
}
function creatembvue3(dom) {
var postparam = checkformdata(dom);
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('creatembvue3', postparam, function (json) {
ciyfn.alert({
title: '移动端Vue3代码'
, width: 'max'
, height: 'max'
, content: '<textarea spellcheck="false" style="white-space: nowrap;width:100%;height:calc(100% - 1em);"></textarea>'
, fn_showed: function (doc, dom) {
$5('textarea', dom).val(json.source);
}
, nobutton: true
});
});
}
function savepc(dom) {
var postparam = checkformdata(dom);
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('savepc', postparam, function (json) {
ciyfn.toast('已生成');
});
}
function checkformdata(dom) {
var postparam = ciyfn.getform(dom);
postparam.total = table.json.list.length;
if (!postparam._bcod_proglang)
return '请选择后端语言';
console.log(postparam);
for (var i = 0; i < postparam.total; i++) {
if (postparam['none_' + i] === 'true')
continue;
var name = postparam['name_' + i];
var cate = postparam['cate_' + i];
var bchk = postparam['bchk_' + i];
var data = postparam['data_' + i] || '';
var set = ciyfn.getstrparam(postparam['set_' + i]);
if (bchk.indexOf('bqry') > -1) {
if (set.dbquery == 'select' && set.listload == 'rel')
return name + ' 下拉查询不能增量加载';
// if ((cate == 'CATU' || cate == 'DB' || cate == 'CATS' || cate == 'CATM') && !set.dbquery) {//文本框查询
// var dats = data.split('|');
// if (dats[0].substring(0, 4) == 'ciy_')
// return name + ' 文本框查询不能用在静态组件中';
// }
}
}
return postparam;
}
</script>
</body>
</html>