|  | @@ -166,6 +166,7 @@ const isSubmitting = ref(false);
 | 
	
		
			
				|  |  |  const dayFormVisible = ref(false);
 | 
	
		
			
				|  |  |  const dialogVisible = ref(false);
 | 
	
		
			
				|  |  |  const dialogMessage = ref('');
 | 
	
		
			
				|  |  | +const isROI = ref(false);
 | 
	
		
			
				|  |  |  const taskDataFormRef = ref<FormInstance>();
 | 
	
		
			
				|  |  |  const taskDataForm = reactive({
 | 
	
		
			
				|  |  |    sales_original: null,
 | 
	
	
		
			
				|  | @@ -565,7 +566,7 @@ async function createMonthData() {
 | 
	
		
			
				|  |  |  //创建任务
 | 
	
		
			
				|  |  |  const submitForm = async (formEl: FormInstance | undefined) => {
 | 
	
		
			
				|  |  |    const fieldsToWarn = validateForm();
 | 
	
		
			
				|  |  | -  if (fieldsToWarn.length > 0) {
 | 
	
		
			
				|  |  | +  if (fieldsToWarn.length > 0 || validateForm2()) {
 | 
	
		
			
				|  |  |      dialogVisible.value = true;
 | 
	
		
			
				|  |  |      dialogMessage.value = `${ fieldsToWarn.join(', ') }`;
 | 
	
		
			
				|  |  |      return;
 | 
	
	
		
			
				|  | @@ -709,6 +710,17 @@ async function updateMonthData(row: RowVO) {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const editRowEvent = async (row: any) => {
 | 
	
		
			
				|  |  | +  currentRow.value = row;
 | 
	
		
			
				|  |  | +  if (validateForm3(row)) {
 | 
	
		
			
				|  |  | +    isROI.value = true;
 | 
	
		
			
				|  |  | +    dialogVisible.value = true;
 | 
	
		
			
				|  |  | +    return;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  await updateRowEvent(row);
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const updateRowEvent = async (row: RowVO) => {
 | 
	
		
			
				|  |  | +  dialogVisible.value = false;
 | 
	
		
			
				|  |  |    const $grid = xGrid.value;
 | 
	
		
			
				|  |  |    if ($grid) {
 | 
	
		
			
				|  |  |      if (dateType === 'day') {
 | 
	
	
		
			
				|  | @@ -727,7 +739,7 @@ const editRowEvent = async (row: any) => {
 | 
	
		
			
				|  |  |      activeEditRow.value = false;
 | 
	
		
			
				|  |  |      await $grid.clearEdit();
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -};
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 日数据提示
 | 
	
		
			
				|  |  |  async function salesTip(apiFunction, dateTypeKey) {
 | 
	
	
		
			
				|  | @@ -844,6 +856,26 @@ const validateForm = () => {
 | 
	
		
			
				|  |  |    return fieldsToWarn;
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const validateForm2 = () => {
 | 
	
		
			
				|  |  | +  const adSalesValue = taskDataForm['ad_sales_original'];
 | 
	
		
			
				|  |  | +  const adCostValue = taskDataForm['ad_cost_original'];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  if (adSalesValue != null && adCostValue != null && adCostValue !== 0) {
 | 
	
		
			
				|  |  | +    const ratio = (adSalesValue - adCostValue) / adCostValue;
 | 
	
		
			
				|  |  | +    return ratio < 0;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const validateForm3 = (row: RowVO) => {
 | 
	
		
			
				|  |  | +  const adSalesValue = row.ad_sales_original;
 | 
	
		
			
				|  |  | +  const adCostValue = row.ad_cost_original;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  if (adSalesValue != null && adCostValue != null && adCostValue !== 0) {
 | 
	
		
			
				|  |  | +    const ratio = (adSalesValue - adCostValue) / adCostValue;
 | 
	
		
			
				|  |  | +    return ratio < 0;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  onMounted(() => {
 | 
	
		
			
				|  |  |    setDefaultDate();
 | 
	
		
			
				|  |  |    //fetchCurrentTaskData();
 | 
	
	
		
			
				|  | @@ -925,7 +957,7 @@ onMounted(() => {
 | 
	
		
			
				|  |  |              <el-button link size="small" type="warning" @click="editRowEvent(row)">保存</el-button>
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  |            <template v-else>
 | 
	
		
			
				|  |  | -            <el-button :disabled="!row.id||activeEditRow" link size="small" type="success" @click="handelEditRow(row)">
 | 
	
		
			
				|  |  | +            <el-button :disabled="!row.id||activeEditRow"  link size="small" type="success" @click="handelEditRow(row)">
 | 
	
		
			
				|  |  |                修改
 | 
	
		
			
				|  |  |              </el-button>
 | 
	
		
			
				|  |  |            </template>
 | 
	
	
		
			
				|  | @@ -992,14 +1024,15 @@ onMounted(() => {
 | 
	
		
			
				|  |  |        </vxe-grid>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |    </el-card>
 | 
	
		
			
				|  |  | -  <el-dialog v-model="dayFormVisible" :before-close="handleClose" style="border-radius: 10px;" :title="`创建任务 : ${currentRow.platformNumber} / ${currentRow.platformName}`"
 | 
	
		
			
				|  |  | +  <el-dialog v-model="dayFormVisible" :before-close="handleClose" :title="`创建任务 : ${currentRow.platformNumber} / ${currentRow.platformName}`"
 | 
	
		
			
				|  |  | +             style="border-radius: 10px;"
 | 
	
		
			
				|  |  |               width="600">
 | 
	
		
			
				|  |  |      <template #title>
 | 
	
		
			
				|  |  |        <span class="text-xl">创建任务</span>
 | 
	
		
			
				|  |  | -      <div class="mt-2" style="display: flex; align-items: center;color: darkgray" >
 | 
	
		
			
				|  |  | +      <div class="mt-2" style="display: flex; align-items: center;color: darkgray">
 | 
	
		
			
				|  |  |          <div style="margin-right: 8px;">
 | 
	
		
			
				|  |  |            平台编号:
 | 
	
		
			
				|  |  | -          <span class="italic pl-1 pr-2" >{{ currentRow.platformNumber }}</span>
 | 
	
		
			
				|  |  | +          <span class="italic pl-1 pr-2">{{ currentRow.platformNumber }}</span>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div>
 | 
	
		
			
				|  |  |            平台名称:
 | 
	
	
		
			
				|  | @@ -1060,13 +1093,18 @@ onMounted(() => {
 | 
	
		
			
				|  |  |          重要提示
 | 
	
		
			
				|  |  |        </el-button>
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  | -    <span>您输入的 </span>
 | 
	
		
			
				|  |  | -    <span style="color: #f1a055;">{{ dialogMessage }}</span>
 | 
	
		
			
				|  |  | -    <span> 相较于上次填入的数据偏离值超过 50% ,是否仍要提交?</span>
 | 
	
		
			
				|  |  | +    <div v-if="dialogMessage">
 | 
	
		
			
				|  |  | +      <span>您输入的 </span>
 | 
	
		
			
				|  |  | +      <span style="color: #f1a055;">{{ dialogMessage }}</span>
 | 
	
		
			
				|  |  | +      <span> 相较于上次填入的数据偏离值超过 50% ,是否仍要提交?</span>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <div v-if="validateForm2()||isROI" class="pt-2">
 | 
	
		
			
				|  |  | +      <span>ROI < 0,请确认数据填入是否正确!</span>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  |      <template #footer>
 | 
	
		
			
				|  |  |        <span class="dialog-footer">
 | 
	
		
			
				|  |  |          <el-button @click="dialogVisible = false">取消</el-button>
 | 
	
		
			
				|  |  | -        <el-button type="primary" @click="submit(formEl)">确认</el-button>
 | 
	
		
			
				|  |  | +        <el-button type="primary" @click="isROI? updateRowEvent(currentRow) : submit()">确认</el-button>
 | 
	
		
			
				|  |  |        </span>
 | 
	
		
			
				|  |  |      </template>
 | 
	
		
			
				|  |  |    </el-dialog>
 |