qsh 3 weeks ago
parent b8bc124162
commit fa39fd8492
  1. 118
      src/views/Clue/Set/Comp/DialogSource.vue

@ -7,30 +7,81 @@
:rules="formRules"
label-width="80px"
>
<el-form-item v-if="formData.parentSource" label="上级来源">
<el-input v-model="formData.parentSource" disabled />
</el-form-item>
<el-form-item label="来源名称" prop="sourceName">
<el-input v-model="formData.sourceName" placeholder="请输入来源名称" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" placeholder="请输入排序" type="number" :min="0" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
placeholder="请输入备注"
:autosize="{ minRows: 4, maxRows: 8 }"
/>
</el-form-item>
<el-row :gutter="20">
<el-col v-if="formData.parentSource" :span="12" :offset="0">
<el-form-item label="上级来源">
<el-input v-model="formData.parentSource" disabled />
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="来源名称" prop="sourceName">
<el-input v-model="formData.sourceName" placeholder="请输入来源名称" />
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" placeholder="请输入排序" type="number" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="成本模式" prop="mode">
<el-radio-group v-model="formData.mode">
<el-radio :label="0"> 总价 </el-radio>
<el-radio :label="1"> 单价 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
placeholder="请输入备注"
:autosize="{ minRows: 4, maxRows: 8 }"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider direction="horizontal" content-position="left">线索成本</el-divider>
<el-button class="mb-10px" type="primary" @click="handleAddPrice"> 添加年份 </el-button>
<el-table :data="formData.priceVOList" border>
<el-table-column label="年份" width="120">
<template #default="{ row }">
<el-date-picker
v-model="row.year"
type="year"
placeholder="选择年份"
size="small"
format="YYYY"
value-format="YYYY"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column v-for="col in 12" :key="col" :label="`${col}月`" width="100px">
<template #default="{ row }">
<el-input-number
v-model="row.monthTargetVOList[col - 1].targetPrice"
size="small"
:controls="false"
style="width: 100%"
/>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
@ -111,8 +162,27 @@ const resetForm = () => {
sourceName: '',
status: 0,
sort: 1,
remark: ''
remark: '',
mode: 0,
priceVOList: []
}
formRef.value?.resetFields()
}
function handleAddPrice() {
const obj = {
year: undefined,
monthTargetVOList: []
}
for (let i = 1; i <= 12; i++) {
obj.monthTargetVOList.push({
month: i,
targetPrice: undefined
})
}
if (!formData.value.priceVOList) {
formData.value.priceVOList = []
}
formData.value.priceVOList.push(obj)
}
</script>

Loading…
Cancel
Save