|  | @@ -8,7 +8,7 @@
 | 
	
		
			
				|  |  |        :close-on-click-modal="false"
 | 
	
		
			
				|  |  |        :close-on-press-escape="false"
 | 
	
		
			
				|  |  |        width="769px"
 | 
	
		
			
				|  |  | -    >
 | 
	
		
			
				|  |  | +    >    
 | 
	
		
			
				|  |  |        <el-form ref="formRef" :model="form" size="default" label-width="80px">
 | 
	
		
			
				|  |  |          <el-row :gutter="35">
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 | 
	
	
		
			
				|  | @@ -32,60 +32,57 @@
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
		
			
				|  |  |            </el-col>
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
 | 
	
		
			
				|  |  | -            <el-form-item label="结算周期" prop="code" :rules="[{ required: true, message: '请输入结算周期', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | -              <el-input v-model="form.code" autocomplete="off" />
 | 
	
		
			
				|  |  | +            <el-form-item label="结算周期" prop="settleDay" :rules="[{ required: true, message: '请输入结算周期', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +              <el-input v-model="form.settleDay" autocomplete="off" />
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
		
			
				|  |  |            </el-col>          
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
 | 
	
		
			
				|  |  | -            <el-form-item label="最高佣金" prop="realName" :rules="[{ required: true, message: '请输入最高佣金', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | -              <el-input v-model="form.realName" autocomplete="off" />
 | 
	
		
			
				|  |  | +            <el-form-item label="最高佣金" prop="maxPrice" :rules="[{ required: true, message: '请输入最高佣金', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +              <el-input v-model="form.maxPrice" autocomplete="off" />
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
		
			
				|  |  |            </el-col>
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 | 
	
		
			
				|  |  | -              <el-form-item label="项目简介" prop="realName" :rules="[{ required: true, message: '请输入最高佣金', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | -                <el-input v-model="form.description" clearable type="textarea" />
 | 
	
		
			
				|  |  | +              <el-form-item label="项目简介" prop="tips" :rules="[{ required: true, message: '请输入项目简介', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +                <el-input v-model="form.tips" clearable type="textarea" />
 | 
	
		
			
				|  |  |                </el-form-item>
 | 
	
		
			
				|  |  |            </el-col>          
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 | 
	
		
			
				|  |  | -            <el-form-item label="项目价格" prop="realName" :rules="[{ required: true, message: '请输入最高佣金', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | -                <el-form :inline="true" ref="formPrice" :model="state.formPrice" class="demo-form-inline">
 | 
	
		
			
				|  |  | -                    <el-form-item label="结算标准">
 | 
	
		
			
				|  |  | -                      <el-input v-model="state.formPrice.name"></el-input>
 | 
	
		
			
				|  |  | +            <el-form-item label="项目价格">              
 | 
	
		
			
				|  |  | +                <el-form :inline="true" ref="PriceformRef" :model="state.formPrice" class="demo-form-inline">
 | 
	
		
			
				|  |  | +                    <el-form-item prop="name" :rules="[{ required: true, message: '请输入结算标准', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +                      <el-input v-model="state.formPrice.name" autocomplete="off" placeholder="结算标准" ></el-input>
 | 
	
		
			
				|  |  |                      </el-form-item>
 | 
	
		
			
				|  |  | -                    <el-form-item label="价格">
 | 
	
		
			
				|  |  | -                        <el-input v-model="state.formPrice.price"></el-input>
 | 
	
		
			
				|  |  | +                    <el-form-item prop="price" :rules="[{ required: true, message: '请输入结算价格', trigger: ['blur', 'change'] },
 | 
	
		
			
				|  |  | +                     { type: 'number', message: '请结算价格为数字类型' }]">
 | 
	
		
			
				|  |  | +                        <el-input v-model.number="state.formPrice.price" autocomplete="off" placeholder="结算价格"></el-input>
 | 
	
		
			
				|  |  |                      </el-form-item>
 | 
	
		
			
				|  |  |                      <el-form-item>
 | 
	
		
			
				|  |  | -                      <el-button type="primary">添加</el-button>
 | 
	
		
			
				|  |  | +                      <el-button type="primary" @click="onPriceAdd">添加</el-button>
 | 
	
		
			
				|  |  |                      </el-form-item>
 | 
	
		
			
				|  |  |                  </el-form>
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
		
			
				|  |  | -            <el-form-item label="" prop="realName" :rules="[{ required: true, message: '请输入最高佣金', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | -                  <el-table :data="state.form.prices" row-key="id" height="'100%'" style="width: 100%; height: 100%">
 | 
	
		
			
				|  |  | +            <el-form-item label="" prop="prices" :rules="[{ required: true, message: '请添加项目价格', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +                <el-table :data="state.form.prices" row-key="id" height="'100%'" style="width: 100%; height: 100%">
 | 
	
		
			
				|  |  |                  <el-table-column type="index" width="80" label="序号"></el-table-column>                                
 | 
	
		
			
				|  |  |                  <el-table-column prop="name" label="结算标准" min-width="140" show-overflow-tooltip/>                  
 | 
	
		
			
				|  |  |                  <el-table-column prop="price" label="价格" width="100" show-overflow-tooltip/>                
 | 
	
		
			
				|  |  | -                <!-- <el-table-column label="操作" width="140" header-align="center" align="center" fixed="right">
 | 
	
		
			
				|  |  | -                    <template #default="{ row }">
 | 
	
		
			
				|  |  | -                        <el-button v-auth="'api:admin:tenant:update'" icon="ele-EditPen" size="small" text type="primary"                            
 | 
	
		
			
				|  |  | -                            >删除</el-button>                        
 | 
	
		
			
				|  |  | +                <el-table-column label="操作" width="140" header-align="center" align="center" fixed="right">
 | 
	
		
			
				|  |  | +                    <template #default="{row}">
 | 
	
		
			
				|  |  | +                        <el-button size="small" text type="primary" @click="onPriceDelete(row)">删除</el-button>                        
 | 
	
		
			
				|  |  |                      </template>
 | 
	
		
			
				|  |  | -                </el-table-column> -->
 | 
	
		
			
				|  |  | +                </el-table-column>
 | 
	
		
			
				|  |  |              </el-table>
 | 
	
		
			
				|  |  | -              </el-form-item>
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  | -          </el-col>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                        
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +              </el-form-item>            
 | 
	
		
			
				|  |  | +          </el-col>                        
 | 
	
		
			
				|  |  |            <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 | 
	
		
			
				|  |  | -            <el-form-item label="项目详情">
 | 
	
		
			
				|  |  | -              <el-input v-model="form.description" clearable type="textarea" />
 | 
	
		
			
				|  |  | +            <el-form-item label="项目详情" prop="detail" :rules="[{ required: true, message: '请输入项目详请', trigger: ['blur', 'change'] }]">
 | 
	
		
			
				|  |  | +              <!-- <el-input v-model="form.description" clearable type="textarea" /> -->
 | 
	
		
			
				|  |  | +              <Editor v-model:get-html="state.editor.htmlVal" v-model:get-text="state.editor.textVal" :disable="state.editor.disable" />
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
		
			
				|  |  |            </el-col>
 | 
	
		
			
				|  |  |          </el-row>
 | 
	
		
			
				|  |  |        </el-form>
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  |        <template #footer>
 | 
	
		
			
				|  |  |          <span class="dialog-footer">
 | 
	
		
			
				|  |  |            <el-button @click="onCancel" size="default">取 消</el-button>
 | 
	
	
		
			
				|  | @@ -97,18 +94,22 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script lang="ts" setup name="admin/project/form">
 | 
	
		
			
				|  |  | -import { reactive, toRefs, getCurrentInstance, ref, computed } from 'vue'
 | 
	
		
			
				|  |  | +import { reactive, toRefs, getCurrentInstance, ref, computed, defineAsyncComponent } from 'vue'
 | 
	
		
			
				|  |  |  import { ProjectAddInput, TenantUpdateInput } from '/@/api/admin/data-contracts'
 | 
	
		
			
				|  |  |  import { ProjectApi } from '/@/api/admin/project'
 | 
	
		
			
				|  |  | - import type { UploadInstance, UploadProps, UploadFile } from 'element-plus'
 | 
	
		
			
				|  |  | +import type { UploadInstance, UploadProps, UploadFile } from 'element-plus'
 | 
	
		
			
				|  |  |  import eventBus from '/@/utils/mitt'
 | 
	
		
			
				|  |  |  import { ElMessage } from 'element-plus'
 | 
	
		
			
				|  |  |  import { useUserInfo } from '/@/stores/userInfo'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// 引入组件
 | 
	
		
			
				|  |  | +const Editor = defineAsyncComponent(()=> import("/@/components/editor/index.vue") )
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const storesUserInfo = useUserInfo()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const uploadRef = ref<UploadInstance>()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  defineProps({
 | 
	
		
			
				|  |  |    title: {
 | 
	
		
			
				|  |  |      type: String,
 | 
	
	
		
			
				|  | @@ -119,6 +120,8 @@ defineProps({
 | 
	
		
			
				|  |  |  const { proxy } = getCurrentInstance() as any
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const formRef = ref()
 | 
	
		
			
				|  |  | +const PriceformRef = ref()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const state = reactive({  
 | 
	
		
			
				|  |  |    showDialog: false,
 | 
	
		
			
				|  |  |    sureLoading: false,  
 | 
	
	
		
			
				|  | @@ -126,24 +129,23 @@ const state = reactive({
 | 
	
		
			
				|  |  |    fileList: [] as UploadFile[],
 | 
	
		
			
				|  |  |    fileDirectory:'project',
 | 
	
		
			
				|  |  |    token: storesUserInfo.getToken(),
 | 
	
		
			
				|  |  | -  formPrice: {
 | 
	
		
			
				|  |  | +  formPrice: {    
 | 
	
		
			
				|  |  |      name: "",
 | 
	
		
			
				|  |  |      price:""
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  editor: {
 | 
	
		
			
				|  |  | +    htmlVal: '',
 | 
	
		
			
				|  |  | +    textVal: '',
 | 
	
		
			
				|  |  | +    disable: false,
 | 
	
		
			
				|  |  | +  }, numberValidateForm: {
 | 
	
		
			
				|  |  | +    age: ''
 | 
	
		
			
				|  |  | +  }  
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  const { form } = toRefs(state)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -// const getPkgs = async () => {
 | 
	
		
			
				|  |  | -//   const res = await new PkgApi().getList().catch(() => {
 | 
	
		
			
				|  |  | -//     state.pkgData = []
 | 
	
		
			
				|  |  | -//   })
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -//   state.pkgData = res?.data ?? []
 | 
	
		
			
				|  |  | -// }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 打开对话框
 | 
	
		
			
				|  |  | -const open = async (row: any = {}) => {
 | 
	
		
			
				|  |  | -  // await getPkgs()
 | 
	
		
			
				|  |  | +const open = async (row: any = {}) => {  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    if (row.id > 0) {
 | 
	
		
			
				|  |  |      const res = await new ProjectApi().get({ id: row.id }, { loading: true }).catch(() => {
 | 
	
	
		
			
				|  | @@ -154,18 +156,54 @@ const open = async (row: any = {}) => {
 | 
	
		
			
				|  |  |        state.form = res.data as ProjectAddInput & TenantUpdateInput
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    } else {
 | 
	
		
			
				|  |  | -    state.form = { pkgIds: [] as number[], enabled: true } as ProjectAddInput & TenantUpdateInput
 | 
	
		
			
				|  |  | +    state.form = {  } as ProjectAddInput & TenantUpdateInput
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    state.showDialog = true
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +// 价格添加按钮
 | 
	
		
			
				|  |  | +const onPriceAdd = () => {     
 | 
	
		
			
				|  |  | +  PriceformRef.value.validate(async (valid: boolean) => {    
 | 
	
		
			
				|  |  | +    if (!valid) return
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -// //手机号失去焦点
 | 
	
		
			
				|  |  | -// const onBlurMobile = () => {
 | 
	
		
			
				|  |  | -//   if (!state.form.userName && state.form.phone && isMobile(state.form.phone)) {
 | 
	
		
			
				|  |  | -//     state.form.userName = state.form.phone
 | 
	
		
			
				|  |  | -//   }
 | 
	
		
			
				|  |  | -// }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    if (state.form.prices == undefined) {
 | 
	
		
			
				|  |  | +      state.form.prices = [];
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let pri: unknown  = state.formPrice.price;
 | 
	
		
			
				|  |  | +    var price =  {name:state.formPrice.name,price:pri as number};
 | 
	
		
			
				|  |  | +    if (state.form.prices.length != 0) {
 | 
	
		
			
				|  |  | +      for (let i = 0; i < state.form.prices.length; i++) {
 | 
	
		
			
				|  |  | +        const element = state.form.prices[i];
 | 
	
		
			
				|  |  | +        if (element.name === price.name) {
 | 
	
		
			
				|  |  | +          proxy.$modal.alertError(`该结算标准已存在!`)
 | 
	
		
			
				|  |  | +          return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    state.form.prices.push(price);
 | 
	
		
			
				|  |  | +    state.formPrice.name = '';
 | 
	
		
			
				|  |  | +    state.formPrice.price = '';
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +//价格删除按钮
 | 
	
		
			
				|  |  | +const onPriceDelete = (row: any) => {  
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    proxy.$modal
 | 
	
		
			
				|  |  | +        .confirmDelete(`确定要删除【${row.name}】?`)
 | 
	
		
			
				|  |  | +      .then(async () => {
 | 
	
		
			
				|  |  | +        // state.form.prices = [];
 | 
	
		
			
				|  |  | +          const pricenew = [];
 | 
	
		
			
				|  |  | +          const prices = state.form.prices;
 | 
	
		
			
				|  |  | +          for (let i = 0; i < prices.length; i++) {
 | 
	
		
			
				|  |  | +            const element = prices[i];            
 | 
	
		
			
				|  |  | +            if (element != row.name && element.price != row.price) {                         
 | 
	
		
			
				|  |  | +              pricenew.push(element);
 | 
	
		
			
				|  |  | +            }            
 | 
	
		
			
				|  |  | +          }        
 | 
	
		
			
				|  |  | +          state.form.prices = [];
 | 
	
		
			
				|  |  | +          state.form.prices = pricenew;
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .catch(() => { })
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  // 取消
 | 
	
		
			
				|  |  |  const onCancel = () => {
 | 
	
		
			
				|  |  |    state.showDialog = false
 | 
	
	
		
			
				|  | @@ -173,7 +211,9 @@ const onCancel = () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 确定
 | 
	
		
			
				|  |  |  const onSure = () => {
 | 
	
		
			
				|  |  | -  formRef.value.validate(async (valid: boolean) => {
 | 
	
		
			
				|  |  | +  state.form.detail = state.editor.htmlVal;
 | 
	
		
			
				|  |  | +  
 | 
	
		
			
				|  |  | +  formRef.value.validate(async (valid: boolean) => {    
 | 
	
		
			
				|  |  |      if (!valid) return
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      state.sureLoading = true
 | 
	
	
		
			
				|  | @@ -190,7 +230,7 @@ const onSure = () => {
 | 
	
		
			
				|  |  |      state.sureLoading = false
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if (res?.success) {
 | 
	
		
			
				|  |  | -      eventBus.emit('refreshTenant')
 | 
	
		
			
				|  |  | +      eventBus.emit('refreshProject')
 | 
	
		
			
				|  |  |        state.showDialog = false
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    })
 | 
	
	
		
			
				|  | @@ -249,7 +289,7 @@ const onError: UploadProps['onError'] = (error) => {
 | 
	
		
			
				|  |  |  //     // this.$message.success('设置成功');
 | 
	
		
			
				|  |  |  //     value.kpi.edit = false;
 | 
	
		
			
				|  |  |  //   }
 | 
	
		
			
				|  |  | -// }    
 | 
	
		
			
				|  |  | +// }   
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  defineExpose({
 | 
	
		
			
				|  |  |    open,
 |