Browse Source

客户弹窗选择

caojunjie 3 năm trước cách đây
mục cha
commit
eb0e5ab195

+ 43 - 80
src/components/selectComponent/customerSelect.vue

@@ -1,11 +1,26 @@
 <template>
+  <span>
+    <el-select
+        v-model="value"
+        :placeholder="configuration.placeholder"
+        style="width: 80%;border-right: none"
+        :disabled="disabled?disabled:false"
+        :multiple="configuration.multiple"
+        :collapse-tags="configuration.collapseTags">
+      <el-option
+          v-for="item in configuration.dicData.length !== 0?configuration.dicData:dicData"
+          :key="item.id"
+          :label="item.cname"
+          :value="item.id"
+      />
+    </el-select>
+    <el-button icon="el-icon-edit" @click="dialogVisible = true" style="width: 20%"></el-button>
   <el-dialog
       title="导入客户"
       :visible.sync="dialogVisible"
       class="el-dialogDeep"
       append-to-body
       width="80%">
-
     <el-row style="margin-top: -5px;height: 0">
       <el-col :span="5">
         <div class="box">
@@ -23,40 +38,14 @@
                      ref="crud"
                      v-model="form"
                      :page.sync="page"
-                     @row-del="rowDel"
-                     @row-update="rowUpdate"
                      :before-open="beforeOpen"
                      :before-close="beforeClose"
-                     @row-save="rowSave"
                      @search-change="searchChange"
                      @search-reset="searchReset"
                      @refresh-change="refreshChange"
                      @selection-change="selectionChange"
                      @on-load="onLoad"
                      @tree-load="treeLoad">
-            <template slot-scope="scope" slot="menu">
-              <el-button
-                  type="text"
-                  icon="el-icon-view"
-                  size="small"
-                  @click.stop="beforeOpenPage(scope.row,scope.index)"
-              >查看
-              </el-button>
-              <el-button
-                  type="text"
-                  icon="el-icon-edit"
-                  size="small"
-                  @click.stop="editOpen(scope.row,scope.index)"
-              >编辑
-              </el-button>
-              <el-button
-                  type="text"
-                  icon="el-icon-delete"
-                  size="small"
-                  @click.stop="rowDel(scope.row,scope.index)"
-              >删除
-              </el-button>
-            </template>
           </avue-crud>
         </basic-container>
       </el-col>
@@ -66,6 +55,7 @@
       <el-button type="primary" @click="confirmSelection" :disabled="configuration.multipleChoices === true?false:selection.length === 1?false:true">确 定</el-button>
     </span>
   </el-dialog>
+  </span>
 </template>
 
 <script>
@@ -74,11 +64,21 @@ import {customerList, typeSave, deleteDetails, getDeptLazyTree} from "@/api/basi
 
 export default {
   name: "customerInformation",
-  props:['configuration'],
+  props:{
+    disabled:Boolean,
+    value:String,
+    configuration:Object,
+  },
+  model:{
+    prop:'value',
+    event:'returnBack'
+  },
   data() {
     return {
       form: {},
+      dicData:[],
       dialogVisible: false,
+      value:'',
       option: option,
       parentId: 0,
       dataList: [],
@@ -128,7 +128,21 @@ export default {
     },
     //确认导出触发
     confirmSelection(){
-      this.$emit('selectionChange',this.selection)
+      if (this.configuration.multipleChoices === true){
+        let value = []
+        for (let item in this.selection){
+          this.dicData.push({id:this.selection[item].id,cname:this.selection[item].cname})
+          value.push(this.selection[item].id)
+        }
+        this.value = value
+      }else {
+        this.dicData.push({id:this.selection[0].id,cname:this.selection[0].cname})
+        this.value = this.selection[0].id
+      }
+      console.log(this.dicData)
+      console.log(this.value)
+      this.selection = []
+      this.$emit('returnBack',this.value)
       this.dialogVisible = false
     },
     //选中触发
@@ -140,44 +154,6 @@ export default {
       this.page.currentPage = 1;
       this.onLoad(this.page);
     },
-    //删除列表后面的删除按钮触发触发(row, index, done)
-    rowDel(row, index, done) {
-      this.$confirm("确定将选择数据删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        return deleteDetails(row.id);
-      }).then(() => {
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        this.page.currentPage = 1;
-        this.onLoad(this.page, {parentId: 0});
-      });
-    },
-    //修改时的修改按钮点击触发
-    rowUpdate(row, index, done, loading) {
-      typeSave(row).then(() => {
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        // 数据回调进行刷新
-        done(row);
-      }, error => {
-        window.console.log(error);
-        loading();
-      });
-    },
-    //新增修改时保存触发
-    rowSave(row, done, loading) {
-      typeSave(row).then(res => {
-        console.log(res)
-        done()
-      })
-    },
     //查询全部
     initData() {
       customerList().then(res => {
@@ -194,13 +170,6 @@ export default {
       column.addDisabled = true;
       this.$refs.crud.rowAdd();
     },
-    //查看跳转页面
-    beforeOpenPage(row, index) {
-      this.$router.push({
-        path: "/detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
-    },
     //新增跳转页面
     beforeOpen(row, index) {
       this.$router.push({
@@ -208,12 +177,6 @@ export default {
         query: {id: JSON.stringify(row.id)},
       });
     },
-    editOpen(row, index) {
-      this.$router.push({
-        path: "/detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
-    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";

+ 11 - 36
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -22,13 +22,9 @@
           <el-row>
             <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
               <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
-                <!--                <avue-input-tree v-if="item.prop === 'corpsTypeId'"  leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
-                <!--                ></avue-input-tree>-->
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
-                <el-input v-else-if="item.prop === 'corpId'" disabled placeholder="请选择内容" v-model="form.corpName" class="input-with-select">
-                  <el-button slot="append" icon="el-icon-edit" @click="$refs.selectComponent.dialogVisible = true;this.customerDivide = 'corpId'" ></el-button>
-                </el-input>
+                <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
                 <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
               </el-form-item>
             </el-col>
@@ -41,9 +37,7 @@
               <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
-                <el-input v-else-if="item.prop === 'belongToCorpId'" disabled placeholder="请选择内容" v-model="form.corpName" class="input-with-select">
-                  <el-button slot="append" icon="el-icon-edit" @click="$refs.selectComponent.dialogVisible = true;this.customerDivide = 'belongToCorpId'" ></el-button>
-                </el-input>
+                <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="configuration"/>
                 <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
               </el-form-item>
             </el-col>
@@ -398,7 +392,6 @@
         </div>
       </div>
     </el-dialog>
-    <selectComponent :configuration="configuration" ref="selectComponent" @selectionChange="selectCustomer"></selectComponent>
   </div>
 </template>
 
@@ -429,7 +422,11 @@ export default {
     return {
       form: {},
       configuration:{
-        multipleChoices:false
+        multipleChoices:true,
+        multiple:true,
+        collapseTags:true,
+        placeholder:'请点击右边按钮选择',
+        dicData:[]
       },
       data: [],
       dataPolicy: [],
@@ -818,8 +815,8 @@ export default {
               }
             ]
           }, {
-            label: '到货地址',
-            prop: 'arrivalAddress',
+            label: '客户全称',
+            prop: 'corpId',
             rules: [
               {
                 required: true,
@@ -838,8 +835,8 @@ export default {
               }
             ]
           }, {
-            label: '客户全称',
-            prop: 'corpId',
+            label: '到货地址',
+            prop: 'arrivalAddress',
             rules: [
               {
                 required: true,
@@ -910,17 +907,6 @@ export default {
               }
             ]
           }, {
-            label: '信用证到期日',
-            type: 'datetime',
-            prop: 'creditDate',
-            rules: [
-              {
-                required: true,
-                message: ' ',
-                trigger: 'blur'
-              }
-            ]
-          }, {
             label: "订单备注",
             span: 24,
             prop: "orderRemark",
@@ -963,17 +949,6 @@ export default {
     }
   },
   methods: {
-    //选择客户触发
-    selectCustomer(selection){
-      console.log(selection)
-      if (this.customerDivide = 'corpId'){
-        this.$set(this.form,"corpId",selection[0].id)
-        this.$set(this.form,"corpName",selection[0].cname)
-      }else if (this.customerDivide = 'belongToCorpId'){
-        this.$set(this.form,"belongToCorpId",selection[0].id)
-        this.$set(this.form,"belongToCorpName",selection[0].cname)
-      }
-    },
     //点击行可编辑
     handleRowClick(row, event, column) {
       console.log(row.$index)

+ 3 - 4
vue.config.js

@@ -26,11 +26,10 @@ module.exports = {
     proxy: {
       '/api': {
         //本地服务接口地址
-        target: 'http://192.168.1.177',
-        //远程演示服务地址,可用于直接启动项目
-        // target: 'https://saber.bladex.vip/api',
+        target: 'http://192.168.1.177:1080',
         // 打包地址
-        // target: 'http://121.37.83.47:10004',
+        // target: 'http://121.37.83.47:10004',//服务器ip
+        // target: 'http://trade.tubaosoft.com:10004',//服务器域名
         ws: true,
         pathRewrite: {
           '^/api': '/'