Browse Source

Merge remote-tracking branch 'origin/master'

master
wangpengfei 2 years ago
parent
commit
2c16507289
  1. 12
      warehousing-system/project_web_ui-xxs/src/views/classification/classManagementInfo.vue
  2. 516
      warehousing-system/project_web_ui-xxs/src/views/component/initial_value/add/productAdd.vue

12
warehousing-system/project_web_ui-xxs/src/views/classification/classManagementInfo.vue

@ -30,10 +30,10 @@
<td>
<el-input v-model="form.categorys" style="width:100%"></el-input>
</td>
<td>类别编码</td>
<!-- <td>类别编码</td>
<td>
<el-input v-model="form.category_key" style="width:100%"></el-input>
</td>
<el-input v-model="form.category_key" oninput="value=value.replace(/[^\d.]/g,'')" maxlength="6" style="width:100%"></el-input>
</td> -->
</tr>
</table>
@ -92,10 +92,10 @@
<td>
<el-input v-model="form.categorys" style="width:100%"></el-input>
</td>
<td>类别编码</td>
<!-- <td>类别编码</td>
<td>
<el-input v-model="form.category_key" style="width:100%"></el-input>
</td>
<el-input v-model="form.category_key" oninput="value=value.replace(/[^\d.]/g,'')" maxlength="6" style="width:100%"></el-input>
</td> -->
</tr>
</table>

516
warehousing-system/project_web_ui-xxs/src/views/component/initial_value/add/productAdd.vue

@ -1,140 +1,281 @@
<template>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text">条码</span>
<el-input v-model="locationForm.barCode" placeholder="" class="item_input" clearable />
<!-- <el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">随机</el-button>-->
</div>
<div class="item">
<span class="item_text">商品名</span>
<el-input v-model="locationForm.name" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">别名</span>
<el-input v-model="locationForm.anotherName" class="item_input" clearable></el-input>
</div>
<div class="item">
<span class="item_text">价值</span>
<el-input v-model="locationForm.value" class="item_input" @input="limitInput1($event)" clearable></el-input>
</div>
<div class="item">
<span class="item_text">净重</span>
<el-input v-model="locationForm.netWeight" class="item_input" @input="limitInput2($event)" clearable></el-input>
</div>
<div class="item">
<span class="item_text">毛重</span>
<el-input v-model="locationForm.roughWeight" class="item_input" @input="limitInput3($event)" clearable></el-input>
</div>
<div class="item">
<span class="item_text">有效天数</span>
<el-input v-model="locationForm.effectiveDays" class="item_input" @input="limitInput4($event)" clearable></el-input>
</div>
<div class="item">
<span class="item_text">备注</span>
<el-input v-model="locationForm.remarks" class="item_input" clearable></el-input>
</div>
</el-card>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text">条码</span>
<el-input v-model="locationForm.barCode" placeholder="" class="item_input" clearable />
<!-- <el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">随机</el-button>-->
</div>
<div class="item">
<span class="item_text">商品名</span>
<el-input v-model="locationForm.name" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">别名</span>
<el-input v-model="locationForm.anotherName" class="item_input" clearable></el-input>
</div>
<div class="item">
<span class="item_text">编码</span>
<el-input v-model="locationForm.code" :disabled="true" class="item_input" clearable></el-input>
</div>
<div class="item">
<span class="item_text">品牌</span>
<el-select v-model="locationForm.brand" @change="selectBrand" class="item_input" placeholder="请选择">
<el-option v-for="(item,i) in brandList" :key="i" :label="item.dictValue" :value="item.sid">
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">一级类别</span>
<el-select v-model="locationForm.categoryY" @change="selectCategoryA" class="item_input" placeholder="请选择">
<el-option v-for="(item,i) in categoryAList" :key="i" :label="item.categorys" :value="item.sid">
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">二级类别</span>
<el-select v-model="locationForm.categoryR" @change="selectCategoryB" class="item_input" placeholder="请选择">
<el-option v-for="(item,i) in categoryBList" :key="i" :label="item.categorys" :value="item.sid">
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">三级类别</span>
<el-select v-model="locationForm.category" @change="selectCategoryC" class="item_input" placeholder="请选择">
<el-option v-for="(item,i) in categoryCList" :key="i" :label="item.categorys" :value="item.sid">
</el-option>
</el-select>
</div>
<div class="item">
<span class="item_text">价值</span>
<el-input v-model="locationForm.value" class="item_input" @input="limitInput1($event)" clearable></el-input>
</div>
<div class="item">
<span class="item_text">净重</span>
<el-input v-model="locationForm.netWeight" class="item_input" @input="limitInput2($event)"
clearable></el-input>
</div>
<div class="item">
<span class="item_text">毛重</span>
<el-input v-model="locationForm.roughWeight" class="item_input" @input="limitInput3($event)"
clearable></el-input>
</div>
<div class="item">
<span class="item_text">有效天数</span>
<el-input v-model="locationForm.effectiveDays" class="item_input" @input="limitInput4($event)"
clearable></el-input>
</div>
<div class="item">
<span class="item_text">备注</span>
<el-input v-model="locationForm.remarks" class="item_input" clearable></el-input>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
submitdisabled: false,
disabledCode: false,
locationForm: {
barCode: "",
name: "",
anotherName: "",
value: "",
netWeight: "",
roughWeight: "",
effectiveDays: "",
remarks: "",
},
viewTitle: "【新增】产品信息",
</div>
</template>
<script>
export default {
data() {
return {
submitdisabled: false,
disabledCode: false,
locationForm: {
barCode: "",
name: "",
anotherName: "",
code: "系统自动排序生成",
value: "",
netWeight: "",
roughWeight: "",
effectiveDays: "",
remarks: "",
brand:"",
brandSid: "",
categoryY: "",
categorySidY: "",
categoryR: "",
categorySidR: "",
category: "",
categorySid: "",
},
viewTitle: "【新增】产品信息",
brandList: [],
categoryAList: [],
categoryBList: [],
categoryCList: [],
categoryPSid: "1" // sid
}
},
created() {
this.getBrandList()
this.getCategoryList("1")
},
methods: {
async getBrandList() {
const {
data: result
} = await this.$http.post('/v1/restrictedbrand/brandList', '')
if (result.code == 200) {
console.log("getBrandList", result.data)
this.brandList = result.data
}
},
created() {
async getCategoryList(type) {
const {
data: result
} = await this.$http.get('/v1/restrictedcategory/categoryListByPsid/' + this.categoryPSid, this.categoryPSid)
if (result.code == 200) {
console.log("getCategoryList", result.data)
if ('1' == type) {
this.categoryAList = result.data
}
if ('2' == type) {
this.categoryBList = result.data
}
if ('3' == type) {
this.categoryCList = result.data
}
// this.brandList = result.data
}
},
selectBrand(value) {
console.log("selectBrand", value)
this.locationForm.brandSid = value
console.log("selectBrand", this.locationForm.brandSid)
},
selectCategoryA(value) {
this.categoryBList = []
this.categoryCList = []
this.locationForm.categoryR = ''
this.locationForm.categorySidR = ''
this.locationForm.category = ''
this.locationForm.categorySid = ''
this.categoryPSid = value
this.locationForm.categoryAsid = value
this.getCategoryList("2")
console.log("categoryPSid", this.categoryPSid)
console.log("selectCategoryA", value)
},
selectCategoryB(value) {
this.categoryCList = []
this.locationForm.category = ''
this.locationForm.categorySid = ''
this.categoryPSid = value
this.locationForm.categoryBsid = value
this.getCategoryList("3")
console.log("categoryPSid", this.categoryPSid)
console.log("selectCategoryB", value)
},
selectCategoryC(value) {
console.log("selectCategoryC", value)
this.locationForm.categorySid = value
},
methods: {
saveOrUpdate() {
if (this.viewTitle === "【新增】产品信息") return this.addProduct()
if (this.viewTitle === "【修改】产品信息") {
this.updataProduct()
saveOrUpdate() {
if (this.viewTitle === "【新增】产品信息") return this.addProduct()
if (this.viewTitle === "【修改】产品信息") {
this.updataProduct()
}
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.clearList()
this.$emit('doback')
},
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.clearList()
this.$emit('doback')
},
showAdd() {
this.viewTitle = "【新增】产品信息";
this.disabledCode=false
this.clearList()
},
clearList(){
showAdd() {
this.viewTitle = "【新增】产品信息";
this.disabledCode = false
this.clearList()
},
clearList() {
this.locationForm = {
barCode: "",
name: "",
anotherName: "",
value: "",
netWeight: "",
roughWeight: "",
effectiveDays: "",
remarks: "",
}
},
showEdit(row) {
console.log(row);
this.viewTitle = "【修改】产品信息";
this.disabledCode=true
this.locationForm=row
},
async updataProduct () {
// this.locationForm = {
// name: "",
// anotherName: "",
// }
const { data: result } = await this.$http.put('/product/updataProduct', this.locationForm)
if (result.status !== 200) return this.$message.error('更新数据失败')
this.$message.success('更新成功')
this.handleReturn('true')
},
async addProduct () {
const { data: result } = await this.$http.post('/product/addProduct', this.locationForm)
if (result.status !== 200) return this.$message.error('添加产品失败')
this.$message.success('添加产品成功')
this.handleReturn('true')
},
createBarCode () {
var now = new Date()
var nowstr = now.getTime()
this.locationForm.barCode = 'P' + now.getTime()
},
limitInput1(value, index) {
barCode: "",
name: "",
anotherName: "",
value: "",
code:"系统自动排序生成",
netWeight: "",
roughWeight: "",
effectiveDays: "",
remarks: "",
brandSid: "",
categoryA: "",
categoryAsid: "",
categoryB: "",
categoryBsid: "",
categoryC: "",
categorySid: "",
}
},
showEdit(row) {
console.log(row);
this.viewTitle = "【修改】产品信息";
this.disabledCode = true
this.locationForm = row
},
async updataProduct() {
console.log("updataProduct", this.locationForm)
const {
data: result
} = await this.$http.put('/product/updataProduct', this.locationForm)
if (result.status !== 200) return this.$message.error('更新数据失败')
this.$message.success('更新成功')
this.handleReturn('true')
},
async addProduct() {
console.log("addProduct", this.locationForm)
const {
data: result
} = await this.$http.post('/product/addProduct', this.locationForm)
if (result.status !== 200) return this.$message.error('添加产品失败')
this.$message.success('添加产品成功')
this.handleReturn('true')
},
createBarCode() {
var now = new Date()
var nowstr = now.getTime()
this.locationForm.barCode = 'P' + now.getTime()
},
limitInput1(value, index) {
this.locationForm.value =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
@ -142,7 +283,7 @@
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
},
limitInput2(value, index) {
limitInput2(value, index) {
this.locationForm.netWeight =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
@ -150,7 +291,7 @@
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
},
limitInput3(value, index) {
limitInput3(value, index) {
this.locationForm.roughWeight =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
@ -158,7 +299,7 @@
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
},
limitInput4(value, index) {
limitInput4(value, index) {
this.locationForm.effectiveDays =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
@ -166,75 +307,76 @@
.replace(/^\./, "0.") // 0.
.match(/^\d*(\d{0,0})/g)[0] || ""; // 02
},
}
}
</script>
<style lang="scss">
.box-card {
margin-left: 60px;
margin-right: 60px;
min-width: 70%;
margin-top: 20px;
.item {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 15px;
height: 40px;
line-height: 40px;
.item_text {
flex: 0.8;
font-size: 18px;
text-align: right;
}
}
</script>
<style lang="scss">
.box-card {
margin-left: 60px;
margin-right: 60px;
min-width: 70%;
margin-top: 20px;
.item_input {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 80px;
}
.item_inputs {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 28px;
}
.item {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 15px;
height: 40px;
line-height: 40px;
.item_left_input {
width: 20%;
}
.item_text {
flex: 0.8;
font-size: 18px;
text-align: right;
}
.item_left_text {
height: 30px;
margin-left: 20px;
line-height: 30px;
color: #018AD2;
padding: 0px 15px;
border: 1.5px solid #018AD2;
border-radius: 5px;
.item_input {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 80px;
}
}
.item_inputs {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 28px;
}
.item_right {
flex: 1;
justify-items: center;
.item_left_input {
width: 20%;
}
.item_right_list_text {
font-size: 16px;
}
.item_left_text {
height: 30px;
margin-left: 20px;
line-height: 30px;
color: #018AD2;
padding: 0px 15px;
border: 1.5px solid #018AD2;
border-radius: 5px;
.item_right_list_delect {
color: #5E94FF;
margin-left: 20px;
font-size: 16px;
text-decoration: underline;
}
}
.item_right {
flex: 1;
justify-items: center;
.item_right_list_text {
font-size: 16px;
}
.item_right_list_delect {
color: #5E94FF;
margin-left: 20px;
font-size: 16px;
text-decoration: underline;
}
}
}
</style>
}
</style>

Loading…
Cancel
Save