tb-order-goods-list.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>订单商品表-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <div class="c-title">检索参数</div>
  22. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="num" name="主键" v-model="p.id"></sa-item>
  24. <sa-item type="text" name="预申报编号" v-model="p.platSeqNo"></sa-item>
  25. <sa-item type="text" name="边民备案号" v-model="p.borderPutrecNo"></sa-item>
  26. <sa-item type="text" name="身份证号" v-model="p.idno"></sa-item>
  27. <sa-item type="text" name="订单ID" v-model="p.orderId"></sa-item>
  28. <sa-item type="num" name="商品ID" v-model="p.goodsId"></sa-item>
  29. <sa-item type="text" name="商品编号" v-model="p.goodsCode"></sa-item>
  30. <sa-item type="text" name="商品名称" v-model="p.goodsName"></sa-item>
  31. <sa-item type="text" name="商品图片" v-model="p.avatar"></sa-item>
  32. <sa-item type="text" name="购买金额" v-model="p.buyAmount"></sa-item>
  33. <sa-item type="text" name="净重" v-model="p.netWt"></sa-item>
  34. <sa-item type="text" name="毛重" v-model="p.grossWt"></sa-item>
  35. <sa-item type="text" name="购买数量" v-model="p.buyQty"></sa-item>
  36. <sa-item type="text" name="第一数量" v-model="p.buyQty1"></sa-item>
  37. <sa-item type="text" name="第二数量" v-model="p.buyQty2"></sa-item>
  38. <sa-item type="text" name="计价单位,如元、万等" v-model="p.buyUnit"></sa-item>
  39. <sa-item type="text" name="数量单位,如kg、吨等" v-model="p.numUnit"></sa-item>
  40. <sa-item type="text" name="创建人编号" v-model="p.createBy"></sa-item>
  41. <sa-item type="text" name="创建人名称" v-model="p.createName"></sa-item>
  42. <sa-item type="text" name="创建时间" v-model="p.createTime"></sa-item>
  43. <sa-item type="text" name="更新人编号" v-model="p.updateBy"></sa-item>
  44. <sa-item type="text" name="更新人名称" v-model="p.updateName"></sa-item>
  45. <sa-item type="text" name="更新时间" v-model="p.updateTime"></sa-item>
  46. <sa-item type="enum" name="删除状态" v-model="p.deleteStatus"
  47. :jv="{0: '禁用', 1: '启用'}" jtype="2" def="不限"></sa-item>
  48. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  49. </el-form>
  50. <div class="fast-btn">
  51. <el-button v-if="sa.isAuth('tb-order-goods-add')" size="mini" type="primary" @click="add()">新增</el-button>
  52. <el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
  53. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  54. </div>
  55. <!-- ------------- 数据列表 ------------- -->
  56. <el-table class="data-table" ref="data-table" :data="dataList" >
  57. <sa-td type="selection"></sa-td>
  58. <sa-td name="主键" prop="id" type="num"></sa-td>
  59. <sa-td name="预申报编号" prop="platSeqNo" ></sa-td>
  60. <sa-td name="边民备案号" prop="borderPutrecNo" ></sa-td>
  61. <sa-td name="身份证号" prop="idno" ></sa-td>
  62. <sa-td name="订单ID" prop="orderId" ></sa-td>
  63. <sa-td name="商品ID" prop="goodsId" type="num"></sa-td>
  64. <sa-td name="商品编号" prop="goodsCode" ></sa-td>
  65. <sa-td name="商品名称" prop="goodsName" ></sa-td>
  66. <sa-td name="商品图片" prop="avatar" ></sa-td>
  67. <sa-td name="购买金额" prop="buyAmount" ></sa-td>
  68. <sa-td name="净重" prop="netWt" ></sa-td>
  69. <sa-td name="毛重" prop="grossWt" ></sa-td>
  70. <sa-td name="购买数量" prop="buyQty" ></sa-td>
  71. <sa-td name="第一数量" prop="buyQty1" ></sa-td>
  72. <sa-td name="第二数量" prop="buyQty2" ></sa-td>
  73. <sa-td name="计价单位,如元、万等" prop="buyUnit" ></sa-td>
  74. <sa-td name="数量单位,如kg、吨等" prop="numUnit" ></sa-td>
  75. <sa-td name="创建人编号" prop="createBy" ></sa-td>
  76. <sa-td name="创建人名称" prop="createName" ></sa-td>
  77. <sa-td name="创建时间" prop="createTime" ></sa-td>
  78. <sa-td name="更新人编号" prop="updateBy" ></sa-td>
  79. <sa-td name="更新人名称" prop="updateName" ></sa-td>
  80. <sa-td name="更新时间" prop="updateTime" ></sa-td>
  81. <sa-td name="删除状态" prop="deleteStatus" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateDeleteStatus(s.row)"></sa-td>
  82. <el-table-column label="操作" fixed="right" width="240px">
  83. <template slot-scope="s">
  84. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  85. <el-button v-if="sa.isAuth('tb-order-goods-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  86. <el-button v-if="sa.isAuth('tb-order-goods-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <!-- ------------- 分页 ------------- -->
  91. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  92. </div>
  93. </div>
  94. <script>
  95. var app = new Vue({
  96. components: {
  97. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  98. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  99. },
  100. el: '.vue-box',
  101. data: {
  102. p: { // 查询参数
  103. id: '', // 主键
  104. platSeqNo: '', // 预申报编号
  105. borderPutrecNo: '', // 边民备案号
  106. idno: '', // 身份证号
  107. orderId: '', // 订单ID
  108. goodsId: '', // 商品ID
  109. goodsCode: '', // 商品编号
  110. goodsName: '', // 商品名称
  111. avatar: '', // 商品图片
  112. buyAmount: '', // 购买金额
  113. netWt: '', // 净重
  114. grossWt: '', // 毛重
  115. buyQty: '', // 购买数量
  116. buyQty1: '', // 第一数量
  117. buyQty2: '', // 第二数量
  118. buyUnit: '', // 计价单位,如元、万等
  119. numUnit: '', // 数量单位,如kg、吨等
  120. createBy: '', // 创建人编号
  121. createName: '', // 创建人名称
  122. createTime: '', // 创建时间
  123. updateBy: '', // 更新人编号
  124. updateName: '', // 更新人名称
  125. updateTime: '', // 更新时间
  126. deleteStatus: '', // 删除状态(0=禁用,1=启用)
  127. pageNo: 1, // 当前页
  128. pageSize: 10, // 页大小
  129. sortType: 0 // 排序方式
  130. },
  131. dataCount: 0,
  132. dataList: [], // 数据集合
  133. },
  134. methods: {
  135. // 刷新
  136. f5: function() {
  137. sa.ajax('/TbOrderGoods/getList', sa.removeNull(this.p), function(res) {
  138. this.dataList = res.data; // 数据
  139. this.dataCount = res.dataCount; // 数据总数
  140. sa.f5TableHeight(); // 刷新表格高度
  141. }.bind(this));
  142. },
  143. // 查看
  144. get: function(data) {
  145. sa.showIframe('数据详情', 'tb-order-goods-info.html?id=' + data.id, '1050px', '90%');
  146. },
  147. // 查看 - 根据选中的
  148. getBySelect: function(data) {
  149. var selection = this.$refs['data-table'].selection;
  150. if(selection.length == 0) {
  151. return sa.msg('请选择一条数据')
  152. }
  153. this.get(selection[0]);
  154. },
  155. // 修改
  156. update: function(data) {
  157. sa.showIframe('修改数据', 'tb-order-goods-add.html?id=' + data.id, '1000px', '90%');
  158. },
  159. // 新增
  160. add: function(data) {
  161. sa.showIframe('新增数据', 'tb-order-goods-add.html?id=-1', '1000px', '90%');
  162. },
  163. // 删除
  164. del: function(data) {
  165. sa.confirm('是否删除,此操作不可撤销', function() {
  166. sa.ajax('/TbOrderGoods/delete?id=' + data.id, function(res) {
  167. sa.arrayDelete(this.dataList, data);
  168. sa.ok('删除成功');
  169. sa.f5TableHeight(); // 刷新表格高度
  170. }.bind(this))
  171. }.bind(this));
  172. },
  173. // 批量删除
  174. deleteByIds: function() {
  175. // 获取选中元素的id列表
  176. let selection = this.$refs['data-table'].selection;
  177. let ids = sa.getArrayField(selection, 'id');
  178. if(selection.length == 0) {
  179. return sa.msg('请至少选择一条数据')
  180. }
  181. // 提交删除
  182. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  183. sa.ajax('/TbOrderGoods/deleteByIds', {ids: ids.join(',')}, function(res) {
  184. sa.arrayDelete(this.dataList, selection);
  185. sa.ok('删除成功');
  186. sa.f5TableHeight(); // 刷新表格高度
  187. }.bind(this))
  188. }.bind(this));
  189. },
  190. // 改 - 删除状态(0=禁用,1=启用)
  191. updateDeleteStatus: function(data) {
  192. // 声明变量记录是否成功
  193. var isOk = false;
  194. var oldValue = data.deleteStatus;
  195. var ajax = sa.ajax('/TbOrderGoods/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  196. isOk = true;
  197. sa.msg('修改成功');
  198. }.bind(this));
  199. // 如果未能修改成功, 则回滚
  200. $.when(ajax).done(function() {
  201. if(isOk == false) {
  202. data.status = oldValue;
  203. }
  204. })
  205. },
  206. },
  207. created: function() {
  208. this.f5();
  209. sa.onInputEnter();
  210. }
  211. })
  212. </script>
  213. </body>
  214. </html>