shootMeter.ShootRequire.Index.js
4.22 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
137
138
139
140
141
142
143
144
145
146
147
148
149
webpackJsonp([158],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by JiangMin on 2016/3/22.
* 拍摄要求管理
*/
var $ = __webpack_require__(1);
var common = __webpack_require__(2);
/**
* 列表显示数据
*/
var g = new common.grid({
el: '#content-list',
hash: false,
//查询参数
parms: function () {
return {
type: common.util.__input('type-filter')
};
},
//列表显示
columns: [
{display: "名称", name: "name"},
{
display: "类别", name: "type", render: function (item) {
var type = item.type + "";
var type1 = type.replace(1, "拍摄类型").replace(2, "拍摄风格")
.replace(3, "模特类型").replace(4, "道具类型")
.replace(5, "滤镜效果").replace(6, "摄影场景").replace(7, "背景类型")
.replace(/\|/g, " ");
return type1;
}
},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-xs btn-primary update" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-xs btn-danger delete" data-index="' + item.__index + '">删除</a>');
return arr.join('');
}
}
]
});
g.init("/shotManage/shotRequire/index1");
/*验证*/
var edit = new common.edit2(".modal-body");
var Bll = {
module: null,
//弹框
toast: function (module, hint, url) {
if (module.__type == 'update') {
delete module.status;
}
Bll.module = module;
var d = new common.dialog({
title: hint,
content: common.util.__template2($("#template").html(), Bll.module),
width: '30%',
button: [
{
value: "保存",
callback: function () {
if (edit.validate()) {
common.util.__ajax({
url: url,
data: Bll.module
}, function (res) {
if (res.code == '200') {
g.reload();
d.close();
}
else {
common.util.__tip(res.message, "warning");
}
}, true);
}
return false;
},
css: "btn-primary"
},
{
"value": "取消",
"css": "btn-info"
}
]
});
edit.init();
}
};
/**
* 监听输入框变化
*/
$(document).on("change", ".observe", function () {
var $this = $(this);
var name = $this.data("field");
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) {
obj[name1] = $this.val();
});
});
/**
* 添加--点击事件
*/
$('#add-content').on('click', function () {
var item = {
"name": "",
"type": -1,
"status": 1,
"__type": "add"
};
Bll.toast(item, "添加", "/shotManage/shotRequire/add");
});
/**
* 编辑--点击事件
*/
$(document).on('click', '.update', function () {
var item = g.rows[$(this).data("index")];
item.__type = "update";
Bll.toast(item, "编辑", "/shotManage/shotRequire/update");
});
//删除--点击事件
$(document).on('click', '.delete', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告",
"确认删除?",
function () {
item.status = 0;
common.util.__ajax({
url: '/shotManage/shotRequire/update',
data: item
}, function () {
g.reload();
}, true);
});
});
//查询按钮--点击事件
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
/***/ }
]);