|
@@ -15,8 +15,35 @@
|
|
{{--@php(dd($item->user_id))--}}
|
|
{{--@php(dd($item->user_id))--}}
|
|
<input type="hidden" name="id" value="{{ $item->id }}">
|
|
<input type="hidden" name="id" value="{{ $item->id }}">
|
|
<input type="hidden" name="user_id" value="{{ $item->user_id }}">
|
|
<input type="hidden" name="user_id" value="{{ $item->user_id }}">
|
|
- @include('share.layui-form-item', ['type' => 'select', 'name' => 'project_id', 'label' => '项目', 'selected_id' => $item->user_id, 'options' => $project_options])
|
|
|
|
- @include('share.layui-form-item', ['type' => 'select', 'name' => 'project_role_id', 'label' => '角色', 'selected_id' => $item->project_role_id, 'options' => $role_options])
|
|
|
|
|
|
+{{-- @include('share.layui-form-item', ['type' => 'select', 'name' => 'project_id', 'label' => '项目', 'selected_id' => $item->project_id, 'options' => $project_options])--}}
|
|
|
|
+{{-- @include('share.layui-form-item', ['type' => 'select', 'name' => 'project_role_id', 'label' => '角色', 'selected_id' => $item->project_role_id, 'options' => $role_options])--}}
|
|
|
|
+
|
|
|
|
+ <div class="layui-form-item">
|
|
|
|
+ <label class="layui-form-label" style="padding: 0px;">项目</label>
|
|
|
|
+ <div class="layui-input-block">
|
|
|
|
+ <select name="project_id" required lay-verify="required" disabled lay-filter="project_id" utocomplete="off" >
|
|
|
|
+ @foreach($project_options as $option)
|
|
|
|
+ <option value="{{ $option['id'] }}" {{ $option['id'] == $item->project_id ? 'selected' : ''}} >{{ $option['name'] }}</option>
|
|
|
|
+ @endforeach
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="layui-form-item">
|
|
|
|
+ <label class="layui-form-label" style="padding: 0px;">角色</label>
|
|
|
|
+ <div class="layui-input-block">
|
|
|
|
+ <select name="project_role_id" required lay-verify="required" autocomplete="off" >
|
|
|
|
+ @if($item->project_id == 1)
|
|
|
|
+ <option value="6" >领导账号</option>
|
|
|
|
+ @else
|
|
|
|
+ @foreach($role_options as $option)
|
|
|
|
+ <option value="{{ $option['id'] }}" {{ $option['id'] == intval($item->project_role_id) ? 'selected' : ''}}>{{ $option['name'] }}</option>
|
|
|
|
+ @endforeach
|
|
|
|
+ @endif
|
|
|
|
+
|
|
|
|
+ $item->project_role_id
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<div class="layui-form-item">
|
|
<div class="layui-form-item">
|
|
<div class="layui-input-block">
|
|
<div class="layui-input-block">
|
|
<button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
|
|
<button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
|
|
@@ -33,22 +60,27 @@
|
|
@section('footer')
|
|
@section('footer')
|
|
<script>
|
|
<script>
|
|
$(function () {
|
|
$(function () {
|
|
- layui.use(['form', 'laydate'], function(){
|
|
|
|
|
|
+ layui.use(['form'], function(){
|
|
var form = layui.form;
|
|
var form = layui.form;
|
|
- var laydate = layui.laydate;
|
|
|
|
-
|
|
|
|
- // form.verify({
|
|
|
|
- // integer: function (value) {
|
|
|
|
- // var pattern = /^[1-9]\d*$/;
|
|
|
|
- // if(!(pattern.test(value) || value === '0')) {
|
|
|
|
- // return '组员人数必须为大于等于0的整数';
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- laydate.render({
|
|
|
|
- elem: '.sg-select-date'
|
|
|
|
|
|
+
|
|
|
|
+ var roleList = {!! json_encode($role_options) !!}
|
|
|
|
+ console.log(roleList)
|
|
|
|
+ form.on('select(project_id)', function(data) {
|
|
|
|
+ project_id = data.value;
|
|
|
|
+ console.log(project_id)
|
|
|
|
+ let options = '';
|
|
|
|
+ if(project_id == 1){
|
|
|
|
+ options = '<option value="6" selected>' + roleList[5].name + '</option>'
|
|
|
|
+ } else {
|
|
|
|
+ for(let i = 0; i < roleList.length; ++i) {
|
|
|
|
+ options += '<option value=' + parseInt(roleList[i]).id + (parseInt(roleList[i].id) === parseInt(project_id) ? ' selected' : '') + '>' + roleList[i].name + '</option>'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $("select[name='project_role_id']").html(options);
|
|
|
|
+ form.render('select');
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|