perfect.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'service/skill/perfect/index' + location.search,
  8. add_url: 'service/skill/perfect/add',
  9. // edit_url: 'service/skill/perfect/edit',
  10. // del_url: 'service/skill/perfect/del',
  11. multi_url: 'service/skill/perfect/multi',
  12. import_url: 'service/skill/perfect/import',
  13. table: 'service_apply_skill',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'updatetime',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {field: 'id', title: __('服务者信息'),operate: false,formatter:function (value,row){
  27. let result = `<div style="display: flex;">
  28. <img style="width: 100px;height: 100px;" src="${row.image}"/>
  29. <div style="margin-left: 16px;flex:1;">
  30. <div style="display: flex;align-items: center">
  31. <span style="font-size: 16px;color: #333;">${row.name}</span>
  32. <div style="background: rgba(248, 118, 121, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: rgba(248, 118, 121, 1)">ID:${row.id}</div>
  33. <div style="background: rgba(123, 101, 251, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: #7B65FB">${row.skill_cate_name}</div>
  34. <div style="flex: 1"></div>`
  35. result += `
  36. </div>
  37. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  38. <span style="color: #333;font-size: 14px;margin-right: 8px;">${row.sex_text}</span><span>身份证:</span>${row.idcard}
  39. </div>
  40. <div style="display: flex;align-items: center;margin-top: 8px;">
  41. <div style="background: #F0FAF3;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">学历:</span>${row.edu_text}</div>
  42. <div style="background: #EFF5FF;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">年龄:</span>${row.age}</div>
  43. <div style="background: #F6F1FF;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">民族:</span>${row.nation}</div>
  44. <div style="background: #FFF7E6;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;"><span style="color: #999999">经验:</span>${row.exper_text}</div>
  45. </div>
  46. <div style="display: flex;align-items: center;margin-top: 8px;width: 100%;">
  47. <div style="width: 100%;background: #F7F7F7;display: flex;align-items: center;padding: 8px;border-radius: 6px;"><span style="color: #999999">所在位置:</span>${row.province}${row.city}${row.district}${row.address}</div>
  48. </div>
  49. </div>
  50. </div>`
  51. return result
  52. }},
  53. {field: 'id', title: __('证件'),operate: false,formatter:function (value,row){
  54. return `
  55. <div style="display: flex;align-items: center;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  56. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  57. <img src="${row.front_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  58. <span style="color: #999999;font-size: 12px;">身份证正面</span>
  59. </div>
  60. <div style="display: flex;flex-direction: column;align-items: center;">
  61. <img src="${row.opposite_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  62. <span style="color: #999999;font-size: 12px;">身份证反面</span>
  63. </div>
  64. </div>
  65. <div style="display: flex;align-items: center;padding: 10px 0 0;">
  66. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  67. <img src="${row.certificate_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  68. <span style="color: #999999;font-size: 12px;">从业资格证</span>
  69. </div>
  70. <div style="display: flex;flex-direction: column;align-items: center;">
  71. <img src="${row.health_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  72. <span style="color: #999999;font-size: 12px;">健康证</span>
  73. </div>
  74. </div>
  75. `
  76. }},
  77. {field: 'id', title: __('服务项目'),operate: false,cellStyle: function () {return {css: {"min-width": "300px","max-width": "500px"}}},formatter:function (value,row){
  78. let word = row.goodsname.split(',')
  79. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  80. for(let i=0; i < word.length; i++){
  81. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  82. }
  83. result+='</div>'
  84. return result
  85. }},
  86. {field: 'id', title: __('照片'),operate: false,formatter:function (value,row){
  87. let images = row.images.split(',')
  88. let result = `<div style="display: flex;align-items: flex-start;flex-direction: column;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  89. <span style="color: #999999;font-size: 12px;">实拍照</span>
  90. <div style="display: flex;flex-direction: column;align-items: center;margin-top: 8px;">
  91. <img src="${row.user_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;">
  92. </div>
  93. </div>`;
  94. if(row.images.length>0){
  95. result+=`<div style="display: flex;align-items: flex-start;flex-direction: column;padding: 10px 0 0;margin-top: 8px;">
  96. <span style="color: #999999;font-size: 12px;">相册</span>
  97. <div style="display: flex;align-items: center;margin-top: 8px;">`;
  98. for(let i=0; i < images.length; i++){
  99. result += `<img src="${images[i]}" alt="" style="width: 56px;height: 56px;margin-right:5px;border-radius: 8px;">`
  100. }
  101. result+='</div></div>'
  102. }
  103. return result
  104. }},
  105. {field: 'id', title: __('状态'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
  106. let result = ` <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  107. <span style="font-size: 14px;color: #999;">状态</span>
  108. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  109. </div>`
  110. if(row.state == -1){
  111. result+=`
  112. <div style="display: flex;align-items: flex-start;justify-content:space-between;width: 250px;height: 66px;white-space:normal;padding:20px 20px 0;border-top: 1px solid #EEEEEE;">
  113. <div style="font-size: 14px;color: #999;flex-shrink:0;">拒绝原因</div>
  114. <div style="color: #FF1F2B;font-size: 14px;text-align:left;margin-left:20px;white-space: pre-line;">${row.note}</div>
  115. </div>
  116. `
  117. }
  118. return result
  119. }},
  120. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  121. return `
  122. <div style="margin-bottom: 10px;">
  123. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  124. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  125. </div>
  126. <div>
  127. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">更新时间</div>
  128. <div style="color: #333333;font-size: 14px;text-align:left;">${row.update_time}</div>
  129. </div>
  130. `
  131. }},
  132. // {checkbox: true},
  133. {field: 'id', title: __('Id'),visible: false},
  134. {field: 'user_id', title: __('User_id'),visible: false},
  135. {field: 'applytype', title: __('Applytype'), searchList: {"0":__('Applytype 0'),"1":__('Applytype 1')}, formatter: Table.api.formatter.normal,visible: false},
  136. {field: 'name', title: __('Name'),visible: false},
  137. {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal,visible: false},
  138. {field: 'idcard', title: __('Idcard'),visible: false},
  139. // {field: 'front_image', title: __('Front_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  140. // {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  141. // {field: 'user_image', title: __('User_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  142. // {field: 'certificate_image', title: __('Certificate_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  143. // {field: 'health_image', title: __('Health_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  144. {field: 'category.name', title: __('Category_id'),visible: false},
  145. {field: 'cate.name', title: __('Skill_cate_id'),visible: false},
  146. {field: 'goodsname', title: __('服务项目'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false},
  147. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  148. // {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  149. {field: 'edu', title: __('Edu'), searchList: {"0":__('Edu 0'),"1":__('Edu 1'),"2":__('Edu 2'),"3":__('Edu 3'),"4":__('Edu 4'),"5":__('Edu 5'),"6":__('Edu 6')}, formatter: Table.api.formatter.normal,visible: false},
  150. {field: 'nation', title: __('Nation'),visible: false},
  151. {field: 'height', title: __('Height'),visible: false},
  152. {field: 'weight', title: __('Weight'),visible: false,operate: false},
  153. {field: 'exper', title: __('Exper'), searchList: {"0":__('Exper 0'),"1":__('Exper 1'),"2":__('Exper 2'),"3":__('Exper 3')}, formatter: Table.api.formatter.normal,visible: false},
  154. {field: 'province', title: __('Province'), operate: 'LIKE',visible: false},
  155. {field: 'city', title: __('City'), operate: 'LIKE',visible: false},
  156. {field: 'district', title: __('District'), operate: 'LIKE',visible: false},
  157. {field: 'address', title: __('Address'), operate: 'LIKE',visible: false},
  158. {field: 'lng', title: __('Lng'),visible: false,operate: false},
  159. {field: 'lat', title: __('Lat'),visible: false,operate: false},
  160. {field: 'note', title: __('Note'), operate: 'LIKE',visible: false},
  161. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false},
  162. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  163. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  164. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  165. buttons: [
  166. {
  167. name:'audit',
  168. text:'通过',
  169. title:'通过',
  170. classname: 'btn btn-xs btn-success btn-ajax',
  171. url: 'service/skill/perfect/agree',
  172. success: function (data, ret) {
  173. $(".btn-refresh").trigger('click');
  174. },
  175. hidden:function(row){
  176. if(row.state != 0){
  177. return true;
  178. }
  179. }
  180. },
  181. {
  182. name: 'refuse',
  183. text: __('拒绝'),
  184. title: __('拒绝'),
  185. classname: 'btn btn-xs btn-danger btn-dialog',
  186. url: function(row){
  187. return 'service/skill/perfect/refuse?ids='+row.id;
  188. },
  189. success: function (data, ret) {
  190. $(".btn-refresh").trigger('click');
  191. },
  192. hidden:function(row){
  193. if(row.state != 0){
  194. return true;
  195. }
  196. }
  197. },
  198. ],
  199. formatter: Table.api.formatter.operate}
  200. ]
  201. ]
  202. });
  203. // 为表格绑定事件
  204. Table.api.bindevent(table);
  205. },
  206. add: function () {
  207. Controller.api.bindevent();
  208. },
  209. edit: function () {
  210. Controller.api.bindevent();
  211. },
  212. agree: function () {
  213. $(document).on('click', '.btn-embossed', function () {
  214. parent.$(".btn-refresh").trigger('click');
  215. });
  216. Controller.api.bindevent();
  217. },
  218. refuse: function () {
  219. $(document).on('click', '.btn-embossed', function () {
  220. parent.$(".btn-refresh").trigger('click');
  221. });
  222. Controller.api.bindevent();
  223. },
  224. api: {
  225. bindevent: function () {
  226. Form.api.bindevent($("form[role=form]"));
  227. }
  228. }
  229. };
  230. return Controller;
  231. });