quote.js
5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'quote/index?controller='+Config.controller+"&ids="+Config.ids,
add_url: 'quote/add?controller='+Config.controller+"&ids="+Config.ids,
edit_url: 'quote/edit',
del_url: 'quote/del',
multi_url: 'quote/multi',
table: 'quote',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
sortOrder:'desc',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'quote_style', title: __('Quote_style')},
{field: 'form', title: __('Form'), searchList: {"0":__('Form 0'),"1":__('Form 1')}, formatter: Table.api.formatter.normal},
{field: 'line', title: __('Line'),formatter:Table.api.formatter.url},
{field: 'quote_id', title: __('Quote_id')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'title', title: __('Title')},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate},
]
],
search:false,
commonSearch:false,
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
$("#c-form").on("change",function () {
var form_id=$(this).val();
if(form_id==1){
//引用id去掉,使用用户输入的;
$("#quote_id").hide();
$('#c-quote_id_text').val("无");
$('#c-quote_id').val("0");
$("#line").show();
$("#content1").show();
$("#title").show();
}else{
$("#line").hide();
$("#content1").hide();
$("#title").hide();
$("#quote_id").show();
}
});
$("#c-quote_style").on("change",function () {
$('#c-quote_id_text').val("");
$('#c-quote_id').val("");
var quote=$(this).val();
$("#c-quote_id_text").data("selectPageObject").option.data=quote+"/index";
if(quote!="pepole"){
$('#c-quote_id_text').data("selectPageObject").option.searchField[0]='title';
$('#c-quote_id_text').data("selectPageObject").option.showField='title';
$('#c-quote_id_text').data("selectPageObject").option.orderBy[0][0]='title';
}else{
$('#c-quote_id_text').data("selectPageObject").option.searchField[0]='name';
$('#c-quote_id_text').data("selectPageObject").option.showField='name';
$('#c-quote_id_text').data("selectPageObject").option.orderBy[0][0]='name';
}
})
},
edit: function () {
Controller.api.bindevent();
if(Config.form==1){
$("#quote_id").hide();
$("#line").show();
$("#content1").show();
$("#title").show();
$('#c-quote_id_text').val("无");
$('#c-quote_id').val("0");
}
$("#c-form").on("change",function () {
var form_id=$(this).val();
if(form_id==1){
//引用id去掉,使用用户输入的;
$("#quote_id").hide();
$("#line").show();
$("#content1").show();
$("#title").show();
$('#c-quote_id_text').val("无");
$('#c-quote_id').val("0");
}else{
$("#line").hide();
$("#content1").hide();
$("#title").hide();
$("#quote_id").show();
}
});
$("#c-quote_style").on("change",function () {
if(Config.form==1){
return;
}
$('#c-quote_id_text').val("");
$('#c-quote_id').val("");
var quote=$(this).val();
$("#c-quote_id_text").data("selectPageObject").option.data=quote+"/index";
if(quote!="pepole"){
$('#c-quote_id_text').data("selectPageObject").option.searchField[0]='title';
$('#c-quote_id_text').data("selectPageObject").option.showField='title';
$('#c-quote_id_text').data("selectPageObject").option.orderBy[0][0]='title';
}else{
$('#c-quote_id_text').data("selectPageObject").option.searchField[0]='name';
$('#c-quote_id_text').data("selectPageObject").option.showField='name';
$('#c-quote_id_text').data("selectPageObject").option.orderBy[0][0]='name';
}
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});