feat(后台): 工地管理-添加分包单位
parent
28f102462a
commit
fdfac7f0e5
|
@ -56,7 +56,7 @@ class Manager extends Base
|
||||||
$item = arrayNullToString($item->toArray());
|
$item = arrayNullToString($item->toArray());
|
||||||
|
|
||||||
$fields = Account::needCheckFields();
|
$fields = Account::needCheckFields();
|
||||||
array_push($fields, 'id', 'role', 'work_at', 'worksite_id');
|
array_push($fields, 'id', 'role', 'work_at', 'worksite_id', '');
|
||||||
|
|
||||||
$user = Account::findById($item['account_id'], $fields)->toArray();
|
$user = Account::findById($item['account_id'], $fields)->toArray();
|
||||||
$user = arrayNullToString($user);
|
$user = arrayNullToString($user);
|
||||||
|
|
|
@ -169,13 +169,23 @@ class Worker extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
$customer->save(['checking' => Account::COMMON_ON]);
|
$customer->save(['checking' => Account::COMMON_ON]);
|
||||||
|
} else {
|
||||||
|
if ($params['field'] == 'address') {
|
||||||
|
//省市区单独处理 使用-分割 如 四川-成都-成华区
|
||||||
|
$arr = explode('-', $params['value']);
|
||||||
|
$customer->save([
|
||||||
|
'province' => $arr[0] ?? '',
|
||||||
|
'city' => $arr[1] ?? '',
|
||||||
|
'area' => $arr[2] ?? '',
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
$customer->save([
|
$customer->save([
|
||||||
$params['field'] => $params['value']
|
$params['field'] => $params['value']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error('工人资料修改失败'.$e->getMessage());
|
Log::error('资料修改失败'.$e->getMessage());
|
||||||
return $this->json(5000, '修改资料失败!'.$e->getMessage());
|
return $this->json(5000, '修改资料失败!'.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\controller\manager;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use app\model\Log;
|
||||||
|
use think\Collection;
|
||||||
|
use think\response\View;
|
||||||
|
use think\response\Json;
|
||||||
|
use think\db\exception\DbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
|
||||||
|
class Outsource extends Base
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$params = input('searchParams/a');
|
||||||
|
$page = input('page/d', 1);
|
||||||
|
$size = input('size/d', 20);
|
||||||
|
|
||||||
|
$where = [];
|
||||||
|
if (!empty($params)) {
|
||||||
|
foreach ($params as $key => $param) {
|
||||||
|
$param = trim($param);
|
||||||
|
if ($key == 'keyword') {
|
||||||
|
$where[] = ['name', 'like', '%'.$param.'%'];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($param == '0' || !empty($param)) {
|
||||||
|
$where[] = [$key, 'like', '%'.$param.'%'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = \app\model\Outsource::where($where);
|
||||||
|
$total = $query->count();
|
||||||
|
|
||||||
|
$res = [
|
||||||
|
'total' => $total,
|
||||||
|
'current' => $page ?: 1,
|
||||||
|
'size' => $size ?: 20,
|
||||||
|
'list' => new Collection(),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($total > 0) {
|
||||||
|
$res['list'] = $query->page($page, $size)->order('sort', 'desc')->order('id', 'desc')->select();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'success', $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @return Json|View
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
try {
|
||||||
|
$input = input('post.');
|
||||||
|
if (!isset($input['name'])) {
|
||||||
|
return $this->json(4000, '参数错误');
|
||||||
|
}
|
||||||
|
\app\model\Outsource::create([
|
||||||
|
'name' => $input['name'] ?? '',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->json();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(4001, '添加失败'.$e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @return \think\response\Json|\think\response\View
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$id = input('id');
|
||||||
|
|
||||||
|
//通过ID查询
|
||||||
|
$item = \app\model\Outsource::where('id', (int)$id)->find();
|
||||||
|
|
||||||
|
if (empty($item)) {
|
||||||
|
return $this->json(4000, '没有相关记录!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
try {
|
||||||
|
$input = input('post.');
|
||||||
|
if (!isset($input['name'])) {
|
||||||
|
return $this->json(4000, '参数错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->save([
|
||||||
|
'name' => $input['name'] ?? '',
|
||||||
|
]);
|
||||||
|
return $this->json();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['item'] = $item;
|
||||||
|
$this->data['id'] = $id;
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新属性
|
||||||
|
*
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function modify()
|
||||||
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
return $this->json(4000, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = input('post.');
|
||||||
|
$validate = $this->validateByApi($item, [
|
||||||
|
'field' => 'require',
|
||||||
|
'value' => 'require',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validate !== true) {
|
||||||
|
return $validate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过ID查询
|
||||||
|
if (!$info = \app\model\Outsource::where('id', (int)$item['id'])->find()) {
|
||||||
|
return $this->json(4001, '记录不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = [$item['field'] => $item['value']];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$info->save($update);
|
||||||
|
return $this->json();
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
return $this->json(4001, $e->getError());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, '修改失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function del(): Json
|
||||||
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
return $this->json(4000, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = $this->request->param('ids/a', []);
|
||||||
|
if (empty($ids)) {
|
||||||
|
$ids[] = $this->request->param('id/d', 0);
|
||||||
|
$ids = array_filter($ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (count($ids)) {
|
||||||
|
//删除逻辑
|
||||||
|
if (\app\model\WorksiteOutsource::whereIn('outsource_id', $ids)->count() > 0) {
|
||||||
|
return $this->json(4000, '分包单位已产生数据,请确认移除后再操作');
|
||||||
|
}
|
||||||
|
\app\model\Outsource::whereIn('id', $ids)->delete();
|
||||||
|
|
||||||
|
Log::write(get_class(), 'del', '删除操作,涉及到的ID为:'.implode(',', $ids));
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,234 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare (strict_types=1);
|
||||||
|
|
||||||
|
namespace app\controller\manager;
|
||||||
|
|
||||||
|
use app\model\WorksiteOutsource as Mwo;
|
||||||
|
use Exception;
|
||||||
|
use app\model\Log;
|
||||||
|
use think\Collection;
|
||||||
|
use think\response\View;
|
||||||
|
use think\response\Json;
|
||||||
|
use think\db\exception\DbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
|
||||||
|
class WorksiteOutsource extends Base
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = ['index', 'add', 'edit', 'del', 'modify'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$worksiteId = input('worksite_id/d', 0);
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$params = input('searchParams/a');
|
||||||
|
$page = input('page/d', 1);
|
||||||
|
$size = input('size/d', 20);
|
||||||
|
|
||||||
|
$where = [];
|
||||||
|
if (!empty($params)) {
|
||||||
|
foreach ($params as $key => $param) {
|
||||||
|
$param = trim($param);
|
||||||
|
if ($key == 'keyword') {
|
||||||
|
$where[] = ['w.name|cl.name|o.name', 'like', '%'.$param.'%'];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($param == '0' || !empty($param)) {
|
||||||
|
$where[] = ['cl.'.$key, '=', $param];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($worksiteId > 0) {
|
||||||
|
$where[] = ['cl.worksite_id', '=', $worksiteId];
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Mwo::alias('cl')
|
||||||
|
->leftJoin('worksite w', 'w.id = cl.worksite_id')
|
||||||
|
->leftJoin('outsource o', 'o.id = cl.outsource_id')
|
||||||
|
->where($where);
|
||||||
|
$total = $query->count();
|
||||||
|
|
||||||
|
$res = [
|
||||||
|
'total' => $total,
|
||||||
|
'current' => $page ?: 1,
|
||||||
|
'size' => $size ?: 20,
|
||||||
|
'list' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($total > 0) {
|
||||||
|
$res['list'] = $query->fieldRaw('cl.*,w.name as worksite_name,o.name as outsource_name')->page($page, $size)->order('cl.id', 'desc')->select();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'success', $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['worksiteId'] = $worksiteId;
|
||||||
|
$this->data['outsourceList'] = \app\model\Outsource::list();
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @return Json|View
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$worksiteId = input('worksite_id/d', 0);
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
try {
|
||||||
|
$input = input('post.');
|
||||||
|
if (empty($input['name']) || empty($input['log_time']) || empty($input['amount']) || empty($input['outsource_id'])) {
|
||||||
|
return $this->json(4000, '参数错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
Mwo::create([
|
||||||
|
'name' => $input['name'] ?? '',
|
||||||
|
'outsource_id' => $input['outsource_id'] ?? 0,
|
||||||
|
'amount' => $input['amount'] ?? 0,
|
||||||
|
'log_time' => $input['log_time'] ?? '',
|
||||||
|
'year' => date('Y', strtotime($input['log_time'])),
|
||||||
|
'month' => date('m', strtotime($input['log_time'])),
|
||||||
|
'day' => date('d', strtotime($input['log_time'])),
|
||||||
|
'ym' => date('Ym', strtotime($input['log_time'])),
|
||||||
|
'remarks' => $input['remarks'] ?? '',
|
||||||
|
'worksite_id' => $input['worksite_id'] ?? 0,
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->json();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(4001, '添加失败'.$e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['outsourceList'] = \app\model\Outsource::list();
|
||||||
|
$this->data['worksiteId'] = $worksiteId;
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @return \think\response\Json|\think\response\View
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$id = input('id');
|
||||||
|
|
||||||
|
//通过ID查询
|
||||||
|
$item = Mwo::where('id', (int) $id)->find();
|
||||||
|
|
||||||
|
if (empty($item)) {
|
||||||
|
return $this->json(4000, '没有相关记录!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
try {
|
||||||
|
$input = input('post.');
|
||||||
|
if (empty($input['name']) || empty($input['log_time']) || empty($input['amount']) || empty($input['outsource_id'])) {
|
||||||
|
return $this->json(4000, '参数错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->save([
|
||||||
|
'name' => $input['name'] ?? '',
|
||||||
|
'outsource_id' => $input['outsource_id'] ?? 0,
|
||||||
|
'amount' => $input['amount'] ?? 0,
|
||||||
|
'log_time' => $input['log_time'] ?? '',
|
||||||
|
'year' => date('Y', strtotime($input['log_time'])),
|
||||||
|
'month' => date('m', strtotime($input['log_time'])),
|
||||||
|
'day' => date('d', strtotime($input['log_time'])),
|
||||||
|
'ym' => date('Ym', strtotime($input['log_time'])),
|
||||||
|
'remarks' => $input['remarks'] ?? '',
|
||||||
|
]);
|
||||||
|
return $this->json();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['outsourceList'] = \app\model\Outsource::list();
|
||||||
|
$this->data['item'] = $item;
|
||||||
|
$this->data['id'] = $id;
|
||||||
|
return $this->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新属性
|
||||||
|
*
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function modify()
|
||||||
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
return $this->json(4000, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = input('post.');
|
||||||
|
$validate = $this->validateByApi($item, [
|
||||||
|
'field' => 'require',
|
||||||
|
'value' => 'require',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validate !== true) {
|
||||||
|
return $validate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过ID查询
|
||||||
|
if (!$info = Mwo::where('id', (int) $item['id'])->find()) {
|
||||||
|
return $this->json(4001, '记录不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = [$item['field'] => $item['value']];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$info->save($update);
|
||||||
|
return $this->json();
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
return $this->json(4001, $e->getError());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, '修改失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function del(): Json
|
||||||
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
return $this->json(4000, '非法请求');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = $this->request->param('ids/a', []);
|
||||||
|
if (empty($ids)) {
|
||||||
|
$ids[] = $this->request->param('id/d', 0);
|
||||||
|
$ids = array_filter($ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (count($ids)) {
|
||||||
|
Mwo::whereIn('id', $ids)->delete();
|
||||||
|
|
||||||
|
Log::write(get_class(), 'del', '删除操作,涉及到的ID为:'.implode(',', $ids));
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return $this->json(5000, $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包单位
|
||||||
|
*
|
||||||
|
* Class Outsource
|
||||||
|
* @package app\model
|
||||||
|
*/
|
||||||
|
class Outsource extends Base
|
||||||
|
{
|
||||||
|
public static function list()
|
||||||
|
{
|
||||||
|
return self::order('sort', 'desc')->order('id', 'desc')->column('name', 'id');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包单位日志
|
||||||
|
*
|
||||||
|
* Class WorksiteOutsource
|
||||||
|
* @package app\model
|
||||||
|
*/
|
||||||
|
class WorksiteOutsource extends Base
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,209 @@
|
||||||
|
layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate'], function () {
|
||||||
|
let $ = layui.jquery,
|
||||||
|
table = layui.table,
|
||||||
|
xmSelect = layui.xmSelect,
|
||||||
|
miniTab = layui.miniTab,
|
||||||
|
laydate = layui.laydate,
|
||||||
|
form = layui.form;
|
||||||
|
|
||||||
|
|
||||||
|
/**** index begin ***/
|
||||||
|
if ($('.location-index-page').length > 0) {
|
||||||
|
miniTab.listen();
|
||||||
|
|
||||||
|
// 渲染表格
|
||||||
|
let listUrl = $('#table-container').data('url');
|
||||||
|
let insTb = table.render({
|
||||||
|
elem: '#table-container',
|
||||||
|
title: '列表',
|
||||||
|
defaultToolbar: ['filter', 'exports', {
|
||||||
|
title: '搜索' //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
||||||
|
, layEvent: 'search'
|
||||||
|
, icon: 'layui-icon-search'
|
||||||
|
}],
|
||||||
|
toolbar: '#toolbar-tpl',
|
||||||
|
method: 'POST',
|
||||||
|
url: listUrl,
|
||||||
|
page: true,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20,50,100,200,500,1000],
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'size',
|
||||||
|
},
|
||||||
|
parseData: function (res) {
|
||||||
|
return {
|
||||||
|
"code": res.code, //解析接口状态
|
||||||
|
"msg": res.msg, //解析提示文本
|
||||||
|
"count": res.data.total, //解析数据长度
|
||||||
|
"data": res.data.list //解析数据列表
|
||||||
|
};
|
||||||
|
},
|
||||||
|
cols: [[
|
||||||
|
{type: 'checkbox'},
|
||||||
|
{field: 'name', title: '名称', minWidth: 200},
|
||||||
|
{field: 'sort', width: 150, align: 'center', title: '排序', edit: 'text'},
|
||||||
|
{templet: '#row-operate', width: 280, align: 'center', title: '操作'}
|
||||||
|
]],
|
||||||
|
done: function () {
|
||||||
|
Tools.setInsTb(insTb);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听工具条 注意区别toolbar和tool toolbar是表头上的工具条 tool是行中的工具条
|
||||||
|
table.on('toolbar(table-container-filter)', function (obj) {
|
||||||
|
let layEvent = obj.event;
|
||||||
|
let insTb = Tools.getInsTb();
|
||||||
|
let url = $($(this).context).data('href')
|
||||||
|
let title = $($(this).context).data('title')
|
||||||
|
let width = $($(this).context).data('width') ? $($(this).context).data('width') : '100%';
|
||||||
|
let height = $($(this).context).data('height') ? $($(this).context).data('height') : '100%';
|
||||||
|
|
||||||
|
let checkStatus = table.checkStatus('table-container');
|
||||||
|
let selected = checkStatus.data;
|
||||||
|
let ids = [];
|
||||||
|
|
||||||
|
switch (layEvent) {
|
||||||
|
// toolbar 删除
|
||||||
|
case 'del':
|
||||||
|
if (checkStatus.data.length <= 0) {
|
||||||
|
layer.msg('请先选择数据');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// let selected = checkStatus.data;
|
||||||
|
// let ids = [];
|
||||||
|
|
||||||
|
$.each(selected, function (index, val) {
|
||||||
|
ids.push(val.id);
|
||||||
|
})
|
||||||
|
delRow(url, ids, insTb);
|
||||||
|
return false;
|
||||||
|
// toolbar 刷新
|
||||||
|
case 'refresh':
|
||||||
|
refreshTab(insTb);
|
||||||
|
return false;
|
||||||
|
// toolbar 搜索
|
||||||
|
case 'search':
|
||||||
|
let search = $('.table-search-fieldset');
|
||||||
|
if (search.hasClass('div-show')) {
|
||||||
|
search.css('display', 'none').removeClass('div-show');
|
||||||
|
} else {
|
||||||
|
search.css('display', 'block').addClass('div-show');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
// 其他 默认为打开弹出层
|
||||||
|
default:
|
||||||
|
if (layEvent !== 'LAYTABLE_COLS' && layEvent !== 'LAYTABLE_EXPORT') {
|
||||||
|
openLayer(url, title, width, height);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听行工具条
|
||||||
|
table.on('tool(table-container-filter)', function (obj) {
|
||||||
|
let data = obj.data;
|
||||||
|
let layEvent = obj.event;
|
||||||
|
let url = $($(this).context).data('href');
|
||||||
|
let title = $($(this).context).data('title');
|
||||||
|
let width = $($(this).context).data('width') ? $($(this).context).data('width') : '100%';
|
||||||
|
let height = $($(this).context).data('height') ? $($(this).context).data('height') : '100%';
|
||||||
|
let insTb = Tools.getInsTb();
|
||||||
|
|
||||||
|
switch (layEvent) {
|
||||||
|
// 行 删除
|
||||||
|
case 'del':
|
||||||
|
let ids = [data.id];
|
||||||
|
delRow(url, ids, insTb);
|
||||||
|
return false;
|
||||||
|
//其他 默认为打开弹出层
|
||||||
|
default:
|
||||||
|
openLayer(url, title, width, height);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
changeSwitch('changeSaleable');//监听上下架
|
||||||
|
|
||||||
|
let modifyUrl = $('#row-modify').data('url');
|
||||||
|
|
||||||
|
table.on('edit(table-container)', function (obj) {
|
||||||
|
let id = obj.data.id;
|
||||||
|
$.ajax(modifyUrl, {
|
||||||
|
data: {"id": id, "field": obj.field, "value": obj.value}
|
||||||
|
,dataType : 'json'
|
||||||
|
,type: 'POST'
|
||||||
|
})
|
||||||
|
.done(function (res) {
|
||||||
|
if (res.code === 0) {
|
||||||
|
insTb.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// switch变更
|
||||||
|
function changeSwitch(filter) {
|
||||||
|
form.on('switch(' + filter + ')', function (obj) {
|
||||||
|
let val = obj.elem.checked ? 1 : 0;
|
||||||
|
$.post(modifyUrl, {id: this.value, field: this.name, value: val}, function (res) {
|
||||||
|
layer.msg(res.msg)
|
||||||
|
if (res.code !== 0) {
|
||||||
|
//操作不成功则刷新页面
|
||||||
|
insTb.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听搜索操作
|
||||||
|
form.on('submit(data-search-btn)', function (data) {
|
||||||
|
//执行搜索重载
|
||||||
|
table.reload('table-container', {
|
||||||
|
page: {curr: 1}
|
||||||
|
, where: data.field
|
||||||
|
}, 'data');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
/*** index end ***/
|
||||||
|
|
||||||
|
if ($('.location-operate-page').length > 0) {
|
||||||
|
let parentCategory = $('#parent-category');
|
||||||
|
let categoryList = parentCategory.data('list') ? parentCategory.data('list') : [];
|
||||||
|
xmSelect.render({
|
||||||
|
el: '#parent-category',
|
||||||
|
paging: false,
|
||||||
|
autoRow: true,
|
||||||
|
clickClose: true,
|
||||||
|
name: 'category_id',
|
||||||
|
tips: '请选择分类',
|
||||||
|
direction: 'auto',
|
||||||
|
height: 'auto',
|
||||||
|
model: {
|
||||||
|
icon: 'hidden',
|
||||||
|
},
|
||||||
|
prop: {
|
||||||
|
name: 'title',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
tree: {
|
||||||
|
show: true,
|
||||||
|
strict: false,
|
||||||
|
clickCheck: true,
|
||||||
|
expandedKeys: true,
|
||||||
|
clickExpand: false
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
color: '#1e84ff',
|
||||||
|
},
|
||||||
|
data: categoryList
|
||||||
|
});
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#published-at',
|
||||||
|
type: 'datetime',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,218 @@
|
||||||
|
layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate'], function () {
|
||||||
|
let $ = layui.jquery,
|
||||||
|
table = layui.table,
|
||||||
|
xmSelect = layui.xmSelect,
|
||||||
|
miniTab = layui.miniTab,
|
||||||
|
laydate = layui.laydate,
|
||||||
|
form = layui.form;
|
||||||
|
|
||||||
|
|
||||||
|
/**** index begin ***/
|
||||||
|
if ($('.location-index-page').length > 0) {
|
||||||
|
miniTab.listen();
|
||||||
|
|
||||||
|
// 渲染表格
|
||||||
|
let listUrl = $('#table-container').data('url');
|
||||||
|
let insTb = table.render({
|
||||||
|
elem: '#table-container',
|
||||||
|
title: '列表',
|
||||||
|
defaultToolbar: ['filter', 'exports', {
|
||||||
|
title: '搜索' //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
||||||
|
, layEvent: 'search'
|
||||||
|
, icon: 'layui-icon-search'
|
||||||
|
}],
|
||||||
|
toolbar: '#toolbar-tpl',
|
||||||
|
method: 'POST',
|
||||||
|
url: listUrl,
|
||||||
|
page: true,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20, 50, 100, 200, 500, 1000],
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'size',
|
||||||
|
},
|
||||||
|
parseData: function (res) {
|
||||||
|
return {
|
||||||
|
"code": res.code, //解析接口状态
|
||||||
|
"msg": res.msg, //解析提示文本
|
||||||
|
"count": res.data.total, //解析数据长度
|
||||||
|
"data": res.data.list //解析数据列表
|
||||||
|
};
|
||||||
|
},
|
||||||
|
cols: [[
|
||||||
|
{type: 'checkbox'},
|
||||||
|
{field: 'id', title: '记录ID', minWidth: 100},
|
||||||
|
{field: 'name', title: '项目名称', minWidth: 100},
|
||||||
|
{field: 'outsource_name', title: '分包单位', minWidth: 100},
|
||||||
|
{field: 'worksite_name', title: '工地(项目)', minWidth: 250},
|
||||||
|
{field: 'log_time', title: '支出时间'},
|
||||||
|
{field: 'created_at', title: '创建时间'},
|
||||||
|
{templet: '#row-operate', width: 280, align: 'center', title: '操作'}
|
||||||
|
]],
|
||||||
|
done: function () {
|
||||||
|
Tools.setInsTb(insTb);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听工具条 注意区别toolbar和tool toolbar是表头上的工具条 tool是行中的工具条
|
||||||
|
table.on('toolbar(table-container-filter)', function (obj) {
|
||||||
|
let layEvent = obj.event;
|
||||||
|
let insTb = Tools.getInsTb();
|
||||||
|
let url = $($(this).context).data('href')
|
||||||
|
let title = $($(this).context).data('title')
|
||||||
|
let width = $($(this).context).data('width') ? $($(this).context).data('width') : '100%';
|
||||||
|
let height = $($(this).context).data('height') ? $($(this).context).data('height') : '100%';
|
||||||
|
|
||||||
|
let checkStatus = table.checkStatus('table-container');
|
||||||
|
let selected = checkStatus.data;
|
||||||
|
let ids = [];
|
||||||
|
|
||||||
|
switch (layEvent) {
|
||||||
|
// toolbar 删除
|
||||||
|
case 'del':
|
||||||
|
if (checkStatus.data.length <= 0) {
|
||||||
|
layer.msg('请先选择数据');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// let selected = checkStatus.data;
|
||||||
|
// let ids = [];
|
||||||
|
|
||||||
|
$.each(selected, function (index, val) {
|
||||||
|
ids.push(val.id);
|
||||||
|
})
|
||||||
|
delRow(url, ids, insTb);
|
||||||
|
return false;
|
||||||
|
// toolbar 刷新
|
||||||
|
case 'refresh':
|
||||||
|
refreshTab(insTb);
|
||||||
|
return false;
|
||||||
|
// toolbar 搜索
|
||||||
|
case 'search':
|
||||||
|
let search = $('.table-search-fieldset');
|
||||||
|
if (search.hasClass('div-show')) {
|
||||||
|
search.css('display', 'none').removeClass('div-show');
|
||||||
|
} else {
|
||||||
|
search.css('display', 'block').addClass('div-show');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
// 其他 默认为打开弹出层
|
||||||
|
default:
|
||||||
|
if (layEvent !== 'LAYTABLE_COLS' && layEvent !== 'LAYTABLE_EXPORT') {
|
||||||
|
openLayer(url, title, width, height);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听行工具条
|
||||||
|
table.on('tool(table-container-filter)', function (obj) {
|
||||||
|
let data = obj.data;
|
||||||
|
let layEvent = obj.event;
|
||||||
|
let url = $($(this).context).data('href');
|
||||||
|
let title = $($(this).context).data('title');
|
||||||
|
let width = $($(this).context).data('width') ? $($(this).context).data('width') : '100%';
|
||||||
|
let height = $($(this).context).data('height') ? $($(this).context).data('height') : '100%';
|
||||||
|
let insTb = Tools.getInsTb();
|
||||||
|
|
||||||
|
switch (layEvent) {
|
||||||
|
// 行 删除
|
||||||
|
case 'del':
|
||||||
|
let ids = [data.id];
|
||||||
|
delRow(url, ids, insTb);
|
||||||
|
return false;
|
||||||
|
//其他 默认为打开弹出层
|
||||||
|
default:
|
||||||
|
openLayer(url, title, width, height);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
changeSwitch('changeSaleable');//监听上下架
|
||||||
|
|
||||||
|
let modifyUrl = $('#row-modify').data('url');
|
||||||
|
|
||||||
|
table.on('edit(table-container)', function (obj) {
|
||||||
|
let id = obj.data.id;
|
||||||
|
$.ajax(modifyUrl, {
|
||||||
|
data: {"id": id, "field": obj.field, "value": obj.value}
|
||||||
|
, dataType: 'json'
|
||||||
|
, type: 'POST'
|
||||||
|
})
|
||||||
|
.done(function (res) {
|
||||||
|
if (res.code === 0) {
|
||||||
|
insTb.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// switch变更
|
||||||
|
function changeSwitch(filter) {
|
||||||
|
form.on('switch(' + filter + ')', function (obj) {
|
||||||
|
let val = obj.elem.checked ? 1 : 0;
|
||||||
|
$.post(modifyUrl, {id: this.value, field: this.name, value: val}, function (res) {
|
||||||
|
layer.msg(res.msg)
|
||||||
|
if (res.code !== 0) {
|
||||||
|
//操作不成功则刷新页面
|
||||||
|
insTb.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听搜索操作
|
||||||
|
form.on('submit(data-search-btn)', function (data) {
|
||||||
|
//执行搜索重载
|
||||||
|
table.reload('table-container', {
|
||||||
|
page: {curr: 1}
|
||||||
|
, where: data.field
|
||||||
|
}, 'data');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
/*** index end ***/
|
||||||
|
|
||||||
|
if ($('.location-operate-page').length > 0) {
|
||||||
|
let parentCategory = $('#parent-category');
|
||||||
|
let categoryList = parentCategory.data('list') ? parentCategory.data('list') : [];
|
||||||
|
xmSelect.render({
|
||||||
|
el: '#parent-category',
|
||||||
|
paging: false,
|
||||||
|
autoRow: true,
|
||||||
|
clickClose: true,
|
||||||
|
name: 'category_id',
|
||||||
|
tips: '请选择分类',
|
||||||
|
direction: 'auto',
|
||||||
|
height: 'auto',
|
||||||
|
model: {
|
||||||
|
icon: 'hidden',
|
||||||
|
},
|
||||||
|
prop: {
|
||||||
|
name: 'title',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
tree: {
|
||||||
|
show: true,
|
||||||
|
strict: false,
|
||||||
|
clickCheck: true,
|
||||||
|
expandedKeys: true,
|
||||||
|
clickExpand: false
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
color: '#1e84ff',
|
||||||
|
},
|
||||||
|
data: categoryList
|
||||||
|
});
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#published-at',
|
||||||
|
type: 'datetime',
|
||||||
|
});
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#log-time',
|
||||||
|
type: 'datetime',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
<div class="layuimini-container location-operate-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<div class="layui-form layuimini-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="name" placeholder="请输入名称" class="layui-input" value="" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn layui-btn-normal" data-url="/manager/outsource/add" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/outsource/outsource.js?v={:mt_rand()}"></script>
|
|
@ -0,0 +1,22 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
<div class="layuimini-container location-operate-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<div class="layui-form layuimini-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="name" placeholder="请输入名称" class="layui-input" value="{$item.name ?? ''}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" name="id" value="{$item.id ?? 0}">
|
||||||
|
<button class="layui-btn layui-btn-normal" data-url="/manager/outsource/edit" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/outsource/outsource.js?v={:mt_rand()}"></script>
|
|
@ -0,0 +1,52 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
|
||||||
|
<div class="layui-row layui-col-space12">
|
||||||
|
<div class="layui-col-xs12 layui-col-md12">
|
||||||
|
<div class="layuimini-container location-index-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<fieldset class="table-search-fieldset" style="display: none">
|
||||||
|
<legend>搜索信息</legend>
|
||||||
|
<div style="margin: 10px 10px 10px 10px">
|
||||||
|
<form class="layui-form layui-form-pane" action="">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label">关键词</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input class="layui-input" name="keyword" placeholder="支持模糊查询">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="image-table">
|
||||||
|
<table id="table-container" class="layui-table" data-url="/manager/outsource/index" lay-filter="table-container-filter"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 隐藏列 -->
|
||||||
|
<!-- 编辑单元格提交url -->
|
||||||
|
<input type="hidden" id="row-modify" data-url="/manager/outsource/modify">
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<script type="text/html" id="row-operate">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/outsource/edit.html?id={{d.id}}" data-title="编辑" lay-event="edit">编辑</a>
|
||||||
|
<!-- <a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/outsource/del.html" lay-event="del">删除</a>-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- toolbar -->
|
||||||
|
<script type="text/html" id="toolbar-tpl">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a>
|
||||||
|
<a class="layui-btn layui-btn-normal layui-btn-sm" data-href="/manager/outsource/add.html" data-title="添加" lay-event="add">添加</a>
|
||||||
|
<!-- <a class="layui-btn layui-btn-danger layui-btn-sm" data-href="/manager/outsource/del.html" lay-event="del">删除</a>-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/outsource/outsource.js?v={:mt_rand()}"></script>
|
|
@ -39,6 +39,7 @@
|
||||||
<!-- 操作列 -->
|
<!-- 操作列 -->
|
||||||
<script type="text/html" id="row-operate">
|
<script type="text/html" id="row-operate">
|
||||||
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/worksite/edit.html?id={{d.id}}" data-title="编辑" lay-event="edit">编辑</a>
|
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/worksite/edit.html?id={{d.id}}" data-title="编辑" lay-event="edit">编辑</a>
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/worksite-outsource/index.html?worksite_id={{d.id}}" data-title="【{{d.name}}】分包单位" lay-event="detail">分包单位</a>
|
||||||
<!-- <a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/worksite/del.html" lay-event="del">删除</a>-->
|
<!-- <a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/worksite/del.html" lay-event="del">删除</a>-->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
<div class="layuimini-container location-operate-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<div class="layui-form layuimini-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">项目名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="name" placeholder="请输入名称" class="layui-input" value="{$item.name ?? ''}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">分包单位</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select name="outsource_id">
|
||||||
|
<option value=""></option>
|
||||||
|
{foreach $outsourceList as $k => $val}
|
||||||
|
<option value="{$k}">{$val}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">支出金额</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="number" name="amount" class="layui-input" value="{$item.amount ?? 0}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">支出时间</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="log_time" id="log-time" class="layui-input" value="{$item.log_time ?? ''}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">备注</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea name="remarks" class="layui-textarea">{$item.remarks ?? ''}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" name="worksite_id" value="{$worksiteId ?? 0}">
|
||||||
|
<button class="layui-btn layui-btn-normal" data-url="/manager/worksite-outsource/add" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/worksite_outsource/worksite_outsource.js?v={:mt_rand()}"></script>
|
|
@ -0,0 +1,55 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
<div class="layuimini-container location-operate-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<div class="layui-form layuimini-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">项目名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="name" placeholder="请输入名称" class="layui-input" value="{$item.name ?? ''}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">分包单位</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select name="outsource_id">
|
||||||
|
<option value=""></option>
|
||||||
|
{foreach $outsourceList as $k => $val}
|
||||||
|
<option value="{$k}" {if $k == $item['outsource_id']}selected{/if}>{$val}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">支出金额</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="number" name="amount" class="layui-input" value="{$item.amount ?? 0}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">支出时间</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="log_time" id="log-time" class="layui-input" value="{$item.log_time ?? ''}" maxlength="250">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">备注</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea name="remarks" class="layui-textarea">{$item.remarks ?? ''}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" name="id" value="{$item.id ?? 0}">
|
||||||
|
<button class="layui-btn layui-btn-normal" data-url="/manager/worksite-outsource/edit" lay-submit lay-filter="saveBtn">确认保存</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/worksite_outsource/worksite_outsource.js?v={:mt_rand()}"></script>
|
|
@ -0,0 +1,69 @@
|
||||||
|
{layout name="manager/layout" /}
|
||||||
|
|
||||||
|
<div class="layui-row layui-col-space12">
|
||||||
|
<div class="layui-col-xs12 layui-col-md12">
|
||||||
|
<div class="layuimini-container location-index-page">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<fieldset class="table-search-fieldset" style="display: block">
|
||||||
|
<legend>搜索信息</legend>
|
||||||
|
<div style="margin: 10px 10px 10px 10px">
|
||||||
|
<form class="layui-form layui-form-pane" action="">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label">关键词</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input class="layui-input" name="keyword" placeholder="支持模糊查询">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label">分包单位</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select name="outsource_id" lay-search="">
|
||||||
|
<option value="">全部</option>
|
||||||
|
{foreach $outsourceList as $k => $val}
|
||||||
|
<option value="{$k}">{$val}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit
|
||||||
|
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="image-table">
|
||||||
|
<table id="table-container" class="layui-table" data-url="/manager/worksite-outsource/index?worksite_id={$worksiteId ?? 0}"
|
||||||
|
lay-filter="table-container-filter"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 隐藏列 -->
|
||||||
|
<!-- 编辑单元格提交url -->
|
||||||
|
<input type="hidden" id="row-modify" data-url="/manager/worksite-outsource/modify">
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<script type="text/html" id="row-operate">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/worksite-outsource/edit.html?id={{d.id}}" data-title="编辑"
|
||||||
|
lay-event="edit">编辑</a>
|
||||||
|
<a class="layui-btn layui-btn-danger layui-btn-xs" data-href="/manager/worksite-outsource/del.html" lay-event="del">删除</a>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- toolbar -->
|
||||||
|
<script type="text/html" id="toolbar-tpl">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i
|
||||||
|
class="fa fa-refresh"></i></a>
|
||||||
|
<a class="layui-btn layui-btn-normal layui-btn-sm" data-href="/manager/worksite-outsource/add.html?worksite_id={$worksiteId ?? 0}" data-title="添加" lay-event="add">添加</a>
|
||||||
|
<!-- <a class="layui-btn layui-btn-danger layui-btn-sm" data-href="/manager/worksite-outsource/del.html" lay-event="del">删除</a>-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="__MANAGER__/js/worksite_outsource/worksite_outsource.js?v={:mt_rand()}"></script>
|
Loading…
Reference in New Issue