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

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

@ -1,140 +1,281 @@
<template> <template>
<div> <div>
<div class="tab-header webtop"> <div class="tab-header webtop">
<!-- 标题 --> <!-- 标题 -->
<div>{{ viewTitle }}</div> <div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 --> <!-- start 添加修改按钮 -->
<div> <div>
<el-button type="primary" size="small" @click="saveOrUpdate">保存</el-button> <el-button type="primary" size="small" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</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>
<!-- 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> </div>
</template>
</div>
<script> </template>
export default {
data() { <script>
return { export default {
submitdisabled: false, data() {
disabledCode: false, return {
locationForm: { submitdisabled: false,
barCode: "", disabledCode: false,
name: "", locationForm: {
anotherName: "", barCode: "",
value: "", name: "",
netWeight: "", anotherName: "",
roughWeight: "", code: "系统自动排序生成",
effectiveDays: "", value: "",
remarks: "", netWeight: "",
}, roughWeight: "",
viewTitle: "【新增】产品信息", 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() { saveOrUpdate() {
if (this.viewTitle === "【新增】产品信息") return this.addProduct() if (this.viewTitle === "【新增】产品信息") return this.addProduct()
if (this.viewTitle === "【修改】产品信息") { if (this.viewTitle === "【修改】产品信息") {
this.updataProduct() this.updataProduct()
} }
}, },
handleReturn(isreload) { handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist') if (isreload === 'true') this.$emit('reloadlist')
this.clearList() this.clearList()
this.$emit('doback') this.$emit('doback')
}, },
showAdd() { showAdd() {
this.viewTitle = "【新增】产品信息"; this.viewTitle = "【新增】产品信息";
this.disabledCode=false this.disabledCode = false
this.clearList() this.clearList()
}, },
clearList(){ clearList() {
this.locationForm = { this.locationForm = {
barCode: "", barCode: "",
name: "", name: "",
anotherName: "", anotherName: "",
value: "", value: "",
netWeight: "", code:"系统自动排序生成",
roughWeight: "", netWeight: "",
effectiveDays: "", roughWeight: "",
remarks: "", effectiveDays: "",
} remarks: "",
}, brandSid: "",
showEdit(row) { categoryA: "",
console.log(row); categoryAsid: "",
this.viewTitle = "【修改】产品信息"; categoryB: "",
this.disabledCode=true categoryBsid: "",
this.locationForm=row categoryC: "",
}, categorySid: "",
async updataProduct () { }
// this.locationForm = { },
// name: "", showEdit(row) {
// anotherName: "", console.log(row);
// } this.viewTitle = "【修改】产品信息";
const { data: result } = await this.$http.put('/product/updataProduct', this.locationForm) this.disabledCode = true
if (result.status !== 200) return this.$message.error('更新数据失败') this.locationForm = row
this.$message.success('更新成功') },
this.handleReturn('true') async updataProduct() {
},
async addProduct () { console.log("updataProduct", this.locationForm)
const { data: result } = await this.$http.post('/product/addProduct', this.locationForm)
if (result.status !== 200) return this.$message.error('添加产品失败') const {
this.$message.success('添加产品成功') data: result
this.handleReturn('true') } = await this.$http.put('/product/updataProduct', this.locationForm)
}, if (result.status !== 200) return this.$message.error('更新数据失败')
createBarCode () { this.$message.success('更新成功')
var now = new Date() this.handleReturn('true')
var nowstr = now.getTime() },
this.locationForm.barCode = 'P' + now.getTime() async addProduct() {
}, console.log("addProduct", this.locationForm)
limitInput1(value, index) { 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 = this.locationForm.value =
("" + value) // ("" + value) //
.replace(/[^\d^\.]+/g, "") // .replace(/[^\d^\.]+/g, "") //
@ -142,7 +283,7 @@
.replace(/^\./, "0.") // 0. .replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02 .match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
}, },
limitInput2(value, index) { limitInput2(value, index) {
this.locationForm.netWeight = this.locationForm.netWeight =
("" + value) // ("" + value) //
.replace(/[^\d^\.]+/g, "") // .replace(/[^\d^\.]+/g, "") //
@ -150,7 +291,7 @@
.replace(/^\./, "0.") // 0. .replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02 .match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
}, },
limitInput3(value, index) { limitInput3(value, index) {
this.locationForm.roughWeight = this.locationForm.roughWeight =
("" + value) // ("" + value) //
.replace(/[^\d^\.]+/g, "") // .replace(/[^\d^\.]+/g, "") //
@ -158,7 +299,7 @@
.replace(/^\./, "0.") // 0. .replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02 .match(/^\d*(\.?\d{0,4})/g)[0] || ""; // 02
}, },
limitInput4(value, index) { limitInput4(value, index) {
this.locationForm.effectiveDays = this.locationForm.effectiveDays =
("" + value) // ("" + value) //
.replace(/[^\d^\.]+/g, "") // .replace(/[^\d^\.]+/g, "") //
@ -166,75 +307,76 @@
.replace(/^\./, "0.") // 0. .replace(/^\./, "0.") // 0.
.match(/^\d*(\d{0,0})/g)[0] || ""; // 02 .match(/^\d*(\d{0,0})/g)[0] || ""; // 02
}, },
}
} }
</script> }
<style lang="scss"> </script>
.box-card { <style lang="scss">
margin-left: 60px; .box-card {
margin-right: 60px; margin-left: 60px;
min-width: 70%; margin-right: 60px;
margin-top: 20px; 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;
}
.item_input { .item {
flex: 4; display: flex;
font-size: 16px; flex-direction: row;
margin-left: 10px; align-items: center;
margin-right: 80px; margin-top: 15px;
} height: 40px;
.item_inputs { line-height: 40px;
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 28px;
}
.item_left_input { .item_text {
width: 20%; flex: 0.8;
} font-size: 18px;
text-align: right;
}
.item_left_text { .item_input {
height: 30px; flex: 4;
margin-left: 20px; font-size: 16px;
line-height: 30px; margin-left: 10px;
color: #018AD2; margin-right: 80px;
padding: 0px 15px; }
border: 1.5px solid #018AD2;
border-radius: 5px;
} .item_inputs {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 28px;
}
.item_right { .item_left_input {
flex: 1; width: 20%;
justify-items: center; }
.item_right_list_text { .item_left_text {
font-size: 16px; 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; .item_right {
font-size: 16px; flex: 1;
text-decoration: underline; 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