pc端价格新增修改

master
CJYXTX\27961 6 months ago
parent a4dcd298bf
commit 5e2ac14b14

@ -1,5 +1,6 @@
package jnpf.service.impl;
import cn.hutool.json.JSONArray;
import jnpf.entity.*;
import jnpf.mapper.NxPriceMapper;
import jnpf.service.*;
@ -570,6 +571,14 @@ public class NxPriceServiceImpl extends ServiceImpl<NxPriceMapper, NxPriceEntity
for(NxPriceProductEntity entitys : tableField106){
entitys.setId(RandomUtil.uuId());
entitys.setPriceId(entity.getId());
//从productListId中获取最后一个productid添加 4.20添加
JSONArray jsonArray = new JSONArray( entitys.getProductListId());
if (jsonArray!=null){
String productid = jsonArray.get(1).toString();
entitys.setProductId(productid);
}
if(isSave){
}else{
}

@ -61,7 +61,9 @@ public class NxProductServiceImpl extends ServiceImpl<NxProductMapper, NxProduct
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
// boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
boolean isPc = true;
String columnData = !isPc ? NxProductConstant.getAppColumnData() : NxProductConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());

@ -1,6 +1,8 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -179,6 +181,7 @@ public class NxPriceController {
}
nxPriceService.saveOrUpdate(nxPriceForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}

@ -139,6 +139,52 @@ public class NxProductController {
return ActionResult.success(vo);
}
/**
*
*
* @param
* @return
*/
@Operation(summary = "获取列表")
@GetMapping("/getList1")
// @PostMapping("/getList1")
public ActionResult list1()throws IOException{
NxProductPagination nxProductPagination=new NxProductPagination();
List<NxProductEntity> list= nxProductService.getList(nxProductPagination);
List<Map<String, Object>> realList=new ArrayList<>();
List<NxProductEntity> entityList =new ArrayList<>();
for (NxProductEntity entity : list) {
if (entity.getParentId()==null){
QueryWrapper<NxProductEntity> nxProductEntityQueryWrapper=new QueryWrapper<>();
nxProductEntityQueryWrapper.lambda().eq(NxProductEntity::getParentId,entity.getId());
List<NxProductEntity> productEntityList=nxProductService.list(nxProductEntityQueryWrapper);
entity.setChildren(productEntityList);
entityList.add(entity);
}
// entity.setParent(entity.getParentId());
// Map<String, Object> nxProductMap=JsonUtil.entityToMap(entity);
// nxProductMap.put("id", nxProductMap.get("id"));
// //副表数据
// //子表数据
// realList.add(nxProductMap);
}
//数据转换
// realList = generaterSwapUtil.swapDataList(realList, NxProductConstant.getFormData(), NxProductConstant.getColumnData(), nxProductPagination.getModuleId(),false);
// boolean isPc = "pc".equals(ServletUtil.getHeader("jnpf-origin" ));
// if(isPc){
// //分组和树形的树形数据转换
// realList = generaterSwapUtil.swapDataList(realList, NxProductConstant.getColumnData(), "id");
// }
//返回对象
// PageListVO vo = new PageListVO();
// vo.setList(realList);
// PaginationVO page = JsonUtil.getJsonToBean(nxProductPagination, PaginationVO.class);
// vo.setPagination(page);
return ActionResult.success(entityList);
}
/**
*

@ -43,4 +43,8 @@ public class NxPriceProductEntity {
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
/** 商品名称 **/
@TableField(value = "PRODUCT_LIST_ID" , updateStrategy = FieldStrategy.IGNORED)
private String productListId;
}

@ -3,6 +3,8 @@ package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
*
*
@ -60,4 +62,7 @@ public class NxProductEntity {
@TableField(exist = false)
private String parent;
@TableField(exist = false)
private List<NxProductEntity> children; //级联
}

@ -21,6 +21,10 @@ public class NxPriceProductModel {
/** 商品名称 **/
@JSONField(name = "productId")
private String productId;
/** 商品名称 **/
@JSONField(name = "productListId")
private Object productListId;
/** 回收价 **/
@JSONField(name = "recoveryPrice")
private String recoveryPrice;

@ -8,7 +8,7 @@
*/
module.exports = {
// 开发环境接口配置
APIURl: 'http://127.0.0.1:30000'
// APIURl: 'http://127.0.0.1:30000'
// 测试环境接口配置
// APIURl: 'http://222.71.165.187:50000'
APIURl: 'http://222.71.165.187:30000'
}

@ -1,7 +1,7 @@
const { APIURl } = require('./apiUrl')
// const UPLOAD_DOMAIN = process.env.NODE_ENV === 'development' ? 'http://222.71.165.188:8808' : 'http://222.71.165.188:8808'; //3333专用
const UPLOAD_DOMAIN = process.env.NODE_ENV === 'development' ? 'http://222.71.165.188:8808' : 'http://118.195.155.9:8808'; //5555专用
const UPLOAD_DOMAIN = process.env.NODE_ENV === 'development' ? 'http://222.71.165.188:8808' : 'http://222.71.165.188:8808'; //3333专用
// const UPLOAD_DOMAIN = process.env.NODE_ENV === 'development' ? 'http://222.71.165.188:8808' : 'http://118.195.155.9:8808'; //5555专用
const UPLOAD_URL = UPLOAD_DOMAIN + '/api/file';
const UPLOAD_KEY = '8bd2aa89033ead51c505e44994e42189'

@ -0,0 +1,693 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{ '下一条' }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
:disabled='btnLoading'>
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled='continueBtnLoading'>
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="基本信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格编号" prop="priceCode">
<JnpfInput v-model="dataForm.priceCode" @change="changeData('priceCode', -1)" placeholder="系统自动生成"
readonly :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格类型" prop="priceType">
<JnpfSelect v-model="dataForm.priceType" @change="changeData('priceType', -1)" placeholder="请选择"
clearable :style='{ "width": "100%" }' :options="priceTypeOptions" :props="priceTypeProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)" placeholder="请选择"
selectType="all" :ableIds="ableAll.buinessIdableIds" clearable :style='{ "width": "100%" }'>
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="价格信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2></h2>
</div>
<el-table :data="dataForm.nxpriceproductList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="回收价" prop="recoveryPrice">
<template slot="header" v-if="false">
<span class="required-sign">*</span>回收价
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.recoveryPrice"
@change="changeData('nxpriceproduct-recoveryPrice', scope.$index)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="赠送积分" prop="rewardPoints">
<template slot="header" v-if="false">
<span class="required-sign">*</span>赠送积分
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.rewardPoints"
@change="changeData('nxpriceproduct-rewardPoints', scope.$index)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="商品id" prop="productId">
<template slot="header" v-if="false">
<span class="required-sign">*</span>商品id
</template>
<template slot-scope="scope">
<JnpfCascader v-model="scope.row.productId"
@change="changeData('nxpriceproduct-productId', scope.$index)" placeholder="请选择" show-all-levels
clearable :style='{ "width": "100%" }' separator="/" :options="scope.row.productIdOptions"
:props="nxpriceproductproductIdProps">
</JnpfCascader>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpriceproductList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addnxpriceproductList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="适配服务站" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2></h2>
</div>
<el-table :data="dataForm.nxpricerecycleList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="回收站" prop="recycleId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>回收站
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.recycleId"
@change="changeData('nxpricerecycle-recycleId', scope.$index)" :rowIndex="scope.$index"
:formData="dataForm" :templateJson="interfaceRes.nxpricerecyclerecycleId" placeholder="请选择"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='station_name' :field="'recycleId' + scope.$index" interfaceId="534688845753483781"
:pageSize="20" :columnOptions="nxpricerecyclerecycleIdcolumnOptions" clearable
:style='{ "width": "100%" }'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpricerecycleList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addnxpricerecycleList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remak">
<JnpfInput v-model="dataForm.remak" @change="changeData('remak', -1)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: {},
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting: {},
eventType: '',
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
nxpriceproductList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
nxpricerecycleList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
},
//
ableAll: {
},
tableRows: {
nxpriceproductList: {
recoveryPrice: '',
recoveryPriceOptions: [],
rewardPoints: '',
rewardPointsOptions: [],
productId: [],
productIdOptions: [],
enabledmark: undefined
},
nxpricerecycleList: {
recycleId: '',
recycleIdOptions: [],
enabledmark: undefined
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
priceCode: undefined,
priceType: "1",
buinessId: undefined,
creatorUserId: undefined,
creatorTime: undefined,
lastModifyTime: undefined,
lastModifyUserId: undefined,
remak: undefined,
nxpriceproductList: [],
nxpricerecycleList: [],
version: 0,
},
tableRequiredData: {},
dataRule:
{
priceType: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
buinessId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
},
priceTypeOptions: [{ "fullName": "回收价", "id": "1" }],
priceTypeProps: { "label": "fullName", "value": "id" },
nxpriceproductproductIdOptions: [],
nxpriceproductproductIdProps: { "label": "name", "value": "id", "children": "children" },
nxpricerecyclerecycleIdcolumnOptions: [{ "label": "回收站编号", "value": "station_code" }, { "label": "回收站名称", "value": "station_name" },],
childIndex: -1,
isEdit: false,
interfaceRes: {
priceCode: [],
priceType: [],
buinessId: [],
creatorUserId: [],
creatorTime: [],
lastModifyTime: [],
lastModifyUserId: [],
remak: [],
nxpriceproductrecoveryPrice: [],
nxpriceproductrewardPoints: [],
nxpriceproductproductId: [],
nxpricerecyclerecycleId: [],
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() { },
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/NxPrice/' + id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
this.getnxpriceproductproductIdOptions();
},
nxpriceproductExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxpriceproductList.length; i++) {
const e = this.dataForm.nxpriceproductList[i];
}
return isOk;
},
nxpricerecycleExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxpricerecycleList.length; i++) {
const e = this.dataForm.nxpricerecycleList[i];
if (!e.recycleId) {
this.$message({
message: '回收站不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
getnxpriceproductproductIdOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.nxpriceproductproductId))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField) {
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
} else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template = {
paramList: templateJsonList
}
getDataInterfaceRes('551316225821512901', template).then(res => {
let data = res.data
this.nxpriceproductproductIdOptions = data
if (index == -1) return
this.dataForm.nxpriceproductList[index].productIdOptions = data
this.changeDataFormData(2, 'nxpriceproductList', 'productId', index, [])
})
},
goBack() {
this.$emit('refresh')
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/NxPrice/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
} else {
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
if (this.userInfo.departmentId != null && this.userInfo.departmentId != '') {
this.dataForm.buinessId = this.userInfo.departmentId
}
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
if (!this.nxpriceproductExist()) return
if (!this.nxpricerecycleExist()) return
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/NxPrice',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
} else {
request({
url: '/api/scm/NxPrice/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
addnxpriceproductList() {
let item = {
recoveryPrice: undefined,
rewardPoints: undefined,
productId: [],
productIdOptions: [],
}
this.getnxpriceproductList(item)
},
delnxpriceproductList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.nxpriceproductList.splice(index, 1);
}).catch(() => {
});
},
getnxpriceproductList(value) {
let item = { ...this.tableRows.nxpriceproductList, ...value }
this.dataForm.nxpriceproductList.push(item)
this.childIndex = this.dataForm.nxpriceproductList.length - 1
this.isEdit = true
this.getnxpriceproductproductIdOptions()
this.isEdit = false
this.childIndex = -1
},
addnxpricerecycleList() {
let item = {
recycleId: '',
}
this.getnxpricerecycleList(item)
},
delnxpricerecycleList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.nxpricerecycleList.splice(index, 1);
}).catch(() => {
});
},
getnxpricerecycleList(value) {
let item = { ...this.tableRows.nxpricerecycleList, ...value }
this.dataForm.nxpricerecycleList.push(item)
this.childIndex = this.dataForm.nxpricerecycleList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList() {
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for (let i = 0; i < _dataAll.nxpriceproductList.length; i++) {
this.childIndex = i
this.getnxpriceproductproductIdOptions()
}
for (let i = 0; i < _dataAll.nxpricerecycleList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
},
},
}
</script>

@ -0,0 +1,885 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width: 70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled="prevDis">
{{ "上一条" }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled="nextDis">
{{ "下一条" }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
:disabled="btnLoading">
{{
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled="continueBtnLoading">
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="基本信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格编号" prop="priceCode">
<JnpfInput v-model="dataForm.priceCode" @change="changeData('priceCode', -1)" placeholder="系统自动生成"
readonly :style="{ width: '100%' }">
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfOrganizeSelect
v-model="dataForm.buinessId"
@change="changeData('buinessId', -1)"
placeholder="请选择"
selectType="all"
:ableIds="ableAll.buinessIdableIds"
clearable
:style="{ width: '100%' }"
>
</JnpfOrganizeSelect>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)" placeholder="请选择"
selectType="all" :ableIds="ableAll.buinessId" clearable disabled="true" :style="{ width: '100%' }">
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格类型" prop="priceType">
<JnpfSelect v-model="dataForm.priceType" @change="changeData('priceType', -1)" placeholder="请选择"
clearable :style="{ width: '100%' }" :options="priceTypeOptions" :props="priceTypeProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="价格信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2></h2>
</div>
<el-table :data="dataForm.nxPriceProductList" size="mini">
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="商品名称" prop="productId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>商品名称
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId" @change="changeProduct" :rowIndex="scope.$index"
:formData="dataForm" :templateJson="interfaceRes.nxpriceproductproductId" placeholder="请选择"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField="name" :field="'productId' + scope.$index" interfaceId="534687918480949765"
:pageSize="20" :columnOptions="nxpriceproductproductIdcolumnOptions" clearable
:style="{ width: '100%' }">
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="单位" prop="unit">
<template slot="header" v-if="false">
<span class="required-sign"></span>单位
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.unit" disabled @change="
changeData('nxpriceproduct-units', scope.$index)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="回收价" prop="recoveryPrice">
<template slot="header" v-if="true">
<span class="required-sign">*</span>回收价
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.recoveryPrice" @change="
changeData(
'nxpriceproduct-recoveryPrice',
scope.$index
)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="赠送积分" prop="rewardPoints">
<template slot="header" v-if="false">
<span class="required-sign">*</span>赠送积分
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.rewardPoints" @change="
changeData(
'nxpriceproduct-rewardPoints',
scope.$index
)
" placeholder="请输入" clearable :style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpriceproductList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="table-actions" @click="addnxpriceproductList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div> -->
<div class="table-actions" @click="choice()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="适配服务站" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2></h2>
</div>
<el-table :data="dataForm.nxPriceRecycleList" size="mini">
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="回收站" prop="recycleId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>回收站
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.recycleId" @change="
changeData('nxpricerecycle-recycleId', scope.$index)
" :rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.nxpricerecyclerecycleId" disabled
placeholder="请选择" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField="station_name" :field="'recycleId' + scope.$index"
interfaceId="534688845753483781" :pageSize="20"
:columnOptions="nxpricerecyclerecycleIdcolumnOptions" clearable :style="{ width: '100%' }">
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="回收站名称" prop="stationCode">
<template slot="header" v-if="true">
<span class="required-sign"></span>回收站编码
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.stationCode" placeholder="请输入" disabled clearable
:style="{ width: '100%' }">
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delnxpricerecycleList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addnxpricerecycleList()"
v-if="dataForm.nxPriceRecycleList.length == 0">
<el-button type="text" icon="el-icon-plus">回收站添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remak">
<JnpfInput v-model="dataForm.remak" @change="changeData('remak', -1)" placeholder="请输入" clearable
:style="{ width: '100%' }">
</JnpfInput>
</jnpf-form-tip-item>
</el-col> -->
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
<ProductBox v-if="productBoxxVisible" ref="ProductBoxs" @refreshDataList="initList" />
</div>
</transition>
</template>
<script>
import request from "@/utils/request";
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import {
getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime,
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
import ProductBox from "@/views/publicPopup/productBox";
export default {
components: { ProductBox },
props: [],
data() {
return {
list: [],
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: "formRef",
setting: {},
eventType: "",
userBoxVisible: false,
productBoxxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
nxPriceProductList: {
popupType: "dialog",
hasPage: true,
popupTitle: "选择数据",
pageSize: 20,
columnOptions: [],
interfaceId: "",
interfaceName: "",
relationOptions: [],
templateJson: [],
popupWidth: "800px",
},
nxPriceRecycleList: {
popupType: "dialog",
hasPage: true,
popupTitle: "选择数据",
pageSize: 20,
columnOptions: [],
interfaceId: "",
interfaceName: "",
relationOptions: [],
templateJson: [],
popupWidth: "800px",
},
},
//
ableAll: {},
tableRows: {
nxPriceProductList: {
productId: "",
productIdOptions: [],
recoveryPrice: "",
recoveryPriceOptions: [],
rewardPoints: "",
rewardPointsOptions: [],
enabledmark: undefined,
},
nxPriceRecycleList: {
recycleId: "",
recycleIdOptions: [],
enabledmark: undefined,
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
priceCode: undefined,
buinessId: undefined,
priceType: "1",
creatorUserId: undefined,
creatorTime: undefined,
lastModifyTime: undefined,
lastModifyUserId: undefined,
remak: undefined,
nxPriceProductList: [],
nxPriceRecycleList: [],
version: 0,
},
tableRequiredData: {},
dataRule: {
buinessId: [
{
required: true,
message: "请至少选择一个",
trigger: "change",
},
],
priceType: [
{
required: true,
message: "请至少选择一个",
trigger: "change",
},
],
recycleId: [
{
required: true,
message: "请至少选择一个",
trigger: "change",
},
],
productId: [
{
required: true,
message: "请至少选择一个",
trigger: "change",
},
],
},
priceTypeOptions: [{ fullName: "回收价", id: "1" }],
priceTypeProps: { label: "fullName", value: "id" },
nxpriceproductproductIdcolumnOptions: [
{ label: "编码", value: "code" },
{ label: "名称", value: "name" },
{ label: "规格", value: "spec" },
],
nxpricerecyclerecycleIdcolumnOptions: [
{ label: "回收站编号", value: "station_code" },
{ label: "回收站名称", value: "station_name" },
],
childIndex: -1,
isEdit: false,
interfaceRes: {
priceCode: [],
buinessId: [],
priceType: [],
creatorUserId: [],
creatorTime: [],
lastModifyTime: [],
lastModifyUserId: [],
remak: [],
nxpriceproductproductId: [],
nxpriceproductrecoveryPrice: [],
nxpriceproductrewardPoints: [],
nxpricerecyclerecycleId: [],
},
};
},
computed: {
...mapGetters(["userInfo"]),
},
watch: {},
created() {
this.dataAll();
this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
},
mounted() { },
methods: {
prev() {
this.index--;
if (this.index === 0) {
this.prevDis = true;
}
this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id);
}
}
},
next() {
this.index++;
if (this.index === this.allList.length - 1) {
this.nextDis = true;
}
this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id);
}
}
},
getInfo(id) {
request({
url: "/api/scm/NxPrice/" + id,
method: "get",
}).then((res) => {
this.dataInfo(res.data);
});
},
goBack() {
this.visible = false;
this.$emit("refreshDataList", true);
},
changeProduct(model, row) {
row.productId = row.id;
this.dataForm.nxPriceProductList.push(row);
// debugger;
// console.log(this.dataForm.nxPriceProductList);
this.dataForm.nxPriceProductList.splice(-2, 1);
// this.dataForm.units = row.units;
},
changeData(model, index) {
this.isEdit = false;
this.childIndex = index;
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = "get" + key + "Options";
if (this[options]) {
this[options]();
}
this.changeData(key, index);
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue;
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue;
}
}
} else {
this.dataForm[data] = defaultValue;
}
}
},
dataAll() { },
nxpriceproductExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
const e = this.dataForm.nxPriceProductList[i];
if (!e.productId) {
this.$message({
message: "商品名称不能为空",
type: "error",
duration: 1000,
});
isOk = false;
break;
}
}
return isOk;
},
nxpricerecycleExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxPriceRecycleList.length; i++) {
const e = this.dataForm.nxPriceRecycleList[i];
// if (!e.recycleId) {
// this.$message({
// message: "",
// type: "error",
// duration: 1000,
// });
// isOk = false;
// break;
// }
}
return isOk;
},
goBack() {
this.$emit("refresh");
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
},
init(id, isDetail, allList) {
this.prevDis = false;
this.nextDis = false;
this.allList = allList || [];
if (allList.length) {
this.index = this.allList.findIndex((item) => item.id === id);
if (this.index == 0) {
this.prevDis = true;
}
if (this.index == this.allList.length - 1) {
this.nextDis = true;
}
} else {
this.prevDis = true;
this.nextDis = true;
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true;
request({
url: "/api/scm/NxPrice/" + this.dataForm.id,
method: "get",
}).then((res) => {
this.dataInfo(res.data);
this.loading = false;
});
} else {
this.clearData();
this.initDefaultData();
}
});
this.$store.commit("generator/UPDATE_RELATION_DATA", {});
},
choice() {
this.productBoxxVisible = true;
let excludeIdList = [];
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
excludeIdList.push(this.dataForm.nxPriceProductList[i].productId);
}
this.$nextTick(() => {
this.$refs.ProductBoxs.init(excludeIdList);
});
},
initList(list) {
for (let i = 0; i < list.length; i++) {
const e = list[i];
let item = {
productId: e.id,
name: e.name,
code: e.code,
spec: e.spec,
unit: e.unit,
// hasSchedule: e.hasSchedule,
// recycleAddress: e.recycleAddress,
};
this.dataForm.nxPriceProductList.push(item);
}
},
//
initDefaultData() {
if (
this.userInfo.organizeIdList instanceof Array &&
this.userInfo.organizeIdList.length > 0
) {
this.dataForm.buinessId = this.userInfo.organizeIdList;
}
this.dataForm.firstContactPerson = this.userInfo.userId;
if (
this.$store.getters.userInfo.organizeId &&
this.$store.getters.userInfo.organizeId != null
) {
this.dataForm.buinessId = this.$store.getters.userInfo.organizeId;
}
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0;
this.$refs["formRef"].validate((valid) => {
if (valid) {
if (!this.nxpriceproductExist()) return;
if (!this.nxpricerecycleExist()) return;
this.request();
}
});
},
request() {
let _data = this.dataList();
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true;
} else {
this.btnLoading = true;
}
if (!this.dataForm.id) {
request({
url: "/api/scm/NxPrice",
method: "post",
data: _data,
})
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData();
this.initDefaultData();
});
this.continueBtnLoading = false;
return;
}
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
})
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
} else {
request({
url: "/api/scm/NxPrice/" + this.dataForm.id,
method: "PUT",
data: _data,
})
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2)
return (this.continueBtnLoading = false);
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
})
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
}
},
addnxpriceproductList() {
let item = {
productId: "",
recoveryPrice: undefined,
rewardPoints: undefined,
};
this.getnxpriceproductList(item);
},
delnxpriceproductList(index) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
type: "warning",
})
.then(() => {
this.dataForm.nxPriceProductList.splice(index, 1);
})
.catch(() => { });
},
getnxpriceproductList(value) {
let item = { ...this.tableRows.nxPriceProductList, ...value };
this.dataForm.nxPriceProductList.push(item);
this.childIndex = this.dataForm.nxPriceProductList.length - 1;
this.isEdit = true;
this.isEdit = false;
this.childIndex = -1;
},
addnxpricerecycleList() {
request({
url: "/api/scm/NxPrice/getListRecycleStation",
method: "post",
}).then((res) => {
this.list = res.data.list
console.log(this.list);
for (let i = 0; i < this.list.length; i++) {
const e = this.list[i];
let list = {
recycleId: e.id,
stationCode: e.stationCode,
// productId: e.id,
name: e.name,
code: e.code,
spec: e.spec,
unit: e.unit,
// hasSchedule: e.hasSchedule,
// recycleAddress: e.recycleAddress,
};
this.dataForm.nxPriceRecycleList.push(list);
}
// this.dataForm.nxPriceRecycleList.push(res);
this.loading = false;
});
// let item = {
// recycleId: "",
// };
// this.getnxpricerecycleList(item);
// .then((res) => {
// this.$message({
// message: res.msg,
// type: "success",
// duration: 1000,
// onClose: () => {
// if (this.dataFormSubmitType == 2)
// return (this.continueBtnLoading = false);
// this.visible = false;
// this.btnLoading = false;
// this.$emit("refresh", true);
// },
// });
// })
// .catch(() => {
// this.btnLoading = false;
// this.continueBtnLoading = false;
// });
},
delnxpricerecycleList(index) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
type: "warning",
})
.then(() => {
this.dataForm.nxPriceRecycleList.splice(index, 1);
})
.catch(() => { });
},
getnxpricerecycleList(value) {
let item = { ...this.tableRows.nxPriceRecycleList, ...value };
this.dataForm.nxPriceRecycleList.push(item);
this.childIndex = this.dataForm.nxPriceRecycleList.length - 1;
this.isEdit = true;
this.isEdit = false;
this.childIndex = -1;
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key];
this.currVmodel = key;
this.selectDialogVisible = true;
this.$nextTick(() => {
this.$refs.selectDialog.init();
});
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i];
if (this["get" + this.currVmodel]) {
this["get" + this.currVmodel](t);
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData);
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue;
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = new Date().getTime();
} else if (timeType == 4) {
let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime();
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
}
} else if (timeType == 5) {
let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime();
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null;
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue;
} else {
timeDataValue = timeDataValue + ":00";
}
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) {
let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) {
let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format);
}
}
return timeDataValue;
},
dataList() {
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll;
this.dataForm = _dataAll;
this.isEdit = true;
this.dataAll();
for (let i = 0; i < _dataAll.nxPriceProductList.length; i++) {
this.childIndex = i;
}
for (let i = 0; i < _dataAll.nxPriceRecycleList.length; i++) {
this.childIndex = i;
}
this.childIndex = -1;
},
},
};
</script>

@ -90,11 +90,11 @@
</div>
<el-table :data="dataForm.nxPriceProductList" size="mini">
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="商品名称" prop="productId">
<!-- <el-table-column label="商品名称" prop="productId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>商品名称
</template>
<template slot-scope="scope">
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId" @change="changeProduct" :rowIndex="scope.$index"
:formData="dataForm" :templateJson="interfaceRes.nxpriceproductproductId" placeholder="请选择"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
@ -103,8 +103,24 @@
:style="{ width: '100%' }">
</JnpfPopupSelect>
</template>
</el-table-column> -->
<el-table-column label="商品id" prop="productListId">
<template slot="header" v-if="false">
<span class="required-sign">*</span>商品id
</template>
<template slot-scope="scope">
<JnpfCascader v-model="scope.row.productListId"
@change="changeData('nxpriceproduct-productListId', scope.$index)" placeholder="请选择"
show-all-levels clearable :style='{ "width": "100%" }' separator="/"
:options="scope.row.productIdOptions" :props="nxpriceproductproductIdProps">
</JnpfCascader>
</template>
</el-table-column>
<el-table-column label="单位" prop="unit">
<template slot="header" v-if="false">
<span class="required-sign"></span>单位
@ -152,13 +168,13 @@
</template>
</el-table-column>
</el-table>
<!-- <div class="table-actions" @click="addnxpriceproductList()">
<div class="table-actions" @click="addnxpriceproductList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div> -->
</div>
<div class="table-actions" @click="choice()">
<!-- <div class="table-actions" @click="choice()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</div> -->
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="24">
@ -307,6 +323,7 @@ export default {
nxPriceProductList: {
productId: "",
productIdOptions: [],
productListId: "",
recoveryPrice: "",
recoveryPriceOptions: [],
rewardPoints: "",
@ -357,7 +374,14 @@ export default {
trigger: "change",
},
],
productId: [
// productId: [
// {
// required: true,
// message: "",
// trigger: "change",
// },
// ],
productListId: [
{
required: true,
message: "请至少选择一个",
@ -367,11 +391,13 @@ export default {
},
priceTypeOptions: [{ fullName: "回收价", id: "1" }],
priceTypeProps: { label: "fullName", value: "id" },
nxpriceproductproductIdcolumnOptions: [
{ label: "编码", value: "code" },
{ label: "名称", value: "name" },
{ label: "规格", value: "spec" },
],
nxpriceproductproductIdProps: { "label": "name", "value": "id", "children": "children" },
nxpricerecyclerecycleIdcolumnOptions: [
{ label: "回收站编号", value: "station_code" },
{ label: "回收站名称", value: "station_name" },
@ -445,7 +471,7 @@ export default {
},
changeProduct(model, row) {
row.productId = row.id;
// row.productId = row.id;
this.dataForm.nxPriceProductList.push(row);
// debugger;
@ -493,20 +519,20 @@ export default {
}
}
},
dataAll() { },
dataAll() { this.getnxpriceproductproductIdOptions(); },
nxpriceproductExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
const e = this.dataForm.nxPriceProductList[i];
if (!e.productId) {
this.$message({
message: "商品名称不能为空",
type: "error",
duration: 1000,
});
isOk = false;
break;
}
// if (!e.productId) {
// this.$message({
// message: "",
// type: "error",
// duration: 1000,
// });
// isOk = false;
// break;
// }
}
return isOk;
},
@ -526,6 +552,33 @@ export default {
}
return isOk;
},
getnxpriceproductproductIdOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.nxpriceproductproductId))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField) {
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
} else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template = {
paramList: templateJsonList
}
getDataInterfaceRes('551316225821512901', template).then(res => {
let data = res.data
this.nxpriceproductproductIdOptions = data
if (index == -1) return
this.dataForm.nxPriceProductList[index].productIdOptions = data
this.changeDataFormData(2, 'nxPriceProductList', 'productListId', index, [])
})
},
goBack() {
this.$emit("refresh");
},
@ -687,8 +740,11 @@ export default {
addnxpriceproductList() {
let item = {
productId: "",
productListId: "",
recoveryPrice: undefined,
rewardPoints: undefined,
productIdOptions: [],
};
this.getnxpriceproductList(item);
},
@ -706,6 +762,7 @@ export default {
this.dataForm.nxPriceProductList.push(item);
this.childIndex = this.dataForm.nxPriceProductList.length - 1;
this.isEdit = true;
this.getnxpriceproductproductIdOptions()
this.isEdit = false;
this.childIndex = -1;
},
@ -872,6 +929,7 @@ export default {
this.dataAll();
for (let i = 0; i < _dataAll.nxPriceProductList.length; i++) {
this.childIndex = i;
this.getnxpriceproductproductIdOptions()
}
for (let i = 0; i < _dataAll.nxPriceRecycleList.length; i++) {
this.childIndex = i;

@ -54,7 +54,7 @@
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle1()">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()">
</el-button>
@ -559,6 +559,28 @@ export default {
this.listQuery.currentPage = 1;
this.initData();
},
addOrUpdateHandle1(row, isDetail) {
let id = row ? row.id : "";
this.formVisible = true;
this.$nextTick(() => {
request({
url: `/api/scm/NxProduct/getList`,
method: "post",
data: _query,
}).then((res) => {
var _list = res.data.list;
this.list = _list.map((o) => ({
...o,
...this.expandObj,
}));
this.total = res.data.pagination.total;
this.listLoading = false;
});
this.$refs.JNPFForm.init(id, isDetail, this.list);
});
},
addOrUpdateHandle(row, isDetail) {
let id = row ? row.id : "";
this.formVisible = true;

@ -15,8 +15,8 @@ const name = defaultSettings.title || '西夏聚宝' // page title
// For example, Mac: sudo npm run
// You can change the port by the following method:
// port = 3000 npm run dev OR npm run dev --port = 3000
const port = process.env.port || process.env.npm_config_port || 5000 // dev port //生产
// const port = process.env.port || process.env.npm_config_port || 4000 // test port
// const port = process.env.port || process.env.npm_config_port || 5000 // dev port //生产
const port = process.env.port || process.env.npm_config_port || 4000 // test port
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {

Loading…
Cancel
Save