cropdefective.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div>
  3. <!-- 左侧树形结构 -->
  4. <el-container>
  5. <layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;" >
  6. <div class="JKWTree-tree" style="height: 70vh;">
  7. <h3>裁剪次片质量维护</h3>
  8. <el-tree :data="treeData" highlight-current @node-click="handleNodeClick"/>
  9. </div>
  10. </layout-sider>
  11. <el-container>
  12. <el-main>
  13. <!-- 按钮区域 -->
  14. <div class="gva-table-box">
  15. <el-form-item>
  16. <el-input v-model="positionvalue" @keydown="keydown_onSearch($event)" placeholder="输入工单编号或产品名称" style="width: 180px;" />
  17. <el-button type="primary" class="search" icon="search" @click="onSearch"></el-button>
  18. <el-button type="primary" class="bt" icon="plus" @click="onAdd">新增次品</el-button>
  19. <el-button type="primary" class="bt" icon="delete" @click="Del">删除</el-button>
  20. <div style="margin-left: auto;">
  21. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  22. </div>
  23. </el-form-item>
  24. <!-- 数据展示 -->
  25. <el-table ref="multipleTable" style="width: 100%;height: 70vh;" tooltip-effect="dark" :data="tableData" row-key="ID"
  26. highlight-current-row="true" border @selection-change="handleSelectionChange"
  27. :row-style="{ height: '20px' }" :header-cell-style="{ padding: '0px' }"
  28. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  29. :show-overflow-tooltip="true" @row-click="Click" @row-dblclick="doubleClick">
  30. <el-table-column type="selection" width="55" />
  31. <!-- 循环渲染列 -->
  32. <el-table-column
  33. v-for=" column in tableColumns "
  34. :key="column.prop"
  35. :prop="column.prop"
  36. :label="column.label"
  37. :width="column.width"
  38. sortable
  39. show-overflow-tooltip="true"/>
  40. </el-table>
  41. <!-- 分页 -->
  42. <div class="gva-pagination">
  43. <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
  44. v-model:page-size="limit"
  45. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  46. @size-change="handleSizeChange" />
  47. </div>
  48. </div>
  49. <!-- 弹出框 -->
  50. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '裁剪次片汇总报工页面' : '裁剪次片汇总报工修改'"
  51. destroy-on-close style="width: 90%; height: 90%; margin-top: 3%;">
  52. <el-form :model="formData" label-position="right" ref="elFormRef":rules="rule" label-width="120px">
  53. <el-row :gutter="24" style="margin-bottom: 20px;" >
  54. <!-- 日期选择框 -->
  55. <el-col :span="8">
  56. <el-form-item label="日期">
  57. <el-date-picker v-model="DefectiveformData['Sys_rq']" id="日期" style="width: 100%;" type="date" />
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <!-- 新增一行按钮 -->
  62. <el-button type="primary" @click="addRow" style="margin-left: 20px; margin-bottom: 20px;">新增一行</el-button>
  63. <el-row :gutter="24">
  64. <el-col :span="19" style="margin-bottom: 15px;">
  65. <!-- 表格头部 -->
  66. <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
  67. <span style="flex: 1;">订单编号|款号</span>
  68. <span style="flex: 1;">面料分类|面料名称</span>
  69. <span style="flex: 1;">颜色</span>
  70. <span style="flex: 1;">款号|款式</span>
  71. <span style="flex: 1;">次片数量</span>
  72. <span style="flex: 1;">次片问题</span>
  73. <span style="flex: 1;">备注</span>
  74. <span style="flex: 1;">报工小组</span>
  75. </div>
  76. </el-col>
  77. <!-- 使用v-for渲染行 -->
  78. <el-col v-for="(row, index) in rows" :key="index" :span="19" style="margin-bottom: 10px; overflow-x: auto;">
  79. <div style="display: flex; justify-content: space-between; align-items: center;">
  80. <el-input style="width: 220px;" placeholder="Enter回车" v-model="row.gdbh" @blur="getGxMcsubmit($event, index)" />
  81. <el-input style="width: 140px;" v-model="row.khks" />
  82. <el-input style="width: 140px;" v-model="row.color" />
  83. <el-input style="width: 140px;" v-model="row.cpsl" />
  84. <el-input style="width: 140px;" v-model="row.color" />
  85. <el-input style="width: 140px;" v-model="row.color" />
  86. <el-input style="width: 140px;" v-model="row.bgxz" />
  87. <el-button type="primary" @click="removeRow(index)" style="font-size: 18px;">复制本条</el-button>
  88. <el-button type="danger" @click="removeRow(index)" style="font-size: 18px;">移除</el-button>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </el-form>
  93. <template #footer>
  94. <div class="dialog-footer" style="width: 100%;">
  95. <el-button @click="closeDialog" style="width: 100px;height: 40px;">关 闭</el-button>
  96. <el-button type="primary" @click="enterDialog" style="width: 100px;height: 40px;">确 定</el-button>
  97. </div>
  98. </template>
  99. </el-dialog>
  100. </el-main>
  101. </el-container>
  102. </el-container>
  103. </div>
  104. </template>
  105. <script setup>
  106. // 全量引入格式化工具 请按需保留
  107. import { ElMessage, ElMessageBox, LAST_KEYS } from 'element-plus'
  108. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  109. import { ref, reactive, nextTick, onMounted, onBeforeMount } from 'vue'
  110. import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
  111. import { useUserStore } from '@/pinia/modules/user'
  112. //获取登录用户信息
  113. const userStore = useUserStore()
  114. const _username = ref('')
  115. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  116. console.log('获取用户名称',_username.value)
  117. //全局获取当前日期
  118. const today = new Date();
  119. const year = today.getFullYear();
  120. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  121. const day = String(today.getDate()).padStart(2, '0');
  122. const hours = String(today.getHours()).padStart(2, '0');
  123. const minutes = String(today.getMinutes()).padStart(2, '0');
  124. const seconds = String(today.getSeconds()).padStart(2, '0');
  125. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  126. const currentDates = `${year}-${month}-${day}`;
  127. // 侧边栏数据请求
  128. const treeData = reactive([]);
  129. const getTabdata = async () => {
  130. }
  131. getTabdata();
  132. /**
  133. * 新增次品
  134. */
  135. const dialogFormVisible = ref(false);
  136. const DefectiveformData = reactive({
  137. Sys_rq: '' ,
  138. bgxz: '裁剪01z组'
  139. });
  140. const rule = {}; // 表单验证规则(如果有)
  141. const rows = reactive([
  142. { gdbh: '', yjGx: '', gxmc: '', cpmc: '' }, // 初始一行
  143. ]);
  144. // 方法:新增一行
  145. const addRow = () => {
  146. rows.push({ gdbh: '', yjGx: '', gxmc: '', cpmc: '' });
  147. };
  148. //新增按钮
  149. const onAdd = async () => {
  150. dialogFormVisible.value = true
  151. DefectiveformData.Sys_rq = currentDates
  152. }
  153. // 键盘事件
  154. const ent1 = (event, index) => {
  155. // 处理键盘事件
  156. console.log(event, index);
  157. };
  158. // 失去焦点事件
  159. const getGxMcsubmit = async (row) => {
  160. // 处理失去焦点事件
  161. console.log('处理失去焦点', row);
  162. };
  163. // 关闭弹窗
  164. const closeDialog = () => {
  165. dialogFormVisible.value = false;
  166. };
  167. // 提交确认
  168. const enterDialog = () => {
  169. console.log('确认提交', formData, rows);
  170. };
  171. // 移除行
  172. const removeRow = (index) => {
  173. rows.splice(index, 1);
  174. };
  175. </script>
  176. <style>
  177. .JKWTree-container {
  178. display: flex;
  179. }
  180. .JKWTree-tree {
  181. width: 300px;
  182. background-color: #fff;
  183. padding: 10px;
  184. margin-right: 20px;
  185. }
  186. .JKWTree-tree h3 {
  187. font-size: 15px;
  188. font-weight: 700;
  189. margin: 10px 0;
  190. }
  191. .JKWTree-content {
  192. flex: 1;
  193. }
  194. /* 选中某行时的背景色*/
  195. .el-table__body tr.current-row>td {
  196. background: #ff80ff !important;
  197. /* 背景颜色 */
  198. }
  199. </style>
  200. <style scoped>
  201. :deep(.el-table td .cell) {
  202. line-height: 20px !important;
  203. }
  204. :deep(.el-tabs__header){
  205. margin-bottom: 0;
  206. }
  207. .search{
  208. margin-left: 0px !important;
  209. margin-right: 10px !important;
  210. }
  211. .bt{
  212. margin-left: 2px !important;
  213. padding: 3px !important;
  214. font-size: 12px;
  215. }
  216. .el-tabs__header{
  217. margin: 0px !important;
  218. }
  219. .gva-table-box{
  220. padding: 0px !important;
  221. }
  222. .mab{
  223. margin-bottom: 5px;
  224. }
  225. /* tree组件背景高亮 */
  226. :deep(.el-tree-node:focus > .el-tree-node__content){
  227. background: #ff80ff !important;
  228. }
  229. /* 屏幕宽度小于 768px 时调整样式 */
  230. :deep(@media (max-width: 1280px)) {
  231. .el-dialog {
  232. width: 90vw;
  233. height: 90vh;
  234. }
  235. }
  236. </style>