export default function useWatch() { const watchPuOrgName = () => ({ handler: function (newProp, oldProp) { if (oldProp) { this.params.priceApplyOrgs = this.params.priceApplyOrgs.filter( (item) => item.orgName !== oldProp ); } if (newProp) { const { puOrgCode: orgCode, puOrgName: orgName } = this.params; this.params.priceApplyOrgs.push({ orgCode, orgName, createByName: undefined, updateByName: undefined, }); } }, deep: true, }); const watchPriceApplyOrgs = () => ({ handler: function (newValue) { this.newParams.priceApplyOrgs = newValue.filter( (item) => item.delFlag === "0" ); }, deep: true, }); const watchPriceApplyItems = () => ({ handler: function (newValue) { this.newParams.priceApplyItems = newValue.filter( (item) => item.delFlag === "0" ); }, deep: true, }); return { watchPuOrgName, watchPriceApplyOrgs, watchPriceApplyItems }; }