index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <div class="mainContentBox">
  3. <avue-crud ref="crudRef1" v-model:search="data1.search" :data="data1.data" :option="data1.option"
  4. v-model:page="data1.page" @row-save="createRow" @row-update="updateRow" @row-del="deleteRow"
  5. @search-change="searchChange" @search-reset="resetChange" @size-change="dataList" @current-change="dataList"
  6. @selection-change="selectionChange" @cell-click="ckickCell">
  7. <template #menu="{ row, index, type }">
  8. <el-button @click="ckickCell(row)" icon="el-icon-view" text type="primary">查看</el-button>
  9. </template>
  10. <template #menu-right="{}">
  11. <el-button class="ml-3" @click="
  12. data1.Utils.exportData(
  13. '/api/v1/process/census/abnormalOperation/export'
  14. )
  15. ">
  16. <template #icon> <i-ep-download /> </template>导出
  17. </el-button>
  18. </template>
  19. </avue-crud>
  20. <el-dialog v-model="editDialog.visible" :title="editDialog.title" width="1200px"
  21. @close="editDialog.visible = false">
  22. <div class="mainContentBox">
  23. <avue-crud ref="crudRef2" v-model:search="data2.search" :data="data2.data" :option="data2.option"
  24. v-model:page="data2.page" @row-update="data2.Methords.updateRow" @row-del="data2.Methords.deleteRow"
  25. @search-change="data2.Methords.dataList" @search-reset="data2.Methords.resetChange"
  26. @size-change="data2.Methords.dataList" @current-change="data2.Methords.dataList"
  27. @selection-change="data2.Methords.selectionChange">
  28. <template #menu-right="{}">
  29. <el-button class="ml-3" @click="
  30. data2.Utils.exportData(
  31. '/api/v1/process/census/abnormalOperationDetails/export'
  32. )
  33. ">
  34. <template #icon> <i-ep-download /> </template>导出
  35. </el-button>
  36. </template></avue-crud>
  37. </div>
  38. </el-dialog>
  39. </div>
  40. </template>
  41. <script setup>
  42. import { ref, getCurrentInstance } from "vue";
  43. import { useCrud } from "@/hooks/userCrud";
  44. import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
  45. import dictDataUtil from "@/common/configs/dictDataUtil";
  46. import editSkill from "@/views/base/skill/components/edit-skill.vue";
  47. import { getEchartData } from "@/api/report";
  48. import * as echarts from "echarts";
  49. // 数据字典相关
  50. const { dicts } = useDictionaryStoreHook();
  51. const editDialog = ref({ visible: false, title: "订单详情" });
  52. const key = ref(false);
  53. // const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  54. // useCrud({
  55. // src: "/api/v1/process/census/completeOrder",
  56. // });
  57. // ;
  58. const data1 = ref(
  59. useCrud({
  60. src: "/api/v1/process/census/abnormalOperation",
  61. })
  62. );
  63. const data2 = ref(
  64. useCrud({
  65. src: "/api/v1/process/census/abnormalOperationDetails",
  66. })
  67. );
  68. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  69. data1.value.Methords;
  70. const { selectionChange, multipleDelete } = data1.value.Methords;
  71. const ckickCell = (row) => {
  72. data2.value.search.workOrderCode = row.workOrderCode;
  73. data2.value.search.operationCode = row.operationCode
  74. data2.value.search.searchTime = data1.value.search.searchTime;
  75. editDialog.value.visible = true;
  76. };
  77. // 设置表格列或者其他自定义的option
  78. data1.value.option = Object.assign(data1.value.option, {
  79. selection: false,
  80. menu: true,
  81. menuWidth: 100,
  82. addBtn: false,
  83. filterBtn: false,
  84. searchShowBtn: false,
  85. columnBtn: false,
  86. gridBtn: false,
  87. editBtn: false,
  88. viewBtn: false,
  89. delBtn: false,
  90. column: [
  91. {
  92. label: "日期范围",
  93. prop: "searchTime",
  94. search: true,
  95. hide: true,
  96. type: "date",
  97. format: "YYYY-MM-DD",
  98. valueFormat: "YYYY-MM-DD",
  99. searchRange: true,
  100. startPlaceholder: "开始日期",
  101. endPlaceholder: "结束日期",
  102. },
  103. {
  104. label: "订单编码",
  105. prop: "orderCode",
  106. overHidden: true,
  107. search: true,
  108. editDisabled: true,
  109. hide: true,
  110. },
  111. {
  112. label: "订单名称",
  113. prop: "orderName",
  114. overHidden: true,
  115. search: true,
  116. editDisabled: true,
  117. hide: true,
  118. },
  119. {
  120. label: "物料编码",
  121. prop: "materialCode",
  122. overHidden: true,
  123. search: true,
  124. editDisabled: true,
  125. hide: true,
  126. },
  127. {
  128. label: "工单编码",
  129. prop: "workOrderCode ",
  130. width: 140,
  131. overHidden: true,
  132. search: true,
  133. editDisabled: true,
  134. hide: true,
  135. },
  136. {
  137. label: "订单名称",
  138. prop: "orderName",
  139. search: false,
  140. },
  141. {
  142. label: "订单编码",
  143. prop: "orderCode",
  144. search: false,
  145. },
  146. {
  147. label: "工单编码",
  148. prop: "workOrderCode",
  149. search: false,
  150. },
  151. {
  152. label: "工单数量",
  153. prop: "planNum",
  154. search: false,
  155. },
  156. {
  157. label: "物料编码",
  158. prop: "materialCode",
  159. search: false,
  160. },
  161. {
  162. label: "物料名称",
  163. prop: "materialName",
  164. search: false,
  165. },
  166. {
  167. label: "物料规格",
  168. prop: "materialModel",
  169. search: false,
  170. },
  171. {
  172. label: "工序编码",
  173. prop: "operationCode",
  174. search: false,
  175. },
  176. {
  177. label: "工序名称",
  178. prop: "operationName",
  179. search: false,
  180. },
  181. {
  182. label: "异常数量",
  183. prop: "count",
  184. search: false,
  185. },
  186. ],
  187. });
  188. data2.value.option = Object.assign(data2.value.option, {
  189. selection: false,
  190. addBtn: false,
  191. filterBtn: false,
  192. searchShowBtn: false,
  193. menu: false,
  194. addBtn: false,
  195. filterBtn: false,
  196. searchShowBtn: false,
  197. columnBtn: false,
  198. gridBtn: false,
  199. editBtn: false,
  200. viewBtn: false,
  201. delBtn: false,
  202. column: [
  203. {
  204. label: "订单名称",
  205. prop: "orderName",
  206. search: false,
  207. },
  208. {
  209. label: "订单编码",
  210. prop: "orderCode",
  211. search: false,
  212. },
  213. {
  214. label: "工单编码",
  215. prop: "workOrderCode",
  216. search: false,
  217. },
  218. {
  219. label: "物料编码",
  220. prop: "materialCode",
  221. search: false,
  222. },
  223. {
  224. label: "物料名称",
  225. prop: "materialName",
  226. search: false,
  227. },
  228. {
  229. label: "物料规格",
  230. prop: "materialModel",
  231. search: false,
  232. },
  233. {
  234. label: "工序编码",
  235. prop: "operationCode",
  236. search: false,
  237. },
  238. {
  239. label: "工序名称",
  240. prop: "operationName",
  241. search: false,
  242. },
  243. {
  244. label: "工位",
  245. prop: "stationName",
  246. search: false,
  247. },
  248. {
  249. label: "流转卡号",
  250. prop: "seqNo",
  251. search: false,
  252. },
  253. {
  254. label: "开始时间",
  255. prop: "realStartWhen",
  256. search: false,
  257. },
  258. {
  259. label: "结束时间",
  260. prop: "realEndWhen",
  261. search: false,
  262. },
  263. {
  264. label: "标准用时",
  265. prop: "standardWorktime",
  266. search: false,
  267. },
  268. {
  269. label: "总共用时",
  270. prop: "totalTime",
  271. search: false,
  272. },
  273. ],
  274. });
  275. const getCurrentMonthStartAndEndDates = () => {
  276. // 获取当前日期
  277. let now = new Date();
  278. // 获取当前月份的第一天
  279. let startDate = new Date(now.getFullYear(), now.getMonth(), 1);
  280. // 获取当前月份的最后一天
  281. let endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  282. // 格式化日期为'YYYY-MM-DD'格式
  283. function formatDate(date) {
  284. let year = date.getFullYear();
  285. let month = String(date.getMonth() + 1).padStart(2, "0");
  286. let day = String(date.getDate()).padStart(2, "0");
  287. return `${year}-${month}-${day}`;
  288. }
  289. // 返回包含开始和结束日期的数组
  290. return [formatDate(startDate), formatDate(endDate)];
  291. };
  292. //设置搜索条件中的时间范围为默认此月
  293. const setTime = () => {
  294. data1.value.search.searchTime = getCurrentMonthStartAndEndDates();
  295. };
  296. onMounted(async () => {
  297. setTime();
  298. dataList();
  299. });
  300. watch(
  301. () => editDialog.value.visible,
  302. () => {
  303. if (editDialog.value.visible == true) {
  304. data2.value.Methords.dataList();
  305. } else {
  306. key.value = !key.value;
  307. }
  308. }
  309. );
  310. </script>
  311. <style lang="scss" scoped>
  312. :deep(.avue-crud__left) {
  313. width: 100%;
  314. }
  315. </style>