|
@@ -20,6 +20,35 @@
|
|
|
@customer-selected="handleCustomerSelected"
|
|
|
/>
|
|
|
</template>
|
|
|
+
|
|
|
+ <!-- 预测年份插槽(使用 $refs.yearPicker 控制禁用) -->
|
|
|
+ <template #year>
|
|
|
+ <el-date-picker
|
|
|
+ ref="yearPicker"
|
|
|
+ v-model="formData.year"
|
|
|
+ type="year"
|
|
|
+ value-format="yyyy"
|
|
|
+ placeholder="请选择年份"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 预测月份插槽(使用 $refs.monthSelect 控制禁用) -->
|
|
|
+ <template #month="{ column }">
|
|
|
+ <el-select
|
|
|
+ ref="monthSelect"
|
|
|
+ v-model="formData.month"
|
|
|
+ placeholder="请选择月份"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="opt in (column && column.dicData) ? column.dicData : []"
|
|
|
+ :key="opt.value"
|
|
|
+ :label="opt.label"
|
|
|
+ :value="opt.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
</avue-form>
|
|
|
|
|
|
<!-- 物料表格区域 -->
|
|
@@ -133,6 +162,37 @@ export default {
|
|
|
*/
|
|
|
components: {
|
|
|
CustomerSelect
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @this {import('./types').ForecastFormMixinComponent & Vue}
|
|
|
+ */
|
|
|
+ mounted() {
|
|
|
+ // 在编辑态,初始禁用“年份/月份”两个控件(通过 $refs 设置)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ try {
|
|
|
+ if (this.isEdit) {
|
|
|
+ if (this.$refs.yearPicker) this.$refs.yearPicker.disabled = true
|
|
|
+ if (this.$refs.monthSelect) this.$refs.monthSelect.disabled = true
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ // 忽略可能的非关键性异常
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ // 通过 $refs 统一设置“年份/月份”的禁用状态
|
|
|
+ setYearMonthDisabled(disabled) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ try {
|
|
|
+ if (this.$refs.yearPicker) this.$refs.yearPicker.disabled = disabled
|
|
|
+ if (this.$refs.monthSelect) this.$refs.monthSelect.disabled = disabled
|
|
|
+ } catch (e) {
|
|
|
+ // 忽略可能的非关键性异常
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|