shengchanjincheng.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-header>
  5. <div class="">
  6. <!-- 按钮部分-->
  7. <el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
  8. <el-form-item>
  9. <el-input v-model="searchInfo" placeholder="搜索员工编号或员工姓名" clearable style="width: 200px;margin: 5px"></el-input>
  10. <el-button type="primary" icon="search" @click="onSubmit" style="margin: 5px">查询</el-button>
  11. <!-- <el-button type="primary" icon="edit" @click="gd_gxcltjonClick" class="bt" title="工序产量核查">工序产量统计</el-button> -->
  12. <el-button type="primary" icon="edit" @click="cp_gdprintonClick" class="bt" title="打印生产工单" >工单打印</el-button>
  13. <el-button type="primary" title="设置工单的状态-->【计划中】 【生产中】 【已完成】" icon="edit" @click="onStatusClick" class="bt">工单状态设置</el-button>
  14. <el-button type="primary" icon="edit" @click="gd_gxclhconClick" class="bt" title="工序产量核查">工序产量核查</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <!-- 状态设置【弹窗】-->
  18. <el-dialog v-model="onstatuslist" title="工单状态设置" width="30%" style="top: 15%">
  19. <div style="width: 100%;height: 100%;">
  20. <div style="width: 100%; display: flex; align-items: center;">
  21. <el-form-item label="工单编号 :" prop="currentProcess">
  22. <el-input v-model="statusformData['gdbh']" placeholder="" />
  23. </el-form-item>
  24. </div>
  25. <div style="width: 100%; display: flex; align-items: center; margin-top: 30px;">
  26. <span>状态设置:</span>
  27. <el-radio-group v-model="status" style="margin-left: 10px;">
  28. <el-radio label="计划中">计划中</el-radio>
  29. <el-radio label="生产中">生产中</el-radio>
  30. <el-radio label="已完工">已完工</el-radio>
  31. </el-radio-group>
  32. </div>
  33. <div class="dialog-footer" style="text-align: right; margin-top: 40px;">
  34. <el-button @click="handleCancel">取消</el-button>
  35. <el-button type="primary" @click="handleConfirm">确认</el-button>
  36. </div>
  37. </div>
  38. </el-dialog>
  39. <!--工序产量核查【弹窗】-->
  40. <el-dialog v-model="gd_gxclhclist" title="工序产量核查" style="width: 100%;height: 100%;margin: 0px;padding: 0px">
  41. <el-button type="" @click="gxclhcCancel">退出</el-button>
  42. <div style="width: 100%; height: 60px; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;">
  43. <div style="width: 100%; height: 60px; padding: 0px; display: flex; align-items: center;">
  44. <el-form-item label="工单编号" prop="currentProcess" style="margin-right: 20px; padding: 0px">
  45. <el-input v-model="gxclhcformData['gdbh']" @keyup.enter="gxclhcProductValue" />
  46. </el-form-item>
  47. </div>
  48. </div>
  49. <el-table ref="paichengRef"
  50. :show-overflow-tooltip="true"
  51. :row-style="{ height: '0px' }"
  52. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '0px' }"
  53. :header-cell-style="{ padding: '0px' }"
  54. style="width: 100%;height: 70vh" border tooltip-effect="dark"
  55. highlight-current-row="true"
  56. @row-click="gxclhc_tableRowClick"
  57. :data="gxclhc_Data" row-key="ID"
  58. :cell-class-name="gxclhcCellClass">
  59. <template v-for="(item, idx) in gxclhc_Columns">
  60. <el-table-column #default="{ row, column, $index }" align="left" :label="item.label" :width="item.width" >
  61. {{row[item.prop]}}
  62. </el-table-column>
  63. </template>
  64. </el-table>
  65. </el-dialog>
  66. </div>
  67. </layout-header>
  68. <layout>
  69. <!-- 左侧树侧形结构-->
  70. <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
  71. <div class="JKWTree-tree" style="height: 200px">
  72. <h3>生产进程查询</h3>
  73. <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
  74. </el-tree>
  75. </div>
  76. </layout-sider>
  77. <!-- 右侧区域 -->
  78. <layout-content >
  79. <el-main>
  80. <div class="gva-table-box">
  81. <!-- 表格数据 -->
  82. <el-table ref="multipleTable" style="width: 100%;height: 65vh" tooltip-effect="dark"
  83. :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
  84. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  85. :data="tableData" border row-key="ID"
  86. size="small"
  87. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  88. @row-click="tableRowClick" :show-overflow-tooltip="true"
  89. @selection-change="handleSelectionChange">
  90. <el-table-column sortable align="center" label="工单编号" prop="工单编号" width="120" />
  91. <el-table-column sortable align="center" label="印件代号" prop="印件代号" width="120" />
  92. <el-table-column sortable align="center" label="印件名称" prop="印件名称" width="200" />
  93. <el-table-column sortable align="center" label="联数" prop="联数" width="100" />
  94. <el-table-column sortable align="center" label="投料大箱" prop="投料大箱" width="100" />
  95. <el-table-column sortable align="center" label="计划投料" prop="计划投料" width="100" />
  96. <el-table-column sortable align="center" label="工序1" prop="工序1" width="100" />
  97. <el-table-column sortable align="center" label="工序2" prop="工序2" width="100" />
  98. <el-table-column sortable align="center" label="工序3" prop="工序3" width="100" />
  99. <el-table-column sortable align="center" label="工序4" prop="工序4" width="100" />
  100. <el-table-column sortable align="center" label="工序5" prop="工序5" width="100" />
  101. <el-table-column sortable align="center" label="工序6" prop="工序6" width="100" />
  102. <el-table-column sortable align="center" label="工序7" prop="工序7" width="100" />
  103. <el-table-column sortable align="center" label="工序8" prop="工序8" width="100" />
  104. <el-table-column sortable align="center" label="工序9" prop="工序9" width="100" />
  105. <el-table-column sortable align="center" label="工序10" prop="工序10" width="100" />
  106. <el-table-column sortable align="center" label="工序11" prop="工序11" width="100" />
  107. <el-table-column sortable align="center" label="工序12" prop="工序12" width="100" />
  108. <el-table-column sortable align="center" label="工序13" prop="工序13" width="100" />
  109. <el-table-column sortable align="center" label="工序14" prop="工序14" width="100" />
  110. <el-table-column sortable align="center" label="工序15" prop="工序15" width="100" />
  111. <el-table-column sortable align="center" label="工序16" prop="工序16" width="100" />
  112. <el-table-column sortable align="center" label="工序17" prop="工序17" width="100" />
  113. </el-table>
  114. <!-- 分页 -->
  115. <div class="gva-pagination">
  116. <el-pagination layout="total" :current-page="page" :page-size="pageSize"
  117. :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  118. <!-- <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize" :page-sizes="[10, 30, 50, 100]"-->
  119. <!-- :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />-->
  120. </div>
  121. </div>
  122. </el-main>
  123. </layout-content>
  124. </layout>
  125. </layout>
  126. <!-- 工单打印 -->
  127. <PrintPage ref="printPageRef" />
  128. </div>
  129. </template>
  130. <script setup>
  131. // 全量引入格式化工具 请按需保留
  132. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  133. import {ref, reactive} from 'vue'
  134. import {
  135. jcgetTab,
  136. workOrderDetail,
  137. getOrderProcessCount
  138. } from '@/api/yunyin/yunying'
  139. import PrintPage from './components/print.vue'
  140. import {ElMessage} from "element-plus";
  141. defineOptions({name: 'Company'})
  142. // =========== 获取左侧树侧形结构 ===========
  143. const treeData = ref({})
  144. const _department_code = ref(null)
  145. const getDepartmentdata = async () => {
  146. try {
  147. const response = await jcgetTab();
  148. console.log("左侧菜单列表↓");
  149. console.log(response);
  150. const formattedData = [];
  151. for (const category in response.data) {
  152. const categoryNode = {
  153. label: category, // 使用分类名称作为节点标签
  154. children: response.data[category].map(item => ({
  155. label: item, // 将客户信息格式化为节点标签
  156. }))
  157. };
  158. formattedData.push(categoryNode);
  159. }
  160. treeData.value = formattedData;
  161. } catch (error) {
  162. console.error(error)
  163. }
  164. }
  165. getDepartmentdata();
  166. //点击左侧树形 获取右侧table列表
  167. const tableData = reactive([]);
  168. const _code = ref(null); //左侧菜单编号
  169. const handleNodeClick = async (node) => {
  170. if(node.label === '印刷工单' || node.label === '糊盒工单'){return false;}
  171. console.log(node.label.substring(0, 5));
  172. _code.value = node.label.substring(0, 5);
  173. searchInfo.value = ''; // 清空搜索信息
  174. _workOrderDetailList(); // 执行获取员工列表的函数
  175. };
  176. //全局调用工单编号
  177. const _Gd_gdbh = ref(null)
  178. //全局调用印件代号
  179. const _Gd_cpdh = ref(null)
  180. const tableRowClick = async (row) => {
  181. console.log(row.工单编号)
  182. _Gd_gdbh.value = row.工单编号;
  183. _Gd_yjdh.value = row.印件代号;
  184. };
  185. //===========工单状态设置按钮=======
  186. const onstatuslist = ref(false);
  187. const statusformData = reactive({gdbh: '',});
  188. const status = ref('计划中'); // 默认选择
  189. const onStatusClick = () => {
  190. if(_Gd_gdbh.value === null || _Gd_gdbh.value === ''){
  191. onstatuslist.value = false;
  192. ElMessage({
  193. type: 'warning',
  194. message: '请选择树形后,再操作此功能'
  195. })
  196. }else{
  197. statusformData['gdbh'] = _Gd_gdbh.value;
  198. onstatuslist.value = true;
  199. }
  200. };
  201. //工单状态设置【放弃按钮】
  202. const handleCancel = () => {
  203. onstatuslist.value = false;
  204. };
  205. //工单状态设置【执行按钮】
  206. const handleConfirm = async () => {
  207. //工单编号
  208. let workOrder = statusformData['gdbh'];
  209. //状态
  210. let statusCode;
  211. if (status.value === '计划中') {
  212. statusCode = "3-计划中";
  213. } else if (status.value === '生产中') {
  214. statusCode = "2-生产中";
  215. }else if (status.value === '已完工') {
  216. statusCode = "1-已完工";
  217. }
  218. const StatusEditdata = await StatusEdit({workOrder:workOrder,status:statusCode});
  219. if (StatusEditdata.code === 0) {
  220. ElMessage({type: 'success',message: '更新成功'})
  221. } else {
  222. ElMessage({type: 'error',message: '更新失败'})
  223. }
  224. onstatuslist.value = false;
  225. };
  226. //=========工单打印===========
  227. const printPageRef = ref()
  228. const cp_gdprintonClick = () => {
  229. printPageRef.value.open(_Gd_gdbh.value)
  230. }
  231. //=========工序产量核查===========
  232. const gd_gxclhclist = ref(false);
  233. const gxclhc_Data = ref([]);
  234. const gxclhc_Columns = ref(
  235. [
  236. { label: '印件及工序名称', prop: 'concatenatedData', width: '380' },
  237. // { label: '印件', prop: 'Gy0_yjno', width: '130' },
  238. // { label: '工序', prop: 'Gy0_gxh', width: '130' },
  239. // { label: '名称', prop: 'Gy0_gxmc', width: '130' },
  240. { label: '工序计划产量', prop: 'Gy0_计划接货数', width: '120' },
  241. { label: '联数', prop: 'Gy0_ls', width: '70' },
  242. { label: '折算车头产量', prop: '折算车头产量', width: '120' },
  243. { label: '实际上报产量', prop: 'sczl_cl', width: '120' },
  244. { label: '制程废品', prop: 'sczl_zcfp', width: '120' },
  245. { label: '制程废品率', prop: '制程废品率', width: '120' },
  246. { label: '来料异常', prop: '来料异常', width: '90' },
  247. { label: '流程单数', prop: 'process_num', width: '90' },
  248. { label: '当前设备', prop: 'Gy0_sbbh', width: '120' },
  249. { label: '工序状态', prop: 'PD_WG', width: '90'},
  250. { label: '首板生产日期', prop: 'sczl_rq', width: '160' },
  251. ]
  252. )
  253. const gxclhcformData = reactive({
  254. gdbh: '',
  255. gdmc: '',
  256. });
  257. // 工序产量核查按钮
  258. const gd_gxclhconClick = async () => {
  259. if(_Gd_gdbh.value === '' || _Gd_gdbh.value === null){
  260. ElMessage({type: 'warning',message: '请选择具体的工单,在进行操作'})
  261. return false;
  262. }
  263. gxclhcformData['gdbh'] = _Gd_gdbh.value;
  264. gd_gxclhclist.value = true;
  265. _getOrderProcessCount();
  266. };
  267. //工序产量核查回车
  268. const gxclhcProductValue = async () => {
  269. console.log("工序产量核查回车")
  270. _getOrderProcessCount();
  271. }
  272. //工序产量核查退出
  273. const gxclhcCancel = async () => {
  274. gd_gxclhclist.value = false;
  275. };
  276. //工序产量核查方法接口
  277. const _getOrderProcessCount = async () => {
  278. const order = gxclhcformData['gdbh'];
  279. const getOrderProcessCount_list = await getOrderProcessCount({order:order});
  280. const concatenatedData = getOrderProcessCount_list.data.map(item => {
  281. // 优化后的代码,使用模板字符串连接字段值并在单个数字前添加零
  282. const formattedYjno = item.Gy0_yjno.length === 1 ? `0${item.Gy0_yjno}` : item.Gy0_yjno;
  283. const formattedGxh = item.Gy0_gxh.length === 1 ? `0${item.Gy0_gxh}` : item.Gy0_gxh;
  284. const concatenatedValue = `${formattedYjno}-${formattedGxh} ${item.Gy0_gxmc} 【${item.Add_gxmc} 】`;
  285. return {
  286. ...item,
  287. concatenatedData: concatenatedValue, // 使用新属性名
  288. };
  289. });
  290. gxclhc_Data.value = concatenatedData;
  291. };
  292. //工序产量核查
  293. const gxclhcCellClass = ({row, column, rowIndex, columnIndex}) =>{
  294. if (column.label === '实际上报产量' ||column.label === '制程废品' || column.label === '制程废品率' ||
  295. column.label === '来料异常' || column.label === '流程单数' || column.label === '当前设备') {
  296. return 'lan-plan-usage-lows';
  297. }
  298. if (column.label === '折算车头产量') {
  299. return 'gxclhc—color-column-red';
  300. }
  301. // 如果不是 'PD_WG' 列,返回空字符串或其他样式类
  302. if (column.label === '工序状态'){
  303. if(row['PD_WG'] === '完工'){
  304. return 'lan-plan-usage-lowshui';
  305. }else{
  306. return 'pczccolor-column-lan';
  307. }
  308. }
  309. }
  310. // 搜索默认为空
  311. const searchInfo = ref('')
  312. //点击【查询】按钮
  313. const onSubmit = () => {
  314. _department_code.value = '';
  315. if(searchInfo.value === ''){
  316. tableData.length = 0;
  317. }else{
  318. _code.value = '';
  319. _workOrderDetailList();
  320. }
  321. };
  322. //获取员工信息列表
  323. const _workOrderDetailList = async ()=>{
  324. let params = {}
  325. params.search = searchInfo.value;
  326. params.order = _code.value;
  327. // params.limit = 200;
  328. // params.page = 1;
  329. try {
  330. const workOrderDetaildata = await workOrderDetail(params);
  331. console.log(workOrderDetaildata)
  332. tableData.splice(0,tableData.length,...workOrderDetaildata.data);
  333. total.value = WorkListdata.data.total;
  334. } catch (error) {
  335. console.error(error);
  336. }
  337. }
  338. // 分页相关的响应式变量
  339. const page = ref(1)
  340. const total = ref(0)
  341. const pageSize = ref(10)
  342. // 分页
  343. const handleCurrentChange = (val) => {
  344. page.value = val;
  345. _getStaffList();
  346. };
  347. // 修改页面容量 点击多少条/页
  348. const handleSizeChange = (val) => {
  349. page.value = 10;//默认显示
  350. pageSize.value = val;
  351. _getStaffList();
  352. };
  353. // 弹窗控制标记
  354. const dialogFormVisible = ref(false)
  355. //修改
  356. const formDataTest = ref({})
  357. </script>
  358. <style scoped>
  359. .form-container {
  360. display: flex;
  361. flex-wrap: wrap;
  362. }
  363. .form-column {
  364. /*flex: 1;*/
  365. margin-right: 15px; /* 调整列之间的间距 */
  366. }
  367. /* 左侧输入框宽度调整 */
  368. .form-column .el-form-item .el-input {
  369. width: 150px; /* 调整左侧输入框的宽度 */
  370. }
  371. /* 媒体查询,根据需要调整断点 */
  372. @media screen and (max-width: 768px) {
  373. .form-column {
  374. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  375. margin-right: 0;
  376. }
  377. }
  378. /*:deep(.el-table td .cell) {*/
  379. /* line-height: 30px !important;*/
  380. /*}*/
  381. .JKWTree-container {
  382. display: flex;
  383. }
  384. .JKWTree-tree {
  385. /*width: 300px;*/
  386. background-color: #fff;
  387. padding: 10px;
  388. margin-right: 20px;
  389. }
  390. .JKWTree-tree h3 {
  391. font-size: 15px;
  392. font-weight: 700;
  393. margin: 10px 0;
  394. }
  395. .JKWTree-content {
  396. flex: 1;
  397. }
  398. /* 图片上传 */
  399. .upload-box {
  400. width: 200px;
  401. height: 200px;
  402. border: 2px dashed #e2e2e2;
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. position: relative;
  407. cursor: pointer;
  408. }
  409. .uploaded-image {
  410. width: 100%;
  411. height: 100%;
  412. object-fit: cover;
  413. }
  414. .upload-icon {
  415. font-size: 40px;
  416. color: #c0c4cc;
  417. }
  418. .file-input {
  419. display: none;
  420. }
  421. .el-table .warning-row {
  422. background: oldlace;
  423. }
  424. /* 选中某行时的背景色 */
  425. :deep(.el-table__body tr.current-row) > td {
  426. background: #ff80ff !important;
  427. }
  428. </style>
  429. <style scoped>
  430. :deep(.el-table td .cell) {
  431. line-height: 20px !important;
  432. }
  433. :deep(.el-tabs__header){
  434. margin-bottom: 0;
  435. }
  436. .search{
  437. margin-left: 0px !important;
  438. margin-right: 10px !important;
  439. }
  440. .bt{
  441. margin-left: 2px !important;
  442. padding: 3px !important;
  443. font-size: 12px;
  444. }
  445. .el-tabs__header{
  446. margin: 0px !important;
  447. }
  448. .gva-table-box{
  449. padding: 0px !important;
  450. }
  451. .mab{
  452. margin-bottom: 5px;
  453. }
  454. </style>