优化 变量输入,下单默认品牌
This commit is contained in:
parent
36b3161116
commit
1d495c6e35
|
|
@ -3,6 +3,7 @@ package cn.hangtag.module.oms.controller.admin.app;
|
|||
import cn.hangtag.framework.common.enums.CommonStatusEnum;
|
||||
import cn.hangtag.framework.common.pojo.CommonResult;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.util.FuncUtil;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
import cn.hangtag.framework.security.core.LoginUser;
|
||||
import cn.hangtag.framework.security.core.util.SecurityFrameworkUtils;
|
||||
|
|
@ -14,6 +15,7 @@ import cn.hangtag.module.oms.dal.dataobject.customerbrand.CustomerBrandDO;
|
|||
import cn.hangtag.module.oms.service.brand.BrandService;
|
||||
import cn.hangtag.module.oms.service.customer.CustomerService;
|
||||
import cn.hangtag.module.oms.service.customerbrand.CustomerBrandService;
|
||||
import cn.hangtag.module.oms.service.saleorder.SaleOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -42,6 +44,9 @@ public class AppBrandController {
|
|||
@Resource
|
||||
private CustomerBrandService customerBrandService;
|
||||
|
||||
@Resource
|
||||
private SaleOrderService saleOrderService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -60,8 +65,21 @@ public class AppBrandController {
|
|||
for (CustomerBrandDO customerBrandDO : listByCustomerId) {
|
||||
brandIds.add(customerBrandDO.getBrandId());
|
||||
}
|
||||
List<BrandDO> list = brandService.getBrandList(
|
||||
new BrandListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()).setIds(brandIds));
|
||||
List<BrandDO> list = brandService.getBrandList( new BrandListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()).setIds(brandIds));
|
||||
|
||||
Long id = saleOrderService.queryLastOrderBrand(customerId);
|
||||
// 获取最近下单的品牌
|
||||
if(FuncUtil.isNotEmpty(id)){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getId().equals(id)){
|
||||
BrandDO brandDO = list.get(i);
|
||||
list.remove(i);
|
||||
// 设置首位
|
||||
list.add(0,brandDO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return success(BeanUtils.toBean(list, BrandSimpleRespVO.class));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class SaleOrderDO extends BaseDO {
|
|||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
private Integer brandId;
|
||||
private Long brandId;
|
||||
/**
|
||||
* 是否分批交货 分批交货以明细表中的交货日期为准
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -136,4 +136,12 @@ public interface SaleOrderService {
|
|||
* @return {@link CreateSaleOrderDTO }
|
||||
*/
|
||||
CreateSaleOrderDTO queryEditOrder(Long id);
|
||||
|
||||
/**
|
||||
* 查询上次订单品牌
|
||||
*
|
||||
* @param customerId 客户id
|
||||
* @return {@link Long }
|
||||
*/
|
||||
Long queryLastOrderBrand(Long customerId);
|
||||
}
|
||||
|
|
@ -1080,6 +1080,20 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long queryLastOrderBrand(Long customerId) {
|
||||
|
||||
LambdaQueryWrapper<SaleOrderDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SaleOrderDO::getCustomerId, customerId);
|
||||
queryWrapper.orderByDesc(SaleOrderDO::getCreateTime);
|
||||
queryWrapper.last("limit 1");
|
||||
SaleOrderDO orderDO = saleOrderMapper.selectOne(queryWrapper);
|
||||
if(FuncUtil.isNotEmpty(orderDO)){
|
||||
return orderDO.getBrandId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载ZIP压缩包(会对下载后的压缩包进行删除)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
style="box-shadow: 0px 2px 5px 2px #dcdcdc;"
|
||||
v-if="that.propInfo[tmp.key].multiLanguage
|
||||
&& that.propInfo[tmp.key].shape === ShapeType.vueTextCell">
|
||||
|
||||
<template v-for="(dl,i) in that.propInfo[tmp.key].dataInfo" :key="i">
|
||||
<div style="padding: 4px" v-if="dl.locale === that.propInfo[tmp.key].dataInfo[0].locale" >
|
||||
<div style="display: flex;align-items: center;">
|
||||
|
|
@ -96,7 +95,18 @@
|
|||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
</div>
|
||||
<el-autocomplete
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
v-model="that.propInfo[tmp.key].dataInfo[i].showLabel"
|
||||
:fetch-suggestions="querySearch"
|
||||
clearable
|
||||
class="inline-input w-50"
|
||||
placeholder="Please Input"
|
||||
@change="changeInput(i,tmp.key)"
|
||||
@select="changeData(i,tmp.key)"
|
||||
/>
|
||||
<el-select-v2
|
||||
v-else
|
||||
v-model="that.propInfo[tmp.key].dataInfo[i].showLabel"
|
||||
filterable
|
||||
:options="getIngredientInfoListByType(that.propInfo[tmp.key].groupType)"
|
||||
|
|
@ -126,10 +136,8 @@
|
|||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<el-button
|
||||
|
|
@ -145,13 +153,15 @@
|
|||
:key="index"
|
||||
style="padding: 4px">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span>
|
||||
<i
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
class="icon-lk_edit"
|
||||
style="font-size: 20px"> </i>
|
||||
<i v-else class="icon-lk_cell_add" style="font-size: 20px"> </i>
|
||||
</span>
|
||||
<span>
|
||||
|
||||
<i
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
class="icon-lk_edit"
|
||||
style="font-size: 20px"> </i>
|
||||
<i v-else class="icon-lk_cell_add" style="font-size: 20px"> </i>
|
||||
</span>
|
||||
|
||||
<el-autocomplete
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
v-model="that.propInfo[tmp.key].dataInfo[index].showLabel"
|
||||
|
|
@ -159,8 +169,8 @@
|
|||
clearable
|
||||
class="inline-input w-50"
|
||||
placeholder="Please Input"
|
||||
@change="changeData"
|
||||
@select="changeData"
|
||||
@change="changeInput(index,tmp.key)"
|
||||
@select="changeData(index,tmp.key)"
|
||||
/>
|
||||
<el-select-v2
|
||||
v-else
|
||||
|
|
@ -194,6 +204,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="deleteList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
|
|
@ -208,19 +220,30 @@
|
|||
</el-button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="that.propInfo[tmp.key].shape === ShapeType.vueShapeImage">
|
||||
<div style="box-shadow: 0px 2px 5px 2px #dcdcdc;" v-else-if="that.propInfo[tmp.key].shape === ShapeType.vueShapeImage">
|
||||
<!-- 功能待完善-->
|
||||
<div
|
||||
v-for="(img,index) in that.propInfo[tmp.key].dataInfo"
|
||||
:key="index" style="display: flex">
|
||||
|
||||
<div class="img-box" v-if="img.url">
|
||||
<div style="display: flex">
|
||||
<img :src="img.url" width="60px" height="60px"/>
|
||||
<div>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
v-if="false && that.propInfo[tmp.key].canChange && img.url "
|
||||
@click="deleteImgList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select-v2
|
||||
v-model="that.propInfo[tmp.key].dataInfo[0].showLabel"
|
||||
filterable
|
||||
:options="washingInfoListByType(that.propInfo[tmp.key].groupType)"
|
||||
placeholder="Please select"
|
||||
@change="changeComboData(that.propInfo[tmp.key],that.propInfo[tmp.key].dataInfo[0].showLabel)"
|
||||
@change="changeComboData(that.propInfo[tmp.key],that.propInfo[tmp.key].dataInfo[index].showLabel)"
|
||||
size="large"
|
||||
style="min-width: 280px;width: 100%"
|
||||
>
|
||||
|
|
@ -233,19 +256,16 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-select-v2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="img.label">
|
||||
<el-input v-model="img.label" disabled/>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="deleteList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
v-if="that.propInfo[tmp.key].canChange && false"
|
||||
@click="appendImageList(tmp.key)">
|
||||
添加
|
||||
</el-button>
|
||||
|
|
@ -410,6 +430,15 @@ const initSucceed = () => {
|
|||
showPng();
|
||||
emit('initSucceed')
|
||||
}
|
||||
const changeInput =(index: number, key: string)=>{
|
||||
|
||||
if(!that.propInfo[key].dataInfo[index].showLabel){
|
||||
useMessage().notifyWarning('请输入'+getLabelName(that.propInfo[key]));
|
||||
return;
|
||||
}
|
||||
that.propInfo[key].dataInfo[index].label = that.propInfo[key].dataInfo[index].showLabel
|
||||
resetData();
|
||||
}
|
||||
const changeData = (index: number, key: string) => {
|
||||
|
||||
const info = that.propInfo[key];
|
||||
|
|
@ -451,30 +480,44 @@ const changeData = (index: number, key: string) => {
|
|||
}
|
||||
|
||||
}
|
||||
const changeComboData = (item: any, label: string) => {
|
||||
let info = [];
|
||||
let startIndex = 0;
|
||||
for (let i = 0; i < that.washingInfoList.length; i++) {
|
||||
// @ts-ignore
|
||||
if (that.washingInfoList[i].value === label) {
|
||||
// @ts-ignore
|
||||
item.dataInfo[0].url = that.washingInfoList[i].url
|
||||
info = that.washingInfoList[i].langMapping
|
||||
startIndex++;
|
||||
break;
|
||||
}
|
||||
const changeComboData = (index: number, key: string) => {
|
||||
const info = that.propInfo[key];
|
||||
const infoList = getIngredientInfoListByType(info.groupType)
|
||||
let mapping = {}
|
||||
for (let i = 0; i < infoList.length; i++) {
|
||||
mapping[infoList[i].label] = infoList[i].langMapping;
|
||||
}
|
||||
console.log("info", info)
|
||||
console.log("111",infoList,mapping)
|
||||
// 多语言变量替换
|
||||
const allData = [...that.propInfo[key].dataInfo]
|
||||
const fLang = allData[1].locale;
|
||||
let m1 = mapping[allData[1].showLabel]
|
||||
if(m1){
|
||||
let ratio = allData[1].ratio
|
||||
for (let i = 0; i < allData.length; i++) {
|
||||
|
||||
for (let i = startIndex; i < item.dataInfo.length; i++) {
|
||||
for (let j = 0; j < info.length; j++) {
|
||||
if (info[j].locale === item.dataInfo[i].locale) {
|
||||
item.dataInfo[i].label = info[j].value
|
||||
break;
|
||||
if(i>0 && allData[i].locale === fLang){
|
||||
ratio = allData[i].ratio
|
||||
m1 = mapping[allData[i].showLabel]
|
||||
}
|
||||
for (let j = 0; j < m1.length; j++) {
|
||||
if( allData[i].locale === m1[j].locale){
|
||||
console.log("m1",m1[j],ratio)
|
||||
let str = ratio;
|
||||
if (str === null || str === undefined || str === -1) {
|
||||
str = ''
|
||||
}
|
||||
allData[i].label= `${m1[j].value}`.replaceAll('${r}', `${str}`)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
that.propInfo[key].dataInfo = [...allData];
|
||||
|
||||
console.log("allData",allData)
|
||||
resetData();
|
||||
}
|
||||
resetData();
|
||||
}
|
||||
|
||||
const washingInfoListByType = (type) => {
|
||||
|
|
@ -512,7 +555,36 @@ const uploadFile = async (fileName) => {
|
|||
});
|
||||
});
|
||||
}
|
||||
const deleteImgList = (key, index) => {
|
||||
// const item = JSON.parse(JSON.stringify(that.propInfo[key]))
|
||||
// const group = findGroup(key,that.propInfo)
|
||||
// const keys = Object.keys(group);
|
||||
//
|
||||
// if(keys.length > 1){
|
||||
// console.log(index)
|
||||
// // 删除同一组数据
|
||||
// const firstLang = item.dataInfo[1].locale
|
||||
// const indexs = [];
|
||||
// for (let i = index; i < item.dataInfo.length; i++) {
|
||||
// if(i > index && firstLang === item.dataInfo[i].locale){
|
||||
// break;
|
||||
// }
|
||||
// indexs.push(i);
|
||||
// }
|
||||
// const newArr = [];
|
||||
// for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
|
||||
// if(!indexs.includes(i)){
|
||||
// newArr.push(that.propInfo[key].dataInfo[i])
|
||||
// }
|
||||
// }
|
||||
// that.propInfo[key].dataInfo = [...newArr]
|
||||
// resetData();
|
||||
// }else {
|
||||
// useMessage().notifyWarning("至少需要一个变量")
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
const deleteList = (key, index) => {
|
||||
const item = JSON.parse(JSON.stringify(that.propInfo[key]))
|
||||
const group = findGroup(key,that.propInfo)
|
||||
|
|
@ -544,33 +616,34 @@ const deleteList = (key, index) => {
|
|||
|
||||
}
|
||||
const appendImageList = (key) => {
|
||||
const item = that.propInfo[key]
|
||||
console.log("item.dataInfo",item)
|
||||
const group = findGroup(key,that.propInfo)
|
||||
const keys = Object.keys(group);
|
||||
console.log("keys",keys)
|
||||
// 有多少组变量
|
||||
if(keys.length >= item.maxSize ){
|
||||
useMessage().notifyWarning("最大数量为:"+item.maxSize)
|
||||
return;
|
||||
}
|
||||
const locale = item.dataInfo[0].locale
|
||||
const tmpArr = [...item.dataInfo]
|
||||
|
||||
for (let i = 0; i < tmpArr.length; i++) {
|
||||
if(i > 0 && tmpArr[i].locale === locale){
|
||||
break;
|
||||
}
|
||||
item.dataInfo.push(
|
||||
{
|
||||
label: '',
|
||||
url: '',
|
||||
ratio: 0,
|
||||
...tmpArr[i]
|
||||
}
|
||||
)
|
||||
}
|
||||
resetData();
|
||||
// todo 待完成
|
||||
// const item = that.propInfo[key]
|
||||
// console.log("item.dataInfo",item)
|
||||
// const group = findGroup(key,that.propInfo)
|
||||
// const keys = Object.keys(group);
|
||||
// console.log("keys",keys)
|
||||
// // 有多少组变量
|
||||
// if(keys.length >= item.maxSize ){
|
||||
// useMessage().notifyWarning("最大数量为:"+item.maxSize)
|
||||
// return;
|
||||
// }
|
||||
// const locale = item.dataInfo[1].locale
|
||||
// const tmpArr = [...item.dataInfo]
|
||||
//
|
||||
// for (let i = 1; i < tmpArr.length; i++) {
|
||||
// if(i > 1 && tmpArr[i].locale === locale){
|
||||
// break;
|
||||
// }
|
||||
// item.dataInfo.push(
|
||||
// {
|
||||
// label: '',
|
||||
// url: '',
|
||||
// ratio: 0,
|
||||
// ...tmpArr[i]
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// resetData();
|
||||
}
|
||||
|
||||
const appendList = (key) => {
|
||||
|
|
@ -791,6 +864,8 @@ const checkPropInfo = (info)=>{
|
|||
let labelInfo = []
|
||||
let rInfo = 0;
|
||||
const firstLang = newInfo[key].dataInfo[0].locale;
|
||||
const linkChar = newInfo[key].linkChar || ',';
|
||||
|
||||
for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) {
|
||||
|
||||
if(firstLang === newInfo[key].dataInfo[i1].locale){
|
||||
|
|
@ -824,13 +899,12 @@ const checkPropInfo = (info)=>{
|
|||
}
|
||||
}
|
||||
if(row){
|
||||
row.label = str.join(",");
|
||||
row.label = str.join(linkChar);
|
||||
newArr.push(row);
|
||||
}
|
||||
}
|
||||
newInfo[key].dataInfo = newArr;
|
||||
console.log("that.propInfo",newArr)
|
||||
console.log("that. newInfo[key]", newInfo[key])
|
||||
|
||||
}
|
||||
resolve(newInfo)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@
|
|||
</el-form-item>
|
||||
<!-- 停用 -->
|
||||
<el-form-item label="控制" >
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div style="width: 800px">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canChange">
|
||||
|
|
@ -51,16 +52,30 @@
|
|||
</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="false">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canInput"
|
||||
:disabled="that.configInfo.isCombo">
|
||||
|
||||
<el-col :span="6">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox :disabled="that.configInfo.shape"
|
||||
v-model="that.configInfo.canInput">
|
||||
<span>允许输入值</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-tooltip
|
||||
content="输入多个变量时的连接字符,使用<br/> 变量进行换行"
|
||||
>
|
||||
<div style="display:flex;">
|
||||
<div>变量链接符</div>
|
||||
<div>
|
||||
<el-input v-model="that.configInfo.linkChar" clearable maxlength="6" placeholder="请输入连接符" show-word-limit />
|
||||
</div>
|
||||
<el-button @click="that.configInfo.linkChar = '<br/>'">换行</el-button>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-row>
|
||||
|
|
@ -98,7 +113,7 @@
|
|||
<template #default="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
<span v-if="that.configInfo.isCombo" style="padding-right: 4px">
|
||||
{{scope.$index !== 0 ? '-text' : '-icon' }}
|
||||
{{scope.$index !== 0 ? '' : '-icon' }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -183,6 +198,7 @@ const that = reactive({
|
|||
maxSize: 100,
|
||||
canChange: false,
|
||||
canInput: false,
|
||||
linkChar: ',',
|
||||
cellIds: [], // 节点id
|
||||
groupId: `g_${Math.random().toString(36).substring(2)}`,
|
||||
data: {}, //节点是数据
|
||||
|
|
@ -249,6 +265,7 @@ const init = (allGroupList, data) => {
|
|||
maxSize: 100, // 节点组最大数量
|
||||
canChange: false, // 是否允许调整数量
|
||||
canInput: false,// 是否允许输入值
|
||||
linkChar: ',',// 连接字符
|
||||
cellIds: [], // 节点id
|
||||
data: {}, //节点是数据
|
||||
shape: '', // 节点类型
|
||||
|
|
|
|||
|
|
@ -1158,6 +1158,7 @@ const getJson = () => {
|
|||
let combo = prop.isCombo === undefined ? false : prop.isCombo;
|
||||
let canChange = prop.canChange === undefined ? false : prop.canChange;
|
||||
let canInput = prop.canInput === undefined ? false : prop.canInput;
|
||||
let linkChar = prop.linkChar === undefined ? ',' : prop.linkChar;
|
||||
|
||||
if (combo) {
|
||||
min = Math.min(dataInfoList.length,min);
|
||||
|
|
@ -1176,6 +1177,7 @@ const getJson = () => {
|
|||
maxSize: max,
|
||||
canChange: canChange,
|
||||
canInput: canInput,
|
||||
linkChar: linkChar,
|
||||
shape: prop.shape,
|
||||
dataInfo: dataInfoList
|
||||
}
|
||||
|
|
@ -1451,10 +1453,12 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
|
|||
|
||||
let canChange = false;
|
||||
let canInput = false;
|
||||
let linkChar = ',';
|
||||
for (let i = 0; i < that.pageConfig.propList.length; i++) {
|
||||
if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) {
|
||||
canChange = that.pageConfig.propList[i].canChange === true
|
||||
canInput = that.pageConfig.propList[i].canInput === true
|
||||
linkChar = that.pageConfig.propList[i].linkChar || ','
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1469,6 +1473,7 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
|
|||
maxSize: max,
|
||||
canChange: canChange,
|
||||
canInput: canInput,
|
||||
linkChar: linkChar,
|
||||
data: info.data, //节点是数据
|
||||
shape: info.shape,
|
||||
pointList: [...tmpPoint], //{ x:10,y:100}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
<el-checkbox class="m-4" v-model="formData.isCombo">多语言拼接</el-checkbox>
|
||||
</el-tooltip>
|
||||
<el-alert
|
||||
title="多语言内容可使用${r}作为占位符如:白鹅绒${r}%以上, 客户填写 60时, 结果为: 白鹅绒60%以上"
|
||||
title="多语言内容可使用${r}作为占位符如:白鹅绒${r}%以上, 填写 60时, 结果为: 白鹅绒60%以上,点击输入框按下Alt+T快速填入"
|
||||
type="info" effect="dark"/>
|
||||
<el-table
|
||||
:data="that.langList"
|
||||
|
|
@ -116,7 +116,9 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.value" placeholder="请输入多语言内容"/>
|
||||
<div>
|
||||
<el-input :id="`rowInput_${scope.$index}`" @focus="inputFocus(scope.$index)" v-model="scope.row.value" placeholder="请输入内容"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="linkChar" label="连接符" width="120">
|
||||
|
|
@ -191,6 +193,7 @@ const formRules = reactive({
|
|||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const that = reactive({
|
||||
inputIndex: -1,
|
||||
langList: [{
|
||||
locale: 'zh-CN', // 语言标识
|
||||
value: '', // 翻译内容
|
||||
|
|
@ -290,6 +293,52 @@ const submitForm = () => {
|
|||
|
||||
}
|
||||
|
||||
const inputFocus = (index)=>{
|
||||
that.inputIndex = index
|
||||
}
|
||||
// 处理按下 Alt + R 快捷键的函数
|
||||
const handleKeydown = (event) => {
|
||||
// 判断是否按下了 Alt + R
|
||||
if (event.altKey && event.key === 'r') {
|
||||
onAltRPressed();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理 Alt + R 被按下时的逻辑
|
||||
const onAltRPressed = () => {
|
||||
console.log('Alt + R 被按下了');
|
||||
if(that.inputIndex >= 0){
|
||||
const byId = document.getElementById("rowInput_"+that.inputIndex);
|
||||
let pos = 0;
|
||||
if(byId){
|
||||
pos = byId.selectionStart;
|
||||
}
|
||||
let str = that.langList[that.inputIndex].value;
|
||||
if(str && str.length > 0 && pos > 0){
|
||||
if(pos >= str.length){
|
||||
that.langList[that.inputIndex].value = that.langList[that.inputIndex].value+"${r}";
|
||||
}else {
|
||||
that.langList[that.inputIndex].value = str.substring(0,pos)+"${r}"+str.substring(pos);
|
||||
}
|
||||
|
||||
}else {
|
||||
that.langList[that.inputIndex].value = "${r}"+that.langList[that.inputIndex].value;
|
||||
}
|
||||
}
|
||||
|
||||
// 在这里可以执行任何自定义的操作
|
||||
};
|
||||
|
||||
// 在组件挂载时添加键盘事件监听
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
// 在组件卸载时移除键盘事件监听
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
style="box-shadow: 0px 2px 5px 2px #dcdcdc;"
|
||||
v-if="that.propInfo[tmp.key].multiLanguage
|
||||
&& that.propInfo[tmp.key].shape === ShapeType.vueTextCell">
|
||||
|
||||
<template v-for="(dl,i) in that.propInfo[tmp.key].dataInfo" :key="i">
|
||||
<div style="padding: 4px" v-if="dl.locale === that.propInfo[tmp.key].dataInfo[0].locale" >
|
||||
<div style="display: flex;align-items: center;">
|
||||
|
|
@ -96,7 +95,18 @@
|
|||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
</div>
|
||||
<el-autocomplete
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
v-model="that.propInfo[tmp.key].dataInfo[i].showLabel"
|
||||
:fetch-suggestions="querySearch"
|
||||
clearable
|
||||
class="inline-input w-50"
|
||||
placeholder="Please Input"
|
||||
@change="changeInput(i,tmp.key)"
|
||||
@select="changeData(i,tmp.key)"
|
||||
/>
|
||||
<el-select-v2
|
||||
v-else
|
||||
v-model="that.propInfo[tmp.key].dataInfo[i].showLabel"
|
||||
filterable
|
||||
:options="getIngredientInfoListByType(that.propInfo[tmp.key].groupType)"
|
||||
|
|
@ -126,10 +136,8 @@
|
|||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<el-button
|
||||
|
|
@ -145,13 +153,15 @@
|
|||
:key="index"
|
||||
style="padding: 4px">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span>
|
||||
<i
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
class="icon-lk_edit"
|
||||
style="font-size: 20px"> </i>
|
||||
<i v-else class="icon-lk_cell_add" style="font-size: 20px"> </i>
|
||||
</span>
|
||||
<span>
|
||||
|
||||
<i
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
class="icon-lk_edit"
|
||||
style="font-size: 20px"> </i>
|
||||
<i v-else class="icon-lk_cell_add" style="font-size: 20px"> </i>
|
||||
</span>
|
||||
|
||||
<el-autocomplete
|
||||
v-if="that.propInfo[tmp.key].canInput"
|
||||
v-model="that.propInfo[tmp.key].dataInfo[index].showLabel"
|
||||
|
|
@ -159,8 +169,8 @@
|
|||
clearable
|
||||
class="inline-input w-50"
|
||||
placeholder="Please Input"
|
||||
@change="changeData"
|
||||
@select="changeData"
|
||||
@change="changeInput(index,tmp.key)"
|
||||
@select="changeData(index,tmp.key)"
|
||||
/>
|
||||
<el-select-v2
|
||||
v-else
|
||||
|
|
@ -194,6 +204,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="deleteList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
|
|
@ -208,19 +220,30 @@
|
|||
</el-button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="that.propInfo[tmp.key].shape === ShapeType.vueShapeImage">
|
||||
<div style="box-shadow: 0px 2px 5px 2px #dcdcdc;" v-else-if="that.propInfo[tmp.key].shape === ShapeType.vueShapeImage">
|
||||
<!-- 功能待完善-->
|
||||
<div
|
||||
v-for="(img,index) in that.propInfo[tmp.key].dataInfo"
|
||||
:key="index" style="display: flex">
|
||||
|
||||
<div class="img-box" v-if="img.url">
|
||||
<div style="display: flex">
|
||||
<img :src="img.url" width="60px" height="60px"/>
|
||||
<div>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
v-if="false && that.propInfo[tmp.key].canChange && img.url "
|
||||
@click="deleteImgList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
</div>
|
||||
<el-select-v2
|
||||
v-model="that.propInfo[tmp.key].dataInfo[0].showLabel"
|
||||
filterable
|
||||
:options="washingInfoListByType(that.propInfo[tmp.key].groupType)"
|
||||
placeholder="Please select"
|
||||
@change="changeComboData(that.propInfo[tmp.key],that.propInfo[tmp.key].dataInfo[0].showLabel)"
|
||||
@change="changeComboData(that.propInfo[tmp.key],that.propInfo[tmp.key].dataInfo[index].showLabel)"
|
||||
size="large"
|
||||
style="min-width: 280px;width: 100%"
|
||||
>
|
||||
|
|
@ -233,19 +256,16 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-select-v2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="img.label">
|
||||
<el-input v-model="img.label" disabled/>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="deleteList(tmp.key,index)">
|
||||
<i class="icon-lk_delete"> </i>
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
v-if="that.propInfo[tmp.key].canChange && false"
|
||||
@click="appendImageList(tmp.key)">
|
||||
添加
|
||||
</el-button>
|
||||
|
|
@ -410,6 +430,15 @@ const initSucceed = () => {
|
|||
showPng();
|
||||
emit('initSucceed')
|
||||
}
|
||||
const changeInput =(index: number, key: string)=>{
|
||||
|
||||
if(!that.propInfo[key].dataInfo[index].showLabel){
|
||||
useMessage().notifyWarning('请输入'+getLabelName(that.propInfo[key]));
|
||||
return;
|
||||
}
|
||||
that.propInfo[key].dataInfo[index].label = that.propInfo[key].dataInfo[index].showLabel
|
||||
resetData();
|
||||
}
|
||||
const changeData = (index: number, key: string) => {
|
||||
|
||||
const info = that.propInfo[key];
|
||||
|
|
@ -451,30 +480,44 @@ const changeData = (index: number, key: string) => {
|
|||
}
|
||||
|
||||
}
|
||||
const changeComboData = (item: any, label: string) => {
|
||||
let info = [];
|
||||
let startIndex = 0;
|
||||
for (let i = 0; i < that.washingInfoList.length; i++) {
|
||||
// @ts-ignore
|
||||
if (that.washingInfoList[i].value === label) {
|
||||
// @ts-ignore
|
||||
item.dataInfo[0].url = that.washingInfoList[i].url
|
||||
info = that.washingInfoList[i].langMapping
|
||||
startIndex++;
|
||||
break;
|
||||
}
|
||||
const changeComboData = (index: number, key: string) => {
|
||||
const info = that.propInfo[key];
|
||||
const infoList = getIngredientInfoListByType(info.groupType)
|
||||
let mapping = {}
|
||||
for (let i = 0; i < infoList.length; i++) {
|
||||
mapping[infoList[i].label] = infoList[i].langMapping;
|
||||
}
|
||||
console.log("info", info)
|
||||
console.log("111",infoList,mapping)
|
||||
// 多语言变量替换
|
||||
const allData = [...that.propInfo[key].dataInfo]
|
||||
const fLang = allData[1].locale;
|
||||
let m1 = mapping[allData[1].showLabel]
|
||||
if(m1){
|
||||
let ratio = allData[1].ratio
|
||||
for (let i = 0; i < allData.length; i++) {
|
||||
|
||||
for (let i = startIndex; i < item.dataInfo.length; i++) {
|
||||
for (let j = 0; j < info.length; j++) {
|
||||
if (info[j].locale === item.dataInfo[i].locale) {
|
||||
item.dataInfo[i].label = info[j].value
|
||||
break;
|
||||
if(i>0 && allData[i].locale === fLang){
|
||||
ratio = allData[i].ratio
|
||||
m1 = mapping[allData[i].showLabel]
|
||||
}
|
||||
for (let j = 0; j < m1.length; j++) {
|
||||
if( allData[i].locale === m1[j].locale){
|
||||
console.log("m1",m1[j],ratio)
|
||||
let str = ratio;
|
||||
if (str === null || str === undefined || str === -1) {
|
||||
str = ''
|
||||
}
|
||||
allData[i].label= `${m1[j].value}`.replaceAll('${r}', `${str}`)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
that.propInfo[key].dataInfo = [...allData];
|
||||
|
||||
console.log("allData",allData)
|
||||
resetData();
|
||||
}
|
||||
resetData();
|
||||
}
|
||||
|
||||
const washingInfoListByType = (type) => {
|
||||
|
|
@ -512,7 +555,36 @@ const uploadFile = async (fileName) => {
|
|||
});
|
||||
});
|
||||
}
|
||||
const deleteImgList = (key, index) => {
|
||||
// const item = JSON.parse(JSON.stringify(that.propInfo[key]))
|
||||
// const group = findGroup(key,that.propInfo)
|
||||
// const keys = Object.keys(group);
|
||||
//
|
||||
// if(keys.length > 1){
|
||||
// console.log(index)
|
||||
// // 删除同一组数据
|
||||
// const firstLang = item.dataInfo[1].locale
|
||||
// const indexs = [];
|
||||
// for (let i = index; i < item.dataInfo.length; i++) {
|
||||
// if(i > index && firstLang === item.dataInfo[i].locale){
|
||||
// break;
|
||||
// }
|
||||
// indexs.push(i);
|
||||
// }
|
||||
// const newArr = [];
|
||||
// for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
|
||||
// if(!indexs.includes(i)){
|
||||
// newArr.push(that.propInfo[key].dataInfo[i])
|
||||
// }
|
||||
// }
|
||||
// that.propInfo[key].dataInfo = [...newArr]
|
||||
// resetData();
|
||||
// }else {
|
||||
// useMessage().notifyWarning("至少需要一个变量")
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
const deleteList = (key, index) => {
|
||||
const item = JSON.parse(JSON.stringify(that.propInfo[key]))
|
||||
const group = findGroup(key,that.propInfo)
|
||||
|
|
@ -544,33 +616,34 @@ const deleteList = (key, index) => {
|
|||
|
||||
}
|
||||
const appendImageList = (key) => {
|
||||
const item = that.propInfo[key]
|
||||
console.log("item.dataInfo",item)
|
||||
const group = findGroup(key,that.propInfo)
|
||||
const keys = Object.keys(group);
|
||||
console.log("keys",keys)
|
||||
// 有多少组变量
|
||||
if(keys.length >= item.maxSize ){
|
||||
useMessage().notifyWarning("最大数量为:"+item.maxSize)
|
||||
return;
|
||||
}
|
||||
const locale = item.dataInfo[0].locale
|
||||
const tmpArr = [...item.dataInfo]
|
||||
|
||||
for (let i = 0; i < tmpArr.length; i++) {
|
||||
if(i > 0 && tmpArr[i].locale === locale){
|
||||
break;
|
||||
}
|
||||
item.dataInfo.push(
|
||||
{
|
||||
label: '',
|
||||
url: '',
|
||||
ratio: 0,
|
||||
...tmpArr[i]
|
||||
}
|
||||
)
|
||||
}
|
||||
resetData();
|
||||
// todo 待完成
|
||||
// const item = that.propInfo[key]
|
||||
// console.log("item.dataInfo",item)
|
||||
// const group = findGroup(key,that.propInfo)
|
||||
// const keys = Object.keys(group);
|
||||
// console.log("keys",keys)
|
||||
// // 有多少组变量
|
||||
// if(keys.length >= item.maxSize ){
|
||||
// useMessage().notifyWarning("最大数量为:"+item.maxSize)
|
||||
// return;
|
||||
// }
|
||||
// const locale = item.dataInfo[1].locale
|
||||
// const tmpArr = [...item.dataInfo]
|
||||
//
|
||||
// for (let i = 1; i < tmpArr.length; i++) {
|
||||
// if(i > 1 && tmpArr[i].locale === locale){
|
||||
// break;
|
||||
// }
|
||||
// item.dataInfo.push(
|
||||
// {
|
||||
// label: '',
|
||||
// url: '',
|
||||
// ratio: 0,
|
||||
// ...tmpArr[i]
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// resetData();
|
||||
}
|
||||
|
||||
const appendList = (key) => {
|
||||
|
|
@ -791,6 +864,8 @@ const checkPropInfo = (info)=>{
|
|||
let labelInfo = []
|
||||
let rInfo = 0;
|
||||
const firstLang = newInfo[key].dataInfo[0].locale;
|
||||
const linkChar = newInfo[key].linkChar || ',';
|
||||
|
||||
for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) {
|
||||
|
||||
if(firstLang === newInfo[key].dataInfo[i1].locale){
|
||||
|
|
@ -824,13 +899,12 @@ const checkPropInfo = (info)=>{
|
|||
}
|
||||
}
|
||||
if(row){
|
||||
row.label = str.join(",");
|
||||
row.label = str.join(linkChar);
|
||||
newArr.push(row);
|
||||
}
|
||||
}
|
||||
newInfo[key].dataInfo = newArr;
|
||||
console.log("that.propInfo",newArr)
|
||||
console.log("that. newInfo[key]", newInfo[key])
|
||||
|
||||
}
|
||||
resolve(newInfo)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@
|
|||
</el-form-item>
|
||||
<!-- 停用 -->
|
||||
<el-form-item label="控制" >
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div style="width: 800px">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canChange">
|
||||
|
|
@ -51,16 +52,30 @@
|
|||
</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="false">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canInput"
|
||||
:disabled="that.configInfo.isCombo">
|
||||
|
||||
<el-col :span="6">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox :disabled="that.configInfo.shape"
|
||||
v-model="that.configInfo.canInput">
|
||||
<span>允许输入值</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-tooltip
|
||||
content="输入多个变量时的连接字符,使用<br/> 变量进行换行"
|
||||
>
|
||||
<div style="display:flex;">
|
||||
<div>变量链接符</div>
|
||||
<div>
|
||||
<el-input v-model="that.configInfo.linkChar" clearable maxlength="6" placeholder="请输入连接符" show-word-limit />
|
||||
</div>
|
||||
<el-button @click="that.configInfo.linkChar = '<br/>'">换行</el-button>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-row>
|
||||
|
|
@ -98,7 +113,7 @@
|
|||
<template #default="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
<span v-if="that.configInfo.isCombo" style="padding-right: 4px">
|
||||
{{scope.$index !== 0 ? '-text' : '-icon' }}
|
||||
{{scope.$index !== 0 ? '' : '-icon' }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -183,6 +198,7 @@ const that = reactive({
|
|||
maxSize: 100,
|
||||
canChange: false,
|
||||
canInput: false,
|
||||
linkChar: ',',
|
||||
cellIds: [], // 节点id
|
||||
groupId: `g_${Math.random().toString(36).substring(2)}`,
|
||||
data: {}, //节点是数据
|
||||
|
|
@ -249,6 +265,7 @@ const init = (allGroupList, data) => {
|
|||
maxSize: 100, // 节点组最大数量
|
||||
canChange: false, // 是否允许调整数量
|
||||
canInput: false,// 是否允许输入值
|
||||
linkChar: ',',// 连接字符
|
||||
cellIds: [], // 节点id
|
||||
data: {}, //节点是数据
|
||||
shape: '', // 节点类型
|
||||
|
|
|
|||
|
|
@ -1158,6 +1158,7 @@ const getJson = () => {
|
|||
let combo = prop.isCombo === undefined ? false : prop.isCombo;
|
||||
let canChange = prop.canChange === undefined ? false : prop.canChange;
|
||||
let canInput = prop.canInput === undefined ? false : prop.canInput;
|
||||
let linkChar = prop.linkChar === undefined ? ',' : prop.linkChar;
|
||||
|
||||
if (combo) {
|
||||
min = Math.min(dataInfoList.length,min);
|
||||
|
|
@ -1176,6 +1177,7 @@ const getJson = () => {
|
|||
maxSize: max,
|
||||
canChange: canChange,
|
||||
canInput: canInput,
|
||||
linkChar: linkChar,
|
||||
shape: prop.shape,
|
||||
dataInfo: dataInfoList
|
||||
}
|
||||
|
|
@ -1451,10 +1453,12 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
|
|||
|
||||
let canChange = false;
|
||||
let canInput = false;
|
||||
let linkChar = ',';
|
||||
for (let i = 0; i < that.pageConfig.propList.length; i++) {
|
||||
if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) {
|
||||
canChange = that.pageConfig.propList[i].canChange === true
|
||||
canInput = that.pageConfig.propList[i].canInput === true
|
||||
linkChar = that.pageConfig.propList[i].linkChar || ','
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1469,6 +1473,7 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
|
|||
maxSize: max,
|
||||
canChange: canChange,
|
||||
canInput: canInput,
|
||||
linkChar: linkChar,
|
||||
data: info.data, //节点是数据
|
||||
shape: info.shape,
|
||||
pointList: [...tmpPoint], //{ x:10,y:100}
|
||||
|
|
|
|||
|
|
@ -647,6 +647,8 @@ const addNewBill = () => {
|
|||
that.pageLoading.close()
|
||||
push("/")
|
||||
},3000)
|
||||
}).catch(e=>{
|
||||
useMessage().warning("出错:"+ e.message ? e.message : e)
|
||||
})
|
||||
}else {
|
||||
SaleOrderApi.placeOrder({
|
||||
|
|
@ -661,6 +663,8 @@ const addNewBill = () => {
|
|||
that.pageLoading.close()
|
||||
push("/")
|
||||
},3000)
|
||||
}).catch(e=>{
|
||||
useMessage().warning("出错:"+ e.message ? e.message : e)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
<el-checkbox class="m-4" v-model="formData.isCombo">多语言拼接</el-checkbox>
|
||||
</el-tooltip>
|
||||
<el-alert
|
||||
title="多语言内容可使用${r}作为占位符如:白鹅绒${r}%以上, 客户填写 60时, 结果为: 白鹅绒60%以上"
|
||||
title="多语言内容可使用${r}作为占位符如:白鹅绒${r}%以上, 填写 60时, 结果为: 白鹅绒60%以上,点击输入框按下Alt+T快速填入"
|
||||
type="info" effect="dark"/>
|
||||
<el-table
|
||||
:data="that.langList"
|
||||
|
|
@ -116,7 +116,9 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.value" placeholder="请输入多语言内容"/>
|
||||
<div>
|
||||
<el-input :id="`rowInput_${scope.$index}`" @focus="inputFocus(scope.$index)" v-model="scope.row.value" placeholder="请输入内容"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="linkChar" label="连接符" width="120">
|
||||
|
|
@ -137,16 +139,7 @@
|
|||
</el-collapse>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="地区标识" prop="locale">
|
||||
<el-select v-model="formData.locale" placeholder="请选择语言标识">
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.LANGUAGE_LOCALE)"
|
||||
:key="`${dict.value}`"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="启用状态" prop="enabled">
|
||||
<el-checkbox v-model="formData.enabled">是否启用</el-checkbox>
|
||||
</el-form-item>
|
||||
|
|
@ -200,6 +193,7 @@ const formRules = reactive({
|
|||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const that = reactive({
|
||||
inputIndex: -1,
|
||||
langList: [{
|
||||
locale: 'zh-CN', // 语言标识
|
||||
value: '', // 翻译内容
|
||||
|
|
@ -299,6 +293,52 @@ const submitForm = () => {
|
|||
|
||||
}
|
||||
|
||||
const inputFocus = (index)=>{
|
||||
that.inputIndex = index
|
||||
}
|
||||
// 处理按下 Alt + R 快捷键的函数
|
||||
const handleKeydown = (event) => {
|
||||
// 判断是否按下了 Alt + R
|
||||
if (event.altKey && event.key === 'r') {
|
||||
onAltRPressed();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理 Alt + R 被按下时的逻辑
|
||||
const onAltRPressed = () => {
|
||||
console.log('Alt + R 被按下了');
|
||||
if(that.inputIndex >= 0){
|
||||
const byId = document.getElementById("rowInput_"+that.inputIndex);
|
||||
let pos = 0;
|
||||
if(byId){
|
||||
pos = byId.selectionStart;
|
||||
}
|
||||
let str = that.langList[that.inputIndex].value;
|
||||
if(str && str.length > 0 && pos > 0){
|
||||
if(pos >= str.length){
|
||||
that.langList[that.inputIndex].value = that.langList[that.inputIndex].value+"${r}";
|
||||
}else {
|
||||
that.langList[that.inputIndex].value = str.substring(0,pos)+"${r}"+str.substring(pos);
|
||||
}
|
||||
|
||||
}else {
|
||||
that.langList[that.inputIndex].value = "${r}"+that.langList[that.inputIndex].value;
|
||||
}
|
||||
}
|
||||
|
||||
// 在这里可以执行任何自定义的操作
|
||||
};
|
||||
|
||||
// 在组件挂载时添加键盘事件监听
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
// 在组件卸载时移除键盘事件监听
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
|
|
|
|||
|
|
@ -21,23 +21,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :span="8">
|
||||
<el-form-item label="语言标识" prop="locale">
|
||||
<el-select
|
||||
v-model="queryParams.locale"
|
||||
placeholder="请选择语言标识"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions(DICT_TYPE.LANGUAGE_LOCALE)"
|
||||
:key="`${dict.value}`"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :xs="24" :span="8">
|
||||
<el-form-item label="启用状态" prop="enabled">
|
||||
<el-select
|
||||
|
|
@ -89,8 +73,8 @@
|
|||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="保养项名称" align="center" prop="value" />
|
||||
<el-table border v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="保养项名称" align="center" prop="value" width="200" />
|
||||
<el-table-column label="品牌通用" align="center" prop="isAll" >
|
||||
<template #default="scope">
|
||||
<div>
|
||||
|
|
@ -98,11 +82,6 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="语言标识 " align="center" prop="locale">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.LANGUAGE_LOCALE" :value="scope.row.locale" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="启用状态" align="center" prop="enabled" >
|
||||
<template #default="scope">
|
||||
<div>
|
||||
|
|
@ -111,13 +90,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
|
|
|
|||
Loading…
Reference in New Issue