<?php
if (count($ziduan_biaodan) > 0) {
foreach ($ziduan_biaodan as $arr => $v) {

if ($v['bd_teshu'] == 1) {

if ($v['table_name'] == 'kehu' && $v['name'] == 'name') { //客户：客户名称
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "name" && $n["inuse"] == "是") {
$get_value = $name;
?>

<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check">
<input name="name" type="text" value="<?php echo $get_value ?>" class="input int-w300" <?php if ($n["bitian"] == "1") {echo 'datatype="*"';}?> <?php if (ONLYCOMPANY == 1) {?>ajaxurl="<?php echo site_url('kehu/ajax_name') ?>?act=edit&id=<?php echo empty($id) ? '0' : $id ?>"<?php }?> />
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?> </dd>
</dl>
<?php }}}
if ($v['table_name'] == 'kehu' && $v['name'] == 'mobile') { //客户：手机号字段
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "mobile" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {
$get_value = $mobile;
?>
<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check">
<?php
$kehu_id = empty($id) ? '0' : $id;
$kehu_weizhi = $this->qmsoft_mysql->get_rows('kehu', array('id' => $kehu_id), 'weizhi');
if (($kehu_weizhi == 0 && $this->qmsoft->check_lever_v(1001)) || $kehu_weizhi == 1) {?>
<input name="mobile" type="text" value="<?php echo $get_value ?>" class="input int-w300" <?php if ($n["bitian"] == "1" && $this->qmsoft->mobile_yz == 1) {echo 'datatype="m" errormsg="手机号格式错误"';} else if ($n["bitian"] == "1" && $this->qmsoft->mobile_yz == 0) {echo 'datatype="*"';} else if ($n["bitian"] == "0" && $this->qmsoft->mobile_yz == 1) {echo 'datatype="m" ignore="ignore" errormsg="手机号格式错误"';} else if ($n["bitian"] == "0" && $this->qmsoft->mobile_yz == 0) {echo '';}?> <?php if (ONLYMOBILE == 1) {?>ajaxurl="<?php echo site_url('kehu/ajax_mobile') ?>?act=edit&id=<?php echo empty($id) ? '0' : $id ?>"<?php }?> />
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?>
<?php } else {
echo $this->qmsoft->jm_mobile($get_value);
}?>
</dd>
</dl>
<?php }}}
if ($v['table_name'] == 'linkman' && $v['name'] == 'mobile') { //联系人：手机号字段
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "mobile" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {
$get_value = $mobile;
?>
<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check">

<?php
	$kehu_weizhi = $this->qmsoft_mysql->get_rows('kehu', array('id' => $cid), 'weizhi');
	if(($kehu_weizhi==0&&$this->qmsoft->check_lever_v(1001))||$kehu_weizhi==1){?>
    
<input name="mobile" type="text" value="<?php echo $get_value ?>" class="input int-w300" <?php if ($n["bitian"] == "1" && $this->qmsoft->mobile_yz == 1) {echo 'datatype="m" errormsg="手机号格式错误"';} else if ($n["bitian"] == "1" && $this->qmsoft->mobile_yz == 0) {echo 'datatype="*"';} else if ($n["bitian"] == "0" && $this->qmsoft->mobile_yz == 1) {echo 'datatype="m" ignore="ignore" errormsg="手机号格式错误"';} else if ($n["bitian"] == "0" && $this->qmsoft->mobile_yz == 0) {echo '';}?> <?php if (ONLYMOBILE == 1) {?>ajaxurl="<?php echo site_url('kehu/ajax_mobile') ?>?act=edit&id=<?php echo empty($id) ? '' : $id ?>&mod=linkman&cid=<?php echo intval($this->input->get('cid', TRUE)) ?>"<?php }?> />
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?> 

    <?php }else{
		echo $this->qmsoft->jm_mobile($get_value);
	}?>

</dd>
</dl>
<?php }}}
if ($v['table_name'] == 'gendan' && $v['name'] == 'nexttime') { //跟单：下次联系
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "nexttime" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {
$get_value = ${$v['name']};
if ($get_value == '0000-00-00 00:00:00' || $get_value == null) {
$get_value = '';
} else {
$get_value = date("Y-m-d h:i", strtotime($nexttime));
}
$remind = $remind;
?>
<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check">
<input name="nexttime" type="text" class="input rule-date-input" value="<?php echo $get_value ?>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" <?php if ($n["bitian"] == "1") {?>datatype="*" nullmsg="请选择日期"<?php }?>/>
&nbsp;
提前：
<select name='remind'>
<option value="0.0833" <?php echo $remind == 0.0833 ? 'selected' : '' ?>>5分钟</option>
<option value="0.5" <?php echo $remind == 0.5 ? 'selected' : '' ?>>30分钟</option>
<option value="1" <?php echo $remind == 1 ? 'selected' : '' ?>>1小时</option>
<option value="2" <?php echo $remind == 2 ? 'selected' : '' ?>>2小时</option>
<option value="3" <?php echo $remind == 3 ? 'selected' : '' ?>>3小时</option>
<option value="24" <?php echo $remind == 24 ? 'selected' : '' ?>>1天</option>
<option value="48" <?php echo $remind == 48 ? 'selected' : '' ?>>2天</option>
<option value="72" <?php echo $remind == 72 ? 'selected' : '' ?>>3天</option>
<option value="168" <?php echo $remind == 168 ? 'selected' : '' ?>>1周</option>
</select>
提醒 <?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?></dd>
</dl>
<?php }}}
if ($v['table_name'] == 'hetong' && $v['name'] == 'number') { //合同：合同编号
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "number" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {
?>
<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check <?php if(HETONGNUMBER==1){?>nochange<?php }?>">
<input name="number" type="text" class="input int-w300" value="<?php echo $number ?>" <?php if ($n["bitian"] == "1") {echo 'datatype="*"';}?> <?php if(HETONGNUMBER==1){?>style="background:#ddd;" readonly<?php }?> ajaxurl="<?php echo site_url('hetong/ajax_check') ?>?act=edit&id=<?php echo empty($id) ? '' : $id ?>"/>
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?> </dd>
</dl>
<?php }}}

if ($v['table_name'] == 'chanpin' && $v['name'] == 'pic') { //产品：缩略图
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "pic" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {
$get_value = $pic;
if (!empty($get_value)) {
$get_value_arr = explode('|', $get_value);
if (is_array($get_value_arr) && count((array) $get_value_arr) > 0) {
    $uplife_name = $get_value_arr[0];
    $uplife_url = $get_value_arr[1];
}
}
?>
<dl class="buguding">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check">
<input id="pic_data" name="pic" type="hidden" value="<?php echo $get_value ?>" class="input int-w300" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> />
<span id="pic_view" class="picview"><img src="<?php echo $uplife_url ?>"></span>
<button type="button" class="btn2 color9 layui-btn-danger" id="pic"><i class="fa fa-cloud-upload"></i>上传图片</button>
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?> </dd>
</dl>
<?php }}}
if ($v['table_name'] == 'caiwu' && $v['name'] == 'money') { //财务：收支金额
foreach ($ziduan_biaodan as $arr => $n) {
if ($n["name"] == "money" && $n["inuse"] == "是" && ($n['qx_edit'] == null || ($n['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $n['qx_edit']))))) {?>
<dl class="zd_<?php echo $n["name"] ?>">
<dt> <?php echo $n["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?><?php echo $n['title']; ?> </dt>
<dd class="int_check"> <span class="zd_money"><?php echo $money ?></span>
<input name="money" type="hidden" class="input int-w300 readonly" value="<?php echo $money ?>" <?php if ($n["bitian"] == "1") {echo 'datatype="*"';}?> readonly style="min-width:130px;width:130px;"/>
<?php echo !empty($n["tip"]) ? '<span class="Validform_checktip">' . $n['tip'] . '</span>' : '' ?> </dd>
</dl>
<script>
$(function() {
$(".zd_money").each(function(){
var thisval=$(this).html();
$(this).html(thisval.replace(".00",""));
});
})
</script>
<?php }}}

} else {

if ($v['type'] == 'text') { //单行文本

if ($v['table_name'] == 'caiwu' && $v['name'] == 'type') { //排除caiwu type
} else {

$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<input name="<?php echo $v['name'] ?>" type="text" value="<?php echo $get_value ?>" class="input int-w300" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> />
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php

}
} //
} else if ($v['type'] == 'users_duo') { //多员工选择
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check nochange">
<input id="<?php echo $v['name'] ?>" name="<?php echo $v['name'] ?>" type="text" class="input int-w300" value="<?php echo $get_value ?>" <?php echo $v['bitian'] == 1 ? 'datatype="*" nullmsg="选择人员"' : '' ?> readonly style="width:60%; clear:right; margin-bottom:5px;" />
<a class="btn2 color13 alert1" href="<?php echo site_url('choose/choose_users') ?>?ctype=<?php echo $this->uri->segment(1, '')?>&fhziduan=<?php echo $v['name'] ?>" data-title="选择人员" data-width="650" data-height="550"><i class="fa fa-plus"></i>选择人员</a>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?>
</dd>
</dl>
<?php
} //
} else if ($v['type'] == 'textarea') { //多行文本
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<textarea name="<?php echo $v['name'] ?>" class="input" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> ><?php echo $get_value ?></textarea>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
} //
} else if ($v['type'] == 'textedit') { //编辑器
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<textarea class="layui-textarea textedit" name="<?php echo $v['name'] ?>" id="<?php echo $v["name"] ?>" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?>><?php echo $get_value ?></textarea>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?>
</dd>
</dl>
<?php
} //
} else if ($v['type'] == 'money') { //金额
$get_value = str_replace(".00", "", floatval(${$v['name']}));
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<input name="<?php echo $v['name'] ?>" type="text" value="<?php echo $get_value ?>" class="input small" <?php echo $v['bitian'] == 1 ? 'datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" errormsg="请输入正确的金额"' : '' ?> />
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
} //
} else if ($v['type'] == 'number2') { //数字
$get_value = str_replace(".00", "", floatval(${$v['name']}));
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<input name="<?php echo $v['name'] ?>" type="number" value="<?php echo $get_value ?>" class="input small" <?php echo $v['bitian'] == 1 ? 'datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" errormsg="请输入正确的数值"' : '' ?> step="0.01" />
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
} //
} else if ($v['type'] == 'yes') { //是否
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<div class="rule-single-checkbox single-checkbox"><a href="javascript:;"><i class="on">否</i><i class="off">是</i></a>
<input name="<?php echo $v['name'] ?>" type="text" value="<?php echo $get_value == '是' ? '是' : '否' ?>" style="display: block;">
</div>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
} //
} else if ($v['type'] == 'radio') { //单选
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {

if (!empty($v['content'])) {
$selectres = explode("|", $v['content']);
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<div class="rule-multi-radio"><span>
<?php foreach ($selectres as $key => $n) {?>
<input id="<?php echo $v['name'] ?>_<?php echo $key+1?>" type="radio" name="<?php echo $v['name'] ?>" value="<?php echo $n ?>" <?php echo $n == $get_value ? 'checked="checked"' : '' ?> <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> />
<label for="<?php echo $v['name'] ?>_<?php echo $key+1?>"><?php echo $n ?></label>
<?php }?>
</span></div>
<?php if ($this->qmsoft->check_lever_v(208)) {?>
<a class="btn1 color1 alert1" href="<?php echo site_url('ziduan/fastset') ?>?id=<?php echo $v['id'] ?>&fromurl=<?php echo urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) ?>" data-title="设置选项值" data-width="520" data-height="250"><i class="fa fa-plus-circle"></i>设置</a>
<?php }?>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
} else {
echo '配置不能为空';
}

} //
} else if ($v['type'] == 'checkbox') { //多选
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {

if (!empty($v['content'])) {
$ns = explode("|", $get_value);
$selectres = explode("|", $v['content']);
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<div class="rule-multi-porp multi-porp">
<ul>
<?php foreach ($selectres as $key => $n) {?>
<li <?php echo $n == $get_value ? 'class="selected"' : '' ?>><a href="javascript:;"><?php echo $v['name'] ?></a><i class="fa-check-square-o-mark"></i></li>
</ul>
<?php }?>
<span style="display:none;">
<?php foreach ($selectres as $key => $n) {?>
<input id="<?php echo $v['name'] ?>_<?php echo $key+1?>" name="<?php echo $v['name'] ?>[]" type="checkbox" value="<?php echo $n ?>" <?php echo in_array($n, $ns) ? 'checked' : '' ?> <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> >
<label for="<?php echo $v['name'] ?>_<?php echo $key+1?>"><?php echo $n ?></label>
<?php }?>
</span></div>
<?php if ($this->qmsoft->check_lever_v(208)) {?>
<a class="btn1 color1 alert1" href="<?php echo site_url('ziduan/fastset') ?>?id=<?php echo $v["id"] ?>&fromurl=<?php echo urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) ?>" data-title="设置选项值" data-width="520" data-height="250"><i class="fa fa-plus-circle"></i>设置</a>
<?php }?>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
} else {
echo '配置不能为空';
}

} //
} else if ($v['type'] == 'select') { //下拉

$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {

if ($v['table_name'] == 'caiwu' && (($v['name'] == 'type1' && $outin == 1) || ($v['name'] == 'type0' && $outin == 0))) {
$v['bitian'] = $this->qmsoft_mysql->get_rows('ziduan', array('table_name' => 'caiwu', 'name' => 'type'), 'bitian');
}

if (!empty($v['content'])) {
$selectres = explode("|", $v['content']);
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<select name="<?php echo $v['name'] ?>" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> >
<option value="">请选择...</option>
<?php foreach ($selectres as $key => $n) {?>
<option value="<?php echo $n ?>" <?php echo $n == $get_value ? 'selected' : '' ?>><?php echo $n ?></option>
<?php }?>
</select>
<?php if ($this->qmsoft->check_lever_v(208)) {?>
<a class="btn1 color1 alert1" href="<?php echo site_url('ziduan/fastset') ?>?id=<?php echo $v["id"] ?>&fromurl=<?php echo urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) ?>" data-title="设置选项值" data-width="520" data-height="250"><i class="fa fa-plus-circle"></i>设置</a>
<?php }?>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
} else {
echo '配置不能为空';
}

} //
} else if ($v['type'] == 'selects') { //二级下拉

$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {

if (!empty($v['content'])) {
$selectres = explode("|", $v['content']);

foreach ($selectres as $fukey => $fuval) {
$zivals = array();
preg_match_all("/(?:\{)(.*)(?:\})/i", $fuval, $zivals);
$zivals = $zivals[1][0];
$arr_zivals = explode('*', $zivals);
$arr_ziduovals[$fukey] = $arr_zivals;
$arr_fuvals[$fukey] = str_replace($zivals, '', $selectres[$fukey]);
$arr_fuvals[$fukey] = str_replace('{}', '', $arr_fuvals[$fukey]);
}
$json_ziduovals = json_encode($arr_ziduovals);

$arr_get_value = explode("-", $get_value);
$get_value_fu = $arr_get_value[0];
$get_value_zi = $arr_get_value[1];
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<select name="<?php echo $v['name'] ?>" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> onchange="<?php echo $v['name'] ?>_getzivals()">
<option value="">请选择...</option>
<?php foreach ($arr_fuvals as $key => $n) {?>
<option value="<?php echo $n ?>" <?php echo $n == $get_value_fu ? 'selected' : '' ?>><?php echo $n ?></option>
<?php }?>
</select>
<select name="<?php echo $v['name'] ?>_zi">
<option value="">请选择...</option>
</select>
<?php if ($this->qmsoft->check_lever_v(208)) {?>
<a class="btn1 color1 alert1" href="<?php echo site_url('ziduan/fastset') ?>?id=<?php echo $v["id"] ?>&fromurl=<?php echo urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) ?>" data-title="设置选项值" data-width="520" data-height="250"><i class="fa fa-plus-circle"></i>设置</a>
<?php }?>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<script>
var <?php echo $v['name'] ?>_zivals = <?php echo $json_ziduovals ?>;
var <?php echo $v['name'] ?>_ziokval = "<?php echo $get_value_zi ?>";

<?php echo $v['name'] ?>_getzivals()

function <?php echo $v['name'] ?>_getzivals() {
var fu_num = document.formsave.<?php echo $v['name'] ?>;
var zi_name = document.formsave.<?php echo $v['name'] ?>_zi;
var fu_isok = <?php echo $v['name'] ?>_zivals[fu_num.selectedIndex - 1];
zi_name.length = 1;
for (var i = 0; i < fu_isok.length; i++) {
zi_name[i + 1] = new Option(fu_isok[i], fu_isok[i]);
}
$('select[name="<?php echo $v['name'] ?>_zi"]').find("option[value='"+<?php echo $v['name'] ?>_ziokval+"']").attr("selected",true);
}
</script>
<?php
} else {
echo '配置不能为空';
}

} //
} else if ($v['type'] == 'datetime') { //时间日期
$get_value = ${$v['name']};
if ($get_value == '0000-00-00 00:00:00' || $get_value == null) {

$get_value = '';

} else {

switch ($v['content']) {
case "yyyy-MM-dd":
$get_value = date("Y-m-d", strtotime($get_value));
break;

case "yyyy-MM-dd HH:mm":
$get_value = date("Y-m-d H:i", strtotime($get_value));
break;

case "yyyy-MM-dd HH:mm:ss":
$get_value = date("Y-m-d H:i:s", strtotime($get_value));
break;

default:
$get_value = null;
}

}

$get_value = $get_value;
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<input name="<?php echo $v['name'] ?>" type="text" value="<?php echo $get_value ?>" class="input rule-date-input" onclick="WdatePicker({dateFmt:'<?php echo !empty($v['content']) ? $v['content'] : 'yyyy-MM-dd' ?>'})" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> />
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
} //
} else if ($v['type'] == 'area') { //地区选择
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check">
<div class="city-choose">
<input name="<?php echo $v['name'] ?>" id="area_<?php echo $v['id'] ?>" class="form-control" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?> type="text" value="<?php echo $get_value ?>" data-toggle="city-picker" readonly>
</div>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<script>
$(function(){
var $area_<?php echo $v['id'] ?> = $('#area_<?php echo $v['id'] ?>');
});
</script>
<?php
} //
} else if ($v['type'] == 'linkman') { //客户联系人
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<?php if (isset($cid) && $cid > 0) {
$kehu_linkmans = $this->qmsoft_data->getkehulinkmans($cid);
$kehu_weizhi = $this->qmsoft_mysql->get_rows('kehu', array('id' => $cid), 'weizhi');
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?> <?php echo $v['title']; ?> </dt>
<dd class="int_check">
<select name="<?php echo $v['name'] ?>" <?php if ($v["bitian"] == "1") {?>datatype="*"<?php }?>>
<option value="">请选择...</option>
<?php foreach ($kehu_linkmans as $key => $n) {?>
<option value="<?php echo empty($n['linkman']) ? '未填写' : $n['linkman'] ?>" <?php echo $n['linkman'] == $get_value ? 'selected' : '' ?>><?php echo empty($n['linkman']) ? '未填写' : $n['linkman'] ?> - <?php if(($kehu_weizhi==0&&$this->qmsoft->check_lever_v(1001))||$kehu_weizhi==1){?><?php echo $n['mobile']?><?php }else{ echo $this->qmsoft->jm_mobile($n['mobile']); }?></option>
<?php }?>
</select>
<?php if ($this->qmsoft->check_lever_v(12)) {?>
<a class="btn1 color1 alert1" href="<?php echo site_url('linkman/add') ?>?cid=<?php echo $cid ?>&fromurl=<?php echo urlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']) ?>" data-title="新增联系人" data-width="620" data-height="550"><i class="fa fa-plus-circle"></i>新增</a>
<?php }?>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
} else {
//echo '客户编号cid不存在';
}

} //
} else if ($v['type'] == 'users' && $v['name'] != 'adduser') { //员工选择
$get_value = ${$v['name']};
$data_users = $this->qmsoft_data->getallusers();
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['title']; ?> <?php echo $v["bitian"] == "1" ? '<font color="#F00">*</font>' : '' ?> </dt>
<dd class="int_check">
<select name="<?php echo $v['name'] ?>" <?php if ($v["bitian"] == "1") {?>datatype="*"<?php }?>>
<option value="">请选择...</option>
<?php foreach ($data_users as $key => $n) {?>
<option value="<?php echo $n['realname'] ?>" <?php echo $n['realname'] == $get_value ? 'selected' : '' ?>><?php echo $n['realname'] ?></option>
<?php }?>
</select>
<?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?></dd>
</dl>
<?php
}
} else if ($v['type'] == 'upload_img') { //图片上传
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
if (!empty($get_value)) {
$get_value_arr = explode('|', $get_value);
if (is_array($get_value_arr) && count((array) $get_value_arr) > 0) {
$uplife_name = $get_value_arr[0];
$uplife_url = $get_value_arr[1];
}
}
?>
<dl class="zd_<?php echo $v["name"] ?> upload_img">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check danfile">
<input id="<?php echo $v['name'] ?>_data" name="<?php echo $v['name'] ?>" type="hidden" value="<?php echo $get_value ?>" class="input int-w300" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?>/>
<span id="<?php echo $v['name'] ?>_view">
<?php if (!empty($get_value)) {?>
<span class="upimg_show"><img class="view_img" src="<?php echo $uplife_url ?>"> <a href="<?php echo $uplife_url ?>" target="_blank" class="upimg_view">查看</a><a class="upimg_del">删除</a></span>
<?php }?>
</span>
<button type="button" class="btn2 color9 layui-btn-danger" id="<?php echo $v['name'] ?>"><i class="fa fa-cloud-upload"></i>上传图片</button>
<span class="layui-inline layui-word-aux"> 图片大小限制为<?php echo UPLOADSIZE ? UPLOADSIZE : 10 ?>M </span> <?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
}
} else if ($v['type'] == 'upload_imgs') { //多图片上传
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?> upload_img">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check duofiles">
<div id="<?php echo $v['name'] ?>_view">
<ul>
<?php
if (is_array($get_value) && count((array) $get_value) > 0) {
for ($i = 0; $i < count($get_value); $i++) {
?>
<span class="upimg_show"><img class="view_img" src="<?php echo $get_value[$i]['url']; ?>">
<p><a href="<?php echo $get_value[$i]['url']; ?>" target="_blank" class="upimg_view">查看</a><a data-id="<?php echo $get_value[$i]['id']; ?>" id="upfile_data_<?php echo $get_value[$i]['id']; ?>" class="upfile_data_del">删除</a></p>
</span>
<?php
}}?>
</ul>
</div>
<button type="button" class="btn2 color9 layui-btn-danger" id="<?php echo $v['name'] ?>"><i class="fa fa-cloud-upload"></i>上传图片(多)</button>
<span class="layui-inline layui-word-aux"> 单图大小限制为<?php echo UPLOADSIZE ? UPLOADSIZE : 10 ?>M </span> <?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> <input type="hidden" id="<?php echo $v['name']?>_test" name="<?php echo $v['name']?>_test" value="<?php echo count($get_value)?>" <?php echo $v['bitian'] == 1 ? 'datatype="*" nullmsg="请上传图片"' : '' ?>/> </dd>
</dl>
<?php
}
} else if ($v['type'] == 'upload_file') { //文件上传
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
if (!empty($get_value)) {
$get_value_arr = explode('|', $get_value);
if (is_array($get_value_arr) && count((array) $get_value_arr) > 0) {
$uplife_name = $get_value_arr[0];
$uplife_url = $get_value_arr[1];
}
}
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check danfile">
<input id="<?php echo $v['name'] ?>_data" name="<?php echo $v['name'] ?>" type="hidden" value="<?php echo $get_value ?>" class="input int-w300" <?php echo $v['bitian'] == 1 ? 'datatype="*"' : '' ?>/>
<span id="<?php echo $v['name'] ?>_view">
<?php if (!empty($get_value)) {?>
<?php echo $uplife_name ?> <a href="<?php echo $uplife_url ?>" download="<?php echo $uplife_name ?>">下载</a></span> <span class="upfile_del">删除</span>
<?php }?>
</span>
<button type="button" class="btn2 color9 layui-btn-danger" id="<?php echo $v['name'] ?>"><i class="fa fa-cloud-upload"></i>上传文件</button>
<span class="layui-inline layui-word-aux"> 文件大小限制为<?php echo UPLOADSIZE ? UPLOADSIZE : 10 ?>M </span> <?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> </dd>
</dl>
<?php
}} else if ($v['type'] == 'upload_files') { //多文件上传
$get_value = ${$v['name']};
if ($v["inuse"] == "是" && ($v['qx_edit'] == null || ($v['qx_edit'] != null && in_array($this->qmsoft->realname, explode(',', $v['qx_edit']))))) {
?>
<dl class="zd_<?php echo $v["name"] ?>">
<dt> <?php echo $v['bitian'] == 1 ? '<font color="#F00">*</font>' : '' ?><?php echo $v['title'] ?> </dt>
<dd class="int_check duofiles">
<div id="<?php echo $v['name'] ?>_list">
<ul>
<?php
if (is_array($get_value) && count((array) $get_value) > 0) {
for ($i = 0; $i < count($get_value); $i++) {
?>
<li><span class="upfile_view"><?php echo $get_value[$i]['client_name']; ?></span> <span class="upfile_down"><a href="<?php echo $get_value[$i]['url']; ?>" download="<?php echo $get_value[$i]['client_name']; ?>">下载</a></span> <span data-id="<?php echo $get_value[$i]['id']; ?>" id="upfile_data_<?php echo $get_value[$i]['id']; ?>" class="upfile_data_del">删除</span></li>
<?php
}}?>
</ul>
</div>
<button type="button" class="btn2 color9 layui-btn-danger" id="<?php echo $v['name'] ?>"><i class="fa fa-cloud-upload"></i>上传文件(多)</button>
<span class="layui-inline layui-word-aux"> 单文件大小限制为<?php echo UPLOADSIZE ? UPLOADSIZE : 10 ?>M </span> <?php echo !empty($v["tip"]) ? '<span class="Validform_checktip vtip" vtitle="' . $v['tip'] . '"><i class="fa fa-question-circle-o"></i></span>' : '' ?> <input type="hidden" id="<?php echo $v['name']?>_test" name="<?php echo $v['name']?>_test" value="<?php echo count($get_value)?>" <?php echo $v['bitian'] == 1 ? 'datatype="*" nullmsg="请上传文件"' : '' ?>/> </dd>
</dl>
<?php
}}

}}}
?>
<script>
$(function() {
$(".zd_ysmoney").hide();
$(".zd_qkmoney").hide();
})
</script>