1004749546@qq.com 4 năm trước cách đây
mục cha
commit
151e62b558
1 tập tin đã thay đổi với 101 bổ sung100 xóa
  1. 101 100
      src/views/tenants/tenantsModal.vue

+ 101 - 100
src/views/tenants/tenantsModal.vue

@@ -14,12 +14,13 @@
               />
             </a-form-item>
           </a-col>
-          <a-col :span="12">
-            <!-- 企业编码 -->
+          <!-- 企业编码 -->
+          <!-- 本次迭代先隐藏 -->
+          <!-- <a-col :span="12">
             <a-form-item label="企业编码:" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
               <a-input allowClear :maxLength="30" v-decorator="['formData.bizCode', { initialValue: formData.bizCode,getValueFromEvent: $filterEmpty }]" placeholder="请输入企业编码" />
             </a-form-item>
-          </a-col>
+          </a-col> -->
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
@@ -72,7 +73,7 @@
             </a-form-item>
           </a-col>
         </a-row>
-        <a-row :gutter="24">
+        <a-row>
           <a-col :span="12">
             <!-- 使用权限 -->
             <a-form-item label="使用权限:" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
@@ -128,9 +129,9 @@
 </template>
 
 <script>
-import { STable, VSelect } from '@/components';
-import { getProvince, getCityByPro, getDistrictByCity, tenantsDetail, tenantsSave } from '@/api/tenants.js';
-import moment from 'moment';
+import { STable, VSelect } from '@/components'
+import { getProvince, getCityByPro, getDistrictByCity, tenantsDetail, tenantsSave } from '@/api/tenants.js'
+import moment from 'moment'
 export default {
   name: 'TenantsModal',
   components: {
@@ -149,20 +150,20 @@ export default {
     }
   },
   watch: {
-    visible(newValue, oldValue) {
-      this.isshow = newValue;
+    visible (newValue, oldValue) {
+      this.isshow = newValue
     },
-    isshow(newValue, oldValue) {
+    isshow (newValue, oldValue) {
       if (newValue) {
         if (this.itemId) {
-          this.getDetail(this.itemId);
+          this.getDetail(this.itemId)
         }
       } else {
-        this.cancel();
+        this.cancel()
       }
     }
   },
-  data() {
+  data () {
     return {
       moment,
       isshow: this.visible,
@@ -185,26 +186,26 @@ export default {
         addrDistrict: undefined,
         addrDetail: '' // 详细地址
       }
-    };
+    }
   },
   computed: {
-    titleText() {
-      return this.itemId ? '编辑' : '新增';
+    titleText () {
+      return this.itemId ? '编辑' : '新增'
     }
   },
-  mounted() {
-    this.getProvinceList();
+  mounted () {
+    this.getProvinceList()
   },
   methods: {
-    cancel(e) {
-      this.clear();
-      this.$emit('close');
+    cancel (e) {
+      this.clear()
+      this.$emit('close')
     },
     // 不可选日期 今天以前日期不可选
-    disabledDate(current) {
-      return current && current.valueOf() < Date.now() - 86400000;
+    disabledDate (current) {
+      return current && current.valueOf() < Date.now() - 86400000
     },
-    pageInit() {
+    pageInit () {
       this.formData = {
         name: '', // 企业名称
         bizCode: '', // 企业编码
@@ -217,161 +218,161 @@ export default {
         addrCity: undefined,
         addrDistrict: undefined,
         addrDetail: '' // 详细地址
-      };
+      }
     },
     // 查详情
-    getDetail(id) {
+    getDetail (id) {
       tenantsDetail({ id: id }).then(res => {
         // console.log(res, 'rrrrrrr')
         if (res.status == 200) {
-          this.formData = Object.assign(this.formData, res.data);
-          const now = moment().add(7, 'day').format('YYYY-MM-DD');
-          const expireDate = moment(now, 'YYYY-MM-DD');
-          this.formData.expireDate = this.formData.expireDate ? moment(this.formData.expireDate, 'YYYY-MM-DD') : expireDate;
-          this.form.setFields({ 'formData.expireDate': { value: this.formData.expireDate, errors: '' } });
-          this.formData.status = Number(this.formData.status);
-          console.log(this.formData, 'this.formData');
+          this.formData = Object.assign(this.formData, res.data)
+          const now = moment().add(7, 'day').format('YYYY-MM-DD')
+          const expireDate = moment(now, 'YYYY-MM-DD')
+          this.formData.expireDate = this.formData.expireDate ? moment(this.formData.expireDate, 'YYYY-MM-DD') : expireDate
+          this.form.setFields({ 'formData.expireDate': { value: this.formData.expireDate, errors: '' } })
+          this.formData.status = Number(this.formData.status)
+          console.log(this.formData, 'this.formData')
         }
-      });
+      })
     },
     // 获取省列表'
-    getProvinceList() {
+    getProvinceList () {
       getProvince().then(res => {
         // console.log(res, 'rrrrrrr')
         if (res.status == 200) {
-          this.addrProvinceList = res.data || [];
+          this.addrProvinceList = res.data || []
         } else {
-          this.addrProvinceList = [];
+          this.addrProvinceList = []
         }
-      });
+      })
     },
     // 获取城市列表
-    getCityList(val) {
-      this.addrCityList = [];
-      this.addrDistrictList = [];
-      this.form.setFields({ 'formData.addrCity': { value: undefined, errors: '' } });
-      this.form.setFields({ 'formData.addrDistrict': { value: undefined, errors: '' } });
-      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } });
-      this.getCityListRequest(val);
+    getCityList (val) {
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.form.setFields({ 'formData.addrCity': { value: undefined, errors: '' } })
+      this.form.setFields({ 'formData.addrDistrict': { value: undefined, errors: '' } })
+      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } })
+      this.getCityListRequest(val)
     },
-    getCityListRequest(val) {
+    getCityListRequest (val) {
       getCityByPro({
         id: val
       }).then(res => {
         if (res.status == 200) {
-          this.addrCityList = res.data || [];
+          this.addrCityList = res.data || []
         } else {
-          this.addrCityList = [];
+          this.addrCityList = []
         }
-      });
+      })
     },
     // 获取区县列表
-    getAreaList(val) {
-      this.addrDistrictList = [];
-      this.form.setFields({ 'formData.addrDistrict': { value: undefined, errors: '' } });
-      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } });
-      this.getAreaListRequest(val);
+    getAreaList (val) {
+      this.addrDistrictList = []
+      this.form.setFields({ 'formData.addrDistrict': { value: undefined, errors: '' } })
+      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } })
+      this.getAreaListRequest(val)
     },
-    getAreaListRequest(val) {
+    getAreaListRequest (val) {
       getDistrictByCity({
         id: val
       }).then(res => {
         if (res.status == 200) {
-          this.addrDistrictList = res.data || [];
+          this.addrDistrictList = res.data || []
         } else {
-          this.addrDistrictList = [];
+          this.addrDistrictList = []
         }
-      });
+      })
     },
     // 区县变更
-    areaCharged(val) {
-      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } });
+    areaCharged (val) {
+      this.form.setFields({ 'formData.addrDetail': { value: undefined, errors: '' } })
     },
     // 有效期改变
-    expireDateChange(v) {
-      console.log(v);
+    expireDateChange (v) {
+      console.log(v)
       this.form.setFields({
         'formData.expireDate': {
           value: v,
           errors: ''
         }
-      });
+      })
     },
     // 使用权限改变
-    scopeTypeChange(v) {
-      this.form.setFields({ 'formData.scopeType': { value: v, errors: '' } });
+    scopeTypeChange (v) {
+      this.form.setFields({ 'formData.scopeType': { value: v, errors: '' } })
     },
     // 启用状态切换
-    onStatusChange(v) {
-      console.log(v, 'vvvvvvvvvv');
-      this.formData.status = v;
+    onStatusChange (v) {
+      console.log(v, 'vvvvvvvvvv')
+      this.formData.status = v
     },
     // 快捷时间处理
-    timeFilter(time) {
+    timeFilter (time) {
       const now = moment()
         .add(time, 'day')
-        .format('YYYY-MM-DD');
+        .format('YYYY-MM-DD')
       this.form.setFields({
         'formData.expireDate': {
           value: moment(now, 'YYYY-MM-DD'),
           errors: ''
         }
-      });
+      })
     },
     // 保存提交
-    handleSubmit() {
-      const _this = this;
+    handleSubmit () {
+      const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
           const params = this.itemId
             ? Object.assign(
-                {
-                  id: this.itemId
-                },
-                values.formData
-              )
-            : values.formData;
-          params.expireDate = moment(params.expireDate).format('YYYY-MM-DD');
+              {
+                id: this.itemId
+              },
+              values.formData
+            )
+            : values.formData
+          params.expireDate = moment(params.expireDate).format('YYYY-MM-DD')
           tenantsSave(params).then(res => {
-            console.log(res, 'res--save');
+            console.log(res, 'res--save')
             if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功');
-              this.$emit('refresh');
-              setTimeout(function() {
-                _this.cancel();
-              }, 300);
+              this.$message.success(res.message ? res.message : '保存成功')
+              this.$emit('refresh')
+              setTimeout(function () {
+                _this.cancel()
+              }, 300)
             } else {
               // this.$message.error(res.message);
             }
-          });
+          })
         }
-      });
+      })
     },
     // 取消
-    handleCancel() {
-      const _this = this;
+    handleCancel () {
+      const _this = this
       this.$confirm({
         title: '提示',
         content: '确定取消吗?',
         okText: '确定',
         cancelText: '取消',
-        onOk() {
-          _this.clear();
-          _this.cancel();
+        onOk () {
+          _this.clear()
+          _this.cancel()
         }
-      });
+      })
     },
-    clear() {
-      this.form.resetFields();
-      this.pageInit();
+    clear () {
+      this.form.resetFields()
+      this.pageInit()
     }
   },
-  beforeCreate() {
+  beforeCreate () {
     this.form = this.$form.createForm(this, {
       name: 'tenantsModal'
-    });
+    })
   }
-};
+}
 </script>
 
 <style>