|
@@ -32,38 +32,38 @@
|
|
|
<form class="layui-form" action="" lay-filter="component-form-element">
|
|
|
<div class="layui-row layui-col-space10 layui-form-item">
|
|
|
<div>
|
|
|
- <label class="layui-form-label"><font color='red' size="4">*</font>设备分类:</label>
|
|
|
+ <label class="layui-form-label"><font color='red' size="4">*</font>名称:</label>
|
|
|
<div class="layui-input-block">
|
|
|
- <select id="id_type" name="type" lay-verify="required">
|
|
|
- </select>
|
|
|
+ <input type="text" name="name" lay-verify="required" placeholder="请输入名称"
|
|
|
+ autocomplete="off" class="layui-input">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <label class="layui-form-label"><font color='red' size="4">*</font>设备名称:</label>
|
|
|
+ <label class="layui-form-label"><font color='red' size="4">*</font>编号:</label>
|
|
|
<div class="layui-input-block">
|
|
|
- <input type="text" name="name" lay-verify="required" placeholder="请输入设备名称"
|
|
|
+ <input type="text" name="number" lay-verify="required" placeholder="请输入编号"
|
|
|
autocomplete="off" class="layui-input">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <label class="layui-form-label"><font color='red' size="4">*</font>设备位置:</label>
|
|
|
+ <label class="layui-form-label"><font color='red' size="4">*</font>型号:</label>
|
|
|
<div class="layui-input-block">
|
|
|
- <input id="id_location" name="location" class="layui-input" placeholder="请输入设备位置"
|
|
|
+ <input type="text" name="type" class="layui-input" placeholder="请输入设备型号"
|
|
|
autocomplete="off" lay-verify="required"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <label class="layui-form-label">质保到期:</label>
|
|
|
- <div class="layui-inline">
|
|
|
- <input id="date1" type="text" name="quality_date" placeholder="请输入质保到期日期"
|
|
|
- autocomplete="off" class="input">
|
|
|
+ <label class="layui-form-label"><font color='red' size="4">*</font>大地点:</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input type="text" name="big_address" placeholder="请输入大地点"
|
|
|
+ autocomplete="off" class="layui-input" lay-verify="required">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <label class="layui-form-label"><font color='red' size="4">*</font>供应商:</label>
|
|
|
+ <label class="layui-form-label"><font color='red' size="4">*</font>小地点:</label>
|
|
|
<div class="layui-input-block">
|
|
|
- <select id="id_supplier" name="supplier" lay-verify="required">
|
|
|
- </select>
|
|
|
+ <input type="text" name="big_address" placeholder="请输入小地点"
|
|
|
+ autocomplete="off" class="layui-input" lay-verify="required">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -94,61 +94,13 @@
|
|
|
, autocomplete = layui.autocomplete
|
|
|
, form = layui.form;
|
|
|
var id = layui.view.getParameterByName('id');
|
|
|
- var location = null
|
|
|
-
|
|
|
- laydate.render({
|
|
|
- elem: '#date1'
|
|
|
- , type: 'date'
|
|
|
- , trigger: 'click'
|
|
|
- });
|
|
|
- autocomplete.render({
|
|
|
- elem: $('#id_location'),
|
|
|
- url: '/tenant/building/location/search/',
|
|
|
- template_val: '',
|
|
|
- template_txt: '<span class=\'layui-badge layui-bg-gray\'>{{d.area_name}} - {{d.building}} -{{d.floor}} - {{d.location}}',
|
|
|
- onselect: function (resp) {
|
|
|
- $('#id_location').val(resp.area_name + '-' + resp.building + '-' + resp.floor + '-' + resp.location);
|
|
|
- location = resp.id;
|
|
|
- }
|
|
|
- });
|
|
|
- admin.req({
|
|
|
- url: '/tenant/equipment/dict/',
|
|
|
- done: function (res) {
|
|
|
- var types = res.data.types;
|
|
|
- var type_node = $('#id_type');
|
|
|
- for (var i in types) {
|
|
|
- var pid = types[i].id;
|
|
|
- var value = types[i].name;
|
|
|
- type_node.append("<option value='" + pid + "'>" + value + "</option>");
|
|
|
- }
|
|
|
-
|
|
|
- var suppliers = res.data.suppliers;
|
|
|
- var supplier_node = $('#id_supplier');
|
|
|
- for (var i in suppliers) {
|
|
|
- var pid = suppliers[i].id;
|
|
|
- var value = suppliers[i].name;
|
|
|
- supplier_node.append("<option value='" + pid + "'>" + value + "</option>");
|
|
|
- }
|
|
|
- form.render();
|
|
|
- loadData();
|
|
|
- }
|
|
|
- });
|
|
|
- var loadData = function () {
|
|
|
- if (id) {
|
|
|
- var editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata)); // 框架有Bug所以这么转换
|
|
|
- form.val("component-form-element", editdata);
|
|
|
- location = editdata.location;
|
|
|
- $('#id_location').val(editdata.location_text);
|
|
|
- }
|
|
|
- };
|
|
|
+ if (id) {
|
|
|
+ var editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata)); // 框架有Bug所以这么转换
|
|
|
+ form.val("component-form-element", editdata);
|
|
|
+ }
|
|
|
form.render(null, 'component-form-element');
|
|
|
|
|
|
form.on('submit(component-form-element)', function (data) {
|
|
|
- if (!location) {
|
|
|
- layer.msg('请搜索并选择位置');
|
|
|
- return false;
|
|
|
- }
|
|
|
- data.field['location'] = location;
|
|
|
if (id) {
|
|
|
var url = '/tenant/equipment/' + id + '/';
|
|
|
var type = 'put';
|