浏览代码

故障报修操作菜单处理

q 1 年之前
父节点
当前提交
8bfe539b55

+ 17 - 6
webmain/flow/input/inputAction.php

@@ -933,36 +933,44 @@ class inputAction extends Action
 	{
 		$modenum 	= $this->post('modenum');
 		$flow 		= m('flow')->initflow($modenum);
+        // 要导入的字段
 		$rows 		= m('flow_element')->getall('mid='.$flow->modeid.' and `isdr`=1 and `iszb`=0','name,isbt,fields,isonly','`sort`,`id`');
 		$fields 	= $fieldss = '';
 		if(!$rows)return returnerror('没有导入的字段');
 		$onlyfield	= array();
+        // 确定必填、唯一字段
 		foreach($rows as $k=>$rs){
 			$fields.=','.$rs['fields'].'';
 			if($rs['isbt']=='1')$fieldss.=','.$rs['fields'].'';
 			if($rs['isonly']=='1')$onlyfield[] = $rs['fields']; //唯一字段
 		}
+        // 字段名
 		$fields = substr($fields, 1);
+        // 必填字段名
 		if($fieldss!='')$fieldss = substr($fieldss,1);
-		
+
+        // 需要导入的数据,提交过来的
 		$data  	= c('html')->importdata($fields, $fieldss); //获取提交过来要导入的数据库
 		if(!$data)return returnerror('没有可导入的数据,注意*是必填的哦');
 		
 		$msgstr = '';
-		
-		//保存前判断
+
+		// 保存前判断
 		if(method_exists($flow,'flowdaorubefore')){
 			$data = $flow->flowdaorubefore($data);
 			if(is_string($data))return returnerror($data);
 		}
-		
+
 		//判断是否有重复
 		$ldata 	= array();
 		foreach($data as $k=>$rs){
 			$bos 	= true;
+            // 唯一字段检查
 			foreach($onlyfield as $onid){
+                // 数组中查找值,在获取重复数据的数组中查找唯一id
 				$val = arrvalue($rs, $onid);
 				if(!isempt($val)){
+                    // 如果找到了记录一下对应字段,用于前端输出
 					$tos = $flow->rows("`$onid`='$val'");
 					if($tos>0){
 						$bos = false;
@@ -971,15 +979,18 @@ class inputAction extends Action
 					}
 				}
 			}
+            // 没找到、没有唯一字段,则记录到$ldata数组中。
 			if($bos)$ldata[] = $rs;
 		}
+        // 判断数组如果为空,则报个提示,没有需要导入的数据。。
 		if(!$ldata)return returnerror('没有可导入的数据'.$msgstr.'');
+        // 获取字段
 		$allfields = $this->db->getallfields('[Q]'.$flow->mtable.'');
-		
+
 		$oi 	= 0;
 		$dorudat= array();
 		foreach($ldata as $k=>$rs){
-		
+
 			$id 	= (int)arrvalue($rs,'id','0');
 			$where 	= '';
 			if($id>0){

+ 1 - 1
webmain/model/agent/agent.php

@@ -200,7 +200,7 @@ class agentModel extends Model
 	/**
 	*	显示人员对应头像
 	*/
-	private function showrowsface($rows)
+	public function showrowsface($rows)
 	{
 		if(!$this->showuface)return $rows;
 		$uids	= '0';

+ 81 - 0
webmain/model/agent/repair_faultModel.php

@@ -0,0 +1,81 @@
+<?php
+/**
+故障报修
+ */
+class agent_repair_faultClassModel extends agentModel
+{
+    protected function agentrows($rows, $rowd, $uid){
+        $typearr = array();
+        if($this->loadci==1) $typearr = $this->flowwesearchdata(1);
+        return array(
+            'rows' =>$rows, // 数据
+            'typearr' =>$typearr, // 类型数组
+        );
+    }
+
+    public function flowwesearchdata($lx)
+    {
+        $arr = m("repair_type")->getall("1=1", "*");
+        $getselectdatad = [];
+        foreach ($arr as $k => $rs) {
+            $dd['id'] = $rs['id'];
+            $dd['name'] = $rs['name'];
+            $dd['num'] = null;
+            $dd['value'] = null;
+            $dd['stotal'] = 0;
+            $dd['nameo'] = $rs['name'];
+            $dd['padding'] = 0;
+            $getselectdatad[] = $dd;
+        }
+        if($lx==1)return $getselectdatad;
+        return array(
+            'typename' => '所有分类',
+            'searchmsg' => '新闻标题/分类',
+        );
+    }
+
+//    public function getdata($uid, $num, $lx, $page)
+//    {
+//        $this->tongmode = true;
+//        if(!isempt($lx)){
+//            $lxa = explode('|', $lx);
+//            if(isset($lxa[1]) && !isempt($lxa[1])){
+//                if($lxa[1] != $num)$this->tongmode = false;
+//                $num = $lxa[1]; // repair_fault
+//                $lx  = $lxa[0]; // all
+//            }
+//        }
+//        $this->loadci 	= (int)$this->rock->get('loadci','0');
+//        $this->getagentinfor($num);
+//        $this->page 	= $page;
+//        $this->user_id 	= $uid;
+//        $this->event 	= $lx;
+//        $narr 	= $this->agentdata($uid, $lx);
+//        $lx		= $this->event; // all
+//        if(!$narr)$narr = $this->getdatalimit($uid, $lx);
+//
+//
+//        $arr 	= array(
+//            'wdtotal' 	=> 0,
+//            'event'		=> $lx,
+//            'num'		=> $num,
+//            'rows'		=> array(),
+//            'rowd'		=> array(),
+//            'page'		=> $page,
+//            'limit'		=> $this->limit,
+//            'agentid'	=> $this->agentid,
+//            'count'		=> 0,
+//            'maxpage'	=> 0
+//        );
+//        if(is_array($narr))foreach($narr as $k=>$v)$arr[$k]=$v;
+//        $barr 			= $this->agentrows($arr['rows'],$arr['rowd'], $uid);
+//        if(isset($barr['rows'])){
+//            foreach($barr as $k=>$v)$arr[$k]=$v;
+//            $barr = $barr['rows'];
+//        }
+//        $arr['rows'] 	= $this->showrowsface($barr);
+//        $arr['stotal']	= $this->agenttotals($uid);
+//        unset($arr['rowd']);
+//        return $arr;
+//    }
+}

+ 50 - 0
webmain/model/flow/repair_faultModel.php

@@ -0,0 +1,50 @@
+<?php
+class flow_repair_faultClassModel extends flowModel
+{
+
+    public $hstate, $hcolor;
+
+    public function initModel()
+    {
+        $this->hstate = array('未处理', '已处理');
+        $this->hcolor = array('#ff6600','green');
+    }
+
+    // 初始化单据可替换其他属性,$lx,0默认,1详情展示,2列表显示,3打印页,4外部详情页
+    public function flowrsreplace($rs, $lx=0)
+    {
+        $zt = $rs['handle_state'];
+        // 将id转换为文字
+        $rs['handle_state'] = $this->getstatezt($zt);
+
+        return $rs;
+    }
+
+    // $ors当前单据操作信息,$crs提交过来的信息
+    public function flowoptmenu($ors, $crs)
+    {
+        // 切换会议议题
+        if ($ors['num'] == 'noup') {
+            $sm = $crs['sm']; // 提交过来的说明
+            $uname = $this->uname;
+            $uid = $this->uid;
+            // 更新说明
+            $this->update([
+                "explain"=>$sm,
+                "repairer"=>$uname,
+                "repairer_id"=>$uid,
+            ], $this->id);
+        }
+    }
+
+    public function getstatezt($zt)
+    {
+        if (isset($this->hstate[$zt])) {
+            $html = '<font color="'.$this->hcolor[$zt].'">'.$this->hstate[$zt].'</font>';
+            return $html;
+        } else {
+            return null;
+        }
+    }
+
+}

+ 4 - 3
webmain/model/flow/userModel.php

@@ -173,8 +173,9 @@ class flow_userClassModel extends flowModel
 		$sort 	= (int)$this->getmou('max(`sort`)', '`id`>0');
 		$dbs	= m('dept');
 		$py 	= c('pingyin');
-		$dname	= $dbs->getmou('name', 1);if(isempt($dname))$dname = '信呼开发团队';
-		
+		$dname	= $dbs->getmou('name', 1);
+        if(isempt($dname))$dname = getconfig('company_name');
+
 		foreach($rows as $k=>$rs){
 			$user = $rs['user'];
 			$name = $rs['name'];
@@ -191,7 +192,7 @@ class flow_userClassModel extends flowModel
 			$arr['user'] = strtolower($user);
 			$arr['name'] = $name;
 			
-			$arr['pass']  		= md5('123456');
+			$arr['pass']  		= md5('Zhks2023_jw');
 			$arr['sort']  		= $sort+$k+1;
 			$arr['workdate']  	= arrvalue($rs,'workdate', $this->rock->date);
 			$arr['adddt']  		= $this->rock->now;

文件差异内容过多而无法显示
+ 247 - 6
webmain/model/optionModel.php


+ 13 - 0
webmain/we/ying/yingyong/repair_fault.js

@@ -0,0 +1,13 @@
+function myyingsinit(){
+    var s = '<select id="type_id" style="width:100px;border:none;background:white;font-size:14px"><option value="">所有分类</option></select>';
+    $('#searsearch_bar').prepend(s);
+    $('#type_id').change(function(){
+        yy.search({'type_id':this.value});
+    });
+}
+yy.onshowdata=function(da){
+    if(da.typearr){
+        js.setselectdata(get('type_id'), da.typearr, 'id');
+    }
+}
+myyingsinit();