|
@@ -50,12 +50,20 @@ class Worklocation extends Model
|
|
|
{
|
|
|
return $this->dataRange()
|
|
|
->catchSearch()
|
|
|
- ->append(['wind_name','fan_number','parts_name','bolt_style_name','boit_type_name'])
|
|
|
+ ->append(['department_name','wind_name','fan_number','work_local_name','parts_name','bolt_style_name','boit_type_name'])
|
|
|
->field('*')
|
|
|
->catchOrder()
|
|
|
->creator()
|
|
|
->paginate();
|
|
|
}
|
|
|
+ //获取部门名称
|
|
|
+ public function getDepartmentNameAttr()
|
|
|
+ {
|
|
|
+ $dep_id = Db::name('wind')->where('id',$this->wind_id)->value('department_id');
|
|
|
+ $name = Db::name('departments')->where('id',$dep_id)->where('status',1)->value('department_name');
|
|
|
+ return $name;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取风场名称
|
|
|
*
|
|
@@ -84,12 +92,72 @@ class Worklocation extends Model
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function getPartsName()
|
|
|
+ public function getPartsNameAttr()
|
|
|
{
|
|
|
$parts = $this->parts;
|
|
|
-
|
|
|
+ $value = $this->get_dict_data(11,$parts);
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
+ //获取工作位置型号
|
|
|
+ public function getWorkLocalNameAttr()
|
|
|
+ {
|
|
|
+ $code = $this->work_local;
|
|
|
+ $value = $this->get_dict_data(12,$code);
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取螺栓样式
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function getBoltStyleNameAttr()
|
|
|
+ {
|
|
|
+
|
|
|
+ $code = $this->bolt_style;
|
|
|
+ $value = $this->get_dict_data(13,$code);
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 螺栓型号
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function getBoitTypeNameAttr()
|
|
|
+ {
|
|
|
+ $code = $this->boit_type;
|
|
|
+ $value = $this->get_dict_data(14,$code);
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询字典 获取value
|
|
|
+ * @param [type] $type 类型
|
|
|
+ * @param [type] $code 唯一code
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function get_dict_data($type,$code)
|
|
|
+ {
|
|
|
+ $where[]=['type_id',"=",$type];
|
|
|
+ $where[] = ['code','=',$code];
|
|
|
+ $value = Db::name('sys_dict_data')->where($where)->value('value');
|
|
|
+ return $value;
|
|
|
}
|
|
|
+ //搜索
|
|
|
+
|
|
|
+// public function searchNumberAttr($query, $value, $data)
|
|
|
+// {
|
|
|
+// return $query->where('number', 'like', '%'.$value.'%');
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|