Kaynağa Gözat

平台列表添加业务归属+数据共享

LiFei 4 yıl önce
ebeveyn
işleme
fe007e779d

+ 46 - 6
src/views/platmanager/HwPlatformList.vue

@@ -67,6 +67,11 @@
            <a @click="handleDetail(record)">{{record.platformName}}</a>
         </span>
 
+        <span slot="action2" slot-scope="text, record">
+           <a-switch default-checked :defaultChecked="record.isShare==1?true:false" @change="changeIsShare(record)" />{{record.isShare==1?"已开启":"已关闭"}}
+        </span>
+
+
         <span slot="action" slot-scope="text, record">
 
           <a @click="handleEdit(record)" v-has="'require:edit'">编辑</a>
@@ -117,7 +122,17 @@
             align: 'left',
             dataIndex: 'enterpriseName'
           },
-
+          {
+            title:'业务归属',
+            align: 'left',
+            dataIndex: 'businessBelong'
+          },
+          {
+            title: '数据共享开关',
+            dataIndex: 'isShare',
+            align: 'left',
+            scopedSlots: { customRender: 'action2' },
+          },
           {
             title:'状态',
             align: 'left',
@@ -136,6 +151,7 @@
           deleteBatch: "/platmanager/hwPlatform/deleteBatch",
           exportXlsUrl: "/platmanager/hwPlatform/exportXls",
           importExcelUrl: "platmanager/hwPlatform/importExcel",
+          edit: '/platmanager/hwPlatform/edit',
         },
         dictOptions:{
         }
@@ -169,13 +185,37 @@
 
           }
         })
-      }
-    },
+      },
+
+      handleDetail(record){
+        this.$refs.modalForm.view(record);
+        this.$refs.modalForm.title="详情";
+      },
+
+      changeIsShare(record) {
+        this.loading = true
+        var isShare=record.isShare==1?0:1
+        record.isShare=isShare
+        let url = this.url.edit
+        putAction(url, record).then(data => {
+          if (data.success) {
+            this.loadData
+
+          }
+          if (data.code === 510) {
+            this.$message.warning(res.message)
+          }
+          this.loading = false
+        })
+      },
+
 
-    handleDetail(record){
-      this.$refs.modalForm.view(record);
-      this.$refs.modalForm.title="详情";
     },
+
+
+
+
+
   }
 </script>
 <style scoped>

+ 51 - 4
src/views/platmanager/modules/HwPlatformModal.vue

@@ -61,7 +61,10 @@
           <a-input v-decorator="[ 'contactPhone', validatorRules.contactPhone]" placeholder="请输入联系电话"></a-input>
         </a-form-item>
 
-
+        <a-form-item label="业务归属" :labelCol="labelCol" :wrapperCol="wrapperCol">
+          <a-select type="list" v-decorator="['businessBelongId',validatorRules.businessBelongId]" :trigger-change="true" @change="changeBelong"
+                    :options="selectOption.options" placeholder="选择业务归属" style="width: 100%" :disabled="isDisabled"/>
+        </a-form-item>
 
 
 
@@ -78,7 +81,7 @@
 
 <script>
 
-  import { httpAction } from '@/api/manage'
+  import { httpAction,putAction } from '@/api/manage'
   import pick from 'lodash.pick'
   import JDate from '@/components/jeecg/JDate'
   import JDictSelectTag from '@/components/dict/JDictSelectTag'
@@ -87,6 +90,8 @@
   import { duplicateCheck } from '@/api/api'
   import Vue from 'vue'
   import { ACCESS_TOKEN } from '@/store/mutation-types'
+  // 引入搜索服务商弹出框的组件
+  const findList = (params) => putAction('/platmanager/hwPlatform/applicationSubList', params)
 
   export default {
     name: 'HwPlatformModal',
@@ -96,6 +101,12 @@
     },
     data() {
       return {
+        selectOption: {
+          options: [
+
+          ]
+        },
+        isDisabled:false,
         disableSubmit:false,
         arr:[],  //存放回显默认省市区code
         provArray: [], //存放省
@@ -144,7 +155,8 @@
           isDataShare: { rules: [{ required: true, message: '请输入是否数据共享' }] },
           startDate: { rules: [{ required: true, message: '请输入开始时间!' }] },
           endDate: { rules: [{ required: true, message: '请输入结束时间!' }] },
-          status: { rules: [{ required: true, message: '请输入状态' }] }
+          status: { rules: [{ required: true, message: '请输入状态' }] },
+          businessBelongId:{ rules: [{ required: true, message: '请选择业务归属' }] }
         },
         url: {
           add: '/platmanager/hwPlatform/add',
@@ -208,14 +220,16 @@
         this.edit({})
       },
       edit(record) {
+        this.isDisabled=false;
         this.form.resetFields()
         this.model = Object.assign({}, record)
+        this.querySubcontratorList()
         if (record.hasOwnProperty('id')) {
           this.picUrl = 'Has no pic url yet'
         }
         this.visible = true
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model, 'id','platformName', 'enterpriseName', 'provinceCode', 'cityCode', 'countryCode', 'provinceCityCountry', 'address', 'contactPerson', 'contactPhone', 'isDataShare', 'startDate', 'endDate', 'status','dutyParagraph','businessLicense'))
+          this.form.setFieldsValue(pick(this.model, 'id','platformName', 'enterpriseName', 'provinceCode','businessBelongId','businessBelong','isShare', 'cityCode', 'countryCode', 'provinceCityCountry', 'address', 'contactPerson', 'contactPhone', 'isDataShare', 'startDate', 'endDate', 'status','dutyParagraph','businessLicense'))
           this.form.setFieldsValue({ status:this.model.status!=null? String(this.model.status):''})
         })
         //回显省市区
@@ -357,6 +371,39 @@
         return this.url.imgerver + this.model.businessLicense
       },
 
+      changeBelong(val){
+        this.model.businessBelongId=val
+        for (let i = 0; i < this.selectOption.options.length ; i++) {
+          if(val==this.selectOption.options[i].value){
+            this.model.businessBelong=this.selectOption.options[i].label
+          }
+        }
+      },
+
+      //查询慧盈配置
+      querySubcontratorList() {
+        findList({}).then((res) => {
+          if (res.success) {
+            this.selectOption.options=[]
+            this.form.setFieldsValue({businessBelongId:null})
+            for(let i = 0;i<res.result.length;i++){
+              if(res.result[i].cpType==2){
+                this.selectOption.options.push({label: res.result[i].abbreviation, value:res.result[i].id })
+                if(this.model.businessBelongId){
+                  this.isDisabled=true
+                  this.$nextTick(() => {
+                    this.form.setFieldsValue({ businessBelongId:this.model.businessBelongId})
+                  })
+                }
+              }
+            }
+          }
+        })
+      },
+
+
+
+
     }
   }
 </script>