detailList.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="s-page">
  3. <el-page-header @back="goBack" :content="title"></el-page-header>
  4. <el-divider></el-divider>
  5. <el-row style="margin-bottom: 10px;">
  6. <el-col :span="24">
  7. <el-button size="small" type="primary" @click="getList()">刷新</el-button>
  8. <el-button size="small" type="primary" @click="derive()">导出</el-button>
  9. </el-col>
  10. </el-row>
  11. <el-table :span-method="objectSpanMethod" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  12. <el-table-column prop="poolId" label="账单编号" align="center" width="180"></el-table-column>
  13. <el-table-column prop="month" align="center" label="月份"></el-table-column>
  14. <el-table-column prop="companyWechatName" align="center" label="所属商户" width="180"></el-table-column>
  15. <el-table-column prop="websitName" align="center" label="网点名称" width="180"></el-table-column>
  16. <el-table-column prop="workerName" align="center" label="工程师信息" width="110"></el-table-column>
  17. <el-table-column prop="workerMobile" align="center" label="联系电话"></el-table-column>
  18. <el-table-column prop="workerIdcard" align="center" label="身份证"></el-table-column>
  19. <el-table-column prop="totalAmount" align="center" label="结算金额 (元)" width="110"></el-table-column>
  20. <el-table-column prop="status" align="center" label="发放状态">
  21. <template slot-scope="scope">
  22. {{scope.row.status == 'NO'?'未发放':scope.row.status == 'YES'?'已发放':''}}
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="poolCreateBy" align="center" label="汇总人" width="180"></el-table-column>
  26. <el-table-column prop="poolCreateTime" align="center" label="汇总时间" width="160"></el-table-column>
  27. <el-table-column prop="poolUpdateBy" align="center" label="发放人" width="180"></el-table-column>
  28. <el-table-column prop="poolUpdateTime" align="center" label="发放时间" width="160"></el-table-column>
  29. <el-table-column prop="orderBaseId" align="center" label="工单单号" width="220">
  30. <template slot-scope="scope">
  31. <div style="display: flex;text-align: left;" @click="copy(scope.row.orderBaseId)">
  32. <el-button type="text">{{scope.row.orderBaseId}}</el-button>
  33. <el-button type="text" style="margin-left: 10px;">复制</el-button>
  34. </div>
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="customerName" align="center" label="客户名字"></el-table-column>
  38. <el-table-column prop="customerMobile" align="center" label="客户电话" width="110"></el-table-column>
  39. <el-table-column prop="customerAddress" align="center" label="详细地址" width="180"></el-table-column>
  40. <el-table-column prop="orderStatus" align="center" label="工单状态"></el-table-column>
  41. <el-table-column prop="orderCreateTime" align="center" label="创建时间" width="160"></el-table-column>
  42. <el-table-column prop="workerEndTime" align="center" label="完工时间" width="160"></el-table-column>
  43. <el-table-column prop="orderType" align="center" label="工单类型"></el-table-column>
  44. <el-table-column prop="brand" align="center" label="产品品牌"></el-table-column>
  45. <el-table-column prop="orderSource" align="center" label="工单来源"></el-table-column>
  46. <el-table-column prop="parentCategoryName" align="center" label="产品大类"></el-table-column>
  47. <el-table-column prop="categoryName" align="center" label="产品小类"></el-table-column>
  48. <el-table-column prop="goodsName" align="center" label="机型名称"></el-table-column>
  49. <el-table-column prop="orderNum" align="center" label="数量"></el-table-column>
  50. <el-table-column prop="settleOrderType" align="center" label="结算单类型" width="110"></el-table-column>
  51. <el-table-column prop="installLabel" align="center" label="安装功率"></el-table-column>
  52. <el-table-column prop="installNormAmount" align="center" label="安装结算标准" width="110"></el-table-column>
  53. <el-table-column prop="repairLabel" align="center" label="质保类型"></el-table-column>
  54. <el-table-column prop="repairAmount" align="center" label="维修上门费" width="110"></el-table-column>
  55. <el-table-column prop="repairRate" align="center" label="维修费用结算比例" width="140"></el-table-column>
  56. <el-table-column prop="repairSettleAmount" align="center" label="维修费用"></el-table-column>
  57. <el-table-column prop="otherType" align="center" label="其他费用类型" width="110"></el-table-column>
  58. <el-table-column prop="otherLabel" align="center" label="其他费用规格" width="110"></el-table-column>
  59. <el-table-column prop="otherPrice" align="center" label="其他费用单价" width="110"></el-table-column>
  60. <!-- <el-table-column prop="" align="center" label="其他费用结算数量" width="140"></el-table-column> -->
  61. <el-table-column prop="examineProject" align="center" label="奖罚单考核项目" width="120"></el-table-column>
  62. <el-table-column prop="examineType" align="center" label="奖罚单考核类型" width="120"></el-table-column>
  63. <el-table-column prop="settleNum" align="center" label="结算数量"></el-table-column>
  64. <el-table-column prop="settleAmount" align="center" label="结算金额"></el-table-column>
  65. <el-table-column prop="remark" align="center" label="备注"></el-table-column>
  66. <el-table-column label="操作" align="center" width="80" fixed="right">
  67. <template slot-scope="scope">
  68. <el-button type="text" style="color: #FF0000" @click="cancel(scope.row.id)">驳回</el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </div>
  73. </template>
  74. <script>
  75. import { listPageV2,pageExport, cancel } from "@/api/workOrder/summaryBillDetail";
  76. export default {
  77. props: ['id','title'],
  78. data() {
  79. return {
  80. dataList: [],
  81. cellList: [], // 单元格数组
  82. count: null, // 计数
  83. };
  84. },
  85. computed: {},
  86. created() {
  87. if(this.id){
  88. this.getList()
  89. }
  90. },
  91. methods: {
  92. // 返回
  93. goBack() {
  94. this.$emit('back');
  95. },
  96. getList(){
  97. listPageV2({id: this.id}).then(res => {
  98. this.dataList = res.data
  99. this.computeCell(res.data)
  100. })
  101. },
  102. cancel(id){
  103. this.$confirm(`请确定是否驳回该数据, 是否继续?`, '提示', {
  104. confirmButtonText: '确定',
  105. cancelButtonText: '取消',
  106. type: 'warning'
  107. }).then(() => {
  108. cancel([id]).then(res => {
  109. if(res.code == 200){
  110. this.$message.success('审核成功!')
  111. this.goBack()
  112. }
  113. })
  114. });
  115. },
  116. copy(row) {
  117. var oInput = document.createElement('input');
  118. oInput.value = row;
  119. document.body.appendChild(oInput);
  120. oInput.select();
  121. document.execCommand("Copy");
  122. oInput.className = 'oInput';
  123. oInput.style.display = 'none';
  124. this.$message({
  125. type: 'success',
  126. message: '复制成功!'
  127. });
  128. },
  129. computeCell(tableBody) {
  130. // 循环遍历表体数据
  131. for (let i = 0; i < tableBody.length; i++) {
  132. if (i == 0) {
  133. // 先设置第一项
  134. this.cellList.push(1); // 初为1,若下一项和此项相同,就往cellList数组中追加0
  135. this.count = 0; // 初始计数为0
  136. console.log("索引", 0, this.count);
  137. } else {
  138. // 判断当前项与上项的设备类别是否相同,因为是合并这一列的单元格
  139. if (tableBody[i].workerName == tableBody[i - 1].workerName) {
  140. // 如果相等
  141. this.cellList[this.count] += 1; // 增加计数
  142. this.cellList.push(0); // 相等就往cellList数组中追加0
  143. console.log("索引", i, this.count);
  144. } else {
  145. this.cellList.push(1); // 不等就往cellList数组中追加1
  146. this.count = i; // 将索引赋值为计数
  147. console.log("索引", i, this.count);
  148. }
  149. }
  150. }
  151. },
  152. // 第2步,将计算好的结果返回给el-table,这样的话表格就会根据这个结果做对应合并列渲染
  153. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  154. // 给第二列做单元格合并。0是第一列,1是第二列。
  155. if (columnIndex < 13) {
  156. console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
  157. const rowCell = this.cellList[rowIndex];
  158. if (rowCell > 0) {
  159. const colCell = 1;
  160. console.log(`动态竖向合并单元格, 第${colCell}列,竖向合并${rowCell}个单元格 `);
  161. return {
  162. rowspan: rowCell,
  163. colspan: colCell,
  164. };
  165. } else {
  166. // 清除原有的单元格,必须要加,否则就会出现单元格会被横着挤到后面了!!!
  167. // 本例中数据是写死的不会出现,数据若是动态后端获取的,就会出现了!!!
  168. return {
  169. rowspan: 0,
  170. colspan: 0,
  171. };
  172. }
  173. }
  174. },
  175. }
  176. };
  177. </script>
  178. <style scoped="scoped" lang="scss">
  179. .s-page {
  180. padding: 20px;
  181. background-color: #ffffff;
  182. }
  183. </style>