|
@@ -3,16 +3,24 @@
|
|
|
v-bind="$attrs"
|
|
|
@register="register"
|
|
|
title="新增设备"
|
|
|
- @ok="submitMolad"
|
|
|
+ @ok="submitMolad(true)"
|
|
|
+ cancelText="拒绝"
|
|
|
+ okText="通过"
|
|
|
+ @cancel="submitMolad(false)"
|
|
|
@visible-change="handleVisibleChange"
|
|
|
>
|
|
|
<div class="pt-3px pr-3px">
|
|
|
<BasicForm @register="registerForm">
|
|
|
- <template #userName="{ model, field }">
|
|
|
+ <template #text="{ model, field }">
|
|
|
{{ model[field] }}
|
|
|
</template>
|
|
|
- <template #name="{ model, field }">
|
|
|
- {{ model[field] }}
|
|
|
+ <template #link="{ model, field }">
|
|
|
+ <a :href="model[field]" target="_blank">{{ model[field] }}</a>
|
|
|
+ </template>
|
|
|
+ <template #iamge="{ model, field }">
|
|
|
+ <div v-if="model[field]">
|
|
|
+ <TableImg :size="200" :simpleShow="true" :imgList="[model[field]]" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</BasicForm>
|
|
|
</div>
|
|
@@ -20,12 +28,13 @@
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { defineComponent, ref, nextTick } from 'vue';
|
|
|
+ import { TableImg } from '/@/components/Table';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
- import { AddDevice, checkDevice } from '/@/api/corporation/modal';
|
|
|
+ import { checkDevice, selectCompanyById, auditCompany } from '/@/api/corporation/modal';
|
|
|
export default defineComponent({
|
|
|
- components: { BasicModal, BasicForm },
|
|
|
+ components: { BasicModal, BasicForm, TableImg },
|
|
|
props: {
|
|
|
userData: { type: Object },
|
|
|
},
|
|
@@ -33,7 +42,7 @@
|
|
|
const modelRef = ref({});
|
|
|
const num = ref(0);
|
|
|
const { createMessage } = useMessage();
|
|
|
- const { success, error } = createMessage;
|
|
|
+ const { error, success } = createMessage; //success,
|
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
|
data && onDataReceive(data);
|
|
|
});
|
|
@@ -58,44 +67,64 @@
|
|
|
};
|
|
|
const schemas: FormSchema[] = [
|
|
|
{
|
|
|
- field: 'userName',
|
|
|
- label: '企业名称',
|
|
|
- slot: 'userName',
|
|
|
+ field: 'name',
|
|
|
+ label: '信息标题',
|
|
|
+ slot: 'text',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'contacts',
|
|
|
+ label: '联系人',
|
|
|
+ slot: 'text',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'phone',
|
|
|
+ label: '手机号',
|
|
|
+ slot: 'text',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'area',
|
|
|
+ label: '所属区域',
|
|
|
+ slot: 'text',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'address',
|
|
|
+ label: '详细地址',
|
|
|
+ slot: 'text',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'website',
|
|
|
+ label: '企业官网',
|
|
|
+ slot: 'text',
|
|
|
component: 'Input',
|
|
|
},
|
|
|
{
|
|
|
field: 'name',
|
|
|
- label: '企业账号',
|
|
|
+ label: '企业简介',
|
|
|
slot: 'name',
|
|
|
component: 'Input',
|
|
|
},
|
|
|
{
|
|
|
- field: 'num',
|
|
|
- component: 'InputNumber',
|
|
|
- label: '设备数量',
|
|
|
- colProps: {
|
|
|
- span: 8,
|
|
|
- },
|
|
|
- componentProps: () => {
|
|
|
- return {
|
|
|
- // xxxx props schema, tableAction, formModel checkDevice
|
|
|
- min: 0,
|
|
|
- onChange: numOnChange,
|
|
|
- };
|
|
|
- },
|
|
|
+ field: 'logo',
|
|
|
+ label: '企业LOGO',
|
|
|
+ slot: 'iamge',
|
|
|
+ component: 'Input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'qualification',
|
|
|
+ label: '企业资质',
|
|
|
+ slot: 'iamge',
|
|
|
+ component: 'Input',
|
|
|
},
|
|
|
];
|
|
|
// let schemasList = []
|
|
|
const [
|
|
|
registerForm,
|
|
|
- {
|
|
|
- setFieldsValue,
|
|
|
- resetFields,
|
|
|
- getFieldsValue,
|
|
|
- validateFields,
|
|
|
- appendSchemaByField,
|
|
|
- removeSchemaByFiled,
|
|
|
- },
|
|
|
+ { setFieldsValue, resetFields, appendSchemaByField, removeSchemaByFiled },
|
|
|
] = useForm({
|
|
|
labelWidth: 120,
|
|
|
schemas,
|
|
@@ -104,50 +133,26 @@
|
|
|
span: 24,
|
|
|
},
|
|
|
});
|
|
|
- async function submitMolad() {
|
|
|
- let formData = {
|
|
|
- ...getFieldsValue(),
|
|
|
- };
|
|
|
- let validate = false;
|
|
|
- try {
|
|
|
- const res = await validateFields();
|
|
|
- validate = true;
|
|
|
- console.log('passing', res, formData);
|
|
|
- } catch (error: unknown) {
|
|
|
- console.log('not passing', error);
|
|
|
- }
|
|
|
- if (validate) {
|
|
|
- const { subNum, id, userName } = modelRef.value;
|
|
|
- try {
|
|
|
- const res = await AddDevice({
|
|
|
- childName: null,
|
|
|
- id,
|
|
|
- subNum,
|
|
|
- userName,
|
|
|
- });
|
|
|
- if (res.code == 200) {
|
|
|
- success(res.message);
|
|
|
- closeModal();
|
|
|
- }
|
|
|
- } catch (errors) {
|
|
|
- error('errors');
|
|
|
- console.log('not passing', error);
|
|
|
- }
|
|
|
- }
|
|
|
+ async function submitMolad(val) {
|
|
|
+ let res = await auditCompany({
|
|
|
+ id: modelRef.value.id,
|
|
|
+ state: val ? 1 : 2,
|
|
|
+ });
|
|
|
+ success(res);
|
|
|
+ closeModal();
|
|
|
}
|
|
|
- function onDataReceive(data) {
|
|
|
+ async function onDataReceive(data) {
|
|
|
// 方式1;
|
|
|
resetFields();
|
|
|
+ let { id } = data.record;
|
|
|
+ let res = await selectCompanyById({
|
|
|
+ id,
|
|
|
+ });
|
|
|
+ console.log('setFieldsValue', res);
|
|
|
setFieldsValue({
|
|
|
- ...data.record,
|
|
|
+ ...res,
|
|
|
});
|
|
|
-
|
|
|
- // // 方式2
|
|
|
modelRef.value = { ...data.record };
|
|
|
-
|
|
|
- // setProps({
|
|
|
- // ...data.record,
|
|
|
- // });
|
|
|
}
|
|
|
function numOnChange(event) {
|
|
|
const value = Number(event);
|