/**
  * (int) actionExists : 判断 classmark 的 name1 是否存在
  * @return int
  */
 public function actionExists()
 {
     $request = Yii::$app->request;
     if ($request->isAjax && $request->isPost) {
         $classmark = $request->post('classmark');
         $name1 = $request->post('name1');
         return Preferences::getCodesByName1($classmark, $name1) ? 'yes' : 'no';
     }
 }
Beispiel #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['code1', 'name1', 'sex', 'birthdate', 'fcode', 'marry', 'unit', 's_date', 'flag', 'memo1', 'selfno', 'childnum', 'mz', 'work1', 'ingoingdate', 'address1', 'hkaddr', 'hkxz', 'e_date', 'checktime'], 'required'], [['marrydate'], 'required', 'when' => function ($model) {
         return $model->marry != '10';
     }, 'whenClient' => "function (attribute, value) {\n                    return \$('#p-marry').val() != '10';\n                }"], [['lhdate'], 'required', 'when' => function ($model) {
         return in_array($model->marry, [Preferences::getCodesByName1('pmarry', '离婚'), Preferences::getCodesByName1('pmarry', '再婚'), Preferences::getCodesByName1('pmarry', '复婚')]);
     }, 'whenClient' => "function (attribute, value) {\n                    return \$.inArray(\$('#p-marry').val(), ['22', '23', '40']) > -1 ;\n                }"], [['zhdate'], 'required', 'when' => function ($model) {
         return $model->marry == '22';
     }, 'whenClient' => "function (attribute, value) {\n                    return \$('#p-marry').val() == '22';\n                }"], [['fhdate'], 'required', 'when' => function ($model) {
         return $model->marry == '23';
     }, 'whenClient' => "function (attribute, value) {\n                    return \$('#p-marry').val() == '23';\n                }"], [['s_date', 'birthdate', 'ingoingdate', 'jobdate', 'marrydate', 'lhdate', 'zhdate', 'fhdate'], 'date', 'format' => 'php:Ymd', 'message' => '日期格式:YYYYMMDD'], [['e_date'], 'number'], [['childnum', 'selfno', 'logout', 'checktime', 'created_by', 'updated_by', 'created_at', 'updated_at'], 'integer'], [['code1'], 'string', 'max' => 36], [['name1', 'tel', 'whcd', 'is_dy', 'title', 'zw', 'ltman', 'lttel', 'cardcode', 'do_man'], 'string', 'max' => 50], [['sex', 'mz', 'marry', 'hkxz', 'work1', 'obect1', 'flag', 'memo1', 'onlysign', 'cztype', 'incity'], 'string', 'max' => 2], [['birthdate', 'marrydate', 'postcode', 'jobdate', 'ingoingdate', 'lhdate', 'zhdate', 'fhdate', 'ltpostcode', 'carddate', 'examinedate', 'feeddate', 'yzdate', 's_date', 'e_date', 'marrowdate', 'leavedate', 'audittime'], 'string', 'max' => 8], [['fcode'], 'string', 'max' => 18, 'min' => 15], [['address1', 'hkaddr', 'ltunit', 'ltaddr', 'fzdw', 'checkunit'], 'string', 'max' => 80], [['grous', 'unit', 'oldunit'], 'string', 'max' => 30], [['picture_name', 'memo2'], 'string', 'max' => 100], [['memo'], 'string', 'max' => 254], [['personal_id'], 'string', 'max' => 60], [['personal_id'], 'unique'], [['unit'], 'exist', 'skipOnError' => true, 'targetClass' => Unit::className(), 'targetAttribute' => ['unit' => 'unitcode']]];
 }