Explorar el Código

字典接口修改

tongshangming hace 3 años
padre
commit
28f9ec4c78
Se han modificado 3 ficheros con 15 adiciones y 9 borrados
  1. 3 3
      src/components/ProTable.vue
  2. 9 3
      src/views/system/Dict.vue
  3. 3 3
      src/views/system/Role.vue

+ 3 - 3
src/components/ProTable.vue

@@ -65,7 +65,7 @@ const curPage = ref(1)
 const loading = ref(false)
 const tableConfig = ref<CustomTable>({
   showOperate: true,
-  operateWidth: 120,
+  operateWidth: 140,
   ...props.tableConfig
 })
 
@@ -223,8 +223,8 @@ defineExpose({
           <el-table-column fixed="right" label="操作" :width="tableConfig.operateWidth" v-if="tableConfig.showOperate">
             <template #default="{ row }">
               <slot name="operateBefore" :row="row"></slot>
-              <el-button link type="primary" size="small" @click="handleUpdate(row)">编辑</el-button>
-              <el-button link type="danger" size="small" @click="handleDelete(row.id)">删除</el-button>
+              <el-button type="primary" size="small" @click="handleUpdate(row)">编辑</el-button>
+              <el-button type="danger" size="small" @click="handleDelete(row.id)">删除</el-button>
               <slot name="operateAfter" :row="row"></slot>
             </template>
           </el-table-column>

+ 9 - 3
src/views/system/Dict.vue

@@ -30,12 +30,18 @@ const CRUD: ICRUD = {
 
 const itemCRUD: ICRUD = {
   create(data: any) {
-    data.dictTypeId = curRow.value.id
+    data['dictType.id'] = curRow.value.id
     return saveDictValue(data)
   },
   update(data: any) {
-    data.dictTypeId = curRow.value.id
-    return saveDictValue(data)
+    data['dictType.id'] = curRow.value.id
+    return saveDictValue({
+      dictValueId: data.id,
+      ['dictType.id']: curRow.value.id,
+      label: data.label,
+      value: data.value,
+      sort: data.sort
+    })
   },
   getList() {
     return getDictValue(curRow.value.id).then((res: any) => {

+ 3 - 3
src/views/system/Role.vue

@@ -107,12 +107,12 @@ const handleSubmit = () => {
 <template>
   <el-row :gutter="16">
     <el-col :span="curRole ? 12 : 24">
-      <pro-table :crud="CRUD" :formConfig="formConfig" :tableConfig="{ operateWidth: 250 }">
+      <pro-table :crud="CRUD" :formConfig="formConfig" :tableConfig="{ operateWidth: 300 }">
         <el-table-column prop="name" label="角色名称"></el-table-column>
         <el-table-column prop="phone" label="备注"></el-table-column>
         <template #operateBefore="{ row }">
-          <el-button link type="primary" size="small" @click="handleRole(row)">角色授权</el-button>
-          <el-button link type="primary" size="small" @click="handleUser(row)">分配用户</el-button>
+          <el-button type="primary" size="small" @click="handleRole(row)">角色授权</el-button>
+          <el-button type="primary" size="small" @click="handleUser(row)">分配用户</el-button>
         </template>
       </pro-table>
     </el-col>