202505281650
This commit is contained in:
parent
4af16aaea6
commit
cc9963b423
|
|
@ -1,9 +1,15 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.system.domain.QuoteType;
|
||||
import com.ruoyi.system.domain.ServiceCate;
|
||||
import com.ruoyi.system.service.IQuoteTypeService;
|
||||
import com.ruoyi.system.service.IServiceGoodsService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -37,7 +43,8 @@ public class QuoteCraftController extends BaseController
|
|||
@Autowired
|
||||
private IQuoteCraftService quoteCraftService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IQuoteTypeService quoteTypeService;
|
||||
|
||||
@Autowired
|
||||
private IServiceGoodsService serviceGoodsService;
|
||||
|
|
@ -62,6 +69,40 @@ public class QuoteCraftController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取工艺分类下拉list用来进行多选
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ServiceGoods:query')")
|
||||
@PostMapping(value = "/selectQuoteTypeList")
|
||||
public AjaxResult selectQuoteTypeList()
|
||||
{
|
||||
|
||||
QuoteType quoteType = new QuoteType();
|
||||
|
||||
List<QuoteType> quoteTypeList = quoteTypeService.selectQuoteTypeList(quoteType);
|
||||
return success(quoteType);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取工艺分类下拉list用来进行多选
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:ServiceGoods:query')")
|
||||
// @PostMapping(value = "/selectQuoteTypeList")
|
||||
// public AjaxResult selectQuoteTypeList(@RequestBody ArrayList<Integer> ids)
|
||||
// {
|
||||
// System.out.println("&&&&&&&&&&&&&&&"+ids);
|
||||
// QuoteType quoteType = new QuoteType();
|
||||
//// if(ids!=null){
|
||||
//// List<String> idslist = Arrays.asList(
|
||||
////
|
||||
//// quoteType.setGoodsids(idslist);
|
||||
//// }
|
||||
// List<QuoteType> quoteTypeList = quoteTypeService.selectQuoteTypeList(quoteType);
|
||||
// return success(quoteTypeList);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 导出项目报价--服务工艺列表
|
||||
*/
|
||||
|
|
@ -82,7 +123,22 @@ public class QuoteCraftController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(quoteCraftService.selectQuoteCraftById(id));
|
||||
QuoteCraft quoteCraft=quoteCraftService.selectQuoteCraftById(id);
|
||||
if(quoteCraft!=null){
|
||||
if (quoteCraft.getTypeId()!=null) {
|
||||
String strtype = quoteCraft.getTypeId();
|
||||
List<String> strtypeList = JSON.parseArray(strtype, String.class);
|
||||
List<Integer> intstrtypeList = strtypeList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
quoteCraft.setTypeintids(intstrtypeList);
|
||||
}
|
||||
if (quoteCraft.getGoodId()!=null){
|
||||
String str = quoteCraft.getGoodId();
|
||||
List<String> stringList = JSON.parseArray(str, String.class);
|
||||
List<Integer> intList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
quoteCraft.setGoodsintids(intList);
|
||||
}
|
||||
}
|
||||
return success(quoteCraft);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -93,6 +149,15 @@ public class QuoteCraftController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuoteCraft quoteCraft)
|
||||
{
|
||||
if(quoteCraft.getGoodsintids().size()>0){
|
||||
List<Integer> intList =quoteCraft.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteCraft.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
}
|
||||
return toAjax(quoteCraftService.insertQuoteCraft(quoteCraft));
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +169,15 @@ public class QuoteCraftController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody QuoteCraft quoteCraft)
|
||||
{
|
||||
if(quoteCraft.getGoodsintids().size()>0){
|
||||
List<Integer> intList =quoteCraft.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteCraft.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
}
|
||||
return toAjax(quoteCraftService.updateQuoteCraft(quoteCraft));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package com.ruoyi.system.controller;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.system.domain.QuoteType;
|
||||
import com.ruoyi.system.service.IQuoteMaterialTypeService;
|
||||
import com.ruoyi.system.service.IServiceGoodsService;
|
||||
|
|
@ -87,7 +89,14 @@ public class QuoteMaterialController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(quoteMaterialService.selectQuoteMaterialById(id));
|
||||
QuoteMaterial quoteMaterial=quoteMaterialService.selectQuoteMaterialById(id);
|
||||
if (quoteMaterial.getGoodId()!=null){
|
||||
String str = quoteMaterial.getGoodId();
|
||||
List<String> stringList = JSON.parseArray(str, String.class);
|
||||
List<Integer> intList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
quoteMaterial.setGoodsintids(intList);
|
||||
}
|
||||
return success(quoteMaterial);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,6 +107,15 @@ public class QuoteMaterialController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuoteMaterial quoteMaterial)
|
||||
{
|
||||
if(quoteMaterial.getGoodsintids().size()>0){
|
||||
List<Integer> intList =quoteMaterial.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteMaterial.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
}
|
||||
return toAjax(quoteMaterialService.insertQuoteMaterial(quoteMaterial));
|
||||
}
|
||||
|
||||
|
|
@ -109,6 +127,18 @@ public class QuoteMaterialController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody QuoteMaterial quoteMaterial)
|
||||
{
|
||||
if(quoteMaterial.getGoodsintids().size()>0){
|
||||
System.out.println("#########################"+quoteMaterial.getGoodsintids());
|
||||
List<Integer> intList =quoteMaterial.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteMaterial.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
System.out.println("#########################"+json.replaceAll("\",\"", "\", \""));
|
||||
|
||||
}
|
||||
return toAjax(quoteMaterialService.updateQuoteMaterial(quoteMaterial));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ package com.ruoyi.system.controller;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.system.domain.QuoteType;
|
||||
import com.ruoyi.system.service.IServiceGoodsService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -79,7 +82,15 @@ public class QuoteMaterialTypeController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(quoteMaterialTypeService.selectQuoteMaterialTypeById(id));
|
||||
QuoteMaterialType quoteMaterialType =quoteMaterialTypeService.selectQuoteMaterialTypeById(id);
|
||||
if (quoteMaterialType.getGoodId()!=null){
|
||||
String str = quoteMaterialType.getGoodId();
|
||||
List<String> stringList = JSON.parseArray(str, String.class);
|
||||
List<Integer> intList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
quoteMaterialType.setGoodsintids(intList);
|
||||
}
|
||||
|
||||
return success(quoteMaterialType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -90,6 +101,15 @@ public class QuoteMaterialTypeController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuoteMaterialType quoteMaterialType)
|
||||
{
|
||||
if(quoteMaterialType.getGoodsintids().size()>0){
|
||||
List<Integer> intList =quoteMaterialType.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteMaterialType.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
}
|
||||
return toAjax(quoteMaterialTypeService.insertQuoteMaterialType(quoteMaterialType));
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +121,18 @@ public class QuoteMaterialTypeController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody QuoteMaterialType quoteMaterialType)
|
||||
{
|
||||
if(quoteMaterialType.getGoodsintids().size()>0){
|
||||
System.out.println("#########################"+quoteMaterialType.getGoodsintids());
|
||||
List<Integer> intList =quoteMaterialType.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteMaterialType.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
System.out.println("#########################"+json.replaceAll("\",\"", "\", \""));
|
||||
|
||||
}
|
||||
return toAjax(quoteMaterialTypeService.updateQuoteMaterialType(quoteMaterialType));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ public class QuoteTypeController extends BaseController
|
|||
|
||||
List<QuoteType> list = quoteTypeService.selectQuoteTypeList(quoteType);
|
||||
for(QuoteType quoteTypeData:list){
|
||||
System.out.println("#########################"+quoteTypeData.getGoodId());
|
||||
System.out.println("#########################"+quoteTypeData.getGoodId().replaceAll("[\\[\\]\"]", "").split(", "));
|
||||
List<String> idslist = Arrays.asList(
|
||||
quoteTypeData.getGoodId().replaceAll("[\\[\\]\"]", "").split(", "));
|
||||
quoteTypeData.setServiceName(serviceGoodsService.selectTitlesByIds(idslist));
|
||||
|
|
@ -135,24 +137,16 @@ public class QuoteTypeController extends BaseController
|
|||
|
||||
QuoteType quoteType = quoteTypeService.selectQuoteTypeById(id);
|
||||
if (quoteType.getGoodId()!=null){
|
||||
String str = "[\"45\", \"47\", \"48\", \"49\", \"5\", \"52\"]";
|
||||
String str = quoteType.getGoodId();
|
||||
List<String> stringList = JSON.parseArray(str, String.class);
|
||||
List<Integer> intList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
quoteType.setGoodsintids(intList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return success(quoteType);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String str = "[\"45\", \"47\", \"48\", \"49\", \"5\", \"52\"]";
|
||||
// List<String> stringList = JSON.parseArray(str, String.class);
|
||||
// List<Integer> intList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
// System.out.println(intList); // 输出: [45, 47, 48, 49, 5, 52]
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -163,6 +157,16 @@ public class QuoteTypeController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuoteType quoteType)
|
||||
{
|
||||
|
||||
if(quoteType.getGoodsintids().size()>0){
|
||||
List<Integer> intList =quoteType.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteType.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
}
|
||||
return toAjax(quoteTypeService.insertQuoteType(quoteType));
|
||||
}
|
||||
|
||||
|
|
@ -174,6 +178,19 @@ public class QuoteTypeController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody QuoteType quoteType)
|
||||
{
|
||||
|
||||
if(quoteType.getGoodsintids().size()>0){
|
||||
System.out.println("#########################"+quoteType.getGoodsintids());
|
||||
List<Integer> intList =quoteType.getGoodsintids();
|
||||
// 先转成字符串List
|
||||
List<String> strList = intList.stream().map(String::valueOf).collect(Collectors.toList());
|
||||
// 再转成json字符串
|
||||
String json = JSON.toJSONString(strList);
|
||||
quoteType.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
System.out.println("#########################"+json.replaceAll("\",\"", "\", \""));
|
||||
|
||||
}
|
||||
return toAjax(quoteTypeService.updateQuoteType(quoteType));
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.domain;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
|
@ -45,6 +46,10 @@ public class QuoteCraft extends BaseEntity
|
|||
@Excel(name = "服务名称")
|
||||
private String ServiceName;
|
||||
|
||||
private List<Integer> goodsintids;
|
||||
|
||||
private List<Integer> typeintids;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Date createdAt;
|
||||
|
|
@ -141,6 +146,22 @@ public class QuoteCraft extends BaseEntity
|
|||
ServiceName = serviceName;
|
||||
}
|
||||
|
||||
public List<Integer> getGoodsintids() {
|
||||
return goodsintids;
|
||||
}
|
||||
|
||||
public void setGoodsintids(List<Integer> goodsintids) {
|
||||
this.goodsintids = goodsintids;
|
||||
}
|
||||
|
||||
public List<Integer> getTypeintids() {
|
||||
return typeintids;
|
||||
}
|
||||
|
||||
public void setTypeintids(List<Integer> typeintids) {
|
||||
this.typeintids = typeintids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.domain;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
|
@ -69,6 +70,9 @@ public class QuoteMaterial extends BaseEntity
|
|||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Date updatedAt;
|
||||
|
||||
|
||||
private List<Integer> goodsintids;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
|
@ -181,6 +185,14 @@ public class QuoteMaterial extends BaseEntity
|
|||
this.priceMax = priceMax;
|
||||
}
|
||||
|
||||
public List<Integer> getGoodsintids() {
|
||||
return goodsintids;
|
||||
}
|
||||
|
||||
public void setGoodsintids(List<Integer> goodsintids) {
|
||||
this.goodsintids = goodsintids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
|
@ -48,6 +49,8 @@ public class QuoteMaterialType extends BaseEntity
|
|||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Date updatedAt;
|
||||
|
||||
private List<Integer> goodsintids;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
|
@ -126,6 +129,14 @@ public class QuoteMaterialType extends BaseEntity
|
|||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public List<Integer> getGoodsintids() {
|
||||
return goodsintids;
|
||||
}
|
||||
|
||||
public void setGoodsintids(List<Integer> goodsintids) {
|
||||
this.goodsintids = goodsintids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@ export function getQuoteCraft(id) {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 查询项目报价--服务工艺详细
|
||||
export function selectQuoteTypeList(ids) {
|
||||
return request({
|
||||
url: '/system/QuoteCraft/selectQuoteTypeList',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 新增项目报价--服务工艺
|
||||
export function addQuoteCraft(data) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
<template>
|
||||
<div>
|
||||
|
||||
<SkuForm
|
||||
:source-attribute="sourceAttribute"
|
||||
:attribute.sync="attribute"
|
||||
:sku.sync="sku"
|
||||
:structure="structure"
|
||||
ref="skuForm"
|
||||
:theme="2"
|
||||
>
|
||||
<el-card class="sku-main-card" shadow="never">
|
||||
<SkuForm
|
||||
:source-attribute="sourceAttribute"
|
||||
:attribute.sync="attribute"
|
||||
:sku.sync="sku"
|
||||
:structure="structure"
|
||||
ref="skuForm"
|
||||
:theme="2"
|
||||
>
|
||||
<template #score="slotProps">
|
||||
<div>
|
||||
<el-rate v-model="slotProps.row.score" />
|
||||
|
|
@ -21,8 +22,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</SkuForm>
|
||||
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -155,7 +155,6 @@ export default {
|
|||
// 2. 组装 sku
|
||||
// 取所有规格名
|
||||
const specNames = Object.keys(attrs);
|
||||
console.log(specNames,this.sku)
|
||||
// 每个sku对象包含所有规格名及其值、图片、价格、库存等字段
|
||||
|
||||
const skuList = (this.sku || []).map(row => {
|
||||
|
|
@ -284,7 +283,7 @@ export default {
|
|||
</script>
|
||||
<style scoped lang="scss">
|
||||
.upimg {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
::v-deep .el-upload--picture-card {
|
||||
width: 60px !important;
|
||||
|
|
@ -300,4 +299,12 @@ export default {
|
|||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
.sku-main-card {
|
||||
margin: 24px 0 24px 0;
|
||||
background: #f8fafd;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #e6e8eb;
|
||||
box-shadow: 0 2px 8px 0 rgba(0,0,0,0.03);
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
:value="item.name"
|
||||
style="width: 200px"
|
||||
clearable
|
||||
@change="onAttributeNameChange(index, $event, item.name)"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
|
|
@ -81,6 +82,8 @@
|
|||
v-model="scope.row.name"
|
||||
style="width: 150px"
|
||||
clearable
|
||||
@focus="onAttributeNameFocus(scope)"
|
||||
@blur="onAttributeNameBlur(scope.$index, $event, scope)"
|
||||
>
|
||||
</el-input>
|
||||
</template>
|
||||
|
|
@ -104,7 +107,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="right">
|
||||
<el-table-column align="right" width="280px">
|
||||
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
|
|
@ -132,7 +135,16 @@
|
|||
<div class="sku-list">
|
||||
|
||||
<el-form ref="form" :model="form" status-icon inline-message>
|
||||
<el-table :data="form.skuData" stripe border highlight-current-row >
|
||||
<!-- 表格区域只固定高度,不做横向滚动和min-width限制 -->
|
||||
<el-table
|
||||
:data="form.skuData"
|
||||
stripe
|
||||
border
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
height="500px"
|
||||
:header-cell-style="{ background: '#f5f7fa', color: '#333', fontWeight: 'bold' }"
|
||||
>
|
||||
<!-- 考虑到异步加载的情况,如果 attribute 数据先加载完成,则表头会立马展示,效果不理想,故使用emitAttribute 数据,该数据为计算属性,通过 myAttribute 生成,结构与 attribute 一致 -->
|
||||
<el-table-column
|
||||
v-if="emitAttribute.length > 0"
|
||||
|
|
@ -191,7 +203,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="item.type == 'slot'"
|
||||
:key="`structure-input-${index}-${scope.row.sku}`"
|
||||
:key="`structure-slot-${index}-${scope.row.sku}`"
|
||||
:prop="'skuData.' + scope.$index + '.' + item.name"
|
||||
:rules="rules[item.name]"
|
||||
>
|
||||
|
|
@ -232,6 +244,16 @@
|
|||
</template>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<!-- 批量设置价格和库存 -->
|
||||
<el-card class="batch-set-card" shadow="never">
|
||||
<div class="batch-set-row">
|
||||
<el-input v-model="batchSetPrice" size="small" placeholder="批量设置价格" class="batch-input" />
|
||||
<el-button size="small" type="primary" class="batch-btn" @click="onBatchSet('price')">批量设置价格</el-button>
|
||||
<el-input v-model="batchSetStock" size="small" placeholder="批量设置库存" class="batch-input" />
|
||||
<el-button size="small" type="success" class="batch-btn" @click="onBatchSet('stock')">批量设置库存</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="sku-divider"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -320,6 +342,9 @@ export default {
|
|||
skuData: [],
|
||||
},
|
||||
batch: {},
|
||||
attributeNameMap: {},
|
||||
batchSetPrice: '',
|
||||
batchSetStock: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -389,6 +414,12 @@ export default {
|
|||
watch: {
|
||||
myAttribute: {
|
||||
handler() {
|
||||
// 保证每次 myAttribute 变化都同步 _oldName 字段
|
||||
this.myAttribute.forEach((attr, idx) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(attr, '_oldName')) {
|
||||
this.$set(this.myAttribute[idx], '_oldName', attr.name);
|
||||
}
|
||||
});
|
||||
if (!this.isInit) {
|
||||
// 更新父组件
|
||||
this.$emit("update:attribute", this.emitAttribute);
|
||||
|
|
@ -453,39 +484,89 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
!this.async && this.init();
|
||||
// 初始化 _oldName
|
||||
this.myAttribute.forEach((attr, idx) => {
|
||||
this.$set(this.myAttribute[idx], '_oldName', attr.name);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
delitem(row, index) {
|
||||
console.log(row, index);
|
||||
row.item.splice(index, 1);
|
||||
// row.item[index].checked=false;
|
||||
// 删除规格
|
||||
this.$confirm('确认删除该规格值吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
row.item.splice(index, 1);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
delsuk(index){
|
||||
this.myAttribute.splice(index,1)
|
||||
delsuk(index) {
|
||||
this.$confirm('确认删除该规格吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.myAttribute.splice(index, 1);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
addlist() {
|
||||
if (this.inputname) {
|
||||
const flag = this.myAttribute.find((item) => {
|
||||
return item.name == this.inputname;
|
||||
if (!this.inputname.trim()) {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: "请填写属性名称",
|
||||
});
|
||||
if (!flag) {
|
||||
this.myAttribute.push({ name: this.inputname, item: [] });
|
||||
this.inputname = "";
|
||||
} else {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: "请勿添加相同规格",
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else{
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: "请填属性名称",
|
||||
});
|
||||
}
|
||||
|
||||
if (this.inputname.includes(this.separator)) {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: `属性名称不允许包含「${this.separator}」字符`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const flag = this.myAttribute.find((item) => {
|
||||
return item.name === this.inputname;
|
||||
});
|
||||
|
||||
if (flag) {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: "请勿添加相同规格",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.myAttribute.push({
|
||||
name: this.inputname.trim(),
|
||||
item: [],
|
||||
canAddAttribute: true,
|
||||
addAttribute: "",
|
||||
_oldName: this.inputname.trim()
|
||||
});
|
||||
this.inputname = "";
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "添加成功",
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.$nextTick(() => {
|
||||
|
|
@ -583,13 +664,38 @@ export default {
|
|||
if (index !== this.attribute.length - 1) {
|
||||
this.combinationAttribute(index + 1, dataTemp);
|
||||
} else {
|
||||
if (!this.isInit || this.async) {
|
||||
// 将原有的 sku 数据和新的 sku 数据比较,相同的 sku 则把原有的 sku 数据覆盖到新的 sku 数据里
|
||||
for (let i = 0; i < this.form.skuData.length; i++) {
|
||||
for (let j = 0; j < dataTemp.length; j++) {
|
||||
if (this.form.skuData[i].sku === dataTemp[j].sku) {
|
||||
dataTemp[j] = this.form.skuData[i];
|
||||
// 1. 构建老skuData的map(用老的sku字符串做key)
|
||||
const oldSkuMap = {};
|
||||
this.form.skuData.forEach(row => {
|
||||
oldSkuMap[row.sku] = row;
|
||||
});
|
||||
// 2. 用新组合的sku去找老数据
|
||||
for (let j = 0; j < dataTemp.length; j++) {
|
||||
// 先尝试用新sku找
|
||||
if (oldSkuMap[dataTemp[j].sku]) {
|
||||
// 迁移所有结构字段
|
||||
this.structure.forEach((v) => {
|
||||
if (!(v.type == "slot" && v.skuProperty == false)) {
|
||||
dataTemp[j][v.name] = oldSkuMap[dataTemp[j].sku][v.name];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 尝试用"老属性名组合"找
|
||||
// 1. 拿到新组合的各个规格
|
||||
const skuArr = dataTemp[j].sku.split(this.separator);
|
||||
// 2. 拿到老的属性名顺序
|
||||
const oldAttrNames = Object.keys(this.form.skuData[0] || {}).filter(k => !this.structure.some(s => s.name === k) && k !== 'sku');
|
||||
// 3. 拼成老sku
|
||||
let oldSku = '';
|
||||
if (oldAttrNames.length === skuArr.length) {
|
||||
oldSku = skuArr.join(this.separator);
|
||||
}
|
||||
if (oldSku && oldSkuMap[oldSku]) {
|
||||
this.structure.forEach((v) => {
|
||||
if (!(v.type == "slot" && v.skuProperty == false)) {
|
||||
dataTemp[j][v.name] = oldSkuMap[oldSku][v.name];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -626,7 +732,18 @@ export default {
|
|||
}
|
||||
},
|
||||
onBatchSet(type) {
|
||||
if (this.batch[type] != "") {
|
||||
// 支持批量设置价格和库存
|
||||
if (type === 'price' && this.batchSetPrice !== '') {
|
||||
this.form.skuData.forEach((v) => {
|
||||
v.price = this.batchSetPrice;
|
||||
});
|
||||
this.batchSetPrice = '';
|
||||
} else if (type === 'stock' && this.batchSetStock !== '') {
|
||||
this.form.skuData.forEach((v) => {
|
||||
v.stock = this.batchSetStock;
|
||||
});
|
||||
this.batchSetStock = '';
|
||||
} else if (this.batch[type] != "") {
|
||||
this.form.skuData.forEach((v) => {
|
||||
v[type] = this.batch[type];
|
||||
});
|
||||
|
|
@ -638,15 +755,52 @@ export default {
|
|||
// 自定义输入框验证,通过调用 structure 里的 validate 方法实现,重点是 callback 要带过去
|
||||
customizeValidate(rule, value, callback) {
|
||||
let [model, index, name] = rule.field.split(".");
|
||||
const row = this.form[model][index];
|
||||
|
||||
// 检查是否为空
|
||||
if (value === '' || value === null || value === undefined) {
|
||||
callback(new Error(`${this.structure.find(s => s.name === name).label}不能为空`));
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查数字类型
|
||||
if (name === 'price' || name === 'stock') {
|
||||
if (isNaN(value) || value < 0) {
|
||||
callback(new Error(`${this.structure.find(s => s.name === name).label}必须是非负数`));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 调用自定义验证
|
||||
this.structure.forEach((v) => {
|
||||
if (v.name == name) {
|
||||
if (v.name === name && v.validate) {
|
||||
v.validate(this.form[model], index, callback);
|
||||
}
|
||||
});
|
||||
|
||||
callback();
|
||||
},
|
||||
// sku 表单验证
|
||||
validate(callback) {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (!valid) {
|
||||
// 查找未填写的字段,提示具体行和字段
|
||||
let errorMsg = '';
|
||||
const formItems = this.$refs.form.fields || [];
|
||||
formItems.forEach(item => {
|
||||
if (item.validateState === 'error') {
|
||||
// skuData.0.price 解析出行号和字段
|
||||
const match = item.prop && item.prop.match(/skuData\.(\d+)\.(\w+)/);
|
||||
if (match) {
|
||||
const rowIdx = Number(match[1]) + 1;
|
||||
const colName = this.structure.find(s => s.name === match[2]);
|
||||
errorMsg += `第${rowIdx}行【${colName ? colName.label : match[2]}】未填写,`;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!errorMsg) errorMsg = '请完整填写所有必填项!';
|
||||
this.$message.error(errorMsg.replace(/,$/, ''));
|
||||
}
|
||||
callback(valid);
|
||||
});
|
||||
},
|
||||
|
|
@ -674,7 +828,45 @@ export default {
|
|||
},
|
||||
getArray(){
|
||||
return this.myAttribute
|
||||
}
|
||||
},
|
||||
onAttributeNameChange(index, newName, oldName) {
|
||||
if (!newName || newName === oldName) return;
|
||||
// 1. 检查新名字是否重复
|
||||
if (this.myAttribute.some((attr, idx) => idx !== index && attr.name === newName)) {
|
||||
this.$message.warning('属性名不能重复');
|
||||
this.myAttribute[index].name = oldName;
|
||||
return;
|
||||
}
|
||||
// 2. 替换 skuData 里的 key
|
||||
this.form.skuData.forEach(row => {
|
||||
if (row[oldName] !== undefined) {
|
||||
row[newName] = row[oldName];
|
||||
delete row[oldName];
|
||||
}
|
||||
});
|
||||
// 3. 触发更新
|
||||
this.$forceUpdate();
|
||||
},
|
||||
onAttributeNameFocus(scope) {
|
||||
// 记录旧名
|
||||
scope.row._oldName = scope.row.name;
|
||||
},
|
||||
onAttributeNameBlur(index, event, scope) {
|
||||
const newName = event.target.value.trim();
|
||||
const oldName = scope.row._oldName || '';
|
||||
if (!newName || newName === oldName) return;
|
||||
// 检查新名字是否重复
|
||||
if (this.myAttribute.some((attr, idx) => idx !== index && attr.name === newName)) {
|
||||
this.$message.warning('属性名不能重复');
|
||||
this.myAttribute[index].name = oldName;
|
||||
return;
|
||||
}
|
||||
// 记录映射
|
||||
this.attributeNameMap[oldName] = newName;
|
||||
this.myAttribute[index].name = newName;
|
||||
this.$set(this.myAttribute[index], '_oldName', newName);
|
||||
this.$forceUpdate();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -712,11 +904,42 @@ export default {
|
|||
border: 1px solid #ebeef5;
|
||||
border-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background: #fafbfc;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
.sku-name {
|
||||
text-align: right;
|
||||
}
|
||||
.batch-set-card {
|
||||
margin: 24px 0 8px 0;
|
||||
background: #f8fafd;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e6e8eb;
|
||||
box-shadow: 0 2px 8px 0 rgba(0,0,0,0.03);
|
||||
.batch-set-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
padding: 12px 0 4px 0;
|
||||
}
|
||||
.batch-input {
|
||||
width: 160px;
|
||||
margin-right: 0;
|
||||
}
|
||||
.batch-btn {
|
||||
min-width: 110px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
.sku-divider {
|
||||
height: 1px;
|
||||
background: #eaeaea;
|
||||
margin: 18px 0 8px 0;
|
||||
border-radius: 1px;
|
||||
}
|
||||
.batch-set {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
|
|
@ -725,6 +948,14 @@ export default {
|
|||
line-height: initial;
|
||||
::v-deep .el-input__inner {
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
transition: border-color 0.2s;
|
||||
&:focus {
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 0 0 2px rgba(64,158,255,0.08);
|
||||
}
|
||||
}
|
||||
::v-deep .el-table__append-wrapper {
|
||||
overflow: initial;
|
||||
|
|
@ -748,6 +979,39 @@ export default {
|
|||
content: "*";
|
||||
color: #f56c6c;
|
||||
}
|
||||
::v-deep .el-table__body .el-table__row td:nth-child(5) {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
::v-deep .el-upload {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.sku-check {
|
||||
padding: 10px 10px 0 10px;
|
||||
.el-button.el-button--mini{
|
||||
padding: 7px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.el-table,
|
||||
.el-card {
|
||||
font-size: 13px;
|
||||
}
|
||||
.el-input,
|
||||
|
||||
.el-card {
|
||||
margin-bottom: 8px;
|
||||
border-radius: 6px;
|
||||
.el-card__header, .el-card__body {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
}
|
||||
.el-table__row {
|
||||
height: 32px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务项目" prop="goodId">
|
||||
<el-select v-model="queryParams.goodId" filterable placeholder="请选择服务项目" clearable>
|
||||
<el-select v-model="queryParams.goodsintids" filterable placeholder="请选择服务项目" clearable>
|
||||
<el-option
|
||||
v-for="type in typeDataList"
|
||||
:key="type.id"
|
||||
|
|
@ -123,50 +123,49 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改项目报价--服务工艺对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="服务" prop="goodId">
|
||||
<el-input v-model="form.goodId" type="textarea" placeholder="请输入内容" />
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="服务" prop="goodsintids">
|
||||
<el-select v-model="form.goodsintids" multiple filterable placeholder="请选择服务" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(type, index) in typeDataList"
|
||||
:key="type.id"
|
||||
:label="type.title"
|
||||
:value="type.id"
|
||||
@click.native="handelSelectMultiple(type, index)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="typeId">
|
||||
<el-input v-model="form.typeId" placeholder="请输入类型" />
|
||||
<el-form-item label="类型" prop="intstrtypeList">
|
||||
<el-select v-model="form.intstrtypeList" multiple filterable placeholder="请选择类型" style="width: 100%">
|
||||
<el-option
|
||||
v-for="type in typeSelectDataList"
|
||||
:key="type.id"
|
||||
:label="type.title"
|
||||
:value="type.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入价格" />
|
||||
<el-input-number v-model="form.price" :min="0" :step="0.01" :precision="2" placeholder="请输入价格" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="createdAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="updatedAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</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 class="dialog-footer" style="text-align:left;margin-top:20px;">
|
||||
<el-button @click="reset">重置</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listQuoteCraft, getQuoteCraft, delQuoteCraft, addQuoteCraft, updateQuoteCraft } from "@/api/system/QuoteCraft"
|
||||
import { listQuoteCraft, getQuoteCraft, delQuoteCraft, addQuoteCraft, updateQuoteCraft ,selectQuoteTypeList} from "@/api/system/QuoteCraft"
|
||||
import { getGoodsDataList } from "@/api/system/QuoteType"
|
||||
|
||||
export default {
|
||||
|
|
@ -187,6 +186,8 @@ export default {
|
|||
total: 0,
|
||||
|
||||
typeDataList: [],
|
||||
|
||||
typeSelectDataList: [],
|
||||
// 项目报价--服务工艺表格数据
|
||||
QuoteCraftList: [],
|
||||
// 弹出层标题
|
||||
|
|
@ -198,6 +199,8 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodId: null,
|
||||
goodsintids: null,
|
||||
intstrtypeList: null,
|
||||
typeId: null,
|
||||
title: null,
|
||||
price: null,
|
||||
|
|
@ -209,10 +212,11 @@ export default {
|
|||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodId: [
|
||||
goodsintids: [
|
||||
{ required: true, message: "服务不能为空", trigger: "blur" }
|
||||
],
|
||||
typeId: [
|
||||
|
||||
intstrtypeList: [
|
||||
{ required: true, message: "类型不能为空", trigger: "blur" }
|
||||
],
|
||||
title: [
|
||||
|
|
@ -230,6 +234,7 @@ export default {
|
|||
created() {
|
||||
this.getList();
|
||||
this.getTypeList();
|
||||
this.getTypeList1();
|
||||
},
|
||||
methods: {
|
||||
/** 查询项目报价--服务工艺列表 */
|
||||
|
|
@ -260,6 +265,13 @@ export default {
|
|||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
//监听多选下拉选择器
|
||||
handelSelectMultiple(position, index) {
|
||||
var ids = this.form.goodsintids;
|
||||
selectQuoteTypeList(ids).then(response => {
|
||||
this.typeSelectDataList = response.data;
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
|
|
@ -287,6 +299,12 @@ export default {
|
|||
this.typeDataList = response.data;
|
||||
})
|
||||
},
|
||||
|
||||
getTypeList1() {
|
||||
selectQuoteTypeList("11").then(response => {
|
||||
this.typeSelectDataList = response.data;
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
|
|
|
|||
|
|
@ -152,43 +152,34 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改项目报价--物料信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="服务项目" prop="goodId">
|
||||
<el-input v-model="form.goodId" type="textarea" placeholder="请输入内容" />
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="服务项目" prop="goodsintids">
|
||||
<el-select v-model="form.goodsintids" multiple filterable placeholder="请选择服务项目" style="width: 100%">
|
||||
<el-option
|
||||
v-for="type in typeDataList"
|
||||
:key="type.id"
|
||||
:label="type.title"
|
||||
:value="type.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="typeId">
|
||||
<el-input v-model="form.typeId" type="textarea" placeholder="请输入内容" />
|
||||
<el-input v-model="form.typeId" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入价格" />
|
||||
<el-input-number v-model="form.price" :min="0" :step="0.01" :precision="2" placeholder="请输入价格" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="createdAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="updatedAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</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 class="dialog-footer" style="text-align:left;margin-top:20px;">
|
||||
<el-button @click="reset">重置</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
|
@ -231,6 +222,7 @@ export default {
|
|||
priceMin: null,
|
||||
priceMax: null,
|
||||
unit: null,
|
||||
goodsintids: null,
|
||||
createdAt: null,
|
||||
updatedAt: null
|
||||
},
|
||||
|
|
@ -238,7 +230,7 @@ export default {
|
|||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodId: [
|
||||
goodsintids: [
|
||||
{ required: true, message: "服务项目不能为空", trigger: "blur" }
|
||||
],
|
||||
typeId: [
|
||||
|
|
|
|||
|
|
@ -140,37 +140,31 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改项目报价--物料分类对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="服务项目" prop="goodsintids">
|
||||
<el-select v-model="form.goodsintids" multiple filterable placeholder="请选择服务项目" style="width: 100%">
|
||||
<el-option
|
||||
v-for="type in typeDataList"
|
||||
:key="type.id"
|
||||
:label="type.title"
|
||||
:value="type.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="服务项目" prop="goodId">
|
||||
<el-input v-model="form.goodId" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入排序" />
|
||||
<el-input-number v-model="form.sort" :min="1" style="width: 120px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="createdAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="${comment}" prop="updatedAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-switch v-model="form.status" :active-value="1" :inactive-value="0" />
|
||||
</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 class="dialog-footer" style="text-align:left;margin-top:20px;">
|
||||
<el-button @click="reset">重置</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
|
@ -214,6 +208,7 @@ export default {
|
|||
goodId: null,
|
||||
sort: null,
|
||||
status: null,
|
||||
goodsintids: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
priceMin: null,
|
||||
|
|
@ -226,7 +221,7 @@ export default {
|
|||
title: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
goodId: [
|
||||
goodsintids: [
|
||||
{ required: true, message: "服务项目不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
|
|
@ -274,9 +269,9 @@ export default {
|
|||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
// 保证 goodId 是字符串数组
|
||||
if (Array.isArray(this.queryParams.goodId)) {
|
||||
this.queryParams.goodId = this.queryParams.goodId.map(String)
|
||||
}
|
||||
// if (Array.isArray(this.queryParams.goodId)) {
|
||||
// this.queryParams.goodId = this.queryParams.goodId.map(String)
|
||||
// }
|
||||
// 校验价格区间
|
||||
if (
|
||||
(this.queryParams.priceMin !== null && this.queryParams.priceMin !== '' && this.queryParams.priceMax !== null && this.queryParams.priceMax !== '')
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="服务项目" prop="goodId">
|
||||
<el-select v-model="queryParams.goodsids" filterable placeholder="请选择服务项目" clearable>
|
||||
<el-select v-model="queryParams.goodsintids" filterable placeholder="请选择服务项目" clearable>
|
||||
<el-option
|
||||
v-for="type in typeDataList"
|
||||
:key="type.id"
|
||||
|
|
@ -140,8 +140,8 @@
|
|||
<!-- 添加或修改项目报价--工艺分类对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="服务项目" prop="goodId">
|
||||
<el-select v-model="form.goodId" placeholder="请选择服务项目" style="width: 100%" multiple filterable>
|
||||
<el-form-item label="服务项目" prop="goodsintids">
|
||||
<el-select v-model="form.goodsintids" placeholder="请选择服务项目" style="width: 100%" multiple filterable>
|
||||
<el-option
|
||||
v-for="type in typeDataList"
|
||||
:key="type.id"
|
||||
|
|
@ -211,7 +211,7 @@ export default {
|
|||
title: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
goodId: [
|
||||
goodsintids: [
|
||||
{ required: true, message: "服务项目不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
|
|
@ -260,9 +260,9 @@ export default {
|
|||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
// 保证 goodId 是字符串数组
|
||||
if (Array.isArray(this.queryParams.goodId)) {
|
||||
this.queryParams.goodId = this.queryParams.goodId.map(String)
|
||||
}
|
||||
// if (Array.isArray(this.queryParams.goodId)) {
|
||||
// this.queryParams.goodId = this.queryParams.goodId.map(String)
|
||||
// }
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
|
|
@ -300,12 +300,12 @@ export default {
|
|||
const id = row.id || this.ids
|
||||
getQuoteType(id).then(response => {
|
||||
const data = response.data
|
||||
// 处理 goodId 为多选数组
|
||||
if (typeof data.goodId === 'string') {
|
||||
data.goodId = data.goodId.split(',').map(i => i.trim()).filter(i => i)
|
||||
} else if (!Array.isArray(data.goodId)) {
|
||||
data.goodId = []
|
||||
}
|
||||
// // 处理 goodId 为多选数组
|
||||
// if (typeof data.goodId === 'string') {
|
||||
// data.goodId = data.goodId.split(',').map(i => i.trim()).filter(i => i)
|
||||
// } else if (!Array.isArray(data.goodId)) {
|
||||
// data.goodId = []
|
||||
// }
|
||||
this.form = data
|
||||
this.open = true
|
||||
this.title = "修改项目报价--工艺分类"
|
||||
|
|
|
|||
Loading…
Reference in New Issue