Browse Source

2023-6-2

master
guoxing 2 years ago
parent
commit
1e5b7a57e0
  1. 4
      yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeProcure/oilTypeProcure.js
  2. 354
      yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/business/oilTypeProcure/oilTypeProcureAdd.vue

4
yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeProcure/oilTypeProcure.js

@ -28,7 +28,7 @@ export default {
// 初始化
procureFetchBySid: function(sid) {
return request({
url: '/v1/warehouselocation/getWarehouseBySid/' + sid
url: '/cyf/procurement/getProcurementBySid/' + sid
})
},
@ -52,7 +52,7 @@ export default {
// 新增提交
procureAddSubmitInfo: function(data) {
return request({
url: '/cyf/procurement/save',
url: '/cyf/procurement/submit',
method: 'post',
data: data
});

354
yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/business/oilTypeProcure/oilTypeProcureAdd.vue

@ -1,79 +1,130 @@
<template>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>采购信息</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text">合同编号</span>
<el-input v-model="formobj.orderNumber" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">合同日期</span>
<el-date-picker v-model="formobj.contractSigningDate" type="date" format="yyyy-MM-dd" class="item_input"
value-format="yyyy-MM-dd" placeholder="请选择" />
</div>
<div class="item">
<span class="item_text">供货商名称</span>
<el-select v-model="formobj.supplierName" filterable placeholder="请选择供货商名称" class="item_input"
@change="getSupplier">
<el-option v-for="item in supplierList" :key="item.sid" :label="item.name" :value="item.sid" />
</el-select>
<div class="app-container">
<div>
<div class="tab-header webtop">
<div>采购信息</div>
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submitData">提交</el-button>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" icon="el-icon-close" @click="handleReturn()">关闭</el-button>
</div>
<div class="item">
<span class="item_text">商品名称</span>
<el-select v-model="formobj.crudeName" filterable placeholder="请选择原油名称" class="item_input" @change="getType">
<el-option v-for="item in crudeList" :key="item.sid" :label="item.name" :value="item.sid" />
</el-select>
<!-- <el-input v-model="formobj.number" placeholder="" class="item_input" clearable /> -->
</div>
<div class="item">
<span class="item_text">商品编码</span>
<el-input v-model="formobj.crudeNumber" placeholder="" :readonly="true" class="item_input" clearable />
<!-- <span class="item_input">{{formobj.crudeNumber}}</span> -->
</div>
<div class="item">
<span class="item_text">单位</span>
<el-input v-model="formobj.sss" placeholder="" :readonly="true" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">单价</span>
<el-input v-model="formobj.price" placeholder="" @input="limitInput1($event,'slPrice')" class="item_input"
clearable />
</div>
<div class="item">
<span class="item_text">重量</span>
<el-input v-model="formobj.weight" placeholder="" @input="limitInput2($event,'slPrice')" class="item_input"
clearable />
</div>
<!-- <div class="item" style="margin-top: 70px;">
<span class="item_text">合同材料</span>
<upload class="item_input" ref="uploadImg" v-model="imgList" @change="backData" bucket="map"
:upload-data="{ type: '0001' }"></upload>
</div> -->
</el-card>
</div>
<div class="listconadd">
<el-form ref="dataForm" :model="formobj" label-position="top" label-width="190px" class="formadd">
<div class="titwu">采购信息</div>
<div class="title" style="display: flex;align-items: center;justify-content: space-between;height:40px">
<div>主体信息</div>
</div>
<el-row>
<el-col :span="4" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">合同编号</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="trightb_item">
<!-- <span>{{temp.bankName}}</span> -->
<el-input v-model="formobj.orderNumber" placeholder="" style="width: 80%;" clearable />
</el-form-item>
</el-col>
<el-col :span="4" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">合同日期</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="trightb_item">
<!-- <span>{{temp.bankAbbreviation}}</span> -->
<el-date-picker v-model="formobj.contractSigningDate" type="date" style="width: 80%;"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="请选择" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">供货商名称</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="trightb_item">
<!-- <span>{{temp.province}} - {{temp.city}} - {{temp.county}}</span> -->
<el-select v-model="formobj.supplierName" filterable placeholder="请选择供货商名称" style="width: 80%;"
@change="getSupplier">
<el-option v-for="item in supplierList" :key="item.sid" :label="item.name" :value="item.sid" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" class="trightb">
<el-form-item class="trightb_item">
<span slot="label">到货日期</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="trightb_item">
<!-- <span>{{temp.address}}</span> -->
<el-date-picker v-model="formobj.arrivalDate" type="date" format="yyyy-MM-dd" style="width: 80%;"
value-format="yyyy-MM-dd" placeholder="请选择" />
</el-form-item>
</el-col>
</el-row>
<el-collapse v-model="activeNames">
<el-collapse-item name="1">
<template slot="title">
商品信息<span class="span" @click.stop="add()">添加</span>
</template>
<el-table v-loading="listLoading" :data="formobj.commodityList" border style="width: 100%;"
:row-style="{height: '40px'}">
<!-- <el-table-column type="selection" align="center" width="50"/> -->
<el-table-column label="序号" type="index" width="80" :index="indexMethod" align="center" />
<el-table-column label="操作" wid align="center" width="150">
<template slot-scope="scope">
<!-- <el-button type="primary" size="mini" @click="toPersonnelDetail(scope.row.sid)">查看</el-button> -->
<!-- <el-button type="primary" size="mini" @click="toEdit(scope.row)">编辑</el-button> -->
<el-button type="primary" size="mini" @click="doCommoditylDel(scope.$index)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="crudeName" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.crudeName" filterable placeholder="请选择原油名称"
@change="getType($event,scope.$index)">
<el-option v-for="item in crudeList" :key="item.sid" :label="item.name" :value="item.sid" />
</el-select>
</template>
</el-table-column>
<el-table-column label="商品编码" prop="crudeNumber" align="center" />
<el-table-column label="单位" prop="sss" align="center" />
<el-table-column label="单价" prop="price" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.price" placeholder="" @input="limitInput1($event,scope.$index)"
clearable></el-input>
</template>
</el-table-column>
<el-table-column label="重量" prop="weight" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.weight" placeholder="" @input="limitInput2($event,scope.$index)"
clearable></el-input>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
</el-form>
</div>
</div>
</div>
</template>
<script>
import req from '@/api/oilTypeProcure/oilTypeProcure'
import req2 from '@/api/oilTypeInAndOutBound/oilTypeInAndOutBound'
import req3 from '@/api/supplier/supplier'
import req3 from '@/api/supplier/supplier'
export default {
data() {
return {
@ -82,27 +133,24 @@
crudeList: [],
supplierLists: [],
supplierList: [],
imgList: [],
listLoading: false,
activeNames: ['1'],
formobj: {
sid: "",
orderNumber: "",
contractSigningDate: "",
arrivalDate: "",
supplierSid: "",
supplierName: "",
typeSid: "",
crudeName: "",
crudeNumber: "",
sss: '',
price: "",
weight: "",
type: '1', // 1 2 3
},
commodityList: [],
}
}
},
created() {
this.supplierInfoList()
this.supplierInfoList()
this.crudeinfoList()
},
methods: {
supplierInfoList() {
req3.supplierList().then((res) => {
@ -148,10 +196,10 @@
* 4当第一位输入小数点的时候自动补全补为 0.
* 5除非是小数否则数字不能以0开头
* @param {string} value - 输入的值
* @param {string} name - 匹配的对象属性 [mkPrice | slPrice]
* @param {string} index - 匹配的对象属性 [mkPrice | slPrice]
*/
limitInput1(value, name) {
this.formobj.price =
limitInput1(value, index) {
this.formobj.commodityList[index].price =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
@ -165,17 +213,16 @@
* 4当第一位输入小数点的时候自动补全补为 0.
* 5除非是小数否则数字不能以0开头
* @param {string} value - 输入的值
* @param {string} name - 匹配的对象属性 [mkPrice | slPrice]
* @param {string} index - 匹配的对象属性 [mkPrice | slPrice]
*/
limitInput2(value, name) {
this.formobj.weight =
limitInput2(value, index) {
this.formobj.commodityList[index].weight =
("" + value) //
.replace(/[^\d^\.]+/g, "") //
.replace(/^0+(\d)/, "$1") // 00
.replace(/^\./, "0.") // 0.
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
},
saveOrUpdate() {
console.log(">>>>>>>>>222222", this.formobj)
@ -213,6 +260,23 @@
}
},
submitData() {
console.log(">>>>>>>>>submit", this.formobj)
req.procureAddSubmitInfo(this.formobj)
.then(resp => {
if (resp.success) {
this.$message({
showClose: true,
type: 'success',
message: resp.msg
})
this.handleReturn("true")
} else {
// resp.code
}
})
.catch(() => {})
},
handleReturn(isreload) {
console.log(">>>>>>>>>")
if (isreload === 'true') this.$emit('reloadlist')
@ -227,15 +291,10 @@
sid: "",
orderNumber: "",
contractSigningDate: "",
arrivalDate: "",
supplierSid: "",
supplierName: "",
typeSid: "",
crudeName: "",
crudeNumber: "",
sss: '',
price: "",
weight: "",
type: '1', // 1 2 3
commodityList: [],
}
},
@ -259,77 +318,72 @@
this.formobj.supplierName = choose[0].supplierName
this.formobj.supplierSid = value
},
getType(value) {
getType(value, index) {
console.log(">>>>>>>>>getType", value)
console.log(">>>>>>>>>getType", index)
const choose = this.crudeLists.filter((item) => item.sid === value)
console.log(">>>>>>>>>getType", choose[0])
this.formobj.crudeNumber = choose[0].number
this.formobj.crudeName = choose[0].name
this.formobj.typeSid = value
this.formobj.commodityList[index].crudeNumber = choose[0].number
this.formobj.commodityList[index].crudeName = choose[0].name
this.formobj.commodityList[index].sid = value
},
}
}
</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;
}
.item_input {
flex: 4;
font-size: 16px;
margin-left: 10px;
margin-right: 80px;
}
add() {
this.formobj.commodityList.push({
.item_left_input {
width: 20%;
}
.item_left_text {
height: 30px;
margin-left: 20px;
line-height: 30px;
color: #018AD2;
padding: 0px 15px;
border: 1.5px solid #018AD2;
border-radius: 5px;
})
},
doCommoditylDel(index) {
const tip = '请确认是否删除所选记录?'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.formobj.commodityList.splice(index, 1);
})
},
}
//
indexMethod(index) {
// var pagestart = (this.listQuery.current - 1) * this.listQuery.size
// var pageindex = index + 1 + pagestart
return index + 1
},
.item_right {
flex: 1;
justify-items: center;
}
}
</script>
<style scoped>
.trightb {
display: flex;
align-items: center;
text-align: ;
justify-content: center;
}
.item_right_list_text {
font-size: 16px;
}
.trightb_item {
padding-top: 5px;
}
.item_right_list_delect {
color: #5E94FF;
margin-left: 20px;
font-size: 16px;
text-decoration: underline;
}
}
.span {
margin-left: 50px;
font-size: 15px;
font-weight: 400;
}
}
/deep/ .el-collapse-item__header {
height: 40px;
padding: 10px;
font-weight: bold;
font-size: 20px;
text-align: left;
color: #ffffff;
background-color: #0294d7;
}
/deep/ .el-collapse-item__content {
padding-bottom: 0;
}
</style>

Loading…
Cancel
Save