Browse Source

添加placeholder,

wangwei 4 years ago
parent
commit
44df033cc7

+ 2 - 1
src/api/sys/member.ts

@@ -6,6 +6,7 @@ import {
   AddUnitParams,
   EditUnitParams,
   GetPersonListModel,
+  GetUnitModel,
   GetPersonModel,
   PersonIdParams,
   AddPersonParams,
@@ -53,7 +54,7 @@ export function deleteBatchesUnit(params: DeleteBatchesParams) {
  * @description: 获取单个会员
  */
 export function getUnit(params: UnitIdParams) {
-  return defHttp.request<GetUnitListModel>({
+  return defHttp.request<GetUnitModel>({
     url: Api.UnitUrl + '/' + params.id,
     method: 'GET',
     params,

+ 6 - 0
src/api/sys/model/memberModel.ts

@@ -19,6 +19,12 @@ export interface DeleteBatchesParams {
 export interface UnitIdParams {
   id: string | number;
 }
+/**
+ * @description: id
+ */
+export interface GetUnitModel {
+  row: object[];
+}
 
 /**
  * @description: add Unit

+ 0 - 128
src/views/member/person/Table.vue

@@ -1,128 +0,0 @@
-<template>
-  <!-- <BasicTable @register="registerTable" /> -->
-  <div class="wrap">
-    <div class="head">
-      <div class="value-head">关系</div>
-      <div class="value-head">姓名</div>
-      <div class="value-head">年龄</div>
-      <div class="value-head">工作单位</div>
-      <div class="value-head">职务</div>
-    </div>
-    <div class="array-item">
-      <div class="content-item" v-for="(item, index) in list" :key="index">
-        <div class="value-content">
-          <Input v-model:value="item.relation" @change="onChange" />
-        </div>
-        <div class="value-content">
-          <Input v-model:value="item.name" @change="onChange" />
-        </div>
-        <div class="value-content">
-          <Input v-model:value="item.age" @change="onChange" />
-        </div>
-        <div class="value-content">
-          <Input v-model:value="item.company" @change="onChange" />
-        </div>
-        <div class="value-content">
-          <Input v-model:value="item.job" @change="onChange" />
-        </div>
-        <a-button
-          class="mr-2 delete-btn"
-          preIcon="mdi:close-thick"
-          color="error"
-          @click="remove(index)"
-        />
-      </div>
-    </div>
-    <a-button class="add-btn mr-2" size="small" color="success" @click="create"> 追加 </a-button>
-  </div>
-</template>
-<script lang="ts">
-  import { defineComponent, onUpdated, reactive, nextTick, toRefs, watch } from 'vue';
-  import { Input } from 'ant-design-vue';
-
-  const props = {
-    value: { type: [], default: [] },
-    placeholder: { type: String, default: '' },
-  };
-
-  export default defineComponent({
-    components: { Input },
-    props,
-    emits: ['change'],
-    setup(props, { emit }) {
-      const state = reactive({
-        list: [] as object[],
-      });
-      // 初始化
-      function init() {
-        // setTimeout(() => {
-
-        // }, 200);
-        nextTick(() => {
-          console.log(`props.value`, props.value);
-          console.log(`props.placeholder`, props.placeholder);
-          state.list = props.value;
-        });
-      }
-      watch(props.value, (value: object[]) => {
-        state.list = value;
-      });
-      onUpdated(() => {
-        init();
-      });
-
-      function onChange() {
-        emit('change', state.list);
-      }
-      function create() {
-        state.list.push({ relation: '', name: '', age: '', company: '', job: '' });
-      }
-      function remove(i) {
-        state.list.splice(i, 1);
-        emit('change', state.list);
-      }
-
-      return {
-        onChange,
-        create,
-        remove,
-        ...toRefs(state),
-      };
-    },
-  });
-</script>
-<style scoped>
-  .head {
-    display: flex;
-    width: 93%;
-    text-align: left;
-    justify-content: space-around;
-  }
-
-  .value-head {
-    width: 20%;
-    font-weight: bold;
-    line-height: 20px;
-  }
-
-  .content-item {
-    display: flex;
-    margin: 5px 0;
-  }
-
-  .value-content {
-    /* width: 50%; */
-    margin-right: 2px;
-  }
-
-  .delete-btn {
-    position: relative;
-    top: 5px;
-    padding: 5px;
-  }
-
-  .add-btn {
-    margin-top: 2px;
-    color: #fff;
-  }
-</style>

+ 0 - 15
src/views/member/person/data.ts

@@ -1,7 +1,4 @@
 import { FormProps, BasicColumn } from '/@/components/Table';
-// import { h } from 'vue';
-// import Table from './Table.vue';
-// import { formatToDate } from '/@/utils/dateUtil';
 import { FormSchema } from '/@/components/Form/index';
 import { adapt } from '/@/utils/adapt';
 import moment from 'moment';
@@ -567,18 +564,6 @@ export const schemas: FormSchema[] = [
       span: adaptWidth.elContainer,
     },
     defaultValue: '',
-    // render: ({ model, field }) => {
-    //   if (!model[field]) {
-    //     model[field] = [];
-    //   }
-    //   return h(Table, {
-    //     value: model[field],
-    //     onChange: (value) => {
-    //       console.log(`e----onchange`, value);
-    //       model[field] = value;
-    //     },
-    //   });
-    // },
     componentProps: ({ formModel }) => {
       console.log(`componentProps-----value`, formModel.family);
       return {

+ 11 - 3
src/views/member/person/popup.vue

@@ -4,7 +4,7 @@
   </BasicModal>
 </template>
 <script lang="ts">
-  import { defineComponent, PropType, ref, toRefs } from 'vue';
+  import { defineComponent, PropType, reactive, ref, toRefs } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, useForm } from '/@/components/Form/index';
   // import {
@@ -18,6 +18,9 @@
   interface PopupData {
     title: string;
   }
+  interface Role {
+    id: string | number;
+  }
 
   export default defineComponent({
     components: { BasicModal, BasicForm },
@@ -31,7 +34,9 @@
     setup(props, { emit }) {
       const popupData = props.popupData as PopupData;
       const modelRef = ref({});
-
+      const role = reactive<Role>({
+        id: 0,
+      });
       const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
         labelWidth: 120,
         schemas,
@@ -48,14 +53,17 @@
       const [register, { closeModal }] = useModalInner((data) => {
         resetFields();
         console.log(`data ----id?`, data.id);
+        if (data.id) {
+          role.id = data.id;
+        }
         setFieldsValue(data);
       });
 
       async function confirm() {
         const data = await validate();
         console.log(`确定`, data);
+        data.id = role.id;
         data.birthday = moment(data.birthday).format('YYYY-MM-DD');
-
         const popupData = { closeModal, data };
         emit('saveData', popupData);
         // closeModal(); // 关闭弹窗

+ 88 - 0
src/views/member/unit/data.ts

@@ -265,6 +265,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '企业名称',
+    },
     required: true,
   },
   {
@@ -275,6 +278,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '法人代表',
+    },
     required: true,
   },
   {
@@ -285,6 +291,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '工商登记号',
+    },
     required: true,
   },
   {
@@ -295,6 +304,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '国税税号',
+    },
   },
   {
     field: 'landTax',
@@ -304,12 +316,16 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '地税税号',
+    },
   },
   {
     field: 'nature',
     label: '单位性质',
     component: 'Select',
     componentProps: {
+      placeholder: '单位性质',
       options: [
         {
           label: '国有企业',
@@ -359,6 +375,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '成立时间',
+    },
     required: true,
   },
   {
@@ -369,6 +388,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '行业分类',
+    },
     required: true,
   },
   {
@@ -379,6 +401,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '职工人数',
+    },
   },
   {
     field: 'partyNum',
@@ -389,6 +414,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '党员数',
+    },
   },
   {
     field: 'tel',
@@ -399,6 +427,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '电话',
+    },
   },
   {
     field: 'fax',
@@ -409,6 +440,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '传真',
+    },
   },
   {
     field: 'zipCode',
@@ -419,6 +453,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '邮箱',
+    },
   },
   {
     field: 'address',
@@ -429,6 +466,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '地址',
+    },
     required: true,
   },
   {
@@ -440,6 +480,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '大专以上文化人数',
+    },
   },
   {
     field: 'laidNum',
@@ -450,6 +493,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '安置下岗人数',
+    },
   },
   {
     field: 'partyCase',
@@ -460,6 +506,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '党、团工会情况',
+    },
   },
   {
     field: 'web',
@@ -470,6 +519,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '网址',
+    },
   },
   {
     field: 'email',
@@ -480,6 +532,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '电子邮箱',
+    },
   },
   {
     field: 'technology',
@@ -489,6 +544,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '高新技术企业认证',
+    },
   },
   {
     field: 'technologyDept',
@@ -505,6 +563,9 @@ export const schemas: FormSchema[] = [
       }
       return false;
     },
+    componentProps: {
+      placeholder: '高新技术企业认证部门',
+    },
     required: ({ values }) => {
       if (values.technology) {
         return true;
@@ -520,6 +581,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '外贸自营进出口权',
+    },
   },
   {
     field: 'foreignTradeDept',
@@ -536,6 +600,9 @@ export const schemas: FormSchema[] = [
       }
       return false;
     },
+    componentProps: {
+      placeholder: '外贸自营进出口权批准部门',
+    },
     required: ({ values }) => {
       if (values.foreignTrade) {
         return true;
@@ -551,6 +618,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '质量管理、质量保证系列认证标准',
+    },
   },
   {
     field: 'qualityDept',
@@ -567,6 +637,9 @@ export const schemas: FormSchema[] = [
       }
       return false;
     },
+    componentProps: {
+      placeholder: '质量管理、质量保证系列认证标准认证部门',
+    },
     required: ({ values }) => {
       if (values.quality) {
         return true;
@@ -583,6 +656,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '注册资金(万元)',
+    },
     required: true,
   },
   {
@@ -594,6 +670,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '资产(万元)',
+    },
   },
   {
     field: 'ownerMoney',
@@ -604,6 +683,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '所有者权益(万元)',
+    },
   },
   {
     field: 'sellMoney',
@@ -614,6 +696,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '销售收入(万元)',
+    },
   },
   {
     field: 'product',
@@ -624,6 +709,9 @@ export const schemas: FormSchema[] = [
     colProps: {
       span: adaptWidth.elContainer,
     },
+    componentProps: {
+      placeholder: '主要经营项目',
+    },
     required: true,
   },
 ];

+ 4 - 7
src/views/member/unit/index.vue

@@ -48,7 +48,7 @@
     getUnitList,
     addUnit,
     deleteBatchesUnit,
-    // getUnit,
+    getUnit,
     editUnit,
     deleteUnit,
   } from '/@/api/sys/member';
@@ -146,13 +146,10 @@
       function handleEdit(record: EditRecordRow) {
         currentEditKeyRef.value = record.id; // record.key
         popupData.title = '编辑';
-        const data = getTableAction().getDataSource();
-        data.map((item) => {
-          if (item.id === record.id) {
-            record = item;
-          }
+        getUnit({ id: record.id }).then((res) => {
+          const data = res.row;
+          openPopup(true, data);
         });
-        openPopup(true, record);
       }
 
       async function handleDelete(record: Recordable) {