Compare commits
	
		
			3 Commits
		
	
	
		
			5ff9c588cb
			...
			6a39a4c2a2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6a39a4c2a2 | |||
| ad42fca580 | |||
| 36f9dc0169 | 
| @ -24,7 +24,7 @@ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|                     <!-- 自定义删除按钮(带文字) --> |                     <!-- 自定义删除按钮(带文字) --> | ||||||
|                     <span class="custom-delete-btn" @click.stop="handleDelete(file)"> |                     <span v-if="!disabled" class="custom-delete-btn" @click.stop="handleDelete(file)"> | ||||||
|                         <el-icon> |                         <el-icon> | ||||||
|                             <Delete /> |                             <Delete /> | ||||||
|                         </el-icon> |                         </el-icon> | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| <template> | <template> | ||||||
|   <div class="app-container customer-control"> |   <div class="app-container customer-control" :key="containerKey" > | ||||||
|     <div class="container-custom"> |     <div class="container-custom"> | ||||||
|       <!-- 搜索栏 --> |       <!-- 搜索栏 --> | ||||||
|       <div ref="searchBarRef" class="search-box"> |       <div ref="searchBarRef" class="search-box"> | ||||||
| @ -106,9 +106,9 @@ | |||||||
|           :rowkey="'id'" |           :rowkey="'id'" | ||||||
|         > |         > | ||||||
|         <!-- 自定义-图片 --> |         <!-- 自定义-图片 --> | ||||||
|           <template #imgPath="slotProps"> |           <template #coverUrl="slotProps"> | ||||||
|             <div class="table-cell-img-box"> |             <div class="table-cell-img-box"> | ||||||
|               <img :src="slotProps.row.imgPath" class="table-cell-img" alt="" /> |               <img :src="slotProps.row.coverUrl" class="table-cell-img" alt="" /> | ||||||
|             </div> |             </div> | ||||||
|           </template> |           </template> | ||||||
|           <!-- 自定义-资讯分类 --> |           <!-- 自定义-资讯分类 --> | ||||||
| @ -141,11 +141,14 @@ | |||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|     <!-- 添加/编辑 --> |     <!-- 添加/编辑 --> | ||||||
|     <el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="500" :close-on-click-modal="false"> |     <el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false"> | ||||||
|       <el-form :disabled="disabled" :model="dialogForm" :label-width="'80'" :rules="dialogFormRules" ref="dialogRef"> |       <el-form :disabled="disabled" :model="dialogForm" :label-width="'80'" :rules="dialogFormRules" ref="dialogRef"> | ||||||
|         <el-form-item label="标题" prop="title"> |         <el-form-item label="标题" prop="title"> | ||||||
|           <el-input v-model="dialogForm.title" autocomplete="off" placeholder="请输入内容标题" /> |           <el-input v-model="dialogForm.title" autocomplete="off" placeholder="请输入内容标题" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|  |         <el-form-item label="封面" prop="coverUrl"> | ||||||
|  |           <myUploadImage v-model="dialogForm.coverUrl" :limit="1" :disabled="disabled" ></myUploadImage> | ||||||
|  |         </el-form-item> | ||||||
|         <el-form-item label="资讯分类" prop="category"> |         <el-form-item label="资讯分类" prop="category"> | ||||||
|           <el-select v-model="dialogForm.category" placeholder="请选择资讯分类"> |           <el-select v-model="dialogForm.category" placeholder="请选择资讯分类"> | ||||||
|             <el-option |             <el-option | ||||||
| @ -175,7 +178,7 @@ | |||||||
|               :mode="mode" |               :mode="mode" | ||||||
|               :disabled="disabled" |               :disabled="disabled" | ||||||
|               v-model="dialogForm.content" |               v-model="dialogForm.content" | ||||||
|               style="height: 300px; overflow-y: scroll" |               style="height: 200px; overflow-y: scroll" | ||||||
|               @onCreated="handleCreated" |               @onCreated="handleCreated" | ||||||
|               @onChange="handleChange" |               @onChange="handleChange" | ||||||
|               @onDestroyed="handleDestroyed" |               @onDestroyed="handleDestroyed" | ||||||
| @ -189,7 +192,7 @@ | |||||||
|       </el-form> |       </el-form> | ||||||
|       <template #footer> |       <template #footer> | ||||||
|         <div class="dialog-footer"> |         <div class="dialog-footer"> | ||||||
|           <el-button type="primary" @click="onSaveCategory"> |           <el-button v-if="!disabled" type="primary" @click="onSaveCategory"> | ||||||
|             保存 |             保存 | ||||||
|           </el-button> |           </el-button> | ||||||
|           <el-button @click="cancelDialog">取消</el-button> |           <el-button @click="cancelDialog">取消</el-button> | ||||||
| @ -265,6 +268,8 @@ defineExpose({ | |||||||
|   handleCreated |   handleCreated | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
|  | const containerKey = ref(0) | ||||||
|  | 
 | ||||||
| const formInline = reactive({ | const formInline = reactive({ | ||||||
|   id: "", |   id: "", | ||||||
|   title: "",//商品名称 |   title: "",//商品名称 | ||||||
| @ -286,6 +291,7 @@ const disabled = ref(false); | |||||||
| let dialogForm = reactive({ | let dialogForm = reactive({ | ||||||
|     id: "", |     id: "", | ||||||
|     title: "", |     title: "", | ||||||
|  |     coverUrl:"", | ||||||
|     content:"", |     content:"", | ||||||
|     category:"", |     category:"", | ||||||
|     publishLocation:'', |     publishLocation:'', | ||||||
| @ -294,6 +300,9 @@ const dialogFormRules = ref({ | |||||||
|     title:  [ |     title:  [ | ||||||
|         { required: true, message: "请输入品牌名称", trigger: "blur" }, |         { required: true, message: "请输入品牌名称", trigger: "blur" }, | ||||||
|     ], |     ], | ||||||
|  |     coverUrl:  [ | ||||||
|  |         { required: true, message: "请上传封面", trigger: "blur" }, | ||||||
|  |     ], | ||||||
|     content:  [ |     content:  [ | ||||||
|         { required: true, message: "请输入内容", trigger: "blur" }, |         { required: true, message: "请输入内容", trigger: "blur" }, | ||||||
|     ], |     ], | ||||||
| @ -370,6 +379,7 @@ let nowClickRow = ref({}); | |||||||
| // 列配置 | // 列配置 | ||||||
| const columns = ref([ | const columns = ref([ | ||||||
|   { prop: "title", label: "标题" }, |   { prop: "title", label: "标题" }, | ||||||
|  |   { prop: "coverUrl", label: "封面", slotName: "coverUrl",}, | ||||||
|   { prop: "category", label: "资讯分类", slotName: "category",}, |   { prop: "category", label: "资讯分类", slotName: "category",}, | ||||||
|   { prop: "publishLocation", label: "发布位置", slotName: "publishLocation",}, |   { prop: "publishLocation", label: "发布位置", slotName: "publishLocation",}, | ||||||
|   { prop: "createTime", label: "发布日期",}, |   { prop: "createTime", label: "发布日期",}, | ||||||
| @ -383,7 +393,7 @@ const getHeaderClass = ({ column }) => { | |||||||
| }; | }; | ||||||
| // 分页变化 | // 分页变化 | ||||||
| const handlePaginationChange = ({ page, pageSize }) => { | const handlePaginationChange = ({ page, pageSize }) => { | ||||||
|   console.log("分页变化:", page, pageSize); |   // console.log("分页变化:", page, pageSize); | ||||||
|   formInline.current = page; |   formInline.current = page; | ||||||
|   formInline.size = pageSize; |   formInline.size = pageSize; | ||||||
|   // 这里可以调用API获取新数据 |   // 这里可以调用API获取新数据 | ||||||
| @ -391,7 +401,7 @@ const handlePaginationChange = ({ page, pageSize }) => { | |||||||
| }; | }; | ||||||
| // 多选框变化 | // 多选框变化 | ||||||
| const handleSelectionChange = (selection) => { | const handleSelectionChange = (selection) => { | ||||||
|   console.log("选中项:", selection); |   // console.log("选中项:", selection); | ||||||
|   selectedIds.value = []; |   selectedIds.value = []; | ||||||
|   selection.forEach(element => { |   selection.forEach(element => { | ||||||
|     selectedIds.value.push(element.id); |     selectedIds.value.push(element.id); | ||||||
| @ -415,7 +425,7 @@ const batchDelete = async () => { | |||||||
|    |    | ||||||
| }; | }; | ||||||
| const deleteGoods = async (param) => { | const deleteGoods = async (param) => { | ||||||
|   console.log("批量删除参数:", param); |   // console.log("批量删除参数:", param); | ||||||
|    |    | ||||||
|   try { |   try { | ||||||
|     tableLoading.value = true; |     tableLoading.value = true; | ||||||
| @ -448,31 +458,27 @@ resetDlg(); | |||||||
| }; | }; | ||||||
| //提交保存 | //提交保存 | ||||||
| const onSaveCategory = async () => {  | const onSaveCategory = async () => {  | ||||||
|   console.log('dialogForm',dialogForm); |  | ||||||
|    |  | ||||||
|   dialogRef.value.validate(async (valid) => {  |   dialogRef.value.validate(async (valid) => {  | ||||||
|     if (valid) {  |     if (valid) {  | ||||||
|         if(isADD.value){ |       if(isADD.value){ | ||||||
|             let response = await addConten(dialogForm); |         let response = await addConten(dialogForm); | ||||||
|             if (response.code === 200) { |         if (response.code === 200) { | ||||||
|                 dialogFormVisible.value = false; |           dialogFormVisible.value = false; | ||||||
|                 ElMessage.success("新增成功!"); |           ElMessage.success("新增成功!"); | ||||||
|                 dialogRef.value.resetFields(); |           dialogRef.value.resetFields(); | ||||||
|                 loadData(); |           containerKey.value++ // 修改 key 值强制刷新 | ||||||
|             } else { |           loadData(); | ||||||
|                 ElMessage.error(response.message); |  | ||||||
|             } |  | ||||||
|         }else{  |  | ||||||
|             let response = await updateInformation(dialogForm); |  | ||||||
|             if (response.code === 200) { |  | ||||||
|                 dialogFormVisible.value = false; |  | ||||||
|                 ElMessage.success("编辑成功!"); |  | ||||||
|                 dialogRef.value.resetFields(); |  | ||||||
|                 loadData(); |  | ||||||
|             } else { |  | ||||||
|                 ElMessage.error(response.message); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |       } else {  | ||||||
|  |         let response = await updateInformation(dialogForm); | ||||||
|  |         if (response.code === 200) { | ||||||
|  |           dialogFormVisible.value = false; | ||||||
|  |           ElMessage.success("编辑成功!"); | ||||||
|  |           dialogRef.value.resetFields(); | ||||||
|  |           containerKey.value++ // 修改 key 值强制刷新 | ||||||
|  |           loadData(); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user