bomproduct.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div>
  3. <layout>
  4. <!-- <layout-header>
  5. <div class="gva-table-box" style="margin-left: 20px;width: 97%;">
  6. <el-form-item>
  7. <el-button type="primary" icon="plus" @click="addonclick" >新增问题分类</el-button>
  8. </el-form-item>
  9. </div>
  10. </layout-header> -->
  11. <layout>
  12. <!-- 右侧区域 -->
  13. <layout-content >
  14. <el-main>
  15. <div class="gva-table-box">
  16. <!-- 表格数据 -->
  17. <el-table ref="multipleTable" style="width: 100%;height: 76vh" tooltip-effect="dark"
  18. :row-style="{ height: '30px' }" :header-cell-style="{ padding: '0px' }"
  19. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  20. :data="tableData" border row-key="ID"
  21. size="small"
  22. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  23. @row-click="tableRowClick" :show-overflow-tooltip="true"
  24. @selection-change="handleSelectionChange">
  25. <el-table-column align="center" label="工单编号" prop="BOM_工单编号" width="100" />
  26. <el-table-column align="center" label="物料编码" prop="BOM_物料编码" width="100" />
  27. <el-table-column align="center" label="物料分类" prop="物料分类" width="110" />
  28. <el-table-column align="center" label="物料名称" prop="BOM_物料名称" width="160" />
  29. <el-table-column align="center" label="计划用料" prop="BOM_计划用量" width="100" />
  30. <el-table-column align="center" label="计划门幅" prop="BOM_计划门幅" width="100" />
  31. <el-table-column align="center" label="定额用料" prop="BOM_标准用量" width="100" />
  32. <el-table-column align="center" label="定额门幅" prop="BOM_定额门幅" width="100" />
  33. <!-- <el-table-column align="center" label="实际门幅" prop="BOM_实际门幅" width="110" /> -->
  34. <el-table-column align="center" label="实际用料" prop="BOM_实际用量" width="100" />
  35. <el-table-column align="center" label="库存总量" prop="BOM_库存总量" width="100" />
  36. <el-table-column align="center" label="面料结余" prop="BOM_面料结余" width="100" />
  37. <el-table-column align="center" label="退还数量" prop="BOM_退还数量" width="100" />
  38. <el-table-column align="center" label="投料单位" prop="BOM_投料单位" width="100" />
  39. <el-table-column align="center" label="备注" prop="BOM_desc" width="160" />
  40. <el-table-column align="center" label="建档人员" prop="Sys_ID" width="160" />
  41. <el-table-column align="center" label="建档日期" prop="Sys_rq" width="160" />
  42. <!-- <el-table-column fixed="right" label="操作" width="200">
  43. <template #default="{ row, $index }">
  44. <!-<el-button @click="Class_change(row,$index)" type="primary" size="small"
  45. style="font-size: 16px;padding: 0px;width: 90px;height: 25px;">
  46. 更改状态
  47. </el-button> --
  48. <el-button @click="record_deleteRow(row,$index)" type="danger" size="small"
  49. style="font-size: 16px;padding: 0px;width: 60px;background-color: red;">
  50. 删除
  51. </el-button>
  52. </template>
  53. </el-table-column> -->
  54. </el-table>
  55. <!-- 分页 -->
  56. <div class="gva-pagination">
  57. <el-pagination
  58. @size-change="handleSizeChange"
  59. @current-change="handleCurrentChange"
  60. :current-page="page"
  61. :page-sizes="[10, 30, 50, 100]"
  62. :page-size="pageSize"
  63. layout="total, sizes, prev, pager, next, jumper"
  64. :total="total">
  65. </el-pagination>
  66. </div>
  67. </div>
  68. <el-dialog v-model="add_QuestiondialogFormVisible" :before-close="add_QuestioncloseDialog"
  69. style="width: 40%; max-height: 80%; overflow-y: auto; margin-top: 4%;"
  70. :title="'新增问题信息'" destroy-on-close>
  71. <el-form label-width="100px" :model="add_Questionformdata">
  72. <el-row :gutter="24" class="form-row">
  73. <el-col :span="20">
  74. <el-form-item label="问题类型" class="mab" prop="keyOrder" id ='MAC地址' label-width='110'>
  75. <el-input v-model="add_Questionformdata.问题类型"/>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="20">
  79. <el-form-item label="归属" class="mab" prop="keyOrder" id ='MAC地址' label-width='110'>
  80. <el-radio-group v-model="add_Questionformdata.归属" >
  81. <el-radio label="次片" border >次片</el-radio>
  82. <el-radio label="返工" border >返工</el-radio>
  83. </el-radio-group>
  84. </el-form-item>
  85. </el-col>
  86. </el-row>
  87. </el-form>
  88. <template #footer>
  89. <div class="dialog-footer" style="display: flex; justify-content: flex-end; padding: 10px;">
  90. <el-button type="primary" @click="add_QuestioncloseDialog">取消</el-button>
  91. <el-button type="primary" @click="add_QuestionenterDialog">确定</el-button>
  92. </div>
  93. </template>
  94. </el-dialog>
  95. </el-main>
  96. </layout-content>
  97. </layout>
  98. </layout>
  99. </div>
  100. </template>
  101. <script setup>
  102. // 全量引入格式化工具 请按需保留
  103. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  104. import { getProblemCategories,deleteProblemCategory,addProblemCategory,Apibomlistarr } from '@/api/mes/job'
  105. import {ref, reactive} from 'vue'
  106. import { useUserStore } from '@/pinia/modules/user'
  107. import {ElMessage,ElMessageBox} from "element-plus";
  108. defineOptions({name: 'Company'})
  109. //获取登录用户信息
  110. const userStore = useUserStore()
  111. const _username = ref('')
  112. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  113. // 分页相关的响应式变量
  114. const page = ref(1)
  115. const total = ref(0)
  116. const pageSize = ref(50)
  117. // 分页
  118. const handleCurrentChange = (val) => {
  119. page.value = val;
  120. _gettabledata();
  121. };
  122. // 修改页面容量 点击多少条/页
  123. const handleSizeChange = (val) => {
  124. pageSize.value = val;
  125. _gettabledata();
  126. };
  127. // =========== 获取表格数据 ===========
  128. const tableData = ref([])
  129. const _gettabledata = async () => {
  130. // 调用接口获取数据
  131. const res = await Apibomlistarr({page:page.value,limit:pageSize.value})
  132. console.log(res)
  133. if (res.code === 0) {
  134. tableData.value = res.data.list;
  135. total.value = res.data.total;
  136. }
  137. }
  138. _gettabledata();
  139. const add_QuestiondialogFormVisible = ref(false)
  140. const add_Questionformdata = reactive({
  141. 问题类型: '',
  142. 归属: '',
  143. });
  144. // 新增
  145. const addonclick = () => {
  146. add_QuestiondialogFormVisible.value = true;
  147. }
  148. const add_QuestionenterDialog = async () => {
  149. //必填
  150. if(add_Questionformdata['问题类型'] === ''||add_Questionformdata['归属'] === ''){
  151. ElMessage({type: 'warning',message: '请将信息填写完整'})
  152. return false;
  153. }
  154. const add_Questionparams = {
  155. 问题类型: add_Questionformdata.问题类型,
  156. classification: add_Questionformdata.归属,
  157. sys_id: userStore.userInfo.nickName,
  158. }
  159. console.log(add_Questionparams)
  160. const res = await addProblemCategory(add_Questionparams)
  161. if (res.code === 0) {
  162. ElMessage.success('新增成功')
  163. add_QuestioncloseDialog()
  164. _gettabledata()
  165. }
  166. }
  167. //新增颜色资料取消
  168. const add_QuestioncloseDialog = () => {
  169. add_QuestiondialogFormVisible.value = false
  170. }
  171. // 更改状态
  172. const Status_change = async (row, index) => {
  173. console.log(row.UniqId,index)
  174. const newStatus = row.status === '1' ? '0' : '1';
  175. // 调用接口获取数据
  176. const res = await updateQuestionDeviceTypes({UniqId:row.UniqId,status:newStatus})
  177. if (res.code === 0) {
  178. ElMessage.success('更改状态成功')
  179. _gettabledata();
  180. }
  181. }
  182. const record_deleteRow = async (row, index) => {
  183. console.log(row.id);
  184. // 使用 ElMessageBox 提示确认删除
  185. ElMessageBox.confirm('确定删除此行数据吗?', '提示', {
  186. confirmButtonText: '确定',
  187. cancelButtonText: '取消',
  188. type: 'warning'
  189. }).then(async () => {
  190. // 确认删除,检查UNIQID是否为空
  191. if (row.id === '' || row.id === null || row.id === undefined) {
  192. // 删除当前行数据
  193. resbomtableData.value.splice(index, 1);
  194. ElMessage({
  195. type: 'success',
  196. message: '删除成功'
  197. });
  198. } else {
  199. // 调用接口删除
  200. const Bomdel_del = await deleteProblemCategory({ id:row.id});
  201. if (Bomdel_del.code === 0) {
  202. ElMessage({
  203. type: 'success',
  204. message: '删除成功'
  205. });
  206. } else {
  207. ElMessage({
  208. type: 'error',
  209. message: '删除失败'
  210. });
  211. }
  212. _gettabledata();
  213. }
  214. }).catch(() => {
  215. // 取消删除
  216. ElMessage({
  217. type: 'info',
  218. message: '已取消删除'
  219. });
  220. });
  221. }
  222. </script>
  223. <style scoped>
  224. .form-container {
  225. display: flex;
  226. flex-wrap: wrap;
  227. }
  228. .form-column {
  229. /*flex: 1;*/
  230. margin-right: 15px; /* 调整列之间的间距 */
  231. }
  232. /* 左侧输入框宽度调整 */
  233. .form-column .el-form-item .el-input {
  234. width: 150px; /* 调整左侧输入框的宽度 */
  235. }
  236. :deep(.hui-plan-usage-lows div) {
  237. color: #8c939d !important;
  238. }
  239. :deep(.lan-plan-usage-lows div) {
  240. color: blue !important;
  241. font-weight: bold;
  242. }
  243. /* 媒体查询,根据需要调整断点 */
  244. @media screen and (max-width: 768px) {
  245. .form-column {
  246. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  247. margin-right: 0;
  248. }
  249. }
  250. /*:deep(.el-table td .cell) {*/
  251. /* line-height: 30px !important;*/
  252. /*}*/
  253. .JKWTree-container {
  254. display: flex;
  255. }
  256. .JKWTree-tree {
  257. /*width: 300px;*/
  258. background-color: #fff;
  259. padding: 10px;
  260. margin-right: 20px;
  261. }
  262. .JKWTree-tree h3 {
  263. font-size: 15px;
  264. font-weight: 700;
  265. margin: 10px 0;
  266. }
  267. .JKWTree-content {
  268. flex: 1;
  269. }
  270. /* 图片上传 */
  271. .upload-box {
  272. width: 200px;
  273. height: 200px;
  274. border: 2px dashed #e2e2e2;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. position: relative;
  279. cursor: pointer;
  280. }
  281. .uploaded-image {
  282. width: 100%;
  283. height: 100%;
  284. object-fit: cover;
  285. }
  286. .upload-icon {
  287. font-size: 40px;
  288. color: #c0c4cc;
  289. }
  290. .file-input {
  291. display: none;
  292. }
  293. .el-table .warning-row {
  294. background: oldlace;
  295. }
  296. /* 选中某行时的背景色 */
  297. :deep(.el-table__body tr.current-row) > td {
  298. background: #ff80ff !important;
  299. }
  300. </style>
  301. <style scoped>
  302. :deep(.el-table td .cell) {
  303. line-height: 20px !important;
  304. }
  305. :deep(.el-tabs__header){
  306. margin-bottom: 0;
  307. }
  308. .search{
  309. margin-left: 0px !important;
  310. margin-right: 10px !important;
  311. }
  312. .bt{
  313. margin-left: 2px !important;
  314. padding: 3px !important;
  315. font-size: 12px;
  316. }
  317. .el-tabs__header{
  318. margin: 0px !important;
  319. }
  320. .gva-table-box{
  321. padding: 0px !important;
  322. }
  323. .mab{
  324. margin-bottom: 5px;
  325. }
  326. </style>