Add technology stack management
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
package com.ruoyi.web.controller.app;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppTechStack;
|
||||||
|
import com.ruoyi.app.service.IAppTechStackService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/techStack")
|
||||||
|
public class AppTechStackController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IAppTechStackService techStackService;
|
||||||
|
|
||||||
|
/** 小程序可选择的启用技术栈。 */
|
||||||
|
@GetMapping("/options")
|
||||||
|
public AjaxResult options()
|
||||||
|
{
|
||||||
|
return success(techStackService.selectEnabledAppTechStackList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('app:techStack:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(AppTechStack techStack)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<AppTechStack> list = techStackService.selectAppTechStackList(techStack);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('app:techStack:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AjaxResult detail(@PathVariable Long id)
|
||||||
|
{
|
||||||
|
return success(techStackService.selectAppTechStackById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('app:techStack:add')")
|
||||||
|
@Log(title = "定制技术栈", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody AppTechStack techStack)
|
||||||
|
{
|
||||||
|
techStack.setCreateBy(getUsername());
|
||||||
|
techStack.setUpdateBy(getUsername());
|
||||||
|
return toAjax(techStackService.insertAppTechStack(techStack));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('app:techStack:edit')")
|
||||||
|
@Log(title = "定制技术栈", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody AppTechStack techStack)
|
||||||
|
{
|
||||||
|
techStack.setUpdateBy(getUsername());
|
||||||
|
return toAjax(techStackService.updateAppTechStack(techStack));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('app:techStack:remove')")
|
||||||
|
@Log(title = "定制技术栈", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(techStackService.deleteAppTechStackByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.app.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目定制技术栈对象 app_tech_stack。
|
||||||
|
*/
|
||||||
|
public class AppTechStack extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private Integer sort;
|
||||||
|
/** 0启用 1停用 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
public Long getId() { return id; }
|
||||||
|
public void setId(Long id) { this.id = id; }
|
||||||
|
public String getName() { return name; }
|
||||||
|
public void setName(String name) { this.name = name; }
|
||||||
|
public Integer getSort() { return sort; }
|
||||||
|
public void setSort(Integer sort) { this.sort = sort; }
|
||||||
|
public String getStatus() { return status; }
|
||||||
|
public void setStatus(String status) { this.status = status; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.app.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppTechStack;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface AppTechStackMapper
|
||||||
|
{
|
||||||
|
AppTechStack selectAppTechStackById(Long id);
|
||||||
|
|
||||||
|
AppTechStack selectAppTechStackByName(@Param("name") String name, @Param("excludeId") Long excludeId);
|
||||||
|
|
||||||
|
List<AppTechStack> selectAppTechStackList(AppTechStack techStack);
|
||||||
|
|
||||||
|
List<AppTechStack> selectEnabledAppTechStackList();
|
||||||
|
|
||||||
|
int insertAppTechStack(AppTechStack techStack);
|
||||||
|
|
||||||
|
int updateAppTechStack(AppTechStack techStack);
|
||||||
|
|
||||||
|
int deleteAppTechStackByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.app.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppTechStack;
|
||||||
|
|
||||||
|
public interface IAppTechStackService
|
||||||
|
{
|
||||||
|
AppTechStack selectAppTechStackById(Long id);
|
||||||
|
|
||||||
|
List<AppTechStack> selectAppTechStackList(AppTechStack techStack);
|
||||||
|
|
||||||
|
List<AppTechStack> selectEnabledAppTechStackList();
|
||||||
|
|
||||||
|
int insertAppTechStack(AppTechStack techStack);
|
||||||
|
|
||||||
|
int updateAppTechStack(AppTechStack techStack);
|
||||||
|
|
||||||
|
int deleteAppTechStackByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.ruoyi.app.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.app.domain.AppTechStack;
|
||||||
|
import com.ruoyi.app.mapper.AppTechStackMapper;
|
||||||
|
import com.ruoyi.app.service.IAppTechStackService;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppTechStackServiceImpl implements IAppTechStackService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AppTechStackMapper techStackMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppTechStack selectAppTechStackById(Long id)
|
||||||
|
{
|
||||||
|
return techStackMapper.selectAppTechStackById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppTechStack> selectAppTechStackList(AppTechStack techStack)
|
||||||
|
{
|
||||||
|
return techStackMapper.selectAppTechStackList(techStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppTechStack> selectEnabledAppTechStackList()
|
||||||
|
{
|
||||||
|
return techStackMapper.selectEnabledAppTechStackList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertAppTechStack(AppTechStack techStack)
|
||||||
|
{
|
||||||
|
normalizeAndValidate(techStack);
|
||||||
|
techStack.setCreateTime(DateUtils.getNowDate());
|
||||||
|
techStack.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return techStackMapper.insertAppTechStack(techStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateAppTechStack(AppTechStack techStack)
|
||||||
|
{
|
||||||
|
if (techStack.getId() == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("技术栈不存在");
|
||||||
|
}
|
||||||
|
normalizeAndValidate(techStack);
|
||||||
|
techStack.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return techStackMapper.updateAppTechStack(techStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteAppTechStackByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return techStackMapper.deleteAppTechStackByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void normalizeAndValidate(AppTechStack techStack)
|
||||||
|
{
|
||||||
|
String name = StringUtils.trim(techStack.getName());
|
||||||
|
if (StringUtils.isEmpty(name) || name.length() > 50)
|
||||||
|
{
|
||||||
|
throw new ServiceException("技术栈名称需填写1至50个字");
|
||||||
|
}
|
||||||
|
if (techStackMapper.selectAppTechStackByName(name, techStack.getId()) != null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("技术栈名称已存在");
|
||||||
|
}
|
||||||
|
techStack.setName(name);
|
||||||
|
if (techStack.getSort() == null || techStack.getSort() < 0)
|
||||||
|
{
|
||||||
|
techStack.setSort(0);
|
||||||
|
}
|
||||||
|
if (!"1".equals(techStack.getStatus()))
|
||||||
|
{
|
||||||
|
techStack.setStatus("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.app.mapper.AppTechStackMapper">
|
||||||
|
|
||||||
|
<resultMap type="AppTechStack" id="AppTechStackResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="sort" column="sort" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAppTechStackVo">
|
||||||
|
select id, name, sort, status, remark, create_by, create_time, update_by, update_time
|
||||||
|
from app_tech_stack
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAppTechStackById" parameterType="Long" resultMap="AppTechStackResult">
|
||||||
|
<include refid="selectAppTechStackVo" /> where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAppTechStackByName" resultMap="AppTechStackResult">
|
||||||
|
<include refid="selectAppTechStackVo" />
|
||||||
|
where name = #{name}
|
||||||
|
<if test="excludeId != null">and id != #{excludeId}</if>
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAppTechStackList" parameterType="AppTechStack" resultMap="AppTechStackResult">
|
||||||
|
<include refid="selectAppTechStackVo" />
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="status != null and status != ''">and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
order by sort asc, id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEnabledAppTechStackList" resultMap="AppTechStackResult">
|
||||||
|
<include refid="selectAppTechStackVo" />
|
||||||
|
where status = '0'
|
||||||
|
order by sort asc, id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAppTechStack" parameterType="AppTechStack" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into app_tech_stack (name, sort, status, remark, create_by, create_time, update_by, update_time)
|
||||||
|
values (#{name}, #{sort}, #{status}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAppTechStack" parameterType="AppTechStack">
|
||||||
|
update app_tech_stack
|
||||||
|
<set>
|
||||||
|
name = #{name}, sort = #{sort}, status = #{status},
|
||||||
|
remark = #{remark}, update_by = #{updateBy}, update_time = #{updateTime}
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAppTechStackByIds" parameterType="Long">
|
||||||
|
delete from app_tech_stack where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
21
ruoyi-ui/src/api/app/techStack.js
Normal file
21
ruoyi-ui/src/api/app/techStack.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function listTechStack(query) {
|
||||||
|
return request({ url: '/app/techStack/list', method: 'get', params: query })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTechStack(id) {
|
||||||
|
return request({ url: '/app/techStack/' + id, method: 'get' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addTechStack(data) {
|
||||||
|
return request({ url: '/app/techStack', method: 'post', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateTechStack(data) {
|
||||||
|
return request({ url: '/app/techStack', method: 'put', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delTechStack(ids) {
|
||||||
|
return request({ url: '/app/techStack/' + ids, method: 'delete' })
|
||||||
|
}
|
||||||
155
ruoyi-ui/src/views/app/techStack/index.vue
Normal file
155
ruoyi-ui/src/views/app/techStack/index.vue
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="80px">
|
||||||
|
<el-form-item label="技术栈" prop="name">
|
||||||
|
<el-input v-model="queryParams.name" placeholder="请输入技术栈名称" clearable @keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="全部状态" clearable>
|
||||||
|
<el-option label="启用" value="0" />
|
||||||
|
<el-option label="停用" value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button v-hasPermi="['app:techStack:add']" type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button v-hasPermi="['app:techStack:edit']" type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate()">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button v-hasPermi="['app:techStack:remove']" type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete()">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="techStackList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="技术栈名称" prop="name" min-width="220" />
|
||||||
|
<el-table-column label="排序" prop="sort" width="100" align="center" />
|
||||||
|
<el-table-column label="状态" width="100" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'" size="small">{{ scope.row.status === '0' ? '启用' : '停用' }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" prop="remark" min-width="240" show-overflow-tooltip />
|
||||||
|
<el-table-column label="更新时间" prop="updateTime" width="165" />
|
||||||
|
<el-table-column label="操作" width="140" align="center" fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button v-hasPermi="['app:techStack:edit']" type="text" icon="el-icon-edit" size="mini" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
|
<el-button v-hasPermi="['app:techStack:remove']" type="text" icon="el-icon-delete" size="mini" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
||||||
|
<el-form-item label="技术栈名称" prop="name">
|
||||||
|
<el-input v-model="form.name" maxlength="50" show-word-limit placeholder="例如:UniApp + Spring Boot" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="sort">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" :max="9999" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio label="0">启用</el-radio>
|
||||||
|
<el-radio label="1">停用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" :rows="3" maxlength="500" show-word-limit placeholder="可填写适用场景" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||||
|
<el-button @click="cancel">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { addTechStack, delTechStack, getTechStack, listTechStack, updateTechStack } from '@/api/app/techStack'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TechStack',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
showSearch: true,
|
||||||
|
ids: [],
|
||||||
|
single: true,
|
||||||
|
multiple: true,
|
||||||
|
total: 0,
|
||||||
|
techStackList: [],
|
||||||
|
open: false,
|
||||||
|
title: '',
|
||||||
|
queryParams: { pageNum: 1, pageSize: 10, name: undefined, status: undefined },
|
||||||
|
form: {},
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: '请输入技术栈名称', trigger: 'blur' }],
|
||||||
|
sort: [{ required: true, message: '请输入显示排序', trigger: 'blur' }],
|
||||||
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() { this.getList() },
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listTechStack(this.queryParams).then(response => {
|
||||||
|
this.techStackList = response.rows || []
|
||||||
|
this.total = response.total || 0
|
||||||
|
}).finally(() => { this.loading = false })
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.form = { id: undefined, name: '', sort: 0, status: '0', remark: '' }
|
||||||
|
this.resetForm('form')
|
||||||
|
},
|
||||||
|
cancel() { this.open = false; this.reset() },
|
||||||
|
handleQuery() { this.queryParams.pageNum = 1; this.getList() },
|
||||||
|
resetQuery() { this.resetForm('queryForm'); this.handleQuery() },
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
handleAdd() { this.reset(); this.title = '新增技术栈'; this.open = true },
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset()
|
||||||
|
const id = row && row.id ? row.id : this.ids[0]
|
||||||
|
getTechStack(id).then(response => {
|
||||||
|
this.form = response.data
|
||||||
|
this.title = '修改技术栈'
|
||||||
|
this.open = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (!valid) return
|
||||||
|
const request = this.form.id ? updateTechStack(this.form) : addTechStack(this.form)
|
||||||
|
request.then(() => {
|
||||||
|
this.$modal.msgSuccess(this.form.id ? '修改成功' : '新增成功')
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row && row.id ? row.id : this.ids
|
||||||
|
this.$modal.confirm('确认删除选中的技术栈吗?历史需求中的技术栈名称不会受影响。').then(() => delTechStack(ids)).then(() => {
|
||||||
|
this.$modal.msgSuccess('删除成功')
|
||||||
|
this.getList()
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user