123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
- <!-- 添加货权转移实绩 -->
- <div class="shipTransport">
- <page-title>返回</page-title>
- <!-- 物资 -->
- <!-- <div class="mofrom">
- <span class="motext">物资</span>
- <el-input class="moinput" v-model="materialName" disabled> </el-input>
- <el-button class="mobutton" type="primary" @click="ondrawer(1)">浏览</el-button>
- </div> -->
- <div class="mofrom">
- <span class="motext">收货人</span>
- <el-input class="moinput" v-model="receiver" disabled> </el-input>
- <el-button class="mobutton" type="primary" @click="ondrawer(3)">浏览</el-button>
- </div>
- <div class="form">
- <div class="form_box">
- <dil-form :formId="137" v-model="form1"></dil-form>
- </div>
- </div>
- <!-- 模态框 -->
- <el-drawer
- :visible.sync="drawer"
- :direction="direction"
- size="50%"
- >
- <el-input
- placeholder="请输入内容"
- v-model="input"
- style="margin-top: 10px; margin-left: 20px; width:250px"
- clearable
- >
- </el-input>
- <el-button
- type="primary"
- class="btn"
- @click="onclick(a)"
- style="margin-bottom: 15px"
- >
- <i class="el-icon-search"></i>查询
- </el-button>
- <div v-show="a == 1">
- <dilTable
- v-bind.sync="second"
- @radio-change="currentRadioChange1"
- ></dilTable>
- </div>
- <div v-show="a == 2">
- <dilTable
- v-bind.sync="second1"
- @radio-change="currentRadioChange2"
- ></dilTable>
- </div>
- <div v-show="a == 3">
- <dilTable
- v-bind.sync="second2"
- @radio-change="currentRadioChange3"
- ></dilTable>
- </div>
- </el-drawer>
- <!-- 确定和取消 -->
- <div class="button_box">
- <el-button @click="onClickCancel">返回</el-button>
- <el-button type="primary" @click="onClickConfirm">确认</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- export default {
- components: { PageTitle },
- data(){
- return {
- form1: {},
- materialName:"",
- receiver:"",
- drawer: false,
- direction: "rtl",
- input: "",
- second: {
- requestUrl: "/api/v1/uc/queryMaterialByLike?apiId=244",
- selectionType: "radio",
- mapList1: [],
- },
- second1: {
- requestUrl: "/api/v1/tms/selectShippeByName?apiId=215",
- selectionType: "radio",
- mapList2: [],
- },
- second2: {
- requestUrl: "/api/v1/tms/getGroupList?apiId=217",
- selectionType: "radio",
- mapList3: [],
- },
- }
- },
- mounted() {
- this.information();
- },
- methods: {
- onclick(a) {
- console.log(a);
- if (a == 1) {
- this.second.requestUrl =
- "/api/v1/uc/queryMaterialByLike?apiId=244&index=" + this.input;
- } else if (a == 2) {
- this.second1.requestUrl =
- "/api/v1/tms/selectShippeByName?apiId=215&con=" + this.input;
- } else {
- this.second2.requestUrl =
- "/api/v1/tms/getGroupList?apiId=217&con=" + this.input;
- }
-
- },
- ondrawer(num) {
- this.drawer = true;
- this.a = num;
- // 清空当前输入框中的数据
- this.input = "";
- },
- currentRadioChange1(selection) {
- (this.second.mapList1 = selection),
- (this.materialName = selection.materialName);
- },
- currentRadioChange2(selection) {
- (this.second1.mapList2 = selection), (this.cargo = selection.portName);
- },
- currentRadioChange3(selection) {
- (this.second2.mapList3 = selection), (this.receiver = selection.pierName);
- },
- information() {
- //编辑货权转移
- this.axios
- .post("/api/v1/tms/selectByCargoTranferResultId/" + this.$route.params.cargoTransferResultId)
- .then((res) => {
- console.log("res",res)
- this.form1 = res.data.data
- this.materialName = res.data.data.materialName;
- this.receiver = res.data.data.receiver;
- });
- },
- // 确认
- onClickConfirm() {
- let AmsshipCargoTransferResult = {
- cargoTransferResultId: this.$route.params.cargoTransferResultId,
- carrierId: this.form1.carrierId,
- groupId: this.form1.groupId,
- resultTelephoneFax: this.form1.resultTelephoneFax,
- resultContactPerson:this.form1.resultContactPerson,
- batchId:this.form1.batchId,
- resultNumberOfLoans: this.form1.resultNumberOfLoans,
- resultFreignForwardingInfo: this.form1.resultFreignForwardingInfo,
- resultMemo: this.form1.resultMemo,
- foreignShipName: this.form1.foreignShipName,
- materialId: this.second.mapList1.materialId,
- };
- //判断放货数量是否为数字
- function isNumber() {
- var value = AmsshipCargoTransferResult.resultNumberOfLoans;
- //验证是否为数字
- var patrn = /^(-)?\d+(\.\d+)?$/;
- if (patrn.exec(value) == null || value == "") {
- return false;
- } else {
- return true;
- }
- }
- //判断是否为电话号码
- function isTelePhone() {
- var value2 = AmsshipCargoTransferResult.resultTelephoneFax;
- //验证是否为数字
- var patrn = /^1[3-9]\d{9}$/;
- // var patrn2 = /^(\d{3,4}-)?\d{7,8}$/;
- if (patrn.exec(value2) == null || value2 == "") {
- return false;
- } else {
- return true;
- }
- }
- //电话号码赋值
- var val2=this.value2;
- var val = this.value;
- if (
- AmsshipCargoTransferResult.foreignShipName == null ||
- AmsshipCargoTransferResult.resultNumberOfLoans == null ||
- AmsshipCargoTransferResult.resultContactPerson == null ||
- AmsshipCargoTransferResult.resultTelephoneFax == null
- )
- this.$message.error("存在空值!");
- else if (!isNumber(val)) this.$message.warning("放货数量必须为数字");
- else if (!isTelePhone(val2)) this.$message.warning("电话号码或传真格式不正确");
- else this.axios
- .post("/api/v1/tms/editCargoTransferResult" ,
- AmsshipCargoTransferResult
- )
- .then(() => {
- this.$message({
- type: "success",
- message: "修改成功!",
- });
- this.$router.go(-1);
- });
- },
- // 返回
- onClickCancel() {
- this.$router.go(-1);
- },
- },
- };
- </script>
- <style lang="scss">
- .shipTransport{
- .mofrom {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 5px;
- margin-bottom: 20px;
- .motext{
- width: 70px;
- }
- .moinput{
- width: 250px;
- }
- .mobutton{
- margin-left: 5px;
- }
- }
- .form{
- display: flex;
- .form_box{
- width: 320px;
- margin-left: 35%;
- margin-top: 30px;
- margin-right: 20px;
- .el-form{
- .preview-group{
- .el-form-item{
- .el-form-item__label{
- display: inline-block;
- width: 70px !important;
- }
- .el-form-item__content{
- .el-select{
- width: 250px;
- }
- .el-input{
- width: 250px;
- }
- }
- }
- }
- }
- }
- }
- .button_box{
- margin-left: 45%;
- }
- }
- </style>
|