info.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('商品基础详情列表')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="formId">
  11. <div class="select-list">
  12. <ul>
  13. <li >
  14. <p>商品名称:</p>
  15. <input type="text" name="name"/>
  16. </li>
  17. <li th:if="${isSystemUser}">
  18. <input name="companyId" type="hidden" id="input_companyId">
  19. <p >所属商户:</p>
  20. <input name="companyName" onclick="selectTree('company')" id="input_companyTreeName" type="text" placeholder="选择商户"
  21. class="form-control required" readonly="readonly" required>
  22. </li>
  23. <li>
  24. <p>所属类型:</p>
  25. <input name="typeId" type="hidden" id="input_typeId">
  26. <input name="typeName" onclick="selectTree('type')" id="input_typeTreeName" type="text" placeholder="选择商品分类"
  27. class="form-control required" readonly="readonly" required>
  28. </li>
  29. <li>
  30. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  31. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  32. </li>
  33. </ul>
  34. </div>
  35. </form>
  36. </div>
  37. <div class="btn-group-sm" id="toolbar" role="group">
  38. <a th:if="@{!${isSystemUser}}" class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="goods:info:add">
  39. <i class="fa fa-plus"></i> 添加
  40. </a>
  41. </div>
  42. <div class="col-sm-12 select-table table-striped">
  43. <table id="bootstrap-table"></table>
  44. </div>
  45. </div>
  46. </div>
  47. <th:block th:include="include :: footer" />
  48. <script th:inline="javascript">
  49. var editFlag = [[${@permission.hasPermi('goods:info:edit')}]];
  50. var putawayFlag = [[${@permission.hasPermi('goods:info:putaway')}]];
  51. var removeFlag = [[${@permission.hasPermi('goods:info:remove')}]];
  52. var putawayDict = [[${@dict.getType('goods_putaway')}]];
  53. var isSystemUser = [[${isSystemUser}]];
  54. var prefix = ctx + "goods/info";
  55. $(function() {
  56. var options = {
  57. url: prefix + "/list",
  58. createUrl: prefix + "/add",
  59. updateUrl: prefix + "/edit/{id}",
  60. removeUrl: prefix + "/remove",
  61. exportUrl: prefix + "/export",
  62. modalName: "商品基础详情",
  63. columns: [{
  64. checkbox: true
  65. },
  66. {
  67. field : 'id',
  68. title : '上架标志',
  69. visible: false
  70. },
  71. {
  72. field : 'name',
  73. title : '商品名称'
  74. },
  75. {
  76. field : 'companyId',
  77. visible: false
  78. },
  79. {
  80. field : 'companyName',
  81. title : '所属商户'
  82. },
  83. {
  84. field : 'typeName',
  85. title : '所属类型',
  86. },
  87. {
  88. field : 'typeId',
  89. title : '所属类型id',
  90. visible: false
  91. },
  92. {
  93. field : 'price',
  94. title : '一口价'
  95. },
  96. {
  97. field : 'cover',
  98. title : '封面图片',
  99. formatter: function(value, row, index) {
  100. // 图片预览(注意:如存储在本地直接获取数据库路径,如有配置context-path需要使用ctx+路径)
  101. // 如:/profile/upload/2019/08/08/3b7a839aced67397bac694d77611ce72.png
  102. return $.table.imageView(value,250,250);
  103. }
  104. },
  105. {
  106. field : 'producedTime',
  107. title : '生产日期'
  108. },
  109. {
  110. field : 'weight',
  111. title : '单重'
  112. },
  113. {
  114. field : 'putawayFlag',
  115. title: '上架标志',
  116. width: '10%',
  117. align: "left",
  118. formatter: function(value, row, index) {
  119. return $.table.selectDictLabel(putawayDict, value);
  120. }
  121. },
  122. {
  123. title: '操作',
  124. align: 'center',
  125. formatter: function(value, row, index) {
  126. var actions = [];
  127. if(!isSystemUser){
  128. if(row.putawayFlag=="0"){
  129. actions.push('<a class="btn btn-success btn-xs ' + putawayFlag + '" onclick="putaway('+row.id+',1)" shiro:hasPermission="goods:info:putaway"><i class="fa fa-edit"></i> 上架</a> ');
  130. actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull('+row.id+')" shiro:hasPermission="goods:info:putaway"><i class="fa fa-edit"></i> 编辑</a> ');
  131. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" onclick="$.operate.remove(\'' + row.id + '\')" shiro:hasPermission="goods:info:remove"><i class="fa fa-remove"></i>删除</a> ');
  132. }else if(row.putawayFlag=="1"){
  133. actions.push('<a class="btn btn-warning btn-xs ' + putawayFlag + '" onclick="putaway('+row.id+',0)" shiro:hasPermission="goods:info:putaway"><i class="fa fa-download"></i> 下架</a> ');
  134. actions.push('<a class="btn btn-primary btn-xs " shiro:hasPermission="goods:info:putaway"><i class="fa fa-edit"></i>查看详情</a> ');
  135. }
  136. }else{
  137. actions.push('<a class="btn btn-primary btn-xs " shiro:hasPermission="goods:info:putaway"><i class="fa fa-edit"></i>查看详情</a> ');
  138. }
  139. return actions.join('');
  140. }
  141. }]
  142. };
  143. $.table.init(options);
  144. });
  145. function putaway(id,putaway){
  146. var data = new FormData();
  147. data.append("id", id);
  148. data.append("putawayFlag", putaway);
  149. $.ajax({
  150. type: "POST",
  151. url: prefix + "/putaway",
  152. data: data,
  153. cache: false,
  154. contentType: false,
  155. processData: false,
  156. dataType: 'json',
  157. success: function (result) {
  158. if (result.code == web_status.SUCCESS) {
  159. $.table.refresh()
  160. } else {
  161. $.modal.alertError(result.msg);
  162. }
  163. }
  164. })
  165. }
  166. /***************选择商户******************/
  167. function selectTree(name) {
  168. var url
  169. var cb;
  170. if(name=="type"){
  171. cb = selectType
  172. url = ctx + "goods/type/selectTypeTree/0";
  173. }else if(name=="company"){
  174. cb= selectCompany
  175. url = ctx + "company/tree";
  176. }
  177. var options2 = {
  178. title: '请选择',
  179. width: "800",
  180. url: url,
  181. callBack: cb
  182. };
  183. $.modal.openOptions(options2);
  184. }
  185. function selectCompany(index, layero){
  186. var body = layer.getChildFrame('body', index);
  187. $("#input_companyId").val(body.find('#treeId').val());
  188. $("#input_companyTreeName").val(body.find('#treeName').val());
  189. layer.close(index);
  190. $.table.search()
  191. }
  192. function selectType(index, layero){
  193. var body = layer.getChildFrame('body', index);
  194. $("#input_typeId").val(body.find('#treeId').val());
  195. $("#input_typeTreeName").val(body.find('#treeName').val());
  196. layer.close(index);
  197. $.table.search()
  198. }
  199. </script>
  200. </body>
  201. </html>