QuestionClassification.vue 9.5 KB

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