index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div class="page-container row-container">
  3. <!-- 左侧区域 -->
  4. <section class="list-part-container" style="flex: 3">
  5. <!-- 搜索区 -->
  6. <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true"
  7. style="margin-right: 0px">
  8. <el-form-item class="section-title" label="报工日报" />
  9. <el-form-item label="生产计划单号:">
  10. <el-input placeholder="请输入批次号" v-model.trim="queryParams.lotCode" @keydown.enter.prevent clearable
  11. style="width: 130px" />
  12. </el-form-item>
  13. <el-form-item label="产品描述:">
  14. <el-input placeholder="请输入产品描述" v-model.trim="queryParams.productDescription" @keydown.enter.prevent
  15. clearable style="width: 130px" />
  16. </el-form-item>
  17. <el-form-item label="员工姓名:">
  18. <el-input placeholder="请输入姓名" v-model.trim="queryParams.nickName" @keydown.enter.prevent clearable
  19. style="width: 96px" />
  20. </el-form-item>
  21. <el-form-item label="箱号:">
  22. <el-input placeholder="请输入箱号" v-model.trim="queryParams.originalCarrier" @keydown.enter.prevent
  23. clearable style="width: 96px" />
  24. </el-form-item>
  25. <el-form-item class="section-title" label="请选择当前工段:">
  26. <el-select-v2 v-model="queryParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 120px"
  27. @change="handleDeptChange" />
  28. </el-form-item>
  29. <el-form-item label="时间:">
  30. <el-date-picker v-model="queryParams.startTime" type="date" value-format="YYYY-MM-DD" :editable="false"
  31. :clearable="false" placeholder="请选择" style="width: 136px" @change="handleDateChange" />
  32. <span>~</span>
  33. <el-date-picker v-model="queryParams.endTime" type="date" value-format="YYYY-MM-DD" :editable="false"
  34. :clearable="false" placeholder="请选择" style="width: 136px" @change="handleDateChange" />
  35. </el-form-item>
  36. <el-form-item style="margin-left: 0">
  37. <el-button type="info" icon="Search" @click="handleQuery">搜索
  38. </el-button>
  39. <el-button type="success" icon="Download" @click="handleExport">导出</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <div class="el-table-container">
  43. <div class="el-table-inner-container">
  44. <el-table ref="dayworkTable" :data="dayworkItemList" v-loading="dayworkLoading" highlight-current-row
  45. height="100%">
  46. <el-table-column label="批次号" prop="lotCode" width="160" align="center" />
  47. <el-table-column label="产品描述" prop="productDescription" align="center" />
  48. <el-table-column label="图纸版本" prop="technologyVersion" width="60" align="center" />
  49. <el-table-column label="工序名称" prop="processAlias" width="160" align="center" />
  50. <el-table-column label="投产量" prop="prodNum" width="60" align="center" />
  51. <el-table-column label="合格数" prop="qualifiedNum" width="60" align="center" />
  52. <el-table-column label="废品数" prop="rejectNum" width="60" align="center" />
  53. <el-table-column label="开始时间" prop="startTime" width="160" align="center" />
  54. <el-table-column label="结束时间" prop="endTime" width="160" align="center" />
  55. <el-table-column label="总工时" prop="workingHours" width="160" align="center" />
  56. <el-table-column label="生产状态" prop="status" width="100" align="center">
  57. <template #default="scope">
  58. <dict-tag :options="daywork_status" :value="scope.row.status" />
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="箱号" prop="originalCarrier" align="center">
  62. <template v-slot:header>
  63. 箱号
  64. <el-popover placement="top-start" effect="dark" trigger="hover"
  65. content="显示批次最新箱号,会根据实际情况变动">
  66. <template #reference>
  67. <el-icon>
  68. <QuestionFilled />
  69. </el-icon>
  70. </template>
  71. </el-popover>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="操作者" prop="nickName" width="160" align="center" />
  75. </el-table>
  76. </div>
  77. </div>
  78. <!-- 分页 -->
  79. <pagination v-show="itemTotal > 0" :total="itemTotal" v-model:page="queryParams.pageNum"
  80. v-model:limit="queryParams.pageSize" @pagination="getDayworkItems" />
  81. </section>
  82. <!-- 右侧区域 -->
  83. </div>
  84. </template>
  85. <script setup>
  86. import {
  87. listReportItem,
  88. delDayworkItem
  89. } from "@/api/business/daywork.js";
  90. import { listDeptProcess } from "@/api/business/deptProcess";
  91. import { getDeptList } from "@/api/business/planDetailSubDetail.js";
  92. import router from "@/router";
  93. const { proxy } = getCurrentInstance();
  94. /** 字典 */
  95. const { daywork_status } = proxy.useDict("daywork_status");
  96. /** 生产批次 */
  97. const dayworkTable = ref(null);
  98. const currentDaywork = ref({});
  99. const dayworkLoading = ref(false);
  100. const total = ref(0);
  101. /**工段 */
  102. const deptList = ref([]);
  103. const loading = ref(false);
  104. /** 报工信息 */
  105. const dayworkItemList = ref([]);
  106. const dayworkItemLoading = ref(false);
  107. const itemTotal = ref(0);
  108. const lastStatus = ref(null)
  109. const latestProcessId = ref(null);
  110. const latestDeptId = ref(null)
  111. const isDispatch = ref(false);
  112. const deptProcessList = ref([]);
  113. /**工序 */
  114. const processList = ref([]);
  115. const queryParams = ref({
  116. dayworkId: "0",
  117. isAmend: 0,
  118. isWasteRecycling: 0,
  119. pageNum: 1,
  120. pageSize: 10,
  121. technologicalProcessDetailId: null,
  122. });
  123. /*********************** 工段相关事件 ****************************/
  124. function getList() {
  125. loading.value = true;
  126. getDeptList().then((response) => {
  127. deptList.value = response.data.rows;
  128. isDispatch.value = response.data.others.isDispatch;
  129. loading.value = false;
  130. if (deptList.value.length > 0 && !isDispatch.value) {
  131. queryParams.value.deptId = deptList.value[0].value;
  132. } else {
  133. deptList.value.unshift({ label: "全部", value: "0" });
  134. }
  135. getDayworkItems();
  136. });
  137. }
  138. //切换工段
  139. function handleDeptChange() {
  140. getDayworkItems();
  141. }
  142. /*********************** 报工信息相关事件 ****************************/
  143. function handleDateChange() {
  144. console.log(queryParams.value.startTime);
  145. console.log(queryParams.value.endTime);
  146. }
  147. /**切换工序 */
  148. function handleProcessChange() {
  149. getDayworkItems();
  150. }
  151. /** 报工详情列表 */
  152. function getDayworkItems() {
  153. console.log(111111)
  154. dayworkItemLoading.value = true;
  155. //查询该工段在工段资源分配时绑定的工序,传一个flag,如果flag有值则后端查询不分页
  156. listDeptProcess({ deptId: queryParams.value.deptId, flag: 1 }).then(
  157. (res) => {
  158. deptProcessList.value = res.rows;
  159. }
  160. );
  161. listReportItem(queryParams.value).then((res) => {
  162. console.log(res)
  163. for (let i = 0; i < res.rows.length; i++) {
  164. //如果时首序,投产数是单批数
  165. if (res.rows[i].prodNum == 0) {
  166. if (currentDaywork.value.isLast == 1) {
  167. res.rows[i].prodNum = currentDaywork.value.lastLotQuantity;
  168. } else {
  169. res.rows[i].prodNum = currentDaywork.value.oneLotQuantity;
  170. }
  171. }
  172. //拿到最新一条报工信息的工序id,只能编辑当前序
  173. // if (res.rows[i] == res.rows[res.rows.length - 1]) {
  174. // latestProcessId.value = res.rows[i].processId;
  175. // }
  176. }
  177. if (res.others != null && res.others.latestProcessId != null) {
  178. latestProcessId.value = res.others.latestProcessId
  179. }
  180. if (res.others != null && res.others.lastItem != null) {
  181. latestDeptId.value = res.others.lastItem.deptId
  182. lastStatus.value = res.others.lastItem.status
  183. }
  184. for (var i = 0; i < res.rows.length; i++) {
  185. let timeStamp = res.rows[i].workingHours;
  186. let seconds = Math.floor((timeStamp / 1000) % 60);
  187. let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
  188. let hours = Math.floor(timeStamp / (1000 * 60 * 60));
  189. let time = `${hours}小时${minutes}分钟${seconds}秒`;
  190. res.rows[i].workingHours = time;
  191. res.rows[i].deptProcessStatus = false;
  192. }
  193. dayworkItemList.value = res.rows;
  194. itemTotal.value = res.total;
  195. dayworkItemLoading.value = false;
  196. });
  197. }
  198. /** 导出按钮操作 */
  199. function handleExport() {
  200. proxy.download('/ezhizao-dms-production/business/productionDaywork/download', {
  201. ...queryParams.value
  202. }, `报工日报${new Date().getTime()}.xlsx`)
  203. }
  204. /** 搜索按钮操作 */
  205. function handleQuery() {
  206. getDayworkItems();
  207. }
  208. onMounted(() => {
  209. getList();
  210. });
  211. </script>
  212. <style scoped>
  213. .el-form--inline .el-form-item {
  214. margin-right: 20px;
  215. }
  216. </style>