You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

410 lines
9.8 KiB

2 weeks ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" class="query-form">
  4. <el-form-item label="单号">
  5. <el-input v-model="searchData.orderNo" clearable placeholder="请输入单号" style="width: 180px"></el-input>
  6. </el-form-item>
  7. <el-form-item label="订单类型">
  8. <el-select v-model="searchData.orderType" clearable placeholder="全部" style="width: 150px">
  9. <el-option label="家用电梯" value="HOME_LIFT"></el-option>
  10. <el-option label="线缆/COP" value="CABLE_COP"></el-option>
  11. <el-option label="改造项目" value="RENOVATION"></el-option>
  12. <el-option label="机加工生产" value="MACHINING"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="报工节点">
  16. <el-input v-model="searchData.nodeName" clearable placeholder="请输入节点名称" style="width: 160px"></el-input>
  17. </el-form-item>
  18. <el-form-item label=" " style="margin-top: -11px">
  19. <el-button @click="getDataList('Y')" plain class="search-btn">查询</el-button>
  20. <el-button @click="resetQuery()" plain class="reset-btn">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <el-table
  24. class="data-table"
  25. :data="dataList"
  26. :height="tableHeight"
  27. border
  28. v-loading="dataListLoading"
  29. style="width: 100%">
  30. <el-table-column type="index" label="#" width="50" align="center"></el-table-column>
  31. <el-table-column prop="logTime" label="报工时间" min-width="160" align="center"></el-table-column>
  32. <el-table-column prop="orderTypeName" label="订单类型" min-width="120" align="center">
  33. <template slot-scope="scope">
  34. <el-tag :type="getTypeTag(scope.row.orderType)" size="small">{{ scope.row.orderTypeName }}</el-tag>
  35. </template>
  36. </el-table-column>
  37. <!-- <el-table-column prop="orderNo" label="单号" width="190" align="center"></el-table-column>-->
  38. <el-table-column prop="projectNo" label="项目/任务标识" min-width="150" align="center">
  39. <template slot-scope="scope">{{ scope.row.projectNo || '-' }}</template>
  40. </el-table-column>
  41. <el-table-column prop="nodeName" label="报工节点" min-width="140" align="center"></el-table-column>
  42. <el-table-column prop="reportQty" label="报工数量" min-width="100" align="center">
  43. <template slot-scope="scope">{{ scope.row.reportQty || '-' }}</template>
  44. </el-table-column>
  45. <el-table-column prop="comment" label="备注" min-width="180" show-overflow-tooltip></el-table-column>
  46. <el-table-column label="操作" width="120" align="center">
  47. <template slot-scope="scope">
  48. <a type="text" style="color:#F56C6C" @click="cancelLog(scope.row)">取消报工</a>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <el-pagination
  53. @size-change="sizeChangeHandle"
  54. @current-change="currentChangeHandle"
  55. :current-page="pageIndex"
  56. :page-sizes="[10, 20, 50, 100]"
  57. :page-size="pageSize"
  58. :total="totalPage"
  59. layout="total, sizes, prev, pager, next, jumper"
  60. style="margin-top: 20px; text-align: right">
  61. </el-pagination>
  62. </div>
  63. </template>
  64. <script>
  65. import { cancelReportLog, getMyReportLogList } from '@/api/longchuang/productionPlan'
  66. export default {
  67. name: 'ProductionReportCancel',
  68. data() {
  69. return {
  70. searchData: { orderNo: '', orderType: '', nodeName: '', page: 1, limit: 20 },
  71. dataList: [],
  72. pageIndex: 1,
  73. pageSize: 20,
  74. totalPage: 0,
  75. dataListLoading: false,
  76. tableHeight: window.innerHeight - 260
  77. }
  78. },
  79. activated() {
  80. this.getDataList('Y')
  81. },
  82. methods: {
  83. getDataList(flag) {
  84. if (flag === 'Y') this.pageIndex = 1
  85. this.searchData.page = this.pageIndex
  86. this.searchData.limit = this.pageSize
  87. this.dataListLoading = true
  88. getMyReportLogList(this.searchData).then(({ data }) => {
  89. this.dataListLoading = false
  90. if (data && data.code === 0) {
  91. const page = data.page || {}
  92. const list = page.list || []
  93. this.dataList = list.map(this.normalizeRow)
  94. this.totalPage = page.totalCount || 0
  95. } else {
  96. this.dataList = []
  97. this.totalPage = 0
  98. this.$message.error((data && data.msg) || '查询失败')
  99. }
  100. }).catch(() => {
  101. this.dataListLoading = false
  102. this.dataList = []
  103. this.totalPage = 0
  104. this.$message.error('查询失败')
  105. })
  106. },
  107. normalizeRow(row) {
  108. return {
  109. ...row,
  110. orderTypeName: this.getOrderTypeName(row.orderType)
  111. }
  112. },
  113. getOrderTypeName(orderType) {
  114. const map = {
  115. HOME_LIFT: '家用电梯',
  116. CABLE_COP: '线缆/COP',
  117. RENOVATION: '改造项目',
  118. MACHINING: '机加工生产'
  119. }
  120. return map[orderType] || orderType || '-'
  121. },
  122. getTypeTag(orderType) {
  123. const map = {
  124. HOME_LIFT: 'primary',
  125. CABLE_COP: 'warning',
  126. RENOVATION: 'success',
  127. MACHINING: 'danger'
  128. }
  129. return map[orderType] || 'info'
  130. },
  131. resetQuery() {
  132. this.searchData = { orderNo: '', orderType: '', nodeName: '', page: 1, limit: 20 }
  133. this.getDataList('Y')
  134. },
  135. cancelLog(row) {
  136. if (!row || !row.logNo) return
  137. this.$confirm('确定取消该条报工记录吗?取消后需要重新报工。', '提示', {
  138. confirmButtonText: '确定',
  139. cancelButtonText: '取消',
  140. type: 'warning'
  141. }).then(() => {
  142. cancelReportLog({ logNo: row.logNo }).then(({ data }) => {
  143. if (data && data.code === 0) {
  144. this.$message.success(data.msg || '取消报工成功')
  145. this.getDataList()
  146. } else {
  147. this.$message.error((data && data.msg) || '取消报工失败')
  148. }
  149. }).catch(() => {
  150. this.$message.error('取消报工失败')
  151. })
  152. }).catch(() => {})
  153. },
  154. sizeChangeHandle(val) {
  155. this.pageSize = val
  156. this.pageIndex = 1
  157. this.getDataList()
  158. },
  159. currentChangeHandle(val) {
  160. this.pageIndex = val
  161. this.getDataList()
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped>
  167. .data-table {
  168. background-color: #fff;
  169. border-radius: 4px;
  170. }
  171. .data-table >>> .cell {
  172. line-height: 20px;
  173. height: 20px;
  174. }
  175. .data-table >>> .el-table__header-wrapper th,
  176. .data-table >>> .el-table__fixed-header-wrapper th {
  177. background-color: #f5f7fa !important;
  178. color: #333;
  179. font-weight: 600;
  180. border-color: #ebeef5;
  181. padding: 8px 0;
  182. }
  183. .data-table >>> .el-table__header-wrapper .cell,
  184. .data-table >>> .el-table__fixed-header-wrapper .cell,
  185. .data-table >>> .el-table__body-wrapper .cell,
  186. .data-table >>> .el-table__fixed-body-wrapper .cell {
  187. padding: 0 10px;
  188. overflow: hidden;
  189. text-overflow: ellipsis;
  190. white-space: nowrap;
  191. font-size: 13px !important;
  192. }
  193. .data-table >>> .el-table__body tr:hover > td {
  194. background-color: #f5f7fa !important;
  195. }
  196. .data-table >>> .el-table__body tr.current-row > td {
  197. background-color: #ecf5ff !important;
  198. }
  199. .query-form {
  200. background-color: #fff;
  201. padding: 15px 15px 5px 15px;
  202. border-radius: 4px;
  203. margin-bottom: 12px;
  204. }
  205. .query-form >>> .el-form-item__label {
  206. color: #333;
  207. font-size: 13px;
  208. padding-bottom: 5px;
  209. }
  210. .query-form >>> .el-input__inner {
  211. height: 32px;
  212. line-height: 32px;
  213. border-radius: 4px;
  214. font-size: 13px;
  215. }
  216. .query-form >>> .el-button {
  217. height: 32px;
  218. padding: 0 15px;
  219. font-size: 13px;
  220. border-radius: 4px;
  221. }
  222. .search-btn {
  223. background-color: #ecf5ff;
  224. border-color: #b3d8ff;
  225. color: #409eff;
  226. }
  227. .search-btn:hover {
  228. background-color: #409eff;
  229. border-color: #409eff;
  230. color: #fff;
  231. }
  232. .reset-btn {
  233. background-color: #f5f7fa;
  234. border-color: #d3d4d6;
  235. color: #606266;
  236. }
  237. .reset-btn:hover {
  238. background-color: #909399;
  239. border-color: #909399;
  240. color: #fff;
  241. }
  242. .add-btn {
  243. background-color: #f0f9eb;
  244. border-color: #c2e7b0;
  245. color: #67c23a;
  246. }
  247. .add-btn:hover {
  248. background-color: #67c23a;
  249. border-color: #67c23a;
  250. color: #fff;
  251. }
  252. .dialog-footer {
  253. text-align: right;
  254. }
  255. .edit-form {
  256. margin-left: 5px;
  257. margin-top: -5px;
  258. }
  259. .detail-tabs-wrap {
  260. margin-top: 12px;
  261. background-color: #fff;
  262. border-radius: 4px;
  263. }
  264. .detail-table {
  265. width: 100%;
  266. }
  267. .detail-table >>> .el-table__header-wrapper th,
  268. .detail-table >>> .el-table__fixed-header-wrapper th {
  269. background-color: #f5f7fa !important;
  270. color: #333;
  271. font-weight: 600;
  272. border-color: #ebeef5;
  273. }
  274. .two-column-layout {
  275. display: flex;
  276. gap: 12px;
  277. }
  278. .stages-column {
  279. width: 38%;
  280. min-width: 320px;
  281. border: 1px solid #ebeef5;
  282. border-radius: 4px;
  283. background: #fff;
  284. }
  285. .logs-column {
  286. flex: 1;
  287. border: 1px solid #ebeef5;
  288. border-radius: 4px;
  289. background: #fff;
  290. }
  291. .column-header {
  292. height: 24px;
  293. display: flex;
  294. align-items: center;
  295. gap: 6px;
  296. padding: 0 12px;
  297. border-bottom: 1px solid #ebeef5;
  298. font-weight: 600;
  299. color: #303133;
  300. }
  301. .progress-badge,
  302. .logs-count {
  303. margin-left: auto;
  304. color: #409eff;
  305. font-size: 12px;
  306. font-weight: 500;
  307. }
  308. .stages-list {
  309. max-height: 295px;
  310. overflow-y: auto;
  311. padding: 10px;
  312. }
  313. .stage-item {
  314. display: flex;
  315. align-items: flex-start;
  316. gap: 10px;
  317. padding: 3px 8px;
  318. border-radius: 4px;
  319. }
  320. .stage-item + .stage-item {
  321. margin-top: 2px;
  322. }
  323. .stage-item.stage-done {
  324. background: #f0f9eb;
  325. }
  326. .stage-item.stage-processing {
  327. background: #fdf6ec;
  328. }
  329. .stage-item.stage-pending {
  330. background: #f5f7fa;
  331. }
  332. .stage-icon {
  333. width: 22px;
  334. height: 22px;
  335. border-radius: 50%;
  336. display: flex;
  337. align-items: center;
  338. justify-content: center;
  339. font-size: 13px;
  340. background: #fff;
  341. border: 1px solid #dcdfe6;
  342. color: #606266;
  343. }
  344. .stage-content {
  345. flex: 1;
  346. }
  347. .stage-name {
  348. font-size: 13px;
  349. color: #303133;
  350. line-height: 20px;
  351. }
  352. .stage-meta {
  353. margin-top: 6px;
  354. display: flex;
  355. align-items: center;
  356. gap: 8px;
  357. }
  358. .stage-owner {
  359. color: #606266;
  360. font-size: 12px;
  361. }
  362. .logs-table-wrapper {
  363. padding: 8px;
  364. }
  365. .el-icon-check {
  366. color: #67c23a;
  367. font-weight: 1000;
  368. }
  369. </style>