tb-orders-list.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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="https://unpkg.com/element-ui@2.13.0/lib/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. <script src="../../static/kj/upload-util.js"></script>
  17. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <!-- <div class="c-title">检索参数</div> -->
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="订单编号" v-model="p.orderNo"></sa-item>
  25. <sa-item type="text" name="商品名称" v-model="p.goodsName"></sa-item>
  26. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  27. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  28. </el-form>
  29. <div class="fast-btn">
  30. <el-button v-if="sa.isAuth('tb-orders-add')" size="mini" type="primary" @click="add()">新增</el-button>
  31. <el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
  32. </div>
  33. <!-- ------------- 数据列表 ------------- -->
  34. <el-table class="data-table" ref="data-table" :data="dataList" >
  35. <sa-td type="selection"></sa-td>
  36. <sa-td name="订单编号" prop="orderNo" ></sa-td>
  37. <sa-td name="商品名称" prop="goodsName" ></sa-td>
  38. <sa-td name="商品来源" prop="goodsFrom" ></sa-td>
  39. <sa-td name="发货商电话" prop="shipperPhone" ></sa-td>
  40. <sa-td name="发货商名称" prop="shipperName" ></sa-td>
  41. <!-- <sa-td name="司机ID" prop="driverId" ></sa-td> -->
  42. <sa-td name="司机名称" prop="driverName" ></sa-td>
  43. <sa-td name="司机电话" prop="driverPhone" ></sa-td>
  44. <!-- <sa-td name="车型ID" prop="carId" ></sa-td> -->
  45. <sa-td name="车型名称" prop="carType" ></sa-td>
  46. <sa-td name="收货人名称" prop="consigneeName" ></sa-td>
  47. <sa-td name="收货人电话号码" prop="consigneePhone" ></sa-td>
  48. <sa-td name="申报订单号" prop="declarationNumber" ></sa-td>
  49. <sa-td name="订单状态已完成" prop="orderFinish" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateOrderFinish(s.row)"></sa-td>
  50. <!-- <sa-td name="删除状态" prop="deleteStatus" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateDeleteStatus(s.row)"></sa-td> -->
  51. <el-table-column label="操作" fixed="right" width="240px">
  52. <template slot-scope="s">
  53. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  54. <el-button v-if="sa.isAuth('tb-orders-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  55. <el-button v-if="sa.isAuth('tb-orders-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!-- ------------- 分页 ------------- -->
  60. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  61. </div>
  62. </div>
  63. <script>
  64. var app = new Vue({
  65. components: {
  66. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  67. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  68. },
  69. el: '.vue-box',
  70. data: {
  71. p: { // 查询参数
  72. id: '', // 货运订单管理表主键
  73. orderNo: '', // 订单编号
  74. goodsId: '', // 商品id
  75. goodsName: '', // 商品名称
  76. goodsFrom: '', // 商品来源(国家)
  77. shipperPhone: '', // 发货商电话
  78. shipperName: '', // 发货商名称
  79. driverId: '', // 司机ID
  80. driverName: '', // 司机名称
  81. driverPhone: '', // 司机电话
  82. carId: '', // 车型ID
  83. carType: '', // 车型名称
  84. consigneeName: '', // 收货人名称
  85. consigneePhone: '', // 收货人电话号码
  86. declarationNumber: '', // (预留字段) 申报订单号
  87. orderFinish: '', // 订单状态已完成 (0=禁用,1=启用)
  88. createTime: '', // 创建时间
  89. createBy: '', // 创建人编号
  90. createName: '', // 创建人名称
  91. updateTime: '', // 更新时间
  92. updateBy: '', // 更新人编号
  93. updateName: '', // 更新人名称
  94. deleteStatus: '', // 删除状态(0=禁用,1=启用)
  95. pageNo: 1, // 当前页
  96. pageSize: 10, // 页大小
  97. sortType: 0 // 排序方式
  98. },
  99. dataCount: 0,
  100. dataList: [], // 数据集合
  101. },
  102. methods: {
  103. // 刷新
  104. f5: function() {
  105. sa.ajax('/level-one-server/TbOrders/getList', sa.removeNull(this.p), function(res) {
  106. this.dataList = res.data; // 数据
  107. this.dataCount = res.dataCount; // 数据总数
  108. sa.f5TableHeight(); // 刷新表格高度
  109. }.bind(this));
  110. },
  111. // 查看
  112. get: function(data) {
  113. sa.showIframe('数据详情', 'tb-orders-info.html?id=' + data.id, '1050px', '90%');
  114. },
  115. // 查看 - 根据选中的
  116. getBySelect: function(data) {
  117. var selection = this.$refs['data-table'].selection;
  118. if(selection.length == 0) {
  119. return sa.msg('请选择一条数据')
  120. }
  121. this.get(selection[0]);
  122. },
  123. // 修改
  124. update: function(data) {
  125. sa.showIframe('修改数据', 'tb-orders-add.html?id=' + data.id, '1000px', '90%');
  126. },
  127. // 新增
  128. add: function(data) {
  129. sa.showIframe('新增数据', 'tb-orders-add.html?id=-1', '1000px', '90%');
  130. },
  131. // 删除
  132. del: function(data) {
  133. sa.confirm('是否删除,此操作不可撤销', function() {
  134. sa.ajax('/level-one-server/TbOrders/delete?id=' + data.id, function(res) {
  135. sa.arrayDelete(this.dataList, data);
  136. sa.ok('删除成功');
  137. sa.f5TableHeight(); // 刷新表格高度
  138. }.bind(this))
  139. }.bind(this));
  140. },
  141. // 批量删除
  142. deleteByIds: function() {
  143. // 获取选中元素的id列表
  144. let selection = this.$refs['data-table'].selection;
  145. let ids = sa.getArrayField(selection, 'id');
  146. if(selection.length == 0) {
  147. return sa.msg('请至少选择一条数据')
  148. }
  149. // 提交删除
  150. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  151. sa.ajax('/level-one-server/TbOrders/deleteByIds', {ids: ids.join(',')}, function(res) {
  152. sa.arrayDelete(this.dataList, selection);
  153. sa.ok('删除成功');
  154. sa.f5TableHeight(); // 刷新表格高度
  155. }.bind(this))
  156. }.bind(this));
  157. },
  158. // 改 - 订单状态已完成 (0=禁用,1=启用)
  159. updateOrderFinish: function(data) {
  160. // 声明变量记录是否成功
  161. var isOk = false;
  162. var oldValue = data.orderFinish;
  163. var ajax = sa.ajax('/level-one-server/TbOrders/updateOrderFinish', {id: data.id, value: data.orderFinish}, function(res) {
  164. isOk = true;
  165. sa.msg('修改成功');
  166. }.bind(this));
  167. // 如果未能修改成功, 则回滚
  168. $.when(ajax).done(function() {
  169. if(isOk == false) {
  170. data.status = oldValue;
  171. }
  172. })
  173. },
  174. // 改 - 删除状态(0=禁用,1=启用)
  175. updateDeleteStatus: function(data) {
  176. // 声明变量记录是否成功
  177. var isOk = false;
  178. var oldValue = data.deleteStatus;
  179. var ajax = sa.ajax('/level-one-server/TbOrders/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  180. isOk = true;
  181. sa.msg('修改成功');
  182. }.bind(this));
  183. // 如果未能修改成功, 则回滚
  184. $.when(ajax).done(function() {
  185. if(isOk == false) {
  186. data.status = oldValue;
  187. }
  188. })
  189. },
  190. },
  191. created: function() {
  192. this.f5();
  193. sa.onInputEnter();
  194. }
  195. })
  196. </script>
  197. </body>
  198. </html>